Skip to content

Spec System

One-Liner

The Spec System is an automatic constraint injection mechanism — Through specification documents defined in YAML frontmatter, relevant constraints are automatically loaded at the start of AI sessions, ensuring AI follows project coding standards and architectural requirements.


Pain Points Solved

Pain PointCurrent StateSpec System Solution
AI ignores standardsCLAUDE.md written but AI ignores it after 5 turnsHook auto-injection, every session carries specs
Standards scatteredCoding conventions in different places, hard to maintainUnified in .workflow/specs/*.md
Context lossNew session requires re-explaining constraintsSpec auto-loads based on task context
Inconsistent codeDifferent developers write different stylesShared Spec ensures consistency

vs Traditional Methods

DimensionCLAUDE.md.cursorrulesSpec System
InjectionAuto-load but easily truncatedManual loadHook auto-injection, task-precise loading
GranularityOne large fileOne large filePer-module files, combined by task
Cross-session memoryNoneNoneWorkflow journal persistence
Team sharingSingle personSingle personGit versioned Spec library

Core Concepts

ConceptDescriptionLocation
Spec FileMarkdown document with YAML frontmatter.workflow/specs/*.md
HookScript that auto-injects specs into AI context.claude/hooks/
Spec IndexRegistry of all available specs.workflow/specs/index.yaml
Spec SelectorLogic that chooses relevant specs for a taskBuilt into CCW

Usage

Creating a Spec

markdown
---
name: coding-standards
description: Project coding standards
triggers:
  - pattern: "**/*.ts"
  - command: "/implement"
  - skill: "code-developer"
applyTo:
  - "src/**"
priority: high
---

# Coding Standards

## TypeScript Guidelines
- Use strict mode
- Prefer interfaces over types
- ...

Spec Loading

Specs are automatically loaded based on:

  1. File patterns being edited
  2. Commands being executed
  3. Skills being invoked

Configuration

yaml
# .workflow/specs/index.yaml
specs:
  - name: coding-standards
    path: ./coding-standards.md
    enabled: true
    
  - name: api-conventions
    path: ./api-conventions.md
    enabled: true

Released under the MIT License.