home / skills / bahayonghang / my-claude-code-settings / tech-design-doc

This skill helps you generate comprehensive technical design documents with structured templates, diagrams, and actionable implementation details to accelerate

npx playbooks add skill bahayonghang/my-claude-code-settings --skill tech-design-doc

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.6 KB
---
name: tech-design-doc
description: Generate technical design documents with proper structure, diagrams, and implementation details. Default language is English unless user requests Chinese.
category: documentation
tags: [design-doc, architecture, adr, rfc, technical-spec]
---

# Technical Design Document Skill

## When to Use

- Designing a new feature or system
- Documenting architecture decisions (ADR/RFC)
- Planning refactoring or optimization work

## Execution Flow

### 1. Assess Complexity

| Level | Scope | Sections Required |
|-------|-------|-------------------|
| Small | Single component, <100 LOC | TL;DR, Design, Implementation |
| Medium | Cross-component, API changes | + Background, Solution Analysis |
| Large | System-level, new service | Full template |

### 2. Gather Context

Before writing, explore the codebase:
- Identify affected components (grep/glob for related code)
- Read existing implementations and patterns
- Note dependencies and potential side effects
- Check for similar solutions already in codebase

### 3. Write Document

Follow the template structure below, scaled to complexity level.

### 4. Verify Before Handoff

- [ ] Problem clearly defined (what breaks if we do nothing?)
- [ ] Options compared with trade-offs (not just one solution)
- [ ] Decision rationale documented
- [ ] Diagrams illustrate key flows
- [ ] Implementation steps are concrete and actionable
- [ ] Risks identified with mitigations

## Document Template

```markdown
# [Feature/System Name] Technical Design

## TL;DR
- 3-5 bullets: problem, solution, key decisions, expected outcome

## Background (Medium/Large)

### Current State
- Existing behavior and limitations

### Problem Statement
- What breaks if we do nothing?
- Who is affected and how?

### Goals / Non-Goals
- Goals: what this design achieves
- Non-Goals: explicitly out of scope

## Solution Analysis (Medium/Large)

### Option 1: [Name]
Pros: ...
Cons: ...

### Option 2: [Name]
Pros: ...
Cons: ...

### Comparison
| Criteria | Option 1 | Option 2 |
|----------|----------|----------|
| Performance | ... | ... |
| Complexity | ... | ... |

### Recommendation
Selected: Option X
Rationale: [why]

## Detailed Design

### Architecture
[Mermaid diagram - see examples below]

### Component Design
- Responsibilities
- Interfaces
- Dependencies

### Data Model (if applicable)
[Schema or structure]

### API Design (if applicable)
[Endpoints, request/response]

## Implementation Plan

### Phase 1: [Name]
- [ ] Task 1
- [ ] Task 2

### Migration Strategy (if applicable)

## Risk Assessment

| Risk | Probability | Impact | Mitigation |
|------|-------------|--------|------------|
| ... | High/Med/Low | High/Med/Low | ... |

## References
- Related docs, external resources
```

## Mermaid Diagram Examples

**Architecture (flowchart):**
```mermaid
flowchart TD
    A[Client] --> B[API Gateway]
    B --> C[Service]
    C --> D[(Database)]
```

**Sequence:**
```mermaid
sequenceDiagram
    Client->>Server: Request
    Server->>DB: Query
    DB-->>Server: Result
    Server-->>Client: Response
```

**State:**
```mermaid
stateDiagram-v2
    [*] --> Pending
    Pending --> Processing: start
    Processing --> Done: complete
    Processing --> Failed: error
```

## Handling Feedback

When user requests changes:
1. Understand which section needs revision
2. Update only affected sections
3. Ensure changes don't contradict other sections
4. Re-verify the checklist items related to changes

## Output Location

- Check if project has `docs/`, `ai_docs/`, or `design/` directory
- Ask user if location is unclear
- Use descriptive filename: `design-[feature-name].md`

Overview

This skill generates clear, actionable technical design documents with a scalable structure, diagrams, and implementation details. It adapts the template to small, medium, and large scopes and produces materials ready for review, handoff, or implementation planning. Default language is English unless you request Chinese.

How this skill works

The skill inspects provided context: feature description, code pointers, and intended scope, then selects a template level (Small/Medium/Large). It produces sections for TL;DR, background, solution analysis, detailed design, implementation plan, migration strategy, risks, and references, and embeds Mermaid diagrams where helpful. Before finalizing, it runs a verification checklist to ensure decisions, trade-offs, and actionable tasks are present.

When to use it

  • Designing a new feature or service from scratch
  • Preparing an ADR/RFC or architecture decision record
  • Planning a cross-team API change or integration
  • Documenting a refactor or optimization with rollout steps
  • Handing off design work to implementation or QA

Best practices

  • Start by assessing complexity and choose the template scale (Small/Medium/Large)
  • Gather concrete code references and dependency notes before writing design details
  • Include 3–5 TL;DR bullets so reviewers grasp intent quickly
  • Compare at least two solution options and document trade-offs
  • Add Mermaid diagrams for architecture, sequence, or state flows to clarify interactions
  • Provide a phased implementation plan with migration steps and rollback criteria

Example use cases

  • Design a new microservice and its API surface with data model and migration plan
  • Produce an ADR comparing two caching strategies with performance and cost trade-offs
  • Document a refactor that touches multiple modules and requires a rollout plan
  • Create a detailed design for a backend feature including sequence diagrams and task checklist
  • Convert exploratory notes and PR discussion into a formal design document for stakeholder review

FAQ

Which template scale should I choose?

Pick Small for single-component changes (<100 LOC), Medium for cross-component or API changes, and Large for new services or system-level work.

Do you include diagrams automatically?

Yes—Mermaid diagrams are added when they clarify architecture, sequences, or state; provide flow details or ask for a specific diagram type if needed.