Skills Input/Output Specification Design
An excellent Skill not only completes tasks, but also clearly defines "what it accepts" and "what it produces".
Good input/output specifications are the foundation of reliable Skill operation.
Why define input/output specifications
Skills face real user requests, with endlessly varied input formats.
Without clear specifications, Claude will guess the input intent on its own, leading to unstable behavior.
Specifications are not restrictions, but clear boundaries for Claude's actions, reducing ambiguity and improving output consistency.
Four elements of input specifications
| Element | Description | Example |
|---|---|---|
| Input Type | Files, text, URLs, parameters, etc. | A PDF file uploaded by the user |
| Format requirements | File extension, encoding, structure | .csv, UTF-8 encoded, with the first row as the header |
| Required/Optional | Which inputs are mandatory | File path is required, column names are optional |
| Default behavior | How to handle when optional parameters are not provided | Analyze all columns when no column names are specified |
Define input specifications in SKILL.md
Example
Input specifications
Required inputs
**
Data file
**
: uploaded by the user
`
.csv
`
or
`
.xlsx
`
file
- Encoding: UTF-
8
(CSV) or standard Excel format
- The first row must be column headers
- File size does not exceed 50MB
Optional inputs
**
Target columns
**
: specify which columns to analyze, defaults to all numeric columns
**
Output formats
**
:
`
table
`
(table) or
`
text
`
(text summary), default
`
table
`
**
Precision
**
: number of decimal places to keep, default
2
decimal places
Handling when input is missing
If the file is not uploaded, tell the user:
"Please upload the CSV or Excel file to be analyzed."
If the file format is not supported, tell the user and list the supported formats.
Three dimensions of output specifications
Dimension 1: Output content
Clearly specify what content to output, avoiding omissions or excessive output.
Example
Output content
After analysis is complete, provide the following:
1
.
**
Statistical summary table
**
: row count, mean, maximum of each column
/
minimum value, number of null values
2
.
**
Data quality report
**
: list problems found (such as too many null values, mixed data types)
3
.
**
File path
**
: if an output file is generated, provide the download path
Dimension 2: Output format
Specify which format the output is presented in and where it is stored.
| Output destination | Format | Storage paths |
|---|---|---|
| Display in the conversation | Markdown tables, code blocks | No storage needed |
| Downloadable file | .xlsx、.pdf、.html | /mnt/user-data/outputs/ |
| Intermediate results | JSON、CSV | /home/claude/(temporary) |
Dimension 3: Output timing
Specify when to output, whether all at once or step by step.
Example
Output timing
1
.
**
After reading the file
**
: immediately tell the user the basic file information (row count, column count, size)
2
.
**
During analysis
**
: if analysis takes more than
10
seconds, first output a progress notice
3
.
**
After analysis completes
**
: output the complete statistical summary
4
.
**
After the file is generated
**
: show the file path and call the present_files tool
Complete input/output specification example
The following is a complete input/output specification for a document summarization Skill:
Example
name: doc-summarizer
description:
Extract summaries from user-uploaded documents, supporting PDF, Word (.docx), and plain text.
Use when the user needs to quickly understand document content, extract key information, or generate a document summary.
Document Summarizer
Input specifications
Required
- Document file (.pdf, .docx, or .txt)
Optional
**
Summary length
**
:
`
short
`
(
3
sentences)
/
`
medium
`
(
1
paragraphs)
/
`
long
`
(
3
paragraphs), default
`
medium
`
**
Language
**
: output language, defaults to the same as the original
**
Focus area
**
: Such as
"Focus on the conclusion section"
、
"Extract numerical data"
Exception handling
-
File exceeds 10MB: tell the user the file is too large and suggest splitting it before uploading
-
Unsupported format: list the supported formats and ask the user to upload again
-
The document is an image scan with unrecognizable text: tell the user it cannot be processed and suggest preprocessing with an OCR tool
Output specifications
Output content (in order)
1
. Document basic information: title (if any), page count, word count estimate
2
. Core summary: output at the user-specified length
3
. Keywords:
5
8
thematic keywords
Output formats
-
All displayed in the conversation using Markdown format
-
No extra files generated unless the user explicitly requests saving
Output example
**
Document
**
:runoob-annual-report.pdf(
24
pages, about
12
,000 words)
**
Summary
**
: This report reviews runoob's annual business performance, with user growth increasing year-on-year by
35
%
,
technical documentation coverage increased to
98
%
. The revenue structure is becoming more diversified, with advertising and membership income remaining proportionally stable.
**
Keyword
**
: annual report, user growth, technical documentation, revenue structure, diversification
Input/output conventions at the script level
If a Skill includes scripts, it is recommended to use JSON as the structured input/output format for easy parsing by Claude.
Example
File path: scripts/summarize.py
Standardized JSON input/output pattern
import
json
import
sys
def
summarize
(
file_path:
str
,
length:
str
=
"medium"
)
dict
:
"""
Summarize a document
Parameters:
file_path: document path (required)
length: summary length, short/medium/long (optional, default medium)
Returns:
dict, containing status, data, or error fields
"""
try
:
Simulate reading a document
with
open
(
file_path
,
"r"
,
encoding
=
"utf-8"
)
as
f:
content
=
f.
read
(
)
Simulate generating a summary
summary
=
content
[
:
200
]
"..."
In practice, real summarization logic should be called
return
{
"status"
:
"success"
,
"data"
:
{
"word_count"
:
len
(
content
)
,
"summary"
: summary
,
"length"
: length
}
}
except
FileNotFoundError:
return
{
"status"
:
"error"
,
"error"
: f
"File does not exist: {file_path}"
}
except
Exception
as
e:
return
{
"status"
:
"error"
,
"error"
:
str
(
e
)
}
if
name
==
"main"
:
file_path
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
1
else
""
length
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
2
else
"medium"
result
=
summarize
(
file_path
,
length
)
Uniformly output JSON for easy parsing by Claude
(
json.
dumps
(
result
,
ensure_ascii
=
False
,
indent
=
2
)
)
{
"status": "success",
"data": {
"word_count": 12480,
"summary": "runoob 年度报告回顾了平台在过去一年的业务表现...",
"length": "medium"
}
}
Using JSON as the script output format lets Claude parse results reliably without having to make speculative interpretations of free text.