.claude/skills/agent-tool-design/SKILL.md
The Agent Tool Contract — 5 principles for designing tools agents call reliably: predictable signature, rich errors, token-efficient output, idempotency, graceful degradation. Includes anti-pattern table with 8 common mistakes.
npx skillsauth add oimiragieo/agent-studio agent-tool-designInstall 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.
The Agent Tool Contract — 5 principles for designing tools that agents call reliably.
Tools must have typed, named parameters with clear required/optional distinction. No positional ambiguity.
Good:
// Clear, named, typed
function searchCode({ query, limit = 20, type = 'semantic' }) { ... }
Bad:
// Positional, ambiguous
function searchCode(q, n, t) { ... }
Errors must include: error code (machine-readable), message (human-readable), context (debugging data).
Good:
throw {
code: 'FILE_NOT_FOUND',
message: `File not found: ${path}`,
context: { path, cwd: process.cwd() },
};
Bad:
throw new Error('not found'); // No context for agent to act on
Tools return structured minimal data. No prose explanations, no redundant wrapping, no verbose status messages. Agents format output themselves.
Good:
return { files: ['a.js', 'b.js'], total: 2 };
Bad:
return { status: 'success', message: 'Found 2 files successfully', data: { files: [...], metadata: {...} } };
Rule of thumb: If the output contains prose an agent would re-read to extract facts, it's too verbose.
Tools must be safe to retry. Running a tool twice should produce the same result as running it once.
Good:
// Upsert instead of insert
db.upsert({ id, ...data });
// mkdir -p instead of mkdir
fs.mkdirSync(path, { recursive: true });
Bad:
// Fails on retry
db.insert({ id, ...data }); // duplicate key error
fs.mkdirSync(path); // EEXIST error
Partial success > hard failure. Return what succeeded with a clear indication of what didn't.
Good:
return {
succeeded: ['file1.js', 'file2.js'],
failed: [{ file: 'file3.js', reason: 'PERMISSION_DENIED' }],
partial: true,
};
Bad:
// One file fails -> entire batch throws
throw new Error('Failed to process file3.js');
| Anti-Pattern | Problem | Fix | | ------------------------------ | ---------------------------------------------- | ------------------------------------ | | Verbose status wrapping | Wastes tokens; agent re-parses to extract data | Return data directly | | Positional args | Ambiguous; breaks on refactor | Named params with types | | Swallowed exceptions | Agent thinks success; work is lost | Always surface errors explicitly | | Non-idempotent mutations | Retry causes duplicate data or errors | Upsert semantics; check-then-set | | Hard failures on partial input | One bad item breaks entire batch | Return partial results | | Side-effect-heavy reads | Read tools that trigger writes confuse agents | Separate reads from writes | | String error messages only | Agent can't programmatically handle errors | Include machine-readable error codes | | Untyped return shape | Agent can't reliably destructure output | Document and enforce return schema |
Before shipping any tool:
[ ] Parameters are named (not positional)
[ ] Required vs optional params are explicit
[ ] All error paths return { code, message, context }
[ ] Output contains no prose — only structured data
[ ] Tool is idempotent (safe to retry)
[ ] Partial failure returns partial results, not throws
[ ] Return shape is documented in JSDoc or TypeScript types
[ ] Token budget for output estimated (< 500 tokens for standard tools)
{ code, message, context } to handle errors programmatically.mkdir -p patterns.{ succeeded, failed, partial: true }.tool-creator skill when designing new toolscode-reviewer agent during tool PRsdynamic-api-integration skill (consuming external tools)agent-evaluation skill (evaluating tool output quality)Before starting:
Read .claude/context/memory/learnings.md
After completing:
.claude/context/memory/learnings.md.claude/context/memory/issues.md.claude/context/memory/decisions.mdASSUME INTERRUPTION: If it's not in memory, it didn't happen.
tools
Comprehensive biosignal processing toolkit for analyzing physiological data including ECG, EEG, EDA, RSP, PPG, EMG, and EOG signals. Use this skill when processing cardiovascular signals, brain activity, electrodermal responses, respiratory patterns, muscle activity, or eye movements. Applicable for heart rate variability analysis, event-related potentials, complexity measures, autonomic nervous system assessment, psychophysiology research, and multi-modal physiological signal integration.
tools
Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting communities, generating synthetic networks, or visualizing network topologies. Applicable to social networks, biological networks, transportation systems, citation networks, and any domain involving pairwise relationships.
data-ai
Molecular featurization for ML (100+ featurizers). ECFP, MACCS, descriptors, pretrained models (ChemBERTa), convert SMILES to features, for QSAR and molecular ML.
development
Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.