system-design
Purpose
Designs the smallest valid architecture for a task, or reverse-engineers docs/design/ARCHITECTURE.md from an existing codebase.
Source Skill purpose
When to use it
Use system-design for complex work that crosses component boundaries or needs an architecture decision grounded in the repository. It chooses only the context, container and component detail the task needs. Each proposed component maps to a verified path and a responsibility, while boundaries name their contracts. Compatibility, migration and alternatives are recorded; an ADR appears only for a real decision. Reverse mode can recover an architecture document from existing code instead of inventing future structure.
The survey checks entry points and dependency direction before a boundary is proposed. Compatibility and migration are explicit even when their result is none, with the reason recorded. A requirement-level choice that the task has not settled is returned for input instead of resolved by the designer.
Source Skill purpose
How it works
Source Flow
- Set scope Read the assignment and identify criteria that require structure or a repository survey.
Source Flow
- Survey the code Inspect entry points, modules, dependency direction, existing architecture and ADRs with paths.
Source Flow
- Choose levels Use only the context, container or component levels needed by the change.
Source Flow
- Map components Record each component's verified path, responsibility, change and boundary contract.
Source Flow
- Assess compatibility Explain effects on callers, migration steps and architectural trade-offs.
Source Flow
- Record decisions Write an ADR only when evidence supports genuine alternatives; ask about missing requirements.
Source Flow
- Write architecture Produce machine-readable architecture and the human document from verified repository facts.
Source Flow
- Validate paths Run architecture validation and correct invalid paths or incomplete decisions.
Source Flow
- Report design Summarize levels, components, boundaries, ADRs, compatibility and remaining risks.
Source Flow
Key rules
- Design the smallest architecture that satisfies the task's acceptance criteria.
Source Hard rules
- Tie every component to an existing repository path.
Source Hard rules
- Read current entry points and dependency conventions before proposing structure.
Source Hard rules
- Write ADRs only for decisions with real alternatives and evidence.
Source Hard rules
- Name the contract across every component boundary.
Source Hard rules
Output and gate
Output
- Produce architecture data, a readable architecture document, warranted ADRs and a ledger.
Source Output
Gate
- Validation must succeed; missing component paths or unsupported ADR choices prevent completion.
Source Gate rule
Source
Source Skill definition