name: architect
description: Design types, interfaces, data flow and module boundaries before implementation, compare two shapes, then write the signatures and get them compiling. Use when the user says "architect", "design the interface", "what should the API look like", "module boundaries", "data model", "schema", "contract", "types first", or when a change crosses several modules or services. Not for screen layout and screenshots (frontend-ui) or splitting work into issues (plan-slices).
metadata:
phase: design
Architect
The shape of a change before its code: types, signatures, data flow and module boundaries, chosen from two sketches and compiling in the real files.
When to use
- A feature adds or changes a public interface, a data model, an API or a boundary between modules or services.
- Several slices or workers will build against the same contract.
- Workarounds keep piling up in the current design.
Not for: screen layout and visual states (frontend-ui), splitting the work (plan-slices), or a one-file change with an obvious shape (just make it, smallest-change).
Steps
- Trace what it touches. Read the entry points, callers, data stores, external APIs, existing types and schemas, ADRs, and the ledger's
DECISIONS.md and GLOSSARY.md. Check any library API you will depend on against its docs for the version in use (step 2 of ../research/SKILL.md). Done when: you have a list of touched modules, entry points and stores, each with a file path.
- Sketch two shapes. For each: the domain types (input and output kept separate), the public signatures, who owns each piece of state, the data flow (a short text or mermaid diagram), and the error semantics. Pick the shape with the smallest interface over the deepest module, one owner per piece of state, one way to do each task, and the least a caller must know. Prefer reusing or deleting what exists (
smallest-change). Done when: both sketches are written and the pick has a one-line why.
- Check the contract. Run the pick through references/interface-checklist.md. Done when: every item is marked pass or not applicable, and each fail has changed the sketch.
- Write types and signatures first. Put the types, interfaces and function signatures in the real files on the change's branch. Leave bodies minimal in the language's usual way; stubs never merge. Derive types from an authoritative schema where one exists. Run the type check or build. Done when: the type check or build command passes, or, in a dynamic language, the modules import and a contract test skeleton runs.
- Record what matters. Record a choice with
decide only if it is hard to reverse, surprising without context, and the result of a real trade-off; add new domain words with term. $LEDGER is ../ledger/scripts/ledger.py from this folder (Claude Code: ${CLAUDE_SKILL_DIR}/../ledger/scripts/ledger.py): python3 -I "$LEDGER" --root <workspace> decide --task <task> --decision '<choice>' --why '<trade-off>' --evidence <design note>. If the repo keeps ADRs, write one there too. Done when: every gated choice is in DECISIONS.md with an evidence path.
- Write the design note. Save it in the repo's design-doc folder if it has one, else in the ledger's
run/design-<slug>.md: the chosen shape, the rejected one and why, the contracts with file paths, the data flow, and open risks. Name the contracts other slices must wait for, so plan-slices can put them in the first wave. Done when: the note exists and lists each contract with its file path.
Red flags
| If you're thinking |
Do this instead |
| "I'll start coding; the shape will emerge." |
Sketch two shapes and write the types first. Reshaping after the code exists costs far more. |
| "There's only one sensible design." |
Write the second sketch anyway. If it is really worse, that takes minutes and you'll know why. |
| "An options bag keeps it flexible for later." |
Expose what callers need now. Every observable behaviour becomes a promise. |
| "I'll validate the input everywhere to be safe." |
Parse at the boundary into typed values; trust the types inside. |
| "All the IDs are strings; that's fine." |
Give IDs that mean different things different types. |
| "One more workaround and it fits." |
Repeated workarounds mean the shape is wrong. Redesign it. |
| "I remember this library's signature." |
Check the docs for the version in use before writing against it. |
| "Every choice belongs in the decision log." |
Only choices that pass the three gates. The design note holds the rest. |
| "This needs a new framework or service." |
Show that reuse, configuration or deletion can't meet the need first. |
Verify
Reply
**Shape:** <one line>, picked over <alternative> because <reason>.
**Contracts:** <file:line> <type or signature>, one per line.
**Compiles:** `<command>` → <result>
**Decisions recorded:** <n> (<titles>)
**Open risks:** <list, or "none">
**Design note:** <path>
**Next:** plan-slices
Credits
Sketching two shapes, one owner per piece of state, "callers know least" and redesigning over patching follow pstack's architect skill and its type-system and boundary-discipline principles by Lauren Tan. Contract first, additive change and consistent error semantics come from api-and-interface-design in addyosmani/agent-skills. Deep modules with small interfaces are John Ousterhout's idea from A Philosophy of Software Design. The three gates for recording a decision adapt Matt Pocock's ADR format (mattpocock/skills).
1---2name: architect3description: Design types, interfaces, data flow and module boundaries before implementation, compare two shapes, then write the signatures and get them compiling. Use when4---5---6name: architect7description: Design types, interfaces, data flow and module boundaries before implementation, compare two shapes, then write the signatures and get them compiling. Use when the user says "architect", "design the interface", "what should the API look like", "module boundaries", "data model", "schema", "contract", "types first", or when a change crosses several modules or services. Not for screen layout and screenshots (frontend-ui) or splitting work into issues (plan-slices).8metadata:9 phase: design10---1112# Architect1314The shape of a change before its code: types, signatures, data flow and module boundaries, chosen from two sketches and compiling in the real files.1516## When to use17- A feature adds or changes a public interface, a data model, an API or a boundary between modules or services.18- Several slices or workers will build against the same contract.19- Workarounds keep piling up in the current design.2021**Not for:** screen layout and visual states (`frontend-ui`), splitting the work (`plan-slices`), or a one-file change with an obvious shape (just make it, `smallest-change`).2223## Steps241. **Trace what it touches.** Read the entry points, callers, data stores, external APIs, existing types and schemas, ADRs, and the ledger's `DECISIONS.md` and `GLOSSARY.md`. Check any library API you will depend on against its docs for the version in use (step 2 of `../research/SKILL.md`). *Done when:* you have a list of touched modules, entry points and stores, each with a file path.252. **Sketch two shapes.** For each: the domain types (input and output kept separate), the public signatures, who owns each piece of state, the data flow (a short text or mermaid diagram), and the error semantics. Pick the shape with the smallest interface over the deepest module, one owner per piece of state, one way to do each task, and the least a caller must know. Prefer reusing or deleting what exists (`smallest-change`). *Done when:* both sketches are written and the pick has a one-line why.263. **Check the contract.** Run the pick through [references/interface-checklist.md](references/interface-checklist.md). *Done when:* every item is marked pass or not applicable, and each fail has changed the sketch.274. **Write types and signatures first.** Put the types, interfaces and function signatures in the real files on the change's branch. Leave bodies minimal in the language's usual way; stubs never merge. Derive types from an authoritative schema where one exists. Run the type check or build. *Done when:* the type check or build command passes, or, in a dynamic language, the modules import and a contract test skeleton runs.285. **Record what matters.** Record a choice with `decide` only if it is hard to reverse, surprising without context, and the result of a real trade-off; add new domain words with `term`. `$LEDGER` is `../ledger/scripts/ledger.py` from this folder (Claude Code: `${CLAUDE_SKILL_DIR}/../ledger/scripts/ledger.py`): `python3 -I "$LEDGER" --root <workspace> decide --task <task> --decision '<choice>' --why '<trade-off>' --evidence <design note>`. If the repo keeps ADRs, write one there too. *Done when:* every gated choice is in `DECISIONS.md` with an evidence path.296. **Write the design note.** Save it in the repo's design-doc folder if it has one, else in the ledger's `run/design-<slug>.md`: the chosen shape, the rejected one and why, the contracts with file paths, the data flow, and open risks. Name the contracts other slices must wait for, so `plan-slices` can put them in the first wave. *Done when:* the note exists and lists each contract with its file path.3031## Red flags32| If you're thinking | Do this instead |33|---|---|34| "I'll start coding; the shape will emerge." | Sketch two shapes and write the types first. Reshaping after the code exists costs far more. |35| "There's only one sensible design." | Write the second sketch anyway. If it is really worse, that takes minutes and you'll know why. |36| "An options bag keeps it flexible for later." | Expose what callers need now. Every observable behaviour becomes a promise. |37| "I'll validate the input everywhere to be safe." | Parse at the boundary into typed values; trust the types inside. |38| "All the IDs are strings; that's fine." | Give IDs that mean different things different types. |39| "One more workaround and it fits." | Repeated workarounds mean the shape is wrong. Redesign it. |40| "I remember this library's signature." | Check the docs for the version in use before writing against it. |41| "Every choice belongs in the decision log." | Only choices that pass the three gates. The design note holds the rest. |42| "This needs a new framework or service." | Show that reuse, configuration or deletion can't meet the need first. |4344## Verify45- [ ] Two shapes were sketched; the pick has a written reason.46- [ ] Every checklist item is pass or not applicable.47- [ ] Types and signatures exist in the real files, and the type check or build passed (command and result recorded).48- [ ] Each piece of state has exactly one owner.49- [ ] Gated choices are in `DECISIONS.md` with evidence; the design note names the contracts.5051## Reply52```53**Shape:** <one line>, picked over <alternative> because <reason>.54**Contracts:** <file:line> <type or signature>, one per line.55**Compiles:** `<command>` → <result>56**Decisions recorded:** <n> (<titles>)57**Open risks:** <list, or "none">58**Design note:** <path>59**Next:** plan-slices60```6162## Credits63Sketching two shapes, one owner per piece of state, "callers know least" and redesigning over patching follow pstack's `architect` skill and its type-system and boundary-discipline principles by Lauren Tan. Contract first, additive change and consistent error semantics come from `api-and-interface-design` in addyosmani/agent-skills. Deep modules with small interfaces are John Ousterhout's idea from *A Philosophy of Software Design*. The three gates for recording a decision adapt Matt Pocock's ADR format (mattpocock/skills).