skills/documenting-tools/SKILL.md
Use when writing MCP tools, API endpoints, CLI commands, or any function that an LLM will invoke. Also use when LLMs misuse tools due to poor descriptions. Triggers: 'document this tool', 'write tool docs', 'MCP tool', 'tool description quality', 'model keeps calling this wrong', 'improve tool description'. For human-facing API docs, standard documentation practices apply instead.
npx skillsauth add axiomantic/spellbook documenting-toolsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Input | Required | Description |
|-------|----------|-------------|
| tool_type | Yes | MCP tool, REST API, CLI command, function |
| tool_code | Yes | Implementation or signature to document |
| existing_docs | No | Current documentation to improve |
| Output | Type | Description |
|--------|------|-------------|
| tool_documentation | Inline/JSON | Complete tool documentation |
| quality_assessment | Inline | Checklist verification |
For every tool, document ALL of these:
| Element | Required | Description | |---------|----------|-------------| | Purpose | Yes | What the tool does in one sentence | | When to use | Yes | Conditions that make this tool appropriate | | When NOT to use | Recommended | Common misuse cases, similar tools to use instead | | Parameters | Yes | Each parameter with type, constraints, examples | | Return value | Yes | What the tool returns on success | | Error cases | Yes | What errors can occur and what they mean | | Side effects | If any | What state changes the tool causes | | Examples | Recommended | 1-2 usage examples |
name (type, required/optional): Description.
- Constraints: [valid ranges, formats, patterns]
- Default: [if optional]
- Example: [concrete value]
Good:
path (string, required): Path to the file to read.
- Can be absolute (/Users/...) or relative to cwd (./src/...)
- Must not contain null bytes
- Example: "/Users/alice/project/README.md"
Bad:
path: The file path
| Error Case | Document | |-----------|----------| | Empty/null input | What happens if required field is empty? | | Invalid type | What if wrong type passed? | | Out of bounds | What if index exceeds array length? | | Missing resource | What if file/URL/ID doesn't exist? | | Permission denied | What if access is restricted? | | Timeout | What if operation takes too long? | | Rate limit | What if quota exceeded? |
errors: [
"ERROR_CODE: Human-readable explanation of when this occurs"
]
{
"name": "tool_name",
"description": "What the tool does. When to use it. When NOT to use it (use X instead).",
"inputSchema": {
"type": "object",
"properties": {
"param_name": {
"type": "string",
"description": "What this parameter controls. Constraints. Example value."
}
},
"required": ["param_name"]
}
}
Bad:
{
"name": "read_file",
"description": "Reads a file"
}
Good:
{
"name": "read_file",
"description": "Reads file contents as UTF-8 string. Use for text files. Fails on binary files (use read_file_binary). Fails if file doesn't exist.",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "File path. Absolute (/Users/...) or relative to cwd (./src/...). Example: '/Users/alice/README.md'"
}
},
"required": ["path"]
},
"errors": [
"FILE_NOT_FOUND: Path does not exist",
"PERMISSION_DENIED: Cannot read file",
"BINARY_FILE: File is binary, use read_file_binary"
]
}
Bad:
{
"name": "api_request",
"description": "Makes an API request"
}
Good:
{
"name": "api_request",
"description": "HTTP request to external API. Use for REST APIs. NOT for internal services (use internal_rpc). Auto-retries 5xx errors 3x.",
"inputSchema": {
"type": "object",
"properties": {
"method": {
"type": "string",
"enum": ["GET", "POST", "PUT", "DELETE", "PATCH"],
"description": "HTTP method"
},
"url": {
"type": "string",
"description": "Full URL with protocol. Must be HTTPS for external APIs. Example: 'https://api.github.com/repos/owner/repo'"
},
"body": {
"type": "object",
"description": "Request body for POST/PUT/PATCH. Auto-serialized to JSON."
},
"timeout_ms": {
"type": "number",
"description": "Timeout in milliseconds. Default: 30000"
}
},
"required": ["method", "url"]
},
"errors": [
"TIMEOUT: Exceeded timeout_ms",
"NETWORK_ERROR: Could not connect",
"INVALID_URL: Malformed URL or disallowed protocol",
"AUTH_REQUIRED: 401 returned, check credentials"
],
"sideEffects": "POST/PUT/DELETE/PATCH may modify remote state"
}
<FINAL_EMPHASIS> Tool documentation is the interface contract between you and every LLM that will use your tool. Ambiguity in that contract means the LLM will guess. Guessing means errors. Clear documentation means correct tool usage on the first try. Write for the model that has never seen your codebase. </FINAL_EMPHASIS>
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
development
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
testing
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
development
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.