system-architecture
Skill2 starsChanged 34 days agoMITView on GitHub
Produce architecture diagrams and contracts (Mermaid sequence/state diagrams, endpoint contracts, data models) for a PRD and append them to the issue on the tracker. Use between /to-spec and /to-tickets to align on how services communicate before breaking work into tickets.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- hugo082/skillstheir own version, first seen Oct 22, 2026
- viasrijan/crazy-skillstheir own version, first seen Oct 20, 2026
- bingyue/fde-skillstheir own version, first seen Oct 13, 2026
- enekesabel/dev-flowtheir own version, first seen Oct 13, 2026
- ProjAnvil/MindForgetheir own version, first seen Oct 9, 2026
- joelhooks/joelclawtheir own version, first seen Oct 8, 2026
Used with
Projects with it also use test-driven-development.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkilltest-driven-development
Use when implementing any feature or bugfix, before writing implementation code
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- joelhooks/joelclaw★ 65same name
- hieutrtr/ai1-skills★ 8same name
- bingyue/fde-skills★ 5same name
- ProjAnvil/MindForge★ 3same name
- enekesabel/dev-flow★ 2same name
- Jacobinwwey/notemdpro★ 2same name
- augments-labs/sdlc-skills★ 1same name
- hugo082/skills★ 1same name
- viasrijan/crazy-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- implement-loopSkill
- product-reviewSkill
- program-designSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 12 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Read existing architecture: Check if there are existing Mermaid diagrams, endpoint docs, or data models that already describe the area.
- Distinctive: line 42
Not every feature needs all three artifacts.
- Distinctive: line 83
Every participant is a real component, service, or external system (not every function).
- Distinctive: line 87
If the feature has multiple flows (happy path, error path, edge case), use separate diagrams with clear labels.
- Very specific: line 111
Use note blocks only for non-obvious semantics.
- Distinctive: line 112
If the state machine already exists and the feature only adds one transition, use diff notation in comments.
- Distinctive: line 122
PUT /api/resources/:slug Request: { name: string, sourceUrl: string, tags?: string[] } Response: { resource: { id: string, name: string, …
- Distinctive: line 135
Every endpoint that the sequence diagram references MUST have a contract here.
- Very specific: line 137
Use the domain types from CONTEXT.md — if Resource is defined in the glossary, reference it.
- Very specific: line 138
If the existing API follows a documented pattern (all routes return { data } wrapping), follow it.
- Very specific: line 164
Only invariants that can be checked mechanically or by a deterministic test belong here — invariants that need LLM judgment belong in ## …
- Distinctive: line 199
Only include tables/entities that are new or modified — reference existing ones by name.
- Distinctive: line 201
If the schema changes are additive-only (new nullable column), note it.
- Distinctive: line 202
If the schema requires a migration strategy (backfill, dual-write), put it in Notes.
- Very specific: line 211
GitHub: Read the current body with gh issue view <number> --json body, insert the section after ## Implementation Decisions (or before ## …
- Very specific: line 215
Local files: Read the file, insert the section after ## Implementation Decisions, write back.
- Distinctive: line 217
GitLab / Linear: Follow the tracker's convention for updating issue descriptions.
- Distinctive: line 272
Do not proceed to tickets or implementation.
- Very specific: line 279
If the user corrects anything, incorporate the fix and re-append the section (overwrite the previous one).
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
System Architecture
Bridge the gap between product requirements (what the user needs) and program design (the shape of the code). Produce a contract — the shared agreement between services on what they send, receive, and store — before anyone writes code. Align on how services, endpoints, schemas, queues, and stores talk to each other, without getting into implementation details.
$ARGUMENTS is the PRD issue to design. Pass a number, URL, or path.
The issue tracker should have been provided to you — run
/setup-matt-pocock-skills if not.
Process
1. Gather context
- Read the PRD. Fetch it from the tracker. Read the full body, user stories, implementation decisions, testing decisions, and out-of-scope.
- Read the terrain. Explore the codebase: existing services, endpoints,
schemas, data models, and how they currently connect. Read
CONTEXT.mdfor domain vocabulary. Read relevant ADRs indocs/adr/. - Read existing architecture. Check if there are existing Mermaid diagrams, endpoint docs, or data models that already describe the area. If they exist, start from them and show only the diff.
Done when: you have read the PRD body, surveyed the relevant codebase area, read CONTEXT.md terms and ADRs, and identified whether existing diagrams or contracts already describe the area.
2. Classify the architecture type
Not every feature needs all three artifacts. Classify based on the PRD:
| If the PRD touches… | Produce |
| Multiple services / components + API | Sequence diagram + endpoint contracts + data model |
| A stateful workflow (order status, onboarding steps) | State diagram + data model |
| Only data (new field, new table, no new orchestration) | Data model only |
| Only existing patterns (follows existing routes exactly) | Skip — no new architecture needed |
System invariants are produced whenever the PRD introduces state
transitions, a data model, API contracts, or touches domain laws from
CONTEXT.md/ADR — i.e. almost always. They are the properties that must
hold in every reachable state; they are what makes tests effective (a test
suite that doesn't pin the invariants verifies scenarios, not laws).
3. Produce artifacts
For each artifact type that fits, produce a draft. Use CONTEXT.md vocabulary
for all names. Do not write implementation code — only contracts and flows.
Mermaid sequence diagram
Produce when the feature introduces new interactions between services, components, or external systems.
```mermaid
sequenceDiagram
+ = new ~ = modified - = removed
participant API
participant ResourceService
participant Store
UI->>API: PUT /resources/:slug
API->>ResourceService: create(input)
ResourceService->>Store: insert resource
ResourceService-->>UI: 201 resource
```Rules:
- Every participant is a real component, service, or external system (not every function).
- Messages are real operations, not generic "process data".
- Return arrows (
-->>) carry the response; request arrows (->>) carry the payload. - Limit to the scope of THIS feature — existing infrastructure is background, not part of the diagram.
- If the feature has multiple flows (happy path, error path, edge case), use separate diagrams with clear labels.
Mermaid state diagram (stateDiagram-v2)
- = created ~ = modified - = removed Produce when the feature involves a stateful workflow with explicit transitions (order lifecycle, document status, onboarding steps, job pipeline).
```mermaid
stateDiagram-v2
[*] --> Draft
Draft --> Published : publish()
Published --> Archived : archive()
Archived --> [*]
note right of Published
Can be viewed by all users
end note
```Rules:
- States are domain concepts from
CONTEXT.md, not implementation states. - Transitions name the action that triggers them, not the condition.
- Use
noteblocks only for non-obvious semantics. - If the state machine already exists and the feature only adds one transition, use diff notation in comments.
Endpoint contracts
Produce when the feature adds or modifies API endpoints (REST, GraphQL, RPC).
### Endpoint contracts
```text
PUT /api/resources/:slug
Request: { name: string, sourceUrl: string, tags?: string[] }
Response: { resource: { id: string, name: string, sourceUrl: string, tags: string[], createdAt: string } }
Errors: 400 — validation error
409 — slug already exists
GET /api/resources/:slug
Response: { resource: Resource }
Errors: 404 — not found
```Rules:
- Every endpoint that the sequence diagram references MUST have a contract here.
- Include request shape, response shape, and possible errors.
- Use the domain types from
CONTEXT.md— ifResourceis defined in the glossary, reference it. - If the existing API follows a documented pattern (all routes return
{ data }wrapping), follow it.
System invariants
Produce when the feature touches state transitions, data, or API contracts — almost always. An invariant is a property that must be true in every reachable state of the system ("it must always be true that…"), not a scenario. State them in the campaign format: law → negation → where verified.
### System invariants
| Invariant (law) | Negation → test | Verified in |
|---|---|---|
| Every node with depth>0 has a `derived_from` edge | `SELECT … WHERE depth>0 AND NOT EXISTS(edge)` | `tests/invariants/test_provenance.py` |
| `QuotaExceeded` is always 402 with `detail.code` | response != 402 or body without `code` | `tests/test_billing_api.py` |
| Document `failed` ⟺ job `failed` in queue or unresolved dead-letter | mirror drift between the two tables | `tests/unit/test_processing_queue.py` |Rules:
- Law: a sentence in
CONTEXT.mdvocabulary — "it must always be true that…". - Negation: the check that fails when the law breaks — the exact query/assertion, not a paraphrase.
- Where verified: the test file that pins it (or "da scrivere in implement-loop").
- Derive them from the other artifacts: state machine → transition invariants; data model → structural invariants; endpoint contracts → response invariants; domain laws already in ADR/CONTEXT.md → codify them.
- Anti-vacuity: an invariant whose test cannot fail is an opinion. If no test can pin it, mark it
[non verificabile — opinione]instead of pretending. - Only invariants that can be checked mechanically or by a deterministic test belong here — invariants that need LLM judgment belong in
## Testing Decisions.
Data model
Produce when the feature adds or modifies database tables, documents, or persisted entities.
### Data model
```sql
CREATE TABLE resource (
slug TEXT PRIMARY KEY,
name TEXT NOT NULL,
source_url TEXT NOT NULL,
tags TEXT[] NOT NULL DEFAULT '{}',
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
```
Or for non-SQL projects:
```typescript
// Firestore collection: resources
interface Resource {
id: string
name: string
sourceUrl: string
tags: string[]
createdAt: Timestamp
}
```Rules:
- Only include tables/entities that are new or modified — reference existing ones by name.
- Include indexes, constraints, and defaults — these are architecture decisions.
- If the schema changes are additive-only (new nullable column), note it.
- If the schema requires a migration strategy (backfill, dual-write), put it in Notes.
4. Append to the PRD
Append a ## System Architecture section to the PRD body on the tracker,
after the existing ## Implementation Decisions section.
How depends on the tracker:
- GitHub: Read the current body with
gh issue view <number> --json body, insert the section after## Implementation Decisions(or before## Testing Decisionsif that section exists), write back withgh issue edit <number> --body "<full-body>". - Local files: Read the file, insert the section after
## Implementation Decisions, write back. - GitLab / Linear: Follow the tracker's convention for updating issue descriptions.
The appended section uses this structure; omit any artifact type that isn't relevant:
## System Architecture
### Interaction flow
```mermaid
sequenceDiagram
...State machine (if applicable)
stateDiagram-v2
...Endpoint contracts
...Data model
...System invariants
| Invariant (law) | Negation → test | Verified in |
| … | … | … |
Architecture notes
Any non-obvious constraints, migration strategy, integration patterns, or ADR references.
Omit sections that are empty — don't produce "N/A" placeholders.
Then remove the `ready-for-agent` label (if present) and apply `needs-architecture`
(or equivalent — see the tracker's triage labels). The architecture needs review
before tickets are created.
### 5. Stop for review
Do **not** proceed to tickets or implementation. Report what was produced and
ask:
> "The architecture for this PRD is ready. The diagrams and contracts
> describe how the services communicate. Would you like to modify anything
> or proceed with to-tickets?"
If the user corrects anything, incorporate the fix and re-append the section
(overwrite the previous one). Only when they approve does the PRD move back
to `ready-for-agent` — or directly to `to-tickets`.
## How this feeds other skills
| Skill | Effect |
|---|---|
| **to-tickets** | Reads the PRD (now with `## System Architecture`) and creates tickets informed by the endpoint contracts and data model. Each ticket inherits its piece of the architecture. |
| **program-design** | Works one ticket deeper: call-stack tree, file-tree diff, type signatures. The architecture says *which* endpoint, program design says *how*. |
| **implement-loop** | The implement subagent sees the full ticket body — architecture context, `## System Invariants`, and program design signatures. The invariants are test contract: their tests are written first (red), then the implementation (green). |
| `to-spec` | Produces the PRD. System architecture evolves it — adds the `## System Architecture` section. |
| `codebase-design` | Provides vocabulary (deep module, seam). System architecture is a different layer — connections between modules, not depth of one. |
| `domain-modeling` | Uses `CONTEXT.md` vocabulary. If a term is ambiguous during architecture, call `domain-modeling`. |
| `improve-codebase-architecture` | If a structural problem emerges ("this service is too coupled"), note it but don't resolve it here. |
## When to skip
Classify the PRD before producing artifacts. Skip if:
| Type | Reason |
|---|---|
| **Bug fix** | "400 error when X is null" — no new architecture |
| **Trivial feature** | "Add phone field to profile" — follows existing pattern |
| **Data only** | New table, no new endpoints or orchestration — data model only |
**Mechanical refactor** and **follows existing pattern** skip the
diagrams/contracts but NOT the invariant elicitation: if the touched module
has domain laws (documented or new), the `## System Invariants` section must
still be written (possibly reduced — law, negation, where verified); if
there are none, the skip annotation must state "no domain laws" explicitly.
The criteria judge domain value, not diff shape.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

