Skip to main content

Writing Specs

7.1 Spec Directory Structure and Layering

Layering principles:
  • index.md is the entry point, listing all spec files and their status
  • Each file focuses on a single topic, 200-500 lines
  • Each section 20-50 lines
  • Write in English (technical terms are naturally English); Chinese projects may use Chinese

7.2 From Empty Templates to Complete Specs

trellis init generates empty templates marked “(To be filled by the team)”. Here’s how to fill them: Step 1: Extract patterns from actual code
Step 2: Write down your conventions
Step 3: Add code examples

Bad Example

7.3 Good Specs vs Bad Specs

Good specs (specific, with code, with reasoning):
Why: Parameterized queries are automatically escaped by the database driver.
Over-specified specs (too granular, stifles creativity):

7.4 Bootstrap Guided Initial Fill

trellis init automatically creates a bootstrap guide task (00-bootstrap-guidelines). The AI detects it during the first /start and guides you through filling in the blank spec files. During this guided task, the AI analyzes your codebase, extracts existing patterns, and auto-fills spec templates.

7.5 Continuous Spec Evolution

Specs are not written once and forgotten; they evolve continuously with development: Evolution flywheel: