agentleFS
fagemxfagemx/edda/.claude/skills/arch-spec/SKILL.md

arch-spec

Skill36 starsChanged 2 months agoApache-2.0View on GitHub

Use when a concept needs a multi-file design dossier (overview, canonical form, schemas, rules, APIs, slices, demo paths) before it's stable enough for project-plan task decomposition. Not for single-file RFCs, ADRs, or already-stable scopes ready for engineering.

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 19 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    You MUST use the TodoWrite tool to track progress: Create the todo list at the START based on the operation:

    line 24
  2. Distinctive:

    Write each spec file

    line 31
  3. Distinctive:

    Read all spec files in directory

    line 38
  4. Distinctive:

    Before ANY operation, read the relevant references:

    line 49
  5. Distinctive:

    Read available project context to understand scope:

    line 79
  6. Distinctive:

    If critical info is missing, ask the user.

    line 92
  7. Very specific:

    Every spec file follows the structure in references/stack-shape.md.

    line 112
  8. Distinctive:

    Every spec MUST have section 2 (what it's NOT).

    line 136
  9. Distinctive:

    When a type appears in 2+ files as a cross-file contract, extract to shared-types.md.

    line 144
  10. Distinctive:

    After extraction, update ALL files to reference instead of redefine.

    line 148
  11. Very specific:

    Use references/review-checklist.md for the complete procedure.

    line 191
  12. Very specific:

    Read every .md file in the directory.

    line 199
  13. Distinctive:

    No type defined in 2+ places (should be in shared-types)

    line 214
  14. Very specific:

    Check against references/promotion-rules.md criteria:

    line 221
  15. Distinctive:

    After completing the check, fix all issues that can be fixed without user input:

    line 230
  16. Distinctive:

    After fixing, list what was fixed in the report.

    line 246
  17. Distinctive:

    Read existing specs + shared-types.md in the target directory

    line 284
  18. Very specific:

    Read references/stack-shape.md for the file template

    line 285
  19. Very specific:

    Read the relevant example from references/examples/

    line 286
  20. Distinctive:

    Add new types to shared-types.md if needed

    line 288
  21. Distinctive:

    Update cross-references in affected existing files

    line 289
  22. Distinctive:

    Run self-check on the new file

    line 290
  23. Distinctive:

    Read ALL spec files in the target directory

    line 296
  24. Distinctive:

    Update ALL files to reference shared-types.md instead of redefining

    line 300
  25. Distinctive:

    Verify no orphan types (defined but never referenced)

    line 301

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Architecture Spec Stack

You are an architecture spec specialist. Your role is to crystallize fuzzy concepts into a stack of interconnected spec files that define WHAT a system is and WHY, before engineering begins.

Arguments

Parse the args parameter using these rules:

  1. Args starts with review → extract path after review (e.g., review docs/world-design-v0 → Review operation on that path)
  2. Args starts with add → extract topic and --to <path> (e.g., add judgment-rules --to docs/world-design-v0)
  3. Args starts with shared-types → extract path (e.g., shared-types docs/world-design-v0)
  4. Args is a topic description → Generate operation (e.g., settlement router for Völva)
  5. Args is empty → ask the user: "What system or concept do you want to spec? And do you want to generate, review, or add?"

Once parsed, hardcode the operation and path in all subsequent steps. Never rely on memory for these values.

Task Tracking (CRITICAL)

You MUST use the TodoWrite tool to track progress. Create the todo list at the START based on the operation:

For Generate:

  1. Read reference files
  2. Gather context and extract core question
  3. Decide stack size (minimal / standard / full)
  4. Choose artifact types
  5. Write each spec file
  6. Extract shared-types (if needed)
  7. Self-check
  8. Present summary

For Review:

  1. Read reference files
  2. Read all spec files in directory
  3. Per-file check
  4. Cross-file check
  5. Fix auto-fixable issues
  6. Promotion status check
  7. Present report (including what was fixed)

Update your todo list after completing each step. Mark as in_progress when starting, completed when done.

Reference Files (CRITICAL)

Before ANY operation, read the relevant references:

# Always read (all operations)
cat .claude/skills/arch-spec/references/when-to-use.md
cat .claude/skills/arch-spec/references/anti-patterns.md
cat .claude/skills/arch-spec/references/gotchas.md

# For Generate operation
cat .claude/skills/arch-spec/references/minimum-stack.md
cat .claude/skills/arch-spec/references/artifact-types.md
cat .claude/skills/arch-spec/references/stack-shape.md
cat .claude/skills/arch-spec/references/examples/README.md

# For Review operation
cat .claude/skills/arch-spec/references/review-checklist.md

# For promotion decisions
cat .claude/skills/arch-spec/references/promotion-rules.md
cat .claude/skills/arch-spec/references/promotion-handoff.md

Then read the relevant example(s) based on what you are producing. See references/examples/README.md for the mapping.


Operation: Generate

Step 1: Gather Context

Read available project context to understand scope:

cat .claude/CLAUDE.md 2>/dev/null
ls docs/ 2>/dev/null

Extract from context or conversation:

  • Core question: What is this system trying to answer?
  • Boundary: What does it NOT do? What is adjacent?
  • First-class nouns: What are the primary entities?
  • Canonical form: What does one cycle / one flow look like?

If critical info is missing, ask the user. Maximum 3 questions.

Step 2: Decide Stack Size

Do NOT default to full stack. Choose based on concept maturity:

ModeWhenFiles
minimalConcept just starting, core cycle unclearoverview + canonical-form + shared-types
standardCore cycle known, needs grounding+ schema + api + demo-path
fullComplete system definition needed+ rules + slice + regimes + handoff

See references/minimum-stack.md for decision criteria.

Step 3: Choose Artifact Types

See references/artifact-types.md for the full menu and decision table.

Step 4: Write Each Spec File

Every spec file follows the structure in references/stack-shape.md. The internal template:

# <topic>.md

> Status: `working draft`
>
> Purpose: <one sentence — what this file answers>
>
> Shared types: see `./shared-types.md` (if applicable)

## 1. One-sentence definition
## 2. What it is NOT / common failure modes
## 3. Core definitions
## 4. Canonical form / flow (ASCII diagram required)
## 5. Schema / types (TypeScript, not prose)
## 6. Position in the overall system
## 7. Canonical examples (minimum 2, concrete JSON/TS)
## 8. Boundaries / out of scope
## Closing statement (quotable one-liner)

Rules:

  • One file, one core question
  • Every spec MUST have section 2 (what it's NOT). No exceptions.
  • TypeScript types, not prose descriptions
  • ASCII diagrams for flows / state machines
  • Structured verdicts ("low" | "medium" | "high"), not numeric scores in v0
  • Reference shared-types.md instead of redefining: // Canonical definition: see ./shared-types.md §X.Y

Step 5: Extract shared-types.md

When a type appears in 2+ files as a cross-file contract, extract to shared-types.md.

Decision is based on concept centrality, not file count. If a type is a core handoff contract between modules, extract it even if only 2 files use it.

After extraction, update ALL files to reference instead of redefine.

Step 6: Self-Check

CheckHow
Every spec answers ONE core questionTitle is a question, not a topic dump
Every spec has "what it's NOT" sectionSection 2 has concrete failure modes
Every type defined in exactly one placeInline (if local) or shared-types (if shared)
No field name conflicts across filesSame concept = same field name everywhere
Canonical examples are concreteActual JSON/TypeScript, not "imagine X"
Boundaries are explicitEach spec states in-scope and out-of-scope
Adjacent specs cross-reference"See X.md" links, no dangling references

Step 7: Output Summary

## Spec Stack Generated

**Location**: `docs/<name>/`
**Mode**: minimal / standard / full
**Files**: X spec files + shared-types.md

| File | Type | Core Question |
|------|------|---------------|
| overview.md | overview | What is this system? |
| ... | ... | ... |

### Cross-References
<which files reference which>

### Known Gaps
<what is intentionally not yet specced>

### Promotion Status
<which specs are stable enough to graduate to project-plan>
See `references/promotion-rules.md` for criteria.

Operation: Review

Use references/review-checklist.md for the complete procedure.

Step 1: Read All Files

ls <spec-directory>/

Read every .md file in the directory.

Step 2: Per-File Check

For each file, verify:

  • Has one-sentence definition (section 1)
  • Has "what it's NOT" section (section 2)
  • Has canonical form / schema with TypeScript types (not prose)
  • Has minimum 2 concrete examples
  • Has explicit boundaries
  • Shared types reference shared-types.md (not redefined inline)

Step 3: Cross-File Check

  • Same concept uses same field name everywhere
  • No type defined in 2+ places (should be in shared-types)
  • Adjacent specs cross-reference each other
  • Canonical form aligns with API routes (if both exist)
  • Demo path covers all major artifacts

Step 4: Promotion Status

Check against references/promotion-rules.md criteria:

  • Names stable (no renames in last 2 discussions)
  • Canonical form exists
  • Canonical slice exists
  • One closure demonstrated
  • shared-types consolidated

Step 5: Fix Auto-Fixable Issues

After completing the check, fix all issues that can be fixed without user input:

Issue TypeAuto-Fix Action
Dangling references to non-existent filesRemove or replace with references to existing files
"Next steps" sections referencing files that now existConvert to "Related files" section with actual links
Type redefined in 2+ files when shared-types existsReplace inline definition with reference to shared-types
Missing cross-references between adjacent specsAdd "see X.md" links
Orphan types in shared-types (defined but never used)Flag in report (don't auto-delete)

Do NOT auto-fix (ask user first):

  • Splitting a god-spec into multiple files
  • Adding missing "what it's NOT" sections (requires domain understanding)
  • Resolving type conflicts where both versions might be intentional
  • Adding canonical examples

After fixing, list what was fixed in the report.

Step 6: Output Report

## Spec Stack Review: <name>

### Auto-Fixed
| # | File | What Was Fixed |
|---|------|---------------|
| 1 | foo.md | Replaced dangling reference to bar.md with link to existing baz.md |

### Per-File Health
| File | Structure | Types | Examples | Boundaries |
|------|-----------|-------|----------|------------|
| overview.md | ok/issue | ok/conflict | ok/missing | ok/vague |

### Cross-File Issues (remaining after auto-fix)
| # | Type | Files | Detail |
|---|------|-------|--------|
| 1 | type conflict | A.md, B.md | fieldX is string in A, number in B |

### Promotion Status
| Criterion | Status |
|-----------|--------|
| Names stable | yes/no |
| Canonical form exists | yes/no |
| Canonical slice exists | yes/no |
| One closure demonstrated | yes/no |

### Verdict
**<HEALTHY / NEEDS FIXES / MAJOR GAPS>** — <one sentence>

Operation: Add

  1. Read existing specs + shared-types.md in the target directory
  2. Read references/stack-shape.md for the file template
  3. Read the relevant example from references/examples/
  4. Generate new spec matching existing style and conventions
  5. Add new types to shared-types.md if needed
  6. Update cross-references in affected existing files
  7. Run self-check on the new file

Operation: Shared Types

  1. Read ALL spec files in the target directory
  2. Find types appearing in 2+ files as cross-file contracts
  3. Find conflicts (same name, different shape)
  4. Generate or update shared-types.md as single source of truth
  5. Update ALL files to reference shared-types.md instead of redefining
  6. Verify no orphan types (defined but never referenced)

Error Handling

SituationAction
Target directory does not existAsk user: create it, or specify correct path?
shared-types.md already exists and conflicts with new specReport conflicts, ask user which version to keep
Spec file is empty or malformedReport as MAJOR GAP in review, skip in cross-file check
User asks for full stack but concept is clearly too earlyRecommend minimal stack, explain why. Proceed only if user insists.
Spec tries to answer 2 questionsSplit into 2 files. Ask user to confirm the split.
Review finds spec doing another spec's jobReport as boundary violation. Recommend which spec should own the logic.

Decision Framework

SituationDecision
Concepts still fuzzyUse arch-spec to crystallize
Concepts clear, need to buildGraduate to project-plan
2+ files share a core typeExtract to shared-types.md
2 systems interactingAdd a handoff contract spec
Spec has no canonical examplesNot done — add examples
Spec answers 2 questionsSplit into 2 files
Names keep changingNot ready for project-plan
Promotion criteria metUse references/promotion-handoff.md to package handoff

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.