type: skill name: Feature Breakdown description: Break down features into implementable tasks skillSlug: feature-breakdown phases: [P] generated: 2026-03-18 status: filled scaffoldVersion: "2.0.0"
Feature Breakdown
Break down features into concrete, implementable tasks within the @dotcontext/cli architecture.
When to Use
- Starting the Planning (P) phase of a PREVC workflow
- Scoping a new CLI command, MCP tool, or service
- Creating a plan document in
.context/plans/ - Estimating complexity to choose the right workflow scale (QUICK/SMALL/MEDIUM/LARGE)
Instructions
1. Classify the Feature Scope
Determine which layers of the codebase are involved:
| Layer | Directory | Examples |
|---|---|---|
| CLI | src/index.ts |
New command, new flag, output format change |
| Service | src/services/<domain>/ |
New business logic, data processing |
| Generator | src/generators/ |
New scaffold type, template changes |
| MCP | src/services/mcp/ |
New tool, new gateway action, schema change |
| Workflow | src/workflow/ |
Phase logic, gate rules, skill/agent integration |
| Utils | src/utils/ |
New utility function, i18n keys, CLI UI changes |
| Types | src/types/, src/types.ts |
New interfaces, frontmatter types |
2. Determine the Workflow Scale
Use these criteria to set the scale when calling workflow-init:
| Scale | Criteria | Typical Feature |
|---|---|---|
| QUICK | Single file, no design decisions | Fix typo, update translation key |
| SMALL | 2-5 files, straightforward logic | Add a flag to existing CLI command |
| MEDIUM | Multiple services, design decisions needed | New MCP gateway action with service |
| LARGE | New subsystem, cross-cutting concerns | New generator type, new AI provider |
3. Identify the Task Breakdown Pattern
Most features in this project follow one of these patterns:
Pattern A: New MCP Gateway Action
- Define the action in the Zod schema (
mcpServer.ts) - Add handler logic in the gateway file (
src/services/mcp/gateway/<tool>.ts) - Create or extend the backing service (
src/services/<domain>/) - Update type exports in
gatewayTools.tsandgateway/index.ts - Add tests for the handler
- Update MCP tool description string
Pattern B: New CLI Command
- Define the command with Commander in
src/index.ts - Create the service in
src/services/<name>/ - Add i18n keys to
src/utils/i18n.ts(bothenandpt-BR) - Wire CLI options to service calls
- Add CLI output via
CLIInterfacefromsrc/utils/cliUI.ts - Write tests
Pattern C: New Generator/Scaffold Type
- Create generator class in
src/generators/<type>/ - Define templates in
src/generators/<type>/templates/ - Add frontmatter type to
src/types/scaffoldFrontmatter.ts - Integrate with
InitServicefor scaffold creation - Integrate with
FillServicefor AI content generation - Add to MCP context gateway if applicable
- Write generator tests
Pattern D: New Workflow Feature
- Update types in
src/workflow/types.ts - Modify phase/gate logic in
src/workflow/ - Update
WorkflowServiceinsrc/services/workflow/ - Update MCP workflow tools if user-facing
- Write tests for phase transitions
4. Create the Plan Document
Use the MCP tool or create manually:
# Via MCP
context({ action: 'scaffoldPlan', planName: 'my-feature', title: 'My Feature', summary: 'What it does' })
# Manual creation in .context/plans/my-feature.md
Structure each phase with concrete steps:
## Phases
### P - Planning
- [ ] Define requirements and acceptance criteria
- [ ] Identify affected services and files
- [ ] Choose workflow scale
### R - Review (for MEDIUM/LARGE)
- [ ] Review architecture impact
- [ ] Document design decisions as ADRs
- [ ] Get plan approval
### E - Execution
- [ ] Implement service logic in src/services/<domain>/
- [ ] Add MCP gateway handler (if applicable)
- [ ] Update CLI integration (if applicable)
- [ ] Add i18n keys for new user-facing strings
- [ ] Update type exports
### V - Validation
- [ ] Write unit tests with jest.mock() for externals
- [ ] Run full test suite: npm test
- [ ] Manual CLI verification: npx tsx src/index.ts <command>
- [ ] TypeScript compilation check: npm run build
### C - Confirmation (for LARGE)
- [ ] Update CHANGELOG.md
- [ ] Update relevant .context/ documentation
- [ ] Update README if public API changed
5. Identify Dependencies and Risks
Common dependencies to flag:
- AI provider changes: Require testing with actual API keys (not just mocks)
- tree-sitter changes: Optional dependency -- test with and without it installed
- MCP protocol changes: Must maintain backward compatibility with existing clients
- Frontmatter format changes: Must handle both v1 and v2 formats
- i18n additions: Both locales must be updated simultaneously
6. Link the Plan to the Workflow
After creating the plan, link it to the active workflow:
plan({ action: 'link', planSlug: 'my-feature' })
This enables phase tracking and the commitPhase action for git integration.
Example: Breaking Down "Add Caching to Semantic Analysis"
Scale: MEDIUM (multiple files, design decision on cache strategy)
Tasks:
- P: Define cache invalidation strategy (file mtime vs. content hash)
- P: Decide cache storage location (
.context/.cache/vs. temp dir) - R: Review impact on
CodebaseAnalyzerandSemanticContextBuilder - E: Add cache layer to
src/services/semantic/codebaseAnalyzer.ts - E: Add cache config to
AnalyzerOptionstype - E: Wire cache option through MCP
context({ action: 'buildSemantic' })params - V: Test cache hit/miss with
codebaseAnalyzer.test.ts - V: Test that
cacheEnabled: falsebypasses cache - V: Manual test with large repo to verify performance improvement
Files affected: src/services/semantic/codebaseAnalyzer.ts, src/services/semantic/types.ts, src/services/mcp/gateway/context.ts, src/services/mcp/mcpServer.ts