Version: 1.0
Status: Immutable
Enforcement: Mandatory via constitution-enforcer skill
This document defines the 9 Constitutional Articles that govern all development activities in this project. These articles are immutable and must be enforced at every stage of the SDD workflow.
Enforcement Agent: The constitution-enforcer skill validates compliance with these articles before proceeding to implementation.
Statement: All new features SHALL begin as independent libraries before integration into applications.
- Every feature MUST start as a standalone library
- Libraries MUST have their own test suites
- Libraries MUST be independently deployable
- Libraries MUST NOT depend on application code
- Libraries MAY be published to package registries
- Enforces modularity and reusability
- Prevents tight coupling
- Enables independent testing and versioning
- Facilitates code sharing across projects
- Feature implemented as library in
/libor separate package - Library has independent package.json (if applicable)
- Library has dedicated test suite
- Library exports public API
- No imports from application code
Statement: All libraries SHALL expose functionality through CLI interfaces.
- Every library MUST provide a CLI interface
- CLI MUST expose all primary functionality
- CLI MUST follow consistent argument conventions
- CLI MUST provide help text and usage examples
- CLI MAY delegate to library API
- Enables scriptability and automation
- Facilitates testing and debugging
- Improves developer experience
- Enables integration with CI/CD pipelines
- Library provides CLI entry point (bin/ or scripts/)
- CLI documented with --help flag
- CLI supports common operations
- CLI uses consistent argument patterns (flags, options)
- CLI exit codes follow conventions (0=success, non-zero=error)
Statement: Tests SHALL be written before implementation (Red-Green-Blue cycle).
- Tests MUST be written before production code
- Tests MUST follow Red-Green-Blue cycle:
- Red: Write failing test
- Green: Write minimal code to pass
- Blue: Refactor with confidence
- Tests MUST cover all EARS requirements
- Test coverage MUST exceed 80%
- Integration tests MUST use real services (see Article IX)
- Ensures requirements are testable
- Prevents over-engineering
- Provides executable specifications
- Enables safe refactoring
- Tests exist before implementation
- All EARS requirements have corresponding tests
- Test coverage ≥ 80%
- Tests follow Red-Green-Blue evidence (git history)
- No production code without tests
Statement: All requirements SHALL use EARS (Easy Approach to Requirements Syntax) format.
- Requirements MUST use one of 5 EARS patterns:
- Event-driven:
WHEN [event], the [system] SHALL [response] - State-driven:
WHILE [state], the [system] SHALL [response] - Unwanted behavior:
IF [error], THEN the [system] SHALL [response] - Optional features:
WHERE [feature enabled], the [system] SHALL [response] - Ubiquitous:
The [system] SHALL [requirement]
- Event-driven:
- Requirements MUST be unambiguous
- Requirements MUST include acceptance criteria
- Requirements MUST be traceable to design and tests
- Eliminates ambiguity
- Improves testability
- Enables traceability
- Standardizes requirements format
- All requirements use EARS patterns
- Requirements are unambiguous (single interpretation)
- Acceptance criteria defined
- Requirements mapped to tests (see
traceability-auditor) - Requirements reviewed by stakeholders
Reference: See steering/rules/ears-format.md for complete EARS guide.
Statement: 100% traceability SHALL be maintained between Requirements ↔ Design ↔ Code ↔ Tests.
- Every requirement MUST map to:
- Design decisions (architecture, API, database)
- Implementation (source files, functions)
- Tests (test cases, scenarios)
- Every test MUST reference requirement ID
- Design documents MUST include requirements coverage matrix
- Task breakdowns MUST map to requirements
- Ensures nothing is missed
- Validates completeness
- Enables impact analysis
- Facilitates audits and compliance
- Requirements have unique IDs (REQ-XXX-NNN)
- Design documents include requirements matrix
- Code comments reference requirement IDs
- Tests reference requirement IDs in descriptions
-
traceability-auditorvalidation passes
Enforcement Agent: Use traceability-auditor skill to validate coverage.
Statement: All skills SHALL consult project memory (steering files) before making decisions.
steering/structure.mdMUST define architecture patternssteering/tech.mdMUST define technology stacksteering/product.mdMUST define business context- All skills MUST read steering files before executing
- Steering files MUST be kept up-to-date
- Changes to steering REQUIRE stakeholder approval
- Ensures consistency across skills
- Provides project context to AI agents
- Prevents architectural drift
- Enables autonomous decision-making
- Steering files exist and are current
- Skill reads steering files before execution
- Decisions align with steering context
- Changes to steering are documented
- Steering sync performed regularly
Management Agent: Use steering skill to generate/update project memory.
Statement: Projects SHALL start with maximum 3 sub-projects initially.
- Initial architecture MUST NOT exceed 3 projects
- Projects = independently deployable units
- Additional projects require Phase -1 Gate approval
- Complexity MUST be justified with:
- Business requirements
- Technical constraints
- Team capacity analysis
- Prevents premature complexity
- Reduces coordination overhead
- Enables faster iteration
- Forces prioritization
- Project count ≤ 3 initially
- Each project has clear purpose
- Projects are independently deployable
- Additional projects require approval gate
- Complexity justified in design.md
Phase -1 Gate: Requires system-architect + project-manager approval before exceeding 3 projects.
Statement: Framework features SHALL be used directly without custom abstraction layers.
- MUST use framework APIs directly
- MUST NOT create custom abstractions over frameworks
- MUST NOT build "wrapper libraries" around frameworks
- Abstractions require Phase -1 Gate approval with:
- Multi-framework support justification
- Team expertise analysis
- Migration path documentation
- Prevents over-engineering
- Reduces maintenance burden
- Leverages framework best practices
- Enables framework updates
- Framework APIs used directly in application code
- No custom wrapper libraries around frameworks
- Framework-specific features leveraged
- Abstractions justified with multi-framework need
- Team has framework expertise
Phase -1 Gate: Requires system-architect + software-developer approval for abstraction layers.
Example Violations:
- Creating
MyDatabasewrapper around Prisma/TypeORM - Building custom
HttpClientwrapper around axios/fetch - Implementing custom
Loggerabstraction over framework logging
Valid Abstractions:
- Multi-framework support (e.g., database library supporting Prisma AND TypeORM)
- Domain-specific abstractions (e.g.,
PaymentGatewayinterface with multiple providers)
Statement: Integration tests SHALL use real services; mocks are discouraged.
- Integration tests MUST use real databases, APIs, services
- Test databases MUST be isolated (containers, test schemas)
- External APIs MUST use sandbox/test environments
- Mocks ALLOWED only when:
- External service unavailable in test environment
- External service has usage limits/costs
- External service has no test environment
- Mock usage REQUIRES justification in test documentation
- Tests real system behavior
- Catches integration issues early
- Validates actual service interactions
- Builds confidence in deployment
- Integration tests use real databases (Docker, test schema)
- External APIs use test/sandbox environments
- Mocks justified with unavailability/cost reasons
- Test data cleanup automated
- Tests pass against real services
Tools: Docker Compose, Testcontainers, test database schemas
Phase -1 Gates are validation checkpoints that occur BEFORE implementation begins. They enforce constitutional compliance.
Gates are triggered when:
- Project count exceeds 3 (Article VII)
- Custom abstraction layers proposed (Article VIII)
- EARS requirements incomplete (Article IV)
- Traceability gaps detected (Article V)
- Detection:
constitution-enforcerskill detects violation - Documentation: Proposer documents justification
- Review: Required skills review proposal
- Approval: Stakeholders approve/reject
- Proceed: Implementation continues only after approval
| Gate | Required Skills | Stakeholders |
|---|---|---|
| Simplicity (Article VII) | system-architect, project-manager |
Tech lead, Product owner |
| Anti-Abstraction (Article VIII) | system-architect, software-developer |
Tech lead, Senior engineer |
| EARS Compliance (Article IV) | requirements-analyst |
Product owner, QA lead |
| Traceability (Article V) | traceability-auditor |
QA lead, Compliance officer |
The constitution-enforcer skill automatically validates compliance:
# Validate before implementation
@constitution-enforcer validate requirements.md
@constitution-enforcer validate design.md| Stage | Articles Validated | Trigger |
|---|---|---|
| Requirements | IV, V | Before design |
| Design | I, II, VI, VII, VIII | Before tasks |
| Implementation | III, V | Before commit |
| Testing | III, V, IX | Before deployment |
- Blocker: Implementation MUST NOT proceed
- Documentation: Violation documented in design.md
- Resolution: Either fix violation OR trigger Phase -1 Gate
- Re-validation:
constitution-enforcerre-runs validation
Constitutional articles are IMMUTABLE. Amendments require:
- Unanimous stakeholder agreement
- Documentation of rationale
- Update to this file with version increment
- Update to
constitution-enforcerskill validation logic - Communication to all team members
Version History:
- v1.0 (Initial) - 9 Articles established
| Article | Principle | Enforced By |
|---|---|---|
| I | Library-First | constitution-enforcer |
| II | CLI Interface | constitution-enforcer |
| III | Test-First | constitution-enforcer, test-engineer |
| IV | EARS Format | constitution-enforcer, requirements-analyst |
| V | Traceability | traceability-auditor |
| VI | Project Memory | All skills (steering system) |
| VII | Simplicity Gate | constitution-enforcer (Phase -1) |
| VIII | Anti-Abstraction | constitution-enforcer (Phase -1) |
| IX | Integration Testing | test-engineer |
Powered by MUSUBI - Constitutional governance for specification-driven development.