| name | convergence-guardrails |
| description | Define and codify project-level architectural invariants, scope boundaries, and non-negotiable rules. Produces ARCHITECTURE.md โ the persistent constraint file that shapes every AI interaction. Use once per project or when architectural drift is detected. |
Architectural Guardrails
Define the rules that constrain every future code change. AI follows architectural constraints if you write them down โ it won't invent them for you.
The Rule
THE HUMAN DEFINES THE ARCHITECTURE. THE AGENT CODIFIES IT.
This skill produces constraints, not analysis. For analysis, use /convergence-architecture first.
When to Use
- Starting a new project (before any feature work)
- After
/convergence-architecture reveals structural problems
- When architectural drift is detected during review
- When onboarding AI to an existing codebase with established patterns
Process
Step 1 โ Assess Current State
Check for existing architectural artifacts:
cat ARCHITECTURE.md 2>/dev/null
grep -i "architecture\|invariant\|constraint" CLAUDE.md 2>/dev/null
If an architecture analysis exists in docs/convergence/architecture/, read it. If not, do a quick structural scan:
find . -type f -name "*.rb" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.rs" | head -50
Map the codebase to its primary components and their relationships.
Step 2 โ Identify Invariants
Ask the human to define the non-negotiable rules for this codebase. Guide with targeted questions, one at a time:
- Component boundaries โ "Which components should never depend on each other?"
- State ownership โ "Where does state live? What is allowed to mutate it?"
- Data flow direction โ "How should data move between layers? Top-down only?"
- Extension pattern โ "When adding a new [view/endpoint/module], should it require modifying existing ones?"
- Concurrency rules โ "Are there threading or async constraints?" (skip if not applicable)
- Data modeling โ "Should structured data stay typed, or is flattening to strings/arrays acceptable?"
Not every question applies to every project. Skip what's irrelevant. The goal is 3-10 concrete rules, not an exhaustive specification.
Step 3 โ Define Scope Boundaries
Ask the human:
"What is this project NOT? What features or directions are explicitly rejected?"
Record:
- Target users โ who this is for
- Supported scope โ what it does (named, specific)
- Rejected scope โ what it deliberately does NOT do
- Rejection criteria โ how to evaluate future feature requests
Frame as: "Velocity makes everything feel cheap. These boundaries exist because complexity budget is finite even when line budget isn't."
Step 4 โ Draft Rules
Write each invariant as a concrete, enforceable rule. Not vague principles โ specific constraints that can be checked against code.
Good rules:
- "Each view implements the View interface and does NOT access other views' state"
- "All async data arrives via typed message variants on the main loop"
- "Adding a new endpoint MUST NOT require modifying existing endpoint files"
- "Never flatten structured data into positional arrays โ use typed structs"
Bad rules (too vague โ rewrite these):
- "Keep code clean"
- "Follow best practices"
- "Use good architecture"
- "Be careful with state"
Step 5 โ Write ARCHITECTURE.md
Write to ARCHITECTURE.md in the project root.
Format:
# Architecture
## Invariants
Rules that apply to every code change. Violating these requires explicit human approval.
- [Rule 1]
- [Rule 2]
- [Rule 3]
## Component Boundaries
[Which components exist, how they relate, what depends on what]
## Data Flow
[How data moves through the system โ direction, typed vs untyped, sync vs async]
## Scope
### This project IS
[Specific, named scope]
### This project is NOT
[Explicitly rejected directions]
### Feature rejection criteria
[How to evaluate "should we add X?"]
Keep it under 60 lines. This file is loaded by other skills โ bloat costs instruction budget.
Step 6 โ Update CLAUDE.md
Check if CLAUDE.md already references ARCHITECTURE.md. If not, add a single directive:
## Architecture
Read ARCHITECTURE.md before modifying code. Do not violate the invariants defined there without explicit human approval.
Place it near the top of the project-specific CLAUDE.md so it's visible early.
Step 7 โ Human Review
Present the full ARCHITECTURE.md for approval:
"ARCHITECTURE.md written. Review the invariants and scope boundaries โ these will constrain every future code change. Anything to add, remove, or reword?"
Key Principles
- Concrete over vague โ "Each X implements interface Y" beats "use good patterns"
- 3-10 rules โ fewer than 3 isn't constraining enough, more than 10 won't be followed
- Under 60 lines โ this is a constraint file, not a design doc
- The shortest path insight โ AI picks the easiest path from prompt to working code; these rules change which path is easiest
Anti-Patterns
| Bad | Why | Do Instead |
|---|
| Writing rules without asking the human | Agent doesn't know the architecture โ human does | Ask questions, codify answers |
| Vague principles ("keep it clean") | Can't be checked against code | Specific: "X must not depend on Y" |
| 30+ rules | Won't be followed โ instruction budget is finite | Prioritize to 3-10 |
| Skipping scope boundaries | Velocity will expand scope without them | Always define what you're NOT building |
| Never updating | Architecture evolves | Re-run when drift is detected or after major features |
| Putting full architecture docs in CLAUDE.md | Wastes instruction budget on every interaction | ARCHITECTURE.md + one-line reference |