tool
Adds or modifies an AI tool definition in domain/tools/ai/ and wires its framework-build target. Use when defining a new AI assistant tool (composing AiTool<C> from Has* capabilities), changing an existing tool's capability intersection, adding or updating content-rewrite logic, configuring PluginsCapability with marketplaceSettings, or registering the tool in the registry. Do NOT use for adding a new capability class — use `capability` instead. Do NOT use for pure string transforms — use `format` instead. Do NOT use for domain type or model changes — use `domain-model` instead.
ai-driven-dev · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add ai-driven-dev/framework --skill toolAbout this skill
name: tool
description: >
Adds or modifies an AI tool definition in domain/tools/ai/ and wires its framework-build
target. Use when defining a new AI assistant tool (composing AiTool from Has* capabilities),
changing an existing tool's capability intersection, adding or updating content-rewrite logic,
configuring PluginsCapability with marketplaceSettings, or registering the tool in the registry.
Do NOT use for adding a new capability class — use capability instead. Do NOT use for pure
string transforms — use format instead. Do NOT use for domain type or model changes — use
domain-model instead.
Tool
Builds a complete AI tool definition: a typed object implementing AiTool<C> where C is an
intersection of Has* interfaces sourced from domain/tools/contracts.ts, registered via
registerTool, and optionally equipped with PluginsCapability and marketplaceSettings.
Available actions
| # | Action | Role | Input |
|---|---|---|---|
| 01 | define-toolconfig | Compose the AiTool object from Has* capabilities | tool name + required capabilities list |
| 02 | content-rewrite | Implement lossless rewriteContent / reverseRewriteContent | tool file from 01 |
| 03 | plugins-and-marketplace | Configure PluginsCapability + marketplaceSettings | tool file from 01 |
| 04 | register-and-test | Call registerTool and validate the full definition | completed tool from 01-03 |
| 05 | build-contract | Declare the tool's framework build behavior via ToolBuildContract | tool from 01 + modes (marketplace/flat) |
Default flow
01 → 02 → 03 → 04 then 05 when the tool must be an aidd framework build target.
Skip 03 when the tool has no plugin capability. Skip 02 when the tool reuses base rewrite helpers without modification (document this explicitly). Skip 05 when the tool is not a framework-build target.
Transversal rules
- Tool file lives in
domain/tools/ai/<tool-name>.ts; one file per tool. AiTool<C>whereCis an intersection ofHas*interfaces — never a plain object literal without the type annotation.- Capability presence guard uses
"agents" in tool.capabilities(in-check), notinstanceof. rewriteContentandreverseRewriteContentmust be exact inverses; composebaseRewriteContent/baseReverseRewriteContentfirst, then apply tool-specific transforms.signalDirpoints to the directory scanned forname: aidd:signals; required and non-null for AI tools.directoryis the root output directory for the tool (e.g..acme/).- Call
registerTool(config)at module bottom — never from use-cases or application layer. - Named export only; no default export.
.jsextensions on all relative imports.- No
anytypes. - Framework-build behavior is declared by ONE artifact-symmetric
ToolBuildContract(all six artifact kinds: skills/agents/mcp/hooks/rules/commands), consumed by the two per-mode orchestrators — NEVER a per-tool*OutputStrategyclass, NEVER a per-tool/per-artifact branch in an orchestrator. Unsupported kinds are{ supported: false }(warn-and-skip). - Build contracts reuse existing path/transform/merge helpers; generalize a helper rather than
reimplement it. Flat MCP merges key-prefix servers by
<plugin>-.
References
references/aitool-shape.md— AiTool fields, Has* interfaces, IdeToolConfig, ToolConfig unionreferences/plugins-capability.md— PluginsCapability constructor params, modes, marketplaceSettings, translationMode, installScopereferences/content-rewrite.md— rewriteContent/reverseRewriteContent contract, base helpers, lossless-round-trip requirementreferences/build-contract.md— ToolBuildContract + ArtifactContract shape, artifact symmetry, the two per-mode orchestrators, reuse points, registry wiring