Overview
The Constitution skill manages the architectural DNA of a project through two shared documents:
| File |
Purpose |
docs/specs/architecture.md |
Technology stack, infrastructure, architectural rules, security constraints, AI guardrails |
docs/specs/ontology.md |
Domain glossary (Ubiquitous Language) — terms, definitions, bounded contexts |
These files live at docs/specs/ and are shared across all specifications. Unlike a monolithic constitution.md, these are created/enriched by brainstorm (Phase 6.8.6) and spec-to-tasks (Phase 1.5).
Instructions
- Identify the operation from
$ARGUMENTS or user intent: create, update, check, or show.
- For create: ask which files to create (architecture.md, ontology.md, or both), gather required information via
AskUserQuestion, then write the files using the templates below.
- For update: identify the target file and section, apply the change surgically, update the
Last Updated date.
- For check: read both constitution files, read the target file, validate against architectural rules and ontology terms, output a Constitution Check Report.
- For show: read and display both files formatted for readability.
- Always confirm with the user before writing or overwriting files.
Examples
# Create constitution before first brainstorm
/developer-kit-specs:constitution create
# Validate a spec against architecture and ontology
/developer-kit-specs:constitution check --target=docs/specs/001/2024-01-15--user-auth.md
# Update the security constraints section
/developer-kit-specs:constitution update --file=architecture --section=security
# Show current constitution
/developer-kit-specs:constitution show
When to Use
| Scenario |
Operation |
| New project — define stack and domain language before first brainstorm |
create |
| Stack or security rules changed |
update |
| Validate a spec, task, or file against architecture and ontology |
check |
| Review current architecture and ontology |
show |
Trigger phrases:
- "Create constitution", "Setup project architecture", "Define ontology"
- "Update constitution", "Update architecture", "Update ontology"
- "Constitution check", "Validate against constitution"
- "Show constitution", "Project principles", "Architectural guardrails"
Operations
create
- Ask which files to create: "Both" (recommended), "architecture.md only", "ontology.md only"
- Check if files exist → ask to overwrite or skip
- For architecture.md: gather via
AskUserQuestion (domains, infrastructure, stack, data, style, rules)
- For ontology.md: ask for terms or create empty scaffold
- Confirm before writing each file
Template lookup order:
- Primary:
${CLAUDE_PLUGIN_ROOT}/templates/architecture.md
- Fallback:
skills/constitution/references/architecture.md
update
- Parse
--file=architecture|ontology and --section=<name>
- Read target file, apply change surgically
- Update
Last Updated date
- Write file
check
- Read both constitution files
- Read target file (
--target=<path>)
- Validate against architecture rules, security constraints, and ontology
- Output Constitution Check Report
show
- Read both
docs/specs/architecture.md and docs/specs/ontology.md
- Display formatted for readability
Context Rot Prevention
The Constitution survives context rot through file-based storage:
- Read at session start: Both
docs/specs/architecture.md and docs/specs/ontology.md
- Never assume in context: MUST be read from file before implementation
- Validate work: Compare against constitution, not memory
For detailed scenarios and recovery protocols, see references/context-rot-prevention.md.
Constraints and Warnings
- Does NOT modify source code — only creates/updates constitution files
- CRITICAL violations MUST be resolved — WARNINGs are advisory
- One architecture.md and one ontology.md per project — shared across all specs
- Update
Last Updated date on every change
- Use ADRs for significant architectural decisions
- Context rot risk: Files > 30 days old may have drifted
Best Practices
- Create before brainstorm: Constitution established early ensures consistency
- Library Verification: Before using ANY external library, verify it's in the architecture's Library Verification section
- Spec Death Principle: Archive completed specs to
archived/ — never let specs become stale
- Ontology enrichment: Updated by
brainstorm (Phase 6.8.6) and spec-to-tasks (Phase 1.5)
- Report format: Security section first, then CWE compliance, architecture, library verification, ontology
Constitution Check Report Format
## Constitution Check Report
Target: <file path>
Date: YYYY-MM-DD
### Security Check (CWE/OWASP Compliance)
| Rule | Level | Status | Location | CWE/OWASP |
|------|-------|--------|----------|-----------|
| No SQL injection | CRITICAL | ✅ OK | - | CWE-89 |
### CWE Compliance Report
| CWE | OWASP | Status | Location |
|-----|-------|--------|----------|
| CWE-89 | A03 | ✅ OK | - |
### Architecture Check
| Rule | Status | Detail |
|------|--------|--------|
| Constructor injection | ✅ OK | - |
### Library Verification Check
| Library | Status | Detail |
|---------|--------|--------|
| bcrypt | ✅ OK | Using hash(password, 12) |
### Ontology Check
| Term | Status | Detail |
|------|--------|--------|
| "User" used consistently | ✅ OK | - |
### Summary
- CRITICAL violations: 0
- WARNING violations: 0
- Compliant rules: N
For detailed security patterns (CWE/OWASP mappings), see references/security-patterns.md.
Integration with SDD Workflow
[Session Start] → Read Constitution files
↓
[Optional] constitution create ← this skill (pre-brainstorm setup)
↓
brainstorm ← Constitution loaded before brainstorming
↓
spec-to-tasks ← Constitution validates spec
↓
task-implementation ← Constitution guardrails active
↓
task-review ← Constitution check validates
↓
[Session End] → Constitution files updated if needed
Required loading before:
specs.brainstorm — Validate requirements align with architecture
specs.spec-to-tasks — Check stack compatibility
specs.task-implementation — Apply AI guardrails
specs.task-review — Constitution check
Reference Files
| File |
Purpose |
references/architecture.md |
Full architecture template |
references/ontology.md |
Full ontology template |
references/security-patterns.md |
CWE/OWASP patterns, verification format |
references/context-rot-prevention.md |
Detailed scenarios and recovery protocols |
references/constitution-check-report.md |
Complete report examples |
For complete templates and detailed reference material, consult the references/ directory.
1---2name: constitution-43description: Creates, updates, validates, and displays the architectural DNA of a project through two shared documents: docs/specs/architecture.md (technology stack, architectural rules, security constraints, AI guardrails) and docs/specs/ontology.md (domain glossary / Ubiquitous Language). Use BEFORE brainstorm as a project setup step, or at any point in the SDD lifecycle to validate specs/tasks against architecture principles. Triggers on 'create constitution', 'update constitution', 'constitution check', 'validate against constitution', 'project principles', 'architectural guardrails', 'setup project architecture', 'define ontology'.4---5
6## Overview
7
8The Constitution skill manages the architectural DNA of a project through two shared documents:
9
10| File | Purpose |
11|------|---------|
12| `docs/specs/architecture.md` | Technology stack, infrastructure, architectural rules, security constraints, AI guardrails |
13| `docs/specs/ontology.md` | Domain glossary (Ubiquitous Language) — terms, definitions, bounded contexts |
14
15These files live at `docs/specs/` and are shared across all specifications. Unlike a monolithic `constitution.md`, these are created/enriched by `brainstorm` (Phase 6.8.6) and `spec-to-tasks` (Phase 1.5).
16
17## Instructions
18
191. Identify the operation from `$ARGUMENTS` or user intent: `create`, `update`, `check`, or `show`.
202. For **create**: ask which files to create (architecture.md, ontology.md, or both), gather required information via `AskUserQuestion`, then write the files using the templates below.
213. For **update**: identify the target file and section, apply the change surgically, update the `Last Updated` date.
224. For **check**: read both constitution files, read the target file, validate against architectural rules and ontology terms, output a Constitution Check Report.
235. For **show**: read and display both files formatted for readability.
246. Always confirm with the user before writing or overwriting files.
25
26## Examples
27
28```bash
29# Create constitution before first brainstorm
30/developer-kit-specs:constitution create
31
32# Validate a spec against architecture and ontology
33/developer-kit-specs:constitution check --target=docs/specs/001/2024-01-15--user-auth.md
34
35# Update the security constraints section
36/developer-kit-specs:constitution update --file=architecture --section=security
37
38# Show current constitution
39/developer-kit-specs:constitution show
40```
41
42
43## When to Use
44
45| Scenario | Operation |
46|----------|-----------|
47| New project — define stack and domain language before first brainstorm | `create` |
48| Stack or security rules changed | `update` |
49| Validate a spec, task, or file against architecture and ontology | `check` |
50| Review current architecture and ontology | `show` |
51
52**Trigger phrases:**
53- "Create constitution", "Setup project architecture", "Define ontology"
54- "Update constitution", "Update architecture", "Update ontology"
55- "Constitution check", "Validate against constitution"
56- "Show constitution", "Project principles", "Architectural guardrails"
57
58## Operations
59
60### create
611. Ask which files to create: "Both" (recommended), "architecture.md only", "ontology.md only"
622. Check if files exist → ask to overwrite or skip
633. For **architecture.md**: gather via `AskUserQuestion` (domains, infrastructure, stack, data, style, rules)
644. For **ontology.md**: ask for terms or create empty scaffold
655. Confirm before writing each file
66
67Template lookup order:
68- Primary: `${CLAUDE_PLUGIN_ROOT}/templates/architecture.md`
69- Fallback: `skills/constitution/references/architecture.md`
70
71### update
721. Parse `--file=architecture|ontology` and `--section=<name>`
732. Read target file, apply change surgically
743. Update `Last Updated` date
754. Write file
76
77### check
781. Read both constitution files
792. Read target file (`--target=<path>`)
803. Validate against architecture rules, security constraints, and ontology
814. Output **Constitution Check Report**
82
83### show
841. Read both `docs/specs/architecture.md` and `docs/specs/ontology.md`
852. Display formatted for readability
86
87## Context Rot Prevention
88
89The Constitution survives context rot through file-based storage:
90
91- **Read at session start**: Both `docs/specs/architecture.md` and `docs/specs/ontology.md`
92- **Never assume in context**: MUST be read from file before implementation
93- **Validate work**: Compare against constitution, not memory
94
95For detailed scenarios and recovery protocols, see `references/context-rot-prevention.md`.
96
97## Constraints and Warnings
98
99- **Does NOT modify source code** — only creates/updates constitution files
100- **CRITICAL violations MUST be resolved** — WARNINGs are advisory
101- **One architecture.md and one ontology.md per project** — shared across all specs
102- **Update `Last Updated` date** on every change
103- **Use ADRs** for significant architectural decisions
104- **Context rot risk**: Files > 30 days old may have drifted
105
106## Best Practices
107
108- **Create before brainstorm**: Constitution established early ensures consistency
109- **Library Verification**: Before using ANY external library, verify it's in the architecture's Library Verification section
110- **Spec Death Principle**: Archive completed specs to `archived/` — never let specs become stale
111- **Ontology enrichment**: Updated by `brainstorm` (Phase 6.8.6) and `spec-to-tasks` (Phase 1.5)
112- **Report format**: Security section first, then CWE compliance, architecture, library verification, ontology
113
114## Constitution Check Report Format
115
116```
117## Constitution Check Report
118Target: <file path>
119Date: YYYY-MM-DD
120
121### Security Check (CWE/OWASP Compliance)
122| Rule | Level | Status | Location | CWE/OWASP |
123|------|-------|--------|----------|-----------|
124| No SQL injection | CRITICAL | ✅ OK | - | CWE-89 |
125
126### CWE Compliance Report
127| CWE | OWASP | Status | Location |
128|-----|-------|--------|----------|
129| CWE-89 | A03 | ✅ OK | - |
130
131### Architecture Check
132| Rule | Status | Detail |
133|------|--------|--------|
134| Constructor injection | ✅ OK | - |
135
136### Library Verification Check
137| Library | Status | Detail |
138|---------|--------|--------|
139| bcrypt | ✅ OK | Using hash(password, 12) |
140
141### Ontology Check
142| Term | Status | Detail |
143|------|--------|--------|
144| "User" used consistently | ✅ OK | - |
145
146### Summary
147- CRITICAL violations: 0
148- WARNING violations: 0
149- Compliant rules: N
150```
151
152For detailed security patterns (CWE/OWASP mappings), see `references/security-patterns.md`.
153
154## Integration with SDD Workflow
155
156```
157[Session Start] → Read Constitution files
158 ↓
159[Optional] constitution create ← this skill (pre-brainstorm setup)
160 ↓
161brainstorm ← Constitution loaded before brainstorming
162 ↓
163spec-to-tasks ← Constitution validates spec
164 ↓
165task-implementation ← Constitution guardrails active
166 ↓
167task-review ← Constitution check validates
168 ↓
169[Session End] → Constitution files updated if needed
170```
171
172Required loading before:
173- `specs.brainstorm` — Validate requirements align with architecture
174- `specs.spec-to-tasks` — Check stack compatibility
175- `specs.task-implementation` — Apply AI guardrails
176- `specs.task-review` — Constitution check
177
178## Reference Files
179
180| File | Purpose |
181|------|---------|
182| `references/architecture.md` | Full architecture template |
183| `references/ontology.md` | Full ontology template |
184| `references/security-patterns.md` | CWE/OWASP patterns, verification format |
185| `references/context-rot-prevention.md` | Detailed scenarios and recovery protocols |
186| `references/constitution-check-report.md` | Complete report examples |
187
188For complete templates and detailed reference material, consult the `references/` directory.