Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Technical specification and design document expert. Use when writing design docs, RFCs, ADRs, or evaluating technology choices. Covers C4 model, system design, and architecture documentation.
.claude/skills/majiayu000-technical-spec/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 126% | 0% |
> Expert guidance for writing effective technical design documents, RFCs, Architecture Decision Records, and technology evaluation frameworks.
> These rules are mandatory. Violating them means the skill is not working correctly.
Every design document must include at least 2 alternative solutions.
markdown❌ FORBIDDEN: ## Solution We will use PostgreSQL for the database. (No alternatives considered) ✅ REQUIRED: ## Proposed Solution PostgreSQL for primary database. ## Alternatives Considered ### Option A: PostgreSQL (Recommended) **Pros**: ACID compliance, JSON support, mature ecosystem **Cons**: Vertical scaling limits **Decision**: Chosen for reliability and team expertise ### Option B: MongoDB **Pros**: Horizontal scaling, flexible schema **Cons**: Eventual consistency, less familiar to team **Decision**: Rejected due to consistency requirements ### Option C: DynamoDB **Pros**: Serverless, auto-scaling **Cons**: Vendor lock-in, complex query patterns **Decision**: Rejected due to query flexibility needs
System designs must include architecture diagrams. No text-only descriptions.
markdown❌ FORBIDDEN: "The user sends a request to the API, which talks to the database and returns a response." ✅ REQUIRED: Include at least one of: - C4 Context/Container diagram - Sequence diagram for key flows - Data flow diagram Example (Mermaid):
sequenceDiagram Client->>API: POST /orders API->>Auth: Validate token Auth-->>API: User context API->>DB: Create order DB-->>API: Order ID API-->>Client: 201 Created
Every design must include measurable success criteria.
markdown❌ FORBIDDEN: ## Goals - Make the system faster - Improve reliability - Better user experience ✅ REQUIRED: ## Success Metrics | Metric | Current | Target | Measurement | |--------|---------|--------|-------------| | API Latency (P95) | 500ms | <200ms | Prometheus histogram | | Availability | 99.5% | 99.9% | Uptime monitoring | | Error Rate | 2% | <0.1% | Error tracking | | Throughput | 1K req/s | 10K req/s | Load testing |
All designs must identify risks and their mitigations.
markdown❌ FORBIDDEN: (No risk section, assuming everything will work) ✅ REQUIRED: ## Risks & Mitigations | Risk | Severity | Likelihood | Mitigation | |------|----------|------------|------------| | Database migration fails | High | Medium | Backup + rollback plan, test in staging | | Third-party API unavailable | Medium | Low | Circuit breaker, fallback cache | | Team lacks expertise | Medium | Medium | Pair programming, external review | | Scope creep | High | High | Fixed scope document, change control |
| Scenario | Document Type | Complexity | |----------|--------------|------------| | New feature design | Technical Design Doc | Medium-High | | System architecture | C4 Model Diagrams | Medium | | Major technical decision | Architecture Decision Record (ADR) | Low-Medium | | Cross-team proposal | RFC (Request for Comments) | Medium-High | | Technology evaluation | Tech Selection Matrix | Medium | | API contract | OpenAPI/AsyncAPI Spec | Low-Medium |
Purpose: Blueprint for implementing a feature or system Audience: Engineers, technical leads When: Before implementing significant features Sections: Problem, solution, alternatives, risks, timeline
Purpose: Proposal for discussion and feedback Audience: Cross-functional teams When: Need consensus on technical direction Sections: Problem statement, proposal, trade-offs, open questions
Purpose: Document a single architectural decision Audience: Current and future engineers When: Any architecturally significant choice Sections: Context, decision, consequences, status
Purpose: Visualize system architecture at multiple zoom levels Audience: Technical and non-technical stakeholders When: Communicating system structure Levels: Context, Container, Component, Code
markdown# Title: User Authentication System **Author**: Jane Doe **Status**: Proposed | In Review | Approved | Implemented **Created**: 2025-12-18 **Last Updated**: 2025-12-18 **Reviewers**: @tech-lead, @security-team
markdown## Problem **Current State**: Users authenticate via legacy session cookies, no MFA support. **Impact**: 23% of security incidents related to compromised credentials. **Constraint**: Must support 10K concurrent users, <200ms login latency. **Goal**: Implement secure, scalable authentication with MFA and OAuth support.
markdown## Solution Implement JWT-based authentication with: - Access tokens (15min TTL) + Refresh tokens (7 day TTL) - TOTP-based MFA (Google Authenticator compatible) - OAuth 2.0 providers (Google, GitHub) - Redis for token blacklist and session management ### High-Level Design [Include C4 Container diagram here] ### Data Flow 1. User submits credentials → Auth Service validates 2. Auth Service generates JWT pair, stores refresh token in Redis 3. Client includes access token in Authorization header 4. API Gateway validates token, extracts user context 5. On expiry, client exchanges refresh token for new access token
markdown## Alternatives ### Option A: Session-based authentication **Pros**: Simpler implementation, server-side revocation **Cons**: Doesn't scale horizontally, higher latency **Decision**: Rejected - doesn't meet scalability requirements ### Option B: Auth0 (3rd party) **Pros**: Battle-tested, feature-complete **Cons**: $500/month cost, vendor lock-in **Decision**: Deferred - revisit if team velocity insufficient
markdown## Risks & Mitigations | Risk | Severity | Likelihood | Mitigation | |------|----------|------------|------------| | JWT secret leak | Critical | Low | Rotate secrets quarterly, use HSM | | Token theft (XSS) | High | Medium | HttpOnly cookies, CSP headers | | Redis downtime | High | Low | Fallback to stateless validation | | Clock skew issues | Medium | Medium | Use `nbf` claim, allow 5min tolerance |
markdown## Work Breakdown ### Phase 1: Core Authentication (Week 1-2) - [ ] JWT generation/validation service - [ ] Password hashing (bcrypt) - [ ] User repository interface - [ ] Unit tests + integration tests ### Phase 2: MFA (Week 3) - [ ] TOTP secret generation - [ ] QR code generation - [ ] Verification endpoint - [ ] Backup codes ### Phase 3: OAuth (Week 4) - [ ] Google OAuth integration - [ ] GitHub OAuth integration - [ ] Account linking flow ### Success Metrics - 100% test coverage for auth logic - <100ms token validation latency - Zero security vulnerabilities in audit
markdown## Open Questions 1. **Token storage**: Should refresh tokens be in httpOnly cookie or localStorage? - **Recommendation**: Cookie (XSS protection), need CSRF mitigation 2. **MFA enforcement**: Opt-in or mandatory for all users? - **Requires**: Product team decision 3. **Session limits**: Should we limit concurrent sessions per user? - **Impact**: Redis storage requirements, UX complexity
markdown✅ DO: - Use simple, direct language - Define acronyms on first use - Include diagrams for complex flows - Use tables for comparisons - Provide concrete examples ❌ DON'T: - Use jargon without explanation - Write walls of text - Assume prior knowledge - Skip the "why" behind decisions - Create docs that become stale
Mermaid (Simple flows)
mermaidsequenceDiagram Client->>API: POST /login API->>DB: Validate credentials DB-->>API: User data API->>Redis: Store session API-->>Client: JWT token
PlantUML with C4 (Architecture)
plantuml@startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml System_Boundary(c1, "Auth System") { Container(api, "API Gateway", "Node.js", "Routes requests") Container(auth, "Auth Service", "Go", "Handles authentication") ContainerDb(redis, "Redis", "Cache", "Sessions & tokens") } Person(user, "User") user -> api : Login request api -> auth : Validate auth -> redis : Store token @enduml
Use consistent templates across your organization:
templates/design-doc-template.mdtemplates/adr-template.mdreference/tech-selection.mdbash# Store docs with code docs/ ├── architecture/ │ ├── ADRs/ │ │ ├── 001-database-selection.md │ │ └── 002-api-authentication.md │ └── diagrams/ │ └── c4-system-context.puml ├── design/ │ └── auth-system-design.md └── rfcs/ └── 2025-01-user-authentication.md
markdown## Requirements Traceability | Requirement | Design Element | Implementation | Tests | |-------------|---------------|----------------|-------| | REQ-001: MFA support | Auth Service TOTP module | `auth/totp.go` | `auth/totp_test.go` | | REQ-002: OAuth login | OAuth provider adapter | `auth/oauth.go` | `auth/oauth_test.go` | | REQ-003: <100ms latency | Redis token cache | `middleware/jwt.go` | `benchmark/auth_bench.go` |
markdown## Document Status - **Proposed**: Initial draft, seeking feedback - **In Review**: Under review by stakeholders - **Approved**: Accepted, ready for implementation - **Implemented**: Fully implemented - **Deprecated**: No longer valid, superseded by ADR-XXX
Before implementation:
After implementation:
markdown❌ Design as justification - Don't write docs after implementation to justify decisions - Write BEFORE to think through design ❌ Too much detail - Don't document every function and variable - Focus on system-level design, not line-by-line code ❌ Spec-first waterfall - Don't spend months on perfect design - Write enough to start, iterate as you learn ❌ Stale documentation - Don't let docs drift from reality - Update or delete outdated docs ❌ No alternatives analysis - Don't present only one solution - Show you considered trade-offs ❌ Missing success criteria - Don't forget to define "done" - Include measurable success metrics
Detailed material starting at ## Quick Reference Card has been moved to reference/extended.md to keep this skill concise. Load that reference when the task requires the moved examples, command catalogs, checklists, platform details, or implementation templates.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | fail→pass | 20,565 | 16,557 | -19% | 1 | 1 | 0% | 3,356 | 5,787 | +72% | 0 | 0 | — |
case-01 | fail→pass | 37,784 | 21,441 | -43% | 1 | 1 | 0% | 6,196 | 6,632 | +7% | 0 | 0 | — |
case-02 | fail→pass | 33,827 | 24,807 | -27% | 1 | 1 | 0% | 5,717 | 7,248 | +27% | 0 | 0 | — |
case-03 | fail→pass | 30,905 | 20,677 | -33% | 1 | 1 | 0% | 4,828 | 6,482 | +34% | 0 | 0 | — |
case-04 | fail→pass | 15,395 | 13,768 | -11% | 1 | 1 | 0% | 2,365 | 5,353 | +126% | 0 | 0 | — |
case-06 | fail→pass | 27,915 | 24,450 | -12% | 1 | 1 | 0% | 4,617 | 6,890 | +49% | 0 | 0 | — |
case-07 | pass→fail | 16,820 | 20,244 | +20% | 1 | 1 | 0% | 2,337 | 6,034 | +158% | 0 | 0 | — |
case-08 | fail→fail | 10,597 | 18,343 | +73% | 1 | 1 | 0% | 1,629 | 6,333 | +289% | 0 | 0 | — |
case-09 | pass→pass | 20,492 | 16,228 | -21% | 1 | 1 | 0% | 3,731 | 5,937 | +59% | 0 | 0 | — |
case-10 | fail→fail | 23,143 | 16,475 | -29% | 1 | 1 | 0% | 3,854 | 5,804 | +51% | 0 | 0 | — |
case-11 | pass→pass | 24,659 | 19,222 | -22% | 1 | 1 | 0% | 4,344 | 6,265 | +44% | 0 | 0 | — |
case-12 | pass→pass | 14,857 | 17,628 | +19% | 1 | 1 | 0% | 2,421 | 5,871 | +143% | 0 | 0 | — |
case-13 | pass→pass | 10,378 | 11,352 | +9% | 1 | 1 | 0% | 1,659 | 4,985 | +200% | 0 | 0 | — |
case-14 | fail→fail | 14,841 | 14,678 | -1% | 1 | 1 | 0% | 2,369 | 5,550 | +134% | 0 | 0 | — |
case-15 | fail→fail | 20,611 | 13,672 | -34% | 1 | 1 | 0% | 3,446 | 5,339 | +55% | 0 | 0 | — |
case-16 | pass→pass | 4,828 | 5,742 | +19% | 1 | 1 | 0% | 660 | 3,936 | +496% | 0 | 0 | — |
case-17 | fail→pass | 29,566 | 20,356 | -31% | 1 | 1 | 0% | 6,173 | 6,662 | +8% | 0 | 0 | — |
case-18 | pass→pass | 10,448 | 19,020 | +82% | 1 | 1 | 0% | 1,841 | 6,568 | +257% | 0 | 0 | — |
case-19 | fail→fail | 18,204 | 17,320 | -5% | 1 | 1 | 0% | 3,391 | 5,915 | +74% | 0 | 0 | — |
case-20 | pass→fail | 15,047 | 22,017 | +46% | 1 | 1 | 0% | 2,949 | 7,505 | +154% | 0 | 0 | — |
case-21 | pass→pass | 11,967 | 14,828 | +24% | 1 | 1 | 0% | 2,029 | 5,471 | +170% | 0 | 0 | — |
case-22 | pass→fail | 19,584 | 19,579 | -0% | 1 | 1 | 0% | 3,236 | 6,359 | +97% | 0 | 0 | — |
case-23 | pass→pass | 22,630 | 30,616 | +35% | 1 | 1 | 0% | 3,493 | 8,069 | +131% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +17 percentage points is the difference between those two pass rates over the 23 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.