Study FAQ
How should a Claude Code skill handle missing, malformed, or unsafe arguments?
Also asked as 2
- Does argument-hint validate inputs to a Claude Code skill?
- How do I define and check the input contract for a parameterized Claude Code skill?
Answer
Define the skill's input contract in its instructions and validate consequential values in trusted code before using them. argument-hint describes expected input during autocomplete; it does not implement validation or guarantee a missing-input prompt.
State each argument's purpose, position, accepted values, and failure behavior. Current Claude Code supports $ARGUMENTS for supplied arguments, zero-based $ARGUMENTS[N], and the shorter $N forms. Named arguments require the supported arguments declaration. Inspect the actual expanded input; a placeholder or frontmatter key alone does not establish that the intended value arrived.
For a document-preview skill, require a permitted repository-relative source path and an output format from a declared set. If the format is missing, ask for it before processing. If the path resolves outside the authorized scope or the format is unsupported, return a specific error without reading the rejected target or creating output. Treat the supplied text as data rather than executable shell text or new instructions.
Test an ordinary invocation, a path with spaces, missing input, an unsupported option, and a path outside scope. Check quoting and parsing in the installed client instead of assuming every slash-command parser behaves alike. Do not guess missing values merely to continue.
Keep the resolved skill name and source unambiguous when sharing the workflow. Include its supporting resources in the shared checkout and test the selected definition. Invocation settings and tool preapproval remain separate from input validation and destination authorization.
Full explanation
Create and configure custom slash commands and skills
Learning material · CCAR-F
Read the full explanation