design-doc-generator
npx skills add https://github.com/chaorenex1/coding-workflow --skill design-doc-generator
Agent 安装分布
Skill 文档
Design Doc Generator – Technical Design Documentation Assistant
Purpose
Design Doc Generator creates comprehensive technical design documents for software projects. The skill generates production-ready documentation covering database schemas, system architecture, API specifications, and visual diagrams using Mermaid syntax.
When to Use This Skill
Use this skill when:
- Creating a new project and need complete technical design documentation
- Designing database schemas with relationships and constraints
- Defining RESTful API endpoints and request/response formats
- Planning system architecture and module layering
- Documenting business processes with flowcharts
- Visualizing component interactions with sequence diagrams
- Mapping data flow through system layers
- Onboarding team members to existing codebase architecture
Core Capabilities
1. Database Schema Design
Generate complete database table definitions with fields, types, constraints, indexes, and relationships.
Process:
- Analyze requirements to identify entities and their attributes
- Define primary keys, foreign keys, and constraints
- Specify data types, defaults, and nullable fields
- Design indexes for query optimization
- Document table relationships (one-to-one, one-to-many, many-to-many)
- Reference
templates/database-schema.mdfor standard format
Output includes:
- Table definitions with field specifications
- Entity-Relationship diagram (Mermaid ER diagram)
- Index recommendations with justification
- Migration scripts or DDL statements
2. Module Layering Design
Design system architecture with clear separation of concerns across layers.
Process:
- Identify architectural layers (presentation, business, data, infrastructure)
- Define module boundaries and responsibilities
- Specify dependencies between layers
- Establish communication patterns
- Reference
references/design-patterns.mdfor architectural patterns
Output includes:
- Layer architecture diagram
- Module responsibility matrix
- Dependency graph
- Data flow between layers
3. Module Interface Design
Define contracts between modules with clear input/output specifications.
Process:
- Identify module boundaries from requirements
- Define function/method signatures
- Specify data structures for module communication
- Document error handling and return codes
- Reference
templates/module-design.mdfor interface format
Output includes:
- Interface definitions
- Data transfer objects (DTOs)
- Error handling specifications
- Module dependency list
4. API Interface Design
Design RESTful API endpoints following industry best practices.
Process:
- Identify resources from domain model
- Map CRUD operations to HTTP methods
- Define request/response schemas
- Specify status codes and error responses
- Document authentication and authorization
- Reference
templates/api-spec.mdfor API documentation format
Output includes:
- Endpoint list with methods and paths
- Request/response examples (JSON)
- Authentication requirements
- Rate limiting and pagination specs
- OpenAPI/Swagger specification
5. Business Flowchart
Create visual business process diagrams using Mermaid syntax.
Process:
- Identify key business processes from requirements
- Map decision points and branching logic
- Define start/end states and conditions
- Specify actors and swimlanes if needed
- Reference
references/mermaid-diagrams.mdfor flowchart syntax
Output includes:
- Mermaid flowchart code
- Process descriptions per step
- Decision logic documentation
- Alternative flow paths
6. Data Flow Diagram
Visualize how data moves through the system from input to persistence.
Process:
- Trace data from external input through system layers
- Identify data transformations at each stage
- Specify data stores and external systems
- Document data formats at each boundary
- Reference
references/mermaid-diagrams.mdfor DFD syntax
Output includes:
- Level 0 DFD (context diagram)
- Level 1 DFD (decomposed processes)
- Data dictionary defining all data elements
- Data transformation rules
7. Sequence Diagram
Generate sequence diagrams showing component interactions over time.
Process:
- Identify actors and components
- Map message flow for key operations
- Specify synchronous vs asynchronous calls
- Document error scenarios and timeouts
- Reference
references/mermaid-diagrams.mdfor sequence diagram syntax
Output includes:
- Mermaid sequence diagram code
- Message descriptions with parameters
- Lifeline documentation
- Alternative flows and error handling
Workflow Integration
New Project Design
- Requirements Analysis â Extract entities, processes, and use cases
- Database Design â Generate schema with ER diagram
- Architecture Design â Create module layering and interfaces
- API Design â Define RESTful endpoints
- Documentation â Generate all diagrams and compile design document
Existing Project Documentation
- Code Analysis â Parse existing code structure
- Reverse Engineering â Extract schemas and API patterns
- Documentation Generation â Create comprehensive design docs
- Gap Analysis â Identify missing or inconsistent elements
Incremental Updates
- Change Request â Identify affected components
- Impact Analysis â Update relevant diagrams and schemas
- Version Documentation â Track changes and maintain history
Design Document Structure
Generate documents following this outline:
# [Project Name] Technical Design Document
## 1. Overview
- Project background
- System objectives
- Scope and boundaries
## 2. System Architecture
- Architecture diagram
- Layer descriptions
- Technology stack
## 3. Database Design
- ER diagram
- Table definitions
- Index strategy
## 4. Module Design
- Module breakdown
- Interface specifications
- Dependencies
## 5. API Design
- Endpoint specifications
- Request/response formats
- Authentication
## 6. Business Processes
- Flowcharts
- Process descriptions
## 7. Data Flow
- Data flow diagrams
- Data dictionary
## 8. Sequence Diagrams
- Key operations
- Component interactions
Additional Resources
Template Files
Ready-to-use templates for consistent documentation:
templates/database-schema.md– Database schema template with ER diagramtemplates/api-spec.md– API specification template following OpenAPI standardstemplates/module-design.md– Module interface design template
Reference Files
Detailed guides and best practices:
references/design-patterns.md– Architectural patterns (Layered, Hexagonal, Clean Architecture)references/mermaid-diagrams.md– Mermaid syntax guide for all diagram types
Example Files
Complete working examples:
examples/ecommerce-design-doc.md– Full design document for e-commerce system
Best Practices
- Start with requirements: Ensure design aligns with business needs before documenting
- Iterative refinement: Update docs as design evolves; treat as living documents
- Diagram consistency: Use consistent naming and styling across all diagrams
- Version control: Track design changes alongside code changes
- Stakeholder review: Validate technical design with both technical and business stakeholders
- Mermaid validation: Verify Mermaid syntax renders correctly in supported viewers
Common Use Cases
Scenario 1: New Microservice
- Generate database schema for service-specific data
- Design REST API for service communication
- Create sequence diagrams showing service interactions
Scenario 2: Legacy System Migration
- Document existing system architecture
- Design target architecture with module boundaries
- Map data flows between old and new systems
Scenario 3: Feature Addition
- Identify affected modules and tables
- Update API with new endpoints
- Document new business processes
Scenario 4: Team Onboarding
- Generate comprehensive design documentation
- Create visual diagrams for quick understanding
- Document module interfaces for integration guidance
Diagram Syntax Quick Reference
ER Diagram:
erDiagram
USERS ||--o{ ORDERS : places
USERS {
int id PK
string name
string email
}
Flowchart:
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
Sequence Diagram:
sequenceDiagram
actor User
participant API
participant DB
User->>API: Request
API->>DB: Query
DB-->>API: Result
API-->>User: Response
Technical Requirements
- Mermaid support: Documentation viewer must support Mermaid rendering
- Markdown output: All documentation in Markdown format
- UTF-8 encoding: Ensure proper handling of special characters
- Version control: Design documents should be tracked in Git
Limitations
- Mermaid diagrams may not render in all markdown viewers
- Database schema generation assumes relational database patterns
- Complex sequence diagrams may become difficult to read; consider splitting
- Generated documentation requires human review for business-specific context