Documentation
Stabilize your AI-generated code. Define contracts once, generate consistent code across all surfaces, regenerate safely anytime.
Get started
Install ContractSpec and define your first contract in minutes.
Core contracts
Commands, queries, events, and presentations. The building blocks.
Safe regeneration
Golden tests, migrations, signing, and audit trails.
Studio (managed)
Visual builder, deployments, and team collaboration.
Quick start
Add ContractSpec to your project and define your first contract:
# Install the CLI and core libraries
bun add -D contractspec
bun add @contractspec/lib.contracts @contractspec/lib.schema
# Create your first contract
bun contractspec create --type operation
# Generate implementation
bun contractspec build src/contracts/mySpec.tsBrowse all documentation
Use the sidebar or choose a topic to explore spec-first development.
Getting Started
Installation, first contract, and CLI usage
Guides
Runnable adoption scenarios with examples
Intent Pages
SEO-optimized pages for specific developer needs
Ecosystem
Plugin API, templates, and integrations
Core Contracts
Commands, queries, events, presentations, workflows
Safe Regeneration
Signing, migrations, golden tests, compliance
Multi-Surface Output
REST, GraphQL, Prisma, MCP tools, React
Libraries
Core runtime libraries and utilities
AI Governance
Agents, contract enforcement, approval workflows
Architecture
Multi-tenancy, integrations, knowledge sources
Manifesto
Our philosophy: compiler not prison