mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
- Add docs directory with VitePress configuration - Add GitHub Actions workflow for docs build and deploy - Support bilingual (English/Chinese) documentation - Include search, custom theme, and responsive design
2.7 KiB
2.7 KiB
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 Point | Current State | Spec System Solution |
|---|---|---|
| AI ignores standards | CLAUDE.md written but AI ignores it after 5 turns | Hook auto-injection, every session carries specs |
| Standards scattered | Coding conventions in different places, hard to maintain | Unified in .workflow/specs/*.md |
| Context loss | New session requires re-explaining constraints | Spec auto-loads based on task context |
| Inconsistent code | Different developers write different styles | Shared Spec ensures consistency |
vs Traditional Methods
| Dimension | CLAUDE.md | .cursorrules |
Spec System |
|---|---|---|---|
| Injection | Auto-load but easily truncated | Manual load | Hook auto-injection, task-precise loading |
| Granularity | One large file | One large file | Per-module files, combined by task |
| Cross-session memory | None | None | Workflow journal persistence |
| Team sharing | Single person | Single person | Git versioned Spec library |
Core Concepts
| Concept | Description | Location |
|---|---|---|
| Spec File | Markdown document with YAML frontmatter | .workflow/specs/*.md |
| Hook | Script that auto-injects specs into AI context | .claude/hooks/ |
| Spec Index | Registry of all available specs | .workflow/specs/index.yaml |
| Spec Selector | Logic that chooses relevant specs for a task | Built into CCW |
Usage
Creating a Spec
---
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:
- File patterns being edited
- Commands being executed
- Skills being invoked
Configuration
# .workflow/specs/index.yaml
specs:
- name: coding-standards
path: ./coding-standards.md
enabled: true
- name: api-conventions
path: ./api-conventions.md
enabled: true
Related Links
- Memory System - Persistent context
- CLI Call - Command line invocation
- Dashboard - Visual management