Agent skill
faion-writing-design-docs
SDD Framework: Creates, edits, or updates design.md with technical implementation. Use when user asks to create design, edit design, update design document, write technical design. Triggers on "design.md", "design document", "technical design".
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/faion-writing-design-docs
SKILL.md
SDD: Writing Design Documents
Communication with user: User's language. Design content: English.
SDD Framework Overview
This skill is part of the Spec-Driven Development (SDD) framework.
SDD Philosophy
"Intent is the source of truth" — specification is the main artifact, code is just its implementation.
SDD Workflow
- SPECIFICATION → faion-writing-specifications → spec.md (approved)
- DESIGN ← YOU ARE HERE → Read spec + constitution → Research codebase → Write design.md
- TASK CREATION →
faion-make-tasksskill → TASK_*.md - EXECUTION → /faion-execute-task, /faion-do-all-tasks → Code + Tests
SDD Directory Structure
aidocs/sdd/
├── CLAUDE.md # SDD overview
├── SDD_WORKFLOW.md # Detailed workflow
├── SPEC_TEMPLATE.md # spec.md template
├── DESIGN_TEMPLATE.md # design.md template ← use this!
├── CONSTITUTION_TEMPLATE.md # constitution.md template
├── TASK_EXECUTION.md # Task execution process
└── {project}/ # epass, billing, etc.
├── constitution.md # Project principles ← read!
└── features/
└── {feature-name}/ # kebab-case
├── spec.md # WHAT and WHY ← read!
├── design.md # HOW ← creating here
└── tasks/ # Tasks
├── todo/
├── in_progress/
└── done/
Key SDD Documents
| Document | Purpose | Status |
|---|---|---|
constitution.md |
Project principles (WHAT) | READ before design |
contracts.md |
API contracts (HOW interfaces) | READ for API features |
spec.md |
WHAT and WHY | READ, must be approved |
design.md |
HOW to implement | CREATING with this skill |
TASK_*.md |
Atomic tasks | Created after design |
contracts.md is the single source of truth for all APIs. For features with API endpoints, design.md MUST reference contracts.md, not redefine endpoints.
When to Use This Skill
ALWAYS use this skill when user asks to:
- Create design.md for a feature
- Edit/update/change/modify existing design document
- Write technical design based on spec
- Add architecture decisions to design
Trigger phrases: "create design", "edit design", "update design.md", "write design document"
Purpose
Creates design.md for a feature based on:
- Approved spec.md
- Codebase analysis
- Project constitution
Input
feature_path- path to feature directory (contains spec.md)
Or:
project- project namefeature- feature name
Prerequisites
Before starting, verify:
SDD_BASE="aidocs/sdd"
# 1. spec.md exists with status approved
cat ${SDD_BASE}/{project}/features/{feature}/spec.md | grep -A1 "Status"
# 2. constitution.md exists
cat ${SDD_BASE}/{project}/constitution.md
Required files:
spec.mdexists with statusapproved- Project
constitution.mdexists ataidocs/sdd/{project}/constitution.md - Project
contracts.mdexists ataidocs/sdd/{project}/contracts.md(for API features)
If constitution.md doesn't exist: Use skill faion-writing-constitutions to create it first.
If contracts.md doesn't exist: Use agent faion-api-designer-agent with MODE=init to create it.
Workflow
Phase 1: Read Specification
Read spec.md completely and extract:
- Problem Statement
- User Stories
- Functional Requirements
- API Contract (if present)
- Data Model (if present)
- Out of Scope
Phase 2: Read Constitution
Read project principles from constitution.md and extract:
- Architecture patterns
- Code standards
- Testing requirements
Phase 2.5: Read API Contracts (if API feature)
Read contracts.md and extract:
- Relevant endpoint definitions
- Request/response schemas
- Auth requirements
- Error format standard
IMPORTANT: Do NOT redefine API endpoints in design.md. Reference contracts.md instead:
## API Endpoints
This feature implements endpoints from [contracts.md](../../contracts.md):
- `POST /api/v1/auth/register` - User registration
- `POST /api/v1/auth/login` - User login
Phase 3: Research Codebase
Use Grep and Glob tools to find related code:
- Similar models in
epass/app/applications/ - Similar services (services.py files)
- Similar views (views.py files)
- Existing patterns
Determine:
- Which components can be reused
- Which patterns are in use
- Where to place new code
Phase 4: Architecture Decisions
For each key decision:
- Define context - what problem are we solving
- List options - minimum 2 alternatives
- Choose solution - which and why
- Document rationale - reasoning behind choice
Typical decisions include:
- Business logic placement (new service vs existing)
- Model structure (new vs extend existing)
- Pattern selection
- Error handling approach
Phase 5: Define Technical Approach
Define:
- Components - new components, interactions, diagrams if complex
- Data Flow - data path through system, validation points, error handling
- Files - CREATE and MODIFY lists with scope
Phase 6: Define Testing Strategy
Based on constitution:
- Unit tests - isolated testing targets
- Integration tests - flow coverage
- Test data - required fixtures
Phase 7: Identify Risks
For each risk document:
- Risk description
- Impact (High/Medium/Low)
- Mitigation strategy
Phase 8: Review with User
Present key decisions:
- Architecture Decisions - agreement check
- Technical Approach - better alternatives
- Risks - completeness check
Phase 9: Agent Review
Before saving, call faion-design-reviewer-agent agent:
Task tool:
subagent_type: "faion-design-reviewer-agent"
prompt: "Review design for {project}/{feature}"
The agent checks:
- FR coverage (all requirements addressed)
- AD structure (context, options, rationale)
- Constitution compliance
- Files list completeness
- Technical correctness
If issues found → fix and re-review. If approved → proceed to save.
Phase 10: Save Design
Save design.md to feature directory: {feature_path}/design.md
Architecture Decision Template
### AD-{N}: {Decision Name}
**Context:**
{Problem being solved and relevant context}
**Options:**
- **A: {Option}**
- Pros: {benefits}
- Cons: {drawbacks}
- **B: {Option}**
- Pros: {benefits}
- Cons: {drawbacks}
**Decision:** {Chosen solution}
**Rationale:** {Why this solution, influencing factors}
**Failed Attempts:** {Optional - approaches tried and rejected during analysis}
Files Section Format
### Files
app/applications/{app}/models.py # MODIFY - add {Model}
app/applications/{app}/services.py # MODIFY - add {Service}
app/applications/{app}/views.py # MODIFY - add {ViewSet}
app/applications/{app}/serializers.py # MODIFY - add {Serializer}
app/applications/{app}/tests/test_{x}.py # CREATE - tests for {x}
Failed Attempts Section
Document approaches that were considered but rejected:
### Failed Attempts
1. **{Approach Name}** - {Why it was rejected}
2. **{Approach Name}** - {Why it was rejected}
This section helps future developers understand why certain paths were not taken.
Output
File design.md at:
aidocs/sdd/{project}/features/{feature}/design.md
Next step: After approving design.md → use faion-make-tasks skill (via /faion-net → create tasks)
Checklist Before Completion
- All FR from spec.md covered
- Architecture Decisions have rationale
- Files list is complete
- Testing strategy defined
- Risks identified
- Follows constitution
- API endpoints reference contracts.md (not redefined)
- User approved
Sources
- Project spec.md
- Project constitution.md
- Project contracts.md (for API features)
- Template:
templates/DESIGN_TEMPLATE.md(in this skill directory)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?