From the-blueprint
Technical design documents — problem analysis, solution exploration, architectural decisions. Invoke whenever task involves any interaction with design documents — creating, updating, reviewing, comparing options, or capturing architectural decisions.
npx claudepluginhub xobotyi/cc-foundry --plugin the-blueprintThis skill uses the workspace's default tool permissions.
Decision records that explore problems and commit to solutions before implementation. A design document serves three
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Retrieves current documentation, API references, and code examples for libraries, frameworks, SDKs, CLIs, and services via Context7 CLI. Ideal for API syntax, configs, migrations, and setup queries.
Uses ctx7 CLI to fetch current library docs, manage AI coding skills (install/search/generate), and configure Context7 MCP for AI editors.
Decision records that explore problems and commit to solutions before implementation. A design document serves three purposes:
The deliverable must be equally useful to a person reading it and to an agent consuming it to plan implementation.
Write a design doc when 3+ of these apply:
Don't write one when:
Document how the affected system works today:
Verify against source code and configuration — don't rely on secondhand descriptions.
A single option is acceptable when it results from exploration — not when exploration was skipped.
Review cross-cutting concerns relevant to the project:
Not all apply to every document. Include only those relevant to the decision scope.
Before presenting the document:
design-docs/ following the file conventions.When to update:
How to update:
Never silently edit — the update trail shows how thinking evolved.
The template below defines the structural frame. Not every section applies to every document — the level of detail is driven by what needs to be decided. A design document for a focused subsystem may omit sections that don't apply. A design document for a cross-cutting architectural change may need all of them and more.
The required sections are: Problem Statement, Goals, Decision, and Cross-Cutting Concerns. Everything else is included when it serves the decision.
# [Problem/Feature Name]
## Problem Statement
What's broken or needed. Include root cause and impact — not just symptoms.
## Current State
How it works now. Architecture, data flow, limitations, and why it was built this way.
## Goals
- [What this effort must achieve]
## Non-Goals
- [What is deliberately excluded and why]
## Key Insight
(Optional) The realization that shapes the solution space.
## Proposed Solutions
### Option 1: [Name]
[Description]
**Pros:**
- ...
**Cons:**
- ...
### Option 2: [Name]
[Description]
**Pros:**
- ...
**Cons:**
- ...
## Comparison
| Aspect | Option 1 | Option 2 |
|--------|----------|----------|
| ... | ... | ... |
## Decision
Which option was chosen and why. This is a commitment, not a suggestion.
## Cross-Cutting Concerns
Security, privacy, observability, performance, compatibility — as relevant.
## Updates
(Added as document evolves)
### Update (YYYY-MM-DD)
What changed and why.
The document includes whatever analysis is necessary to make the decision defensible. This is not about "high-level vs. low-level" — it's about "decided vs. not yet decided."
Include details when they are the subject of the decision:
Exclude details that belong to implementation, not decision-making:
The test: "Is this detail needed to evaluate whether the decision is correct?" If yes, include it. If it's needed to implement the decision, it belongs in the technical design.
Design documents can reference parent decisions. A parent document may decide the overall direction ("we will build an attribution system"); a child document decides the specifics of a subsystem ("how the attribution engine matches regions").
When writing a child document:
Weak:
Users complain about slow search.
Strong:
Search latency p95 is 3.2s, up from 800ms after the October data migration. Root cause: the new schema lacks a compound index on (tenant_id, created_at), forcing full table scans. Impact: enterprise customers (40% of revenue) report degraded experience; 3 support tickets this week.
The strong version includes: metric, timeline, root cause, and business impact.
# Search Performance Regression
## Problem Statement
Search latency p95 is 3.2s, up from 800ms after the October data migration.
Root cause: the new schema lacks a compound index on (tenant_id, created_at),
forcing full table scans. Impact: enterprise customers (40% of revenue) report
degraded experience; 3 support tickets this week.
## Current State
Search queries hit PostgreSQL directly. The October migration changed the
tenant isolation model from schema-per-tenant to shared table with tenant_id
column. No index was added for the new access pattern.
## Goals
- Restore search p95 to under 1s
- No downtime during fix
## Non-Goals
- Full-text search improvements (separate effort)
- Migrating search to a dedicated search engine
## Proposed Solutions
### Option 1: Add Compound Index
Add (tenant_id, created_at DESC) index. Estimated build time: ~20 min on
production with CONCURRENTLY.
**Pros:** Minimal change, directly addresses root cause, no downtime.
**Cons:** Index adds ~2GB storage, slows writes marginally.
### Option 2: Materialized View
Pre-compute recent results per tenant in a materialized view, refresh on schedule.
**Pros:** Faster reads, could support future search features.
**Cons:** Stale data between refreshes, operational complexity, overkill for this problem.
## Comparison
| Aspect | Compound Index | Materialized View |
|---------------|-------------------|----------------------|
| Complexity | Low | Medium |
| Risk | Low | Medium (staleness) |
| Timeline | Hours | Days |
| Maintenance | None | Refresh scheduling |
## Decision
Compound Index. Directly addresses root cause with minimal risk. The materialized
view adds operational complexity that is not justified for a single query pattern.
We would revisit this decision only if we planned to migrate search to a dedicated
engine within 3 months — in that case, neither option would be worth the investment.
## Cross-Cutting Concerns
- **Performance:** Index build with CONCURRENTLY avoids table locks.
- **Observability:** Add p95 latency alert threshold at 1.5s.
design-docs/ within project directoryNN-short-description.md (e.g., 02-cache-layer-redesign.md)design-docs/completed/ when implementedWhen creating: Follow the workflow steps (1-8) silently. Use the document template, enforce goals/non-goals separation, generate multiple options, produce a comparison, and land on a decision — not a recommendation. Verify completeness (Step 7) before presenting. Do not narrate which rules you are following.
When reviewing or working with an existing design document, evaluate it against every rule below. Report violations explicitly — do not silently accept a non-compliant document.
Violations to check:
NN-short-description.md convention. Report the expected name if it doesn't match.Reporting format: For each violation, state:
Do not present a summary like "overall looks good with minor issues." List every violation. If there are no violations, state that explicitly.
Implementation manuals: Design docs explore WHAT and WHY, not HOW. A doc that reads "this is how we implement it" — with package layouts, function signatures, or pseudocode — without exploring trade-offs is not a design doc. It's a task description wearing a design doc's structure.
This does not mean design docs must stay abstract. A design doc that analyzes data source reliability, defines matching semantics, or specifies validation boundaries is making decisions at the right level. The distinction is: design specificity (analyzing options to make a decision) vs. implementation detail (describing how to code the decision).
Analysis without commitment: A document that presents options and says "we recommend X, but conditions might change" is not a decision record — it's a report. The document must commit. If conditions later change, update the document with a new decision and the rationale for the shift.
Premature completeness: Marking a document complete while it contains "TBD", "open items", or unresolved questions. If you can't decide, the analysis is incomplete — do more research, ask stakeholders, or narrow the scope until you can commit.
When the user approves the design document:
The design document is complete and passes all quality checks. The next step is creating a technical design that maps the decided solution onto the codebase — affected components, tool selection, and sequencing. Would you like to proceed with the technical design?
technical-design skill.Before considering a design doc complete:
NN-short-description.md)