versioning-constitutions
Use when architectural patterns evolve, tech stack changes, or foundational rules need updates - creates new constitution version directory, migrates/organizes content into modular files, updates symlink, and documents changes
What this skill does
# Versioning Constitutions
## Core Principle
**Constitution versions are immutable snapshots of architectural truth.**
When foundational rules change (patterns, tech stack, architecture), create a new version rather than editing in place. This preserves history, enables rollback, and makes changes explicit.
## When to Use This Skill
**ALWAYS create a new version when:**
- Adding a new mandatory pattern (e.g., adopting effect-ts for error handling)
- **Removing OR relaxing a mandatory pattern** (e.g., making next-safe-action optional)
- Changing tech stack (e.g., migrating from Prisma to Drizzle)
- Updating architectural boundaries (e.g., adding new layer)
- Deprecating rules that are no longer valid
- Major library version changes with breaking patterns (e.g., Next.js 15 → 16)
**CRITICAL:** Removing or relaxing a mandatory pattern ALWAYS requires a new version, even if existing code would still work. "Non-breaking" is not sufficient - any change to mandatory patterns needs versioning for audit trail.
**Do NOT use for:**
- Fixing typos or clarifying existing rules (edit current version directly)
- Adding examples to existing patterns (edit current version directly)
- Project-specific implementation details (those go in specs/)
**Test for Constitutionality:**
Before adding content to constitution, ask: "If we violate this rule, does the architecture break?"
- ✅ Constitutional: "Must use next-safe-action" → violating breaks type safety & validation
- ❌ Not constitutional: "Forms should have wrapper, fields, button" → violating just looks different
**Constitution = Architectural rules. Specs = Implementation patterns.**
## Process
### Step 1: Determine Version Number
Read `docs/constitutions/current/meta.md` to get current version.
**Version increment rules:**
- Increment by 1 (v1 → v2, v2 → v3)
- No semantic versioning (major.minor.patch)
- Sequential only
### Step 2: Create New Version Directory
```bash
# Create new version directory
mkdir -p docs/constitutions/v{N}
# Copy structure from current
cp docs/constitutions/current/*.md docs/constitutions/v{N}/
```
### Step 3: Update Content
Edit files in new version directory with changes:
- `meta.md` - Update version number, date, changelog
- `architecture.md` - Update if architectural boundaries changed
- `patterns.md` - Update if mandatory patterns changed
- `tech-stack.md` - Update if libraries added/removed
- `schema-rules.md` - Update if database philosophy changed
- `testing.md` - Update if testing requirements changed
**Critical - Minimal Changes Only:**
- Only change what NEEDS changing for this version
- NO reorganizing sections ("while I'm here")
- NO reformatting code examples
- NO alphabetizing lists
- NO renaming headings for style
- NO creating new categories unless absolutely required
The diff should show ONLY the substantive change, not stylistic improvements.
### Step 4: Update Symlink
```bash
# Remove old symlink
rm docs/constitutions/current
# Create new symlink pointing to new version
ln -s v{N} docs/constitutions/current
```
### Step 5: Verify References
Check that all references still work:
```bash
# Find all references to constitutions
grep -r "@docs/constitutions/current" .claude/
grep -r "docs/constitutions/current" .claude/
```
All references should use `current/` symlink, never hardcoded versions.
### Step 6: Document in meta.md
**MANDATORY:** Update `meta.md` with complete documentation:
- New version number (e.g., "Version: 2")
- Creation date (e.g., "Created: 2025-01-17")
- Previous version reference (e.g., "Previous: v1")
- **Summary of WHAT changed** (e.g., "Removed Redux prohibition")
- **Rationale for WHY** (e.g., "React Server Components handle all state needs, Redux adds complexity without benefit")
**The WHY is critical.** In 6 months, the context will be lost. Document:
- What problem does this change solve?
- What decision or discussion led to this?
- Why now vs earlier/later?
DO NOT rely on git commit messages or external docs. meta.md must be self-contained.
## Quality Checklist
Before updating symlink:
- [ ] New version directory exists at `docs/constitutions/v{N}/`
- [ ] All 6 files present (meta, architecture, patterns, tech-stack, schema-rules, testing)
- [ ] `meta.md` has correct version number and changelog
- [ ] Changes documented with rationale (why, not just what)
- [ ] Old version remains untouched (immutable)
- [ ] References in commands use `current/` not `v{N}/`
## Common Mistakes
### Mistake 1: Editing Current Version for Breaking Changes
**Wrong:** Edit `docs/constitutions/current/patterns.md` directly when removing next-safe-action requirement
**Right:** Create v2, update patterns.md in v2, update symlink
**Why:** Breaking changes need versioning. Commands/specs may reference old patterns.
### Mistake 2: Hardcoding Version in References
**Wrong:** `@docs/constitutions/v2/architecture.md`
**Right:** `@docs/constitutions/current/architecture.md`
**Why:** When v3 is created, all references break. Symlink abstracts version.
### Mistake 3: Reorganizing for Style
**Wrong:** "Let me alphabetize sections and rename files while versioning"
**Right:** Only change content that needs substantive updates
**Why:** Gratuitous changes obscure what actually changed. Diff should show real changes.
### Mistake 4: Forgetting to Update meta.md
**Wrong:** Copy files, update content, update symlink, done
**Right:** Update meta.md with version, date, and changelog
**Why:** Future you won't remember why version changed. Document the why.
### Mistake 5: Versioning Implementation Details
**Wrong:** Create v2 because we changed button component structure
**Right:** Constitution = foundational rules only. Implementation goes in specs/
**Why:** Constitution is for patterns/architecture/stack, not implementation choices.
### Mistake 6: Rationalizing In-Place Edits
**Wrong:** "This change is non-breaking, so I can edit v1 in-place per the meta.md guidance"
**Right:** Removing/relaxing ANY mandatory pattern requires versioning, even if "non-breaking"
**Why:** Audit trail matters more than technical breaking changes. Future readers need to know WHEN rules changed, not just that they did. Git history is not sufficient - constitution versions create explicit snapshots.
## Quick Reference
```bash
# Check current version
cat docs/constitutions/current/meta.md
# Create new version
mkdir -p docs/constitutions/v{N}
cp docs/constitutions/current/*.md docs/constitutions/v{N}/
# Edit content
# Update meta.md, then other files as needed
# Update symlink
rm docs/constitutions/current
ln -s v{N} docs/constitutions/current
# Verify
ls -la docs/constitutions/current
grep -r "constitutions/v[0-9]" .claude/ # Should return nothing
```
## Example: Adding New Pattern
Scenario: We're adopting `effect-ts` for error handling and deprecating throw/catch.
**Step 1:** Current version is v1 (read meta.md)
**Step 2:** Create v2
```bash
mkdir -p docs/constitutions/v2
cp docs/constitutions/current/*.md docs/constitutions/v2/
```
**Step 3:** Update content
- `meta.md`: Version 2, date, "Added effect-ts error handling pattern"
- `patterns.md`: Add new section on Effect error handling
- `tech-stack.md`: Add effect-ts to approved libraries
- Leave other files unchanged
**Step 4:** Update symlink
```bash
rm docs/constitutions/current
ln -s v2 docs/constitutions/current
```
**Step 5:** Verify references (should all use `current/`)
**Step 6:** meta.md documents why (type-safe error handling, eliminate throw)
## Testing This Skill
See `test-scenarios.md` for pressure scenarios and RED-GREEN-REFACTOR tests.
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.