From internal-docs-writer
Write or update architecture documentation — system overview, component diagrams, data flows, bounded contexts, and key decisions. Produces a living document that explains boundaries and why, not implementation details.
npx claudepluginhub hpsgd/turtlestack --plugin internal-docs-writerThis skill is limited to using the following tools:
Write architecture documentation for $ARGUMENTS using the mandatory process and structure below.
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.
Write architecture documentation for $ARGUMENTS using the mandatory process and structure below.
Core principle: Architecture docs explain boundaries, relationships, and decisions — not implementation details. Document WHAT the system is, WHERE data flows, and WHY decisions were made. Leave HOW to the code.
Before writing, build a complete picture:
Grep and GlobOutput: A component inventory with ownership, dependencies, and data stores.
Every architecture doc starts by answering "what problem does this system solve and for whom?"
# Architecture: [System Name]
## Context
### What this system does
[2–3 sentences: the problem it solves and the value it provides. Written for someone who has never seen this system.]
### Who uses it
| Actor | How they interact | What they care about |
|---|---|---|
| [End users] | [Web app, mobile app, API] | [Speed, reliability] |
| [Internal teams] | [Admin dashboard, CLI] | [Observability, control] |
| [External systems] | [Webhooks, API integration] | [Consistency, uptime] |
### System boundary
[One sentence: what is inside this system vs. what is outside (consumed as external dependencies)]
Output: Context section with actors and system boundary.
Document each component with just enough detail to understand its role and boundaries:
## Components
### Component diagram
\`\`\`mermaid
graph TD
Client[Web Client] --> Gateway[API Gateway]
Gateway --> AuthSvc[Auth Service]
Gateway --> OrderSvc[Order Service]
OrderSvc --> OrderDB[(Order DB)]
OrderSvc --> Queue[Event Queue]
Queue --> NotifySvc[Notification Service]
NotifySvc --> Email[Email Provider]
OrderSvc --> InventorySvc[Inventory Service]
InventorySvc --> InventoryDB[(Inventory DB)]
\`\`\`
### [Component name]
| Property | Value |
|---|---|
| **Purpose** | [One sentence — if you need two, it's two components] |
| **Owns** | [Data this component is the source of truth for] |
| **Consumes** | [Other components or external services it depends on] |
| **Exposes** | [API, events, or UI it provides to others] |
| **Scales by** | [Horizontal / vertical / managed — and the key metric] |
| **Fails by** | [What happens when this component is down — who is affected?] |
Rules for components:
Output: Mermaid component diagram and per-component specification tables.
For the 2–3 most critical workflows, trace the full data path:
## Data flows
### [Workflow name, e.g., "Place an order"]
\`\`\`mermaid
sequenceDiagram
participant Client
participant Gateway as API Gateway
participant OrderSvc as Order Service
participant DB as Order DB
participant Queue as Event Queue
participant NotifySvc as Notification Service
Client->>Gateway: POST /orders
Gateway->>OrderSvc: Create order
OrderSvc->>DB: Write order (ACID)
OrderSvc-->>Queue: Publish OrderCreated
OrderSvc->>Gateway: 201 Created
Gateway->>Client: Order confirmation
Queue-->>NotifySvc: Process event
NotifySvc-->>Client: Email confirmation
\`\`\`
| Step | Consistency | Failure handling | Latency budget |
|---|---|---|---|
| Write order | Strong (ACID) | Reject request, return 500 | 50ms |
| Publish event | At-least-once | Retry with backoff, dead-letter after 5 failures | 10ms |
| Send email | Best-effort | Log failure, retry in 1 hour | N/A (async) |
Rules for data flows:
Output: Sequence diagrams with annotated flow tables for key workflows.
## Bounded contexts
| Context | Owns | Communicates via | Boundary type |
|---|---|---|---|
| Orders | Order lifecycle, line items | REST API + events | Service boundary |
| Inventory | Stock levels, reservations | Events (async) | Service boundary |
| Identity | Users, roles, sessions | REST API (sync) | Shared library |
## Key decisions
| Decision | Choice | Rationale | ADR |
|---|---|---|---|
| [What was decided] | [What was chosen] | [One sentence: why] | [Link to ADR or "undocumented — write one"] |
| Message broker | Kafka | Ordering guarantees needed for event sourcing | [ADR-007](./adrs/007-kafka.md) |
| Auth approach | OAuth2 + JWKS | Federation with existing IdP, no session state | [ADR-003](./adrs/003-auth.md) |
Rules for decisions:
/architect:write-adr.Output: Bounded context table and key decisions table with ADR links.
## Non-functional requirements
| Dimension | Target | Current | Measured by |
|---|---|---|---|
| Availability | 99.9% | [current or unknown] | [monitoring tool/dashboard] |
| Latency (p95) | < 200ms reads | [current or unknown] | [APM tool] |
| Throughput | 500 req/s peak | [current or unknown] | [load test results] |
| Recovery | RPO: 1h, RTO: 4h | [current or unknown] | [last DR test date] |
## Known limitations
- [Limitation 1 — what it means for users and what would need to change to fix it]
- [Limitation 2]
Output: NFR table with targets and measurement methods, plus known limitations.
| Check | Requirement |
|---|---|
| Diagrams present | At least one component diagram and one sequence diagram |
| Boundaries clear | Can a reader tell what this system owns vs. what it consumes? |
| Decisions linked | Does every key decision reference an ADR? |
| Failure modes stated | Does every component state what happens when it fails? |
| No implementation details | Does the doc describe boundaries and flows, not code structure? |
| Freshness marker | Is the "last updated" date present? |
/architect:write-adr.Last updated: [date] marker and a Review trigger: [what change should prompt a rewrite] note./internal-docs-writer:write-runbook for operational procedures and /internal-docs-writer:write-changelog for change history.# Architecture: [System Name]
**Last updated:** [date]
**Review trigger:** [what change should prompt an update]
## Context
[What, who, boundary]
## Components
[Mermaid diagram + per-component tables]
## Data Flows
[Sequence diagrams + annotated flow tables]
## Bounded Contexts
[Ownership table]
## Key Decisions
[Decision table with ADR links]
## Non-Functional Requirements
[Target vs current table]
## Known Limitations
[Bulleted list with impact]
## Related Documentation
- [Runbooks](./runbooks/)
- [ADRs](./adrs/)
- [Changelog](./CHANGELOG.md)