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
Constitution Skill
Overview
The Constitution is the architectural DNA of a project, expressed through two shared documents:
| File |
Purpose |
docs/specs/architecture.md |
Technology stack, infrastructure choices, architectural rules, security constraints, AI guardrails |
docs/specs/ontology.md |
Domain glossary (Ubiquitous Language) — terms, definitions, bounded contexts |
These files live at the docs/specs/ level and are shared across all specifications.
Key difference from the old constitution.md approach: instead of a single monolithic file, the constitution is split into two focused documents that are also created and enriched by brainstorm (Phase 6.8.6) and spec-to-tasks (Phase 1.5). This skill lets you create or manage them before brainstorm, as a project setup step.
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"
Available Operations
1. create — Create one or both files interactively
2. update — Update a specific section of one file
3. check — Validate a spec/task/file against both documents
4. show — Display the current state of both documents
Operation: create
Ask the user which files to create (if not specified in $ARGUMENTS):
- Options: "Both architecture.md and ontology.md" (recommended), "architecture.md only", "ontology.md only"
For each file to create, check if it already exists. If yes, ask: overwrite or skip.
For docs/specs/architecture.md, gather via AskUserQuestion:
Q1 — Software Stack:
- Options: "Java / Spring Boot", "TypeScript / NestJS", "TypeScript / React", "Python / Django or FastAPI", "PHP / Laravel or Symfony", or freeform
Q2 — Data Architecture:
- Options: "PostgreSQL", "MySQL", "MongoDB", "Multiple databases", or freeform
Q3 — Infrastructure:
- Options: "AWS", "Docker / Docker Compose", "Kubernetes", "Serverless", "Not yet decided", or freeform
Q4 — Architectural Rules (optional, freeform):
- Forbidden patterns, required patterns, security constraints, AI guardrails
Then create docs/specs/architecture.md using the Architecture Template below.
For docs/specs/ontology.md, gather via AskUserQuestion:
Ask the user to list the main domain terms and their definitions. Explain:
"The ontology captures the Ubiquitous Language of your project. It is normally enriched during brainstorming when terms emerge from the idea. You can seed it now with known terms, or create an empty scaffold to fill later."
- Options: "Seed with known terms (I'll provide them)", "Create empty scaffold", "Skip for now"
Then create docs/specs/ontology.md using the Ontology Template below.
Confirm with the user before writing each file.
Operation: update
- Identify the target file and section from
$ARGUMENTS:
--file=architecture or --file=ontology
--section=<section-name> (e.g., --section=security, --section=glossary)
- Read the target file.
- Apply the update surgically — do not touch other sections.
- Update the
Last Updated date.
- Write the updated file.
Operation: check
- Read both
docs/specs/architecture.md and docs/specs/ontology.md. If either is missing, warn the user but continue with the available file(s).
- Read the target file from
$ARGUMENTS (--target=<path>).
- Check against architecture.md:
- Forbidden libraries/imports present?
- Unapproved patterns used?
- Security constraints violated (raw SQL, hardcoded secrets, etc.)?
- AI guardrails violated?
- Check against ontology.md:
- Are domain terms used consistently (no synonyms for defined terms)?
- Are new domain concepts introduced without being added to the glossary?
- Output a Constitution Check Report (see format below).
Operation: show
- Read
docs/specs/architecture.md and docs/specs/ontology.md.
- Print both files formatted for readability, with a header indicating which file is which.
Architecture Template
# Project Architecture
**Created**: YYYY-MM-DD
**Last Updated**: YYYY-MM-DD
## Software Stack
| Component | Technology | Notes |
|-----------|-----------|-------|
| Language | [e.g., TypeScript] | [version if known] |
| Framework | [e.g., NestJS] | [version if known] |
| Key Libraries | [e.g., Drizzle ORM, Passport] | |
## Data Architecture
| Component | Technology | Notes |
|-----------|-----------|-------|
| Primary Database | [e.g., PostgreSQL] | |
| Caching | [e.g., Redis, none] | |
| ORM / Data Access | [e.g., Drizzle, Hibernate] | |
| Migrations | [e.g., Flyway, Drizzle Kit] | |
## Infrastructure
| Component | Technology | Notes |
|-----------|-----------|-------|
| Hosting | [e.g., AWS ECS] | |
| CI/CD | [e.g., GitHub Actions] | |
| Containerization | [e.g., Docker] | |
| Orchestration | [e.g., Kubernetes, none] | |
## Architectural Rules
- [Rule 1, e.g., "Use constructor injection. Never use @Autowired on fields."]
- [Rule 2, e.g., "Domain entities must not depend on framework annotations."]
## Security Constraints
- Forbidden patterns:
- No raw SQL string concatenation (SQL injection — CWE-89)
- No hardcoded secrets or credentials (CWE-798)
- No deserialization of untrusted data (CWE-502)
- Required patterns:
- [e.g., All inputs validated with Bean Validation]
- [e.g., All secrets via environment variables or Secrets Manager]
## AI Guardrails
Rules that AI agents MUST follow when generating code for this project:
- [Guardrail 1, e.g., "Never generate @Transactional on repository methods."]
- [Guardrail 2, e.g., "Always generate tests alongside implementation code."]
- [Guardrail 3, e.g., "Do not introduce new dependencies without explicit approval."]
## Architecture Decisions
> Significant modifications to this architecture document must be tracked
> via **ADR (Architecture Decision Records)** using the `adr-drafting` skill.
>
> ADR location: `docs/architecture/adr/`
Ontology Template
# Project Ontology — Ubiquitous Language
**Created**: YYYY-MM-DD
**Last Updated**: YYYY-MM-DD
## Domain Glossary
| Term | Definition | Bounded Context |
|------|-----------|-----------------|
| [Term 1] | [Definition] | [Context where this term applies] |
| [Term 2] | [Definition] | [Context where this term applies] |
## Bounded Contexts
| Context | Description | Key Terms |
|---------|-------------|-----------|
| [Context 1] | [Description] | [Key terms] |
## Conceptual Mapping
[Relationships between key domain entities — to be refined during brainstorming and task generation]
Constitution Check Report Format
## Constitution Check Report
Target: <file or spec path>
Date: YYYY-MM-DD
### Architecture Check
| Rule | Status | Detail |
|------|--------|--------|
| Constructor injection required | ✅ OK | No field injection found |
| No hardcoded secrets | ❌ CRITICAL | Line 42: hardcoded password string |
| JWT authentication | ⚠️ WARNING | Missing @PreAuthorize on endpoint |
### Ontology Check
| Term | Status | Detail |
|------|--------|--------|
| "Reservation" used consistently | ✅ OK | No synonym "Booking" found |
| New term "Voucher" introduced | ⚠️ WARNING | Not defined in ontology.md |
### Summary
- CRITICAL violations: 1 (must fix before proceeding)
- WARNING violations: 2 (should fix)
- Compliant rules: 2
Relationship with brainstorm and spec-to-tasks
This skill is the pre-brainstorm setup entry point. The same files are also created/enriched by:
| Command |
When |
What it does |
constitution create |
Before brainstorm (this skill) |
Creates architecture.md and/or ontology.md from scratch |
brainstorm Phase 6.8.6 |
During brainstorming |
Creates/enriches ontology.md with terms extracted from the idea |
spec-to-tasks Phase 1.5 |
After brainstorm |
Creates architecture.md if missing; enriches ontology.md with new terms from the spec |
If you run constitution create before brainstorm, the brainstorm and spec-to-tasks commands will detect the existing files and load them instead of creating new ones — no duplication.
Note on ontology.md: The ontology is normally most naturally created during brainstorming, because domain terms emerge from the idea description. Using constitution create to seed it beforehand is useful when the team already has a well-defined domain language.
Integration with SDD Workflow
[Optional] constitution create ← this skill (pre-brainstorm setup)
↓
brainstorm ← enriches ontology.md (Phase 6.8.6)
↓
spec-to-tasks ← loads/creates architecture.md, enriches ontology.md (Phase 1.5)
↓
task-implementation ← AI guardrails from architecture.md prevent unapproved patterns
↓
task-review / ralph-loop ← constitution check validates implementation
Constraints
- Does NOT modify source code — only creates/updates
docs/specs/architecture.md and docs/specs/ontology.md
- Constitution Check is advisory for WARNINGs — CRITICAL violations must be resolved
- One architecture.md and one ontology.md per project — shared across all specs
- Version the architecture — update
Last Updated date on every change; use ADRs for significant decisions
1---2name: constitution-33description: 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## Instructions
7
81. Identify the operation from `$ARGUMENTS` or user intent: `create`, `update`, `check`, or `show`.
92. 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.
103. For **update**: identify the target file and section, apply the change surgically, update the `Last Updated` date.
114. For **check**: read both constitution files, read the target file, validate against architectural rules and ontology terms, output a Constitution Check Report.
125. For **show**: read and display both files formatted for readability.
136. Always confirm with the user before writing or overwriting files.
14
15## Examples
16
17**Create constitution before first brainstorm:**
18```
19/developer-kit-specs:constitution create
20```
21
22**Validate a spec against architecture and ontology:**
23```
24/developer-kit-specs:constitution check --target=docs/specs/001/2024-01-15--user-auth.md
25```
26
27**Update the security constraints section:**
28```
29/developer-kit-specs:constitution update --file=architecture --section=security
30```
31
32**Show current constitution:**
33```
34/developer-kit-specs:constitution show
35```
36
37---
38
39# Constitution Skill
40
41## Overview
42
43The **Constitution** is the architectural DNA of a project, expressed through two shared documents:
44
45| File | Purpose |
46|------|---------|
47| `docs/specs/architecture.md` | Technology stack, infrastructure choices, architectural rules, security constraints, AI guardrails |
48| `docs/specs/ontology.md` | Domain glossary (Ubiquitous Language) — terms, definitions, bounded contexts |
49
50These files live at the `docs/specs/` level and are **shared across all specifications**.
51
52**Key difference from the old constitution.md approach**: instead of a single monolithic file, the constitution is split into two focused documents that are also created and enriched by `brainstorm` (Phase 6.8.6) and `spec-to-tasks` (Phase 1.5). This skill lets you create or manage them **before brainstorm**, as a project setup step.
53
54## When to Use
55
56| Scenario | Operation |
57|----------|-----------|
58| New project — define stack and domain language before first brainstorm | `create` |
59| Stack or security rules changed | `update` |
60| Validate a spec, task, or file against architecture and ontology | `check` |
61| Review current architecture and ontology | `show` |
62
63**Trigger phrases:**
64- "Create constitution", "Setup project architecture", "Define ontology"
65- "Update constitution", "Update architecture", "Update ontology"
66- "Constitution check", "Validate against constitution"
67- "Show constitution", "Project principles", "Architectural guardrails"
68
69## Available Operations
70
71**1. create** — Create one or both files interactively
72**2. update** — Update a specific section of one file
73**3. check** — Validate a spec/task/file against both documents
74**4. show** — Display the current state of both documents
75
76---
77
78## Operation: create
79
801. Ask the user which files to create (if not specified in `$ARGUMENTS`):
81 - Options: "Both architecture.md and ontology.md" (recommended), "architecture.md only", "ontology.md only"
82
832. For each file to create, check if it already exists. If yes, ask: overwrite or skip.
84
853. **For `docs/specs/architecture.md`**, gather via `AskUserQuestion`:
86
87 **Q1 — Software Stack**:
88 - Options: "Java / Spring Boot", "TypeScript / NestJS", "TypeScript / React", "Python / Django or FastAPI", "PHP / Laravel or Symfony", or freeform
89
90 **Q2 — Data Architecture**:
91 - Options: "PostgreSQL", "MySQL", "MongoDB", "Multiple databases", or freeform
92
93 **Q3 — Infrastructure**:
94 - Options: "AWS", "Docker / Docker Compose", "Kubernetes", "Serverless", "Not yet decided", or freeform
95
96 **Q4 — Architectural Rules** (optional, freeform):
97 - Forbidden patterns, required patterns, security constraints, AI guardrails
98
99 Then create `docs/specs/architecture.md` using the **Architecture Template** below.
100
1014. **For `docs/specs/ontology.md`**, gather via `AskUserQuestion`:
102
103 Ask the user to list the main domain terms and their definitions. Explain:
104 > "The ontology captures the Ubiquitous Language of your project. It is normally enriched during brainstorming when terms emerge from the idea. You can seed it now with known terms, or create an empty scaffold to fill later."
105
106 - Options: "Seed with known terms (I'll provide them)", "Create empty scaffold", "Skip for now"
107
108 Then create `docs/specs/ontology.md` using the **Ontology Template** below.
109
1105. Confirm with the user before writing each file.
111
112---
113
114## Operation: update
115
1161. Identify the target file and section from `$ARGUMENTS`:
117 - `--file=architecture` or `--file=ontology`
118 - `--section=<section-name>` (e.g., `--section=security`, `--section=glossary`)
1192. Read the target file.
1203. Apply the update surgically — do not touch other sections.
1214. Update the `Last Updated` date.
1225. Write the updated file.
123
124---
125
126## Operation: check
127
1281. Read both `docs/specs/architecture.md` and `docs/specs/ontology.md`. If either is missing, warn the user but continue with the available file(s).
1292. Read the target file from `$ARGUMENTS` (`--target=<path>`).
1303. Check against **architecture.md**:
131 - Forbidden libraries/imports present?
132 - Unapproved patterns used?
133 - Security constraints violated (raw SQL, hardcoded secrets, etc.)?
134 - AI guardrails violated?
1354. Check against **ontology.md**:
136 - Are domain terms used consistently (no synonyms for defined terms)?
137 - Are new domain concepts introduced without being added to the glossary?
1385. Output a **Constitution Check Report** (see format below).
139
140---
141
142## Operation: show
143
1441. Read `docs/specs/architecture.md` and `docs/specs/ontology.md`.
1452. Print both files formatted for readability, with a header indicating which file is which.
146
147---
148
149## Architecture Template
150
151```markdown
152# Project Architecture
153
154**Created**: YYYY-MM-DD
155**Last Updated**: YYYY-MM-DD
156
157## Software Stack
158
159| Component | Technology | Notes |
160|-----------|-----------|-------|
161| Language | [e.g., TypeScript] | [version if known] |
162| Framework | [e.g., NestJS] | [version if known] |
163| Key Libraries | [e.g., Drizzle ORM, Passport] | |
164
165## Data Architecture
166
167| Component | Technology | Notes |
168|-----------|-----------|-------|
169| Primary Database | [e.g., PostgreSQL] | |
170| Caching | [e.g., Redis, none] | |
171| ORM / Data Access | [e.g., Drizzle, Hibernate] | |
172| Migrations | [e.g., Flyway, Drizzle Kit] | |
173
174## Infrastructure
175
176| Component | Technology | Notes |
177|-----------|-----------|-------|
178| Hosting | [e.g., AWS ECS] | |
179| CI/CD | [e.g., GitHub Actions] | |
180| Containerization | [e.g., Docker] | |
181| Orchestration | [e.g., Kubernetes, none] | |
182
183## Architectural Rules
184
185- [Rule 1, e.g., "Use constructor injection. Never use @Autowired on fields."]
186- [Rule 2, e.g., "Domain entities must not depend on framework annotations."]
187
188## Security Constraints
189
190- Forbidden patterns:
191 - No raw SQL string concatenation (SQL injection — CWE-89)
192 - No hardcoded secrets or credentials (CWE-798)
193 - No deserialization of untrusted data (CWE-502)
194- Required patterns:
195 - [e.g., All inputs validated with Bean Validation]
196 - [e.g., All secrets via environment variables or Secrets Manager]
197
198## AI Guardrails
199
200Rules that AI agents MUST follow when generating code for this project:
201
202- [Guardrail 1, e.g., "Never generate @Transactional on repository methods."]
203- [Guardrail 2, e.g., "Always generate tests alongside implementation code."]
204- [Guardrail 3, e.g., "Do not introduce new dependencies without explicit approval."]
205
206## Architecture Decisions
207
208> Significant modifications to this architecture document must be tracked
209> via **ADR (Architecture Decision Records)** using the `adr-drafting` skill.
210>
211> ADR location: `docs/architecture/adr/`
212```
213
214---
215
216## Ontology Template
217
218```markdown
219# Project Ontology — Ubiquitous Language
220
221**Created**: YYYY-MM-DD
222**Last Updated**: YYYY-MM-DD
223
224## Domain Glossary
225
226| Term | Definition | Bounded Context |
227|------|-----------|-----------------|
228| [Term 1] | [Definition] | [Context where this term applies] |
229| [Term 2] | [Definition] | [Context where this term applies] |
230
231## Bounded Contexts
232
233| Context | Description | Key Terms |
234|---------|-------------|-----------|
235| [Context 1] | [Description] | [Key terms] |
236
237## Conceptual Mapping
238
239[Relationships between key domain entities — to be refined during brainstorming and task generation]
240```
241
242---
243
244## Constitution Check Report Format
245
246```
247## Constitution Check Report
248Target: <file or spec path>
249Date: YYYY-MM-DD
250
251### Architecture Check
252
253| Rule | Status | Detail |
254|------|--------|--------|
255| Constructor injection required | ✅ OK | No field injection found |
256| No hardcoded secrets | ❌ CRITICAL | Line 42: hardcoded password string |
257| JWT authentication | ⚠️ WARNING | Missing @PreAuthorize on endpoint |
258
259### Ontology Check
260
261| Term | Status | Detail |
262|------|--------|--------|
263| "Reservation" used consistently | ✅ OK | No synonym "Booking" found |
264| New term "Voucher" introduced | ⚠️ WARNING | Not defined in ontology.md |
265
266### Summary
267- CRITICAL violations: 1 (must fix before proceeding)
268- WARNING violations: 2 (should fix)
269- Compliant rules: 2
270```
271
272---
273
274## Relationship with brainstorm and spec-to-tasks
275
276This skill is the **pre-brainstorm setup** entry point. The same files are also created/enriched by:
277
278| Command | When | What it does |
279|---------|------|-------------|
280| `constitution create` | Before brainstorm (this skill) | Creates architecture.md and/or ontology.md from scratch |
281| `brainstorm` Phase 6.8.6 | During brainstorming | Creates/enriches ontology.md with terms extracted from the idea |
282| `spec-to-tasks` Phase 1.5 | After brainstorm | Creates architecture.md if missing; enriches ontology.md with new terms from the spec |
283
284**If you run `constitution create` before brainstorm**, the brainstorm and spec-to-tasks commands will detect the existing files and load them instead of creating new ones — no duplication.
285
286**Note on ontology.md**: The ontology is normally most naturally created during brainstorming, because domain terms emerge from the idea description. Using `constitution create` to seed it beforehand is useful when the team already has a well-defined domain language.
287
288---
289
290## Integration with SDD Workflow
291
292```
293[Optional] constitution create ← this skill (pre-brainstorm setup)
294 ↓
295brainstorm ← enriches ontology.md (Phase 6.8.6)
296 ↓
297spec-to-tasks ← loads/creates architecture.md, enriches ontology.md (Phase 1.5)
298 ↓
299task-implementation ← AI guardrails from architecture.md prevent unapproved patterns
300 ↓
301task-review / ralph-loop ← constitution check validates implementation
302```
303
304---
305
306## Constraints
307
308- **Does NOT modify source code** — only creates/updates `docs/specs/architecture.md` and `docs/specs/ontology.md`
309- **Constitution Check is advisory for WARNINGs** — CRITICAL violations must be resolved
310- **One architecture.md and one ontology.md per project** — shared across all specs
311- **Version the architecture** — update `Last Updated` date on every change; use ADRs for significant decisions