architect
Sketch the types, signatures and module layout before writing code for non-trivial work. Use when asked to architect or design something, or when coding first would lock in the wrong shape.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- tip
- sketches types, signatures and module structure before any code | architect this | design this | sketch the types | module structure
- card
- Settle the shape before code | 2 | Sketches types, signatures and module structure twice, apart, picks one and grafts the other's best, then lets the code fill in against it. | Reach for it when jumping to code would lock in the wrong shape. Its design is what a brief's `Design:` line names. | op: the operator; model: a crewmate
- name
- architect
- description
- Sketch the types, signatures and module layout before writing code for non-trivial work. Use when asked to architect or design something, or when coding first would lock in the wrong shape.
02 资源文件 6
- 参考文档feature.json161 B
- 参考文档references/design-red-flags.md2.9 KB
- 参考文档references/rationale-template.md3.0 KB
- 参考文档references/runner-prompt.md2.2 KB
- 脚本tests/test_architect_skill.py493 B
- 参考文档verify.md560 B
03 SKILL.md 正文
Architect
Source: pstack, pstack/skills/architect/SKILL.md
Sketch types, function signatures, class shapes, and module boundaries with not implemented bodies and pseudocode. Make the sketch twice, apart, pick and graft one, then fill in code against it.
To run a skill named here, read its file and do what it says: arena never loads by itself. Run this first:
if R=$(realpath ~/.claude/skills/architect/../.. 2> /dev/null) && [ -f "$R/playbooks/arena.md" ]; then
echo "$R"
else
echo "no root: ~/.claude/skills/architect is not a link into the repo this skill lives in"
fi
It prints the root of the repo this skill lives in. Every path below that starts with playbooks/, principles/ or skills/ is from that root, and a path that starts with references/ is beside this file. On no root the skill was loaded from somewhere else: the root is two directories above the real place of this file, not of a link to it.
Start
Open a todo list with one entry per phase before starting. With no todo tool, write the list in this thread.
- Ground
- Sketch
- Agree
- Implement
- Scrap
Phase A: Ground the problem
Build a real mental model of every system the new code touches.
Run the how skill (features/how/SKILL.md) over the relevant subsystems.
Naming a file isn't grounding.
Produce the architectural explanation how prescribes.
If the design redefines ownership or layering, also run the why skill (features/why/SKILL.md) on the existing shape so the rationale becomes a constraint, not a guess.
Skip Phase A only when the work is genuinely greenfield with no surrounding system to integrate.
Phase B: Sketch
Make two candidate designs in this thread, one after the other, then pick one and graft the other's best into it. Copy these steps into the todo list as this phase's entries.
- Frame it.
The prompt is the design-sketch task, the Phase A grounding, and the text below the line
---inreferences/runner-prompt.mdand inreferences/rationale-template.md. The rubric is interface depth (which candidate hides more complexity behind a smaller, simpler public surface) and the flags inreferences/design-red-flags.mdthis task is most likely to raise, six criteria at most. Write both down before either candidate. - Write candidate a to the prompt: its usage and its type sketch, in a scratch worktree,
git worktree add --detach "$(mktemp -d "${TMPDIR:-/tmp}/a.XXXXXX")/a" HEAD. - Write candidate b to the same prompt in a second worktree, a whole other shape and not a point fix inside a's (
principles/principle-exhaust-the-design-space.md). Name what of a's shape it gives up. - Score each against the rubric, criterion by criterion and not on how it feels, and screen each against the other flags.
- Pick the base. Assume the next contributor is an agent that sees only the files it opened, copies the nearest example, and takes the shortest path that compiles. Prefer the design where a change that looks right from one file is right for the whole repo. A rich interface can keep call chains short by concentrating capability instead of scattering it across layers.
- Graft what the other does better, usually one or two things, by hand, so the result still reads as one design (
principles/principle-redesign-from-first-principles.md). - Check it.
A sketch passes when the repo's check command still passes with it in the worktree, its types check where the repo has a type checker, and the usage and the type sketch agree.
A body that says
not implementedis not a failure. Then remove both worktrees,git worktree remove --force <path>.
One writer sees both candidates, so b is apart from a only by the shape it gives up.
Where the shape needs two writers that never see each other, ask for an arena instead, which runs as four threads of their own (features/arena-swarm/skills/arena/playbooks/arena.md).
In a home, that is /arena, and a crewmate or a scout parks a gate whose question is whether to run /arena <the design-sketch task>, with the default that no arena runs, and goes on with its two candidates.
What comes out is one design package. The pick and each graft fill the rationale's "Synthesis decision" section, and the losing candidate goes under "Alternatives considered" with its scores.
Phase C: Agree (opt-in)
Default: proceed directly to implementation with the synthesized design. No human checkpoint.
Opt in to a checkpoint when the invoker explicitly asks: "/architect with checkpoint," "stop and show me before implementing," or similar. Then surface the synthesized design and pause for sign-off.
The synthesis can ship as its own commit either way, the scaffold before the feature (principles/principle-foundational-thinking.md).
Planned and scoped breakage during fill-in is fine (principles/principle-outcome-oriented-execution.md).
For adversarial pressure on the design before implementing, run the interrogate skill (features/skill-library/skills/interrogate/SKILL.md) on the synthesized sketch.
If the human pushes back on the shape (in a checkpoint or after the fact), treat that as Phase A evidence. Re-ground and re-run Phase B before writing more code.
Phase D: Implement against the sketch
Replace not implemented bodies with code, pseudocode with logic. The synthesized sketch is the contract. Deviations from it are signal to surface, not friction to absorb silently. If a function needs a parameter the sketch didn't anticipate, ask whether the sketch was wrong, the requirement was missed, or the implementation is overreaching.
Phase E: Scrap when the architecture is wrong
If implementation keeps producing friction the sketch can't absorb, throw the sketch out. Don't bolt fixes onto a wrong design (principles/principle-redesign-from-first-principles.md, principles/principle-fix-root-causes.md).
The signal is a pattern, not single instances. Tells:
- The same shape of workaround appearing repeatedly across unrelated code.
- Multiple unrelated edge cases that all need special-case branches.
- Types that need escape hatches (
any, casts, optional fields always set in practice) to compile. - The "we need a lock" reflex when the sketch said the state wasn't shared.
- Callers having to know the abstraction's internal rules to use it.
- Two or more independent Phase D deviations of the same shape across the implementation.
Use judgment. A few edge cases don't condemn an architecture. Some problems are legitimately complex. Complexity in the data is not complexity in the design.
When you scrap:
- Re-run the
howskill over what's been built. - Redesign as if the new constraints had been day-one assumptions.
- Subtract before adding (
principles/principle-subtract-before-you-add.md). The new sketch should be smaller than the old one before it grows. - Return to Phase B and sketch again.
Outputs
The caller's usage is written first and the type sketch derived from it. One file with new types and signatures for small changes. Module map plus type definitions for larger work. The rationale ships alongside, shaped per references/rationale-template.md, including the usage sketch and the synthesis decision.
04 同仓库更多 Skills
no-key
A skill its skills.json lists as hidden that a model may still call by itself, kept broken so the lint is seen to catch it.
fake-skill
A FAKE skill in a FAKE tree, named for its folder until the test renames the folder.
extra-key
A skill its skills.json does not list as hidden that a model still cannot call, kept broken so the lint is seen to catch it.
unslop
Cut AI tells from writing. Use when the user says text reads like AI, asks to unslop it, or before prose ships to people.
technical-writing
Write or review docs, READMEs, RFCs, PR descriptions and commit messages to a layered standard: Diataxis structure, Google developer style, STE rules and Global English.
why
Find why code is the way it is, from its history and every evidence source this session can query, with citations. Use for 'why does X work this way', 'why did we pick Y', regressions and postmortems. Use how for runtime behavior.