8. File & Component Creation Rules
New File Locations
Checklist for Adding a New Tool
src/tools/<name>.ts— define the tool withtoolDef()(description, inputSchema, handler). EveryinputSchemafield must be.nullable()with a.describe()that states its default — see 04-coding-rulessrc/tools/index.ts— merge the new tool into thetoolsobjectsrc/tools/<name>.test.ts— unit test for the handlersrc/tools/openai-schema.test.ts— bump the tool count so the guard covers the new toolREADME.md— add the argument table, defaults, ranges, return shape and examples by handskills/mcp-kit-cli/SKILL.md— add the same argument table by hand- The exposed
namefield is part of MCP client compatibility — choose it carefully
Decision Guide for Modifying Existing Components
When to Extract Shared Logic
Extract to shared logic if any of these conditions apply:
- Same code used by both the MCP server and the CLI → Move to
src/common/kit/ - Same code used in 2+ tools → Extract to a utility in the owning domain directory (e.g.,
src/exchange/parse.ts) - Complex Zod schema reused → Extract to a shared Zod schema