|
37 | 37 |
|
38 | 38 | --- |
39 | 39 |
|
40 | | -## 📋 LeanSpec - Lightweight Specification Management |
| 40 | +## 📋 LeanSpec - Specification Management |
41 | 41 |
|
42 | 42 | **Philosophy**: Lightweight spec methodology for AI-powered development. Clarity over documentation. |
43 | 43 |
|
44 | | -### Core Principles |
| 44 | +### 🚨 CRITICAL: Before ANY Task |
45 | 45 |
|
46 | | -1. **Read README.md first** - Understand project context before starting |
47 | | -2. **Check specs/** - Review existing specs to avoid duplicate work |
48 | | -3. **Keep it minimal** - If it doesn't add clarity, cut it |
49 | | -4. **Stay in sync** - Specs evolve with implementation |
| 46 | +**STOP and check these first:** |
50 | 47 |
|
51 | | -### When to Create a Spec |
52 | | - |
53 | | -**Create specs for:** |
54 | | - |
55 | | -- Features requiring design/planning (>2 days work) |
56 | | -- Features that affect multiple parts of the system |
57 | | -- Architectural decisions affecting multiple components |
58 | | -- Breaking changes or significant refactors |
59 | | -- Design decisions needing team alignment |
60 | | -- Complex features benefiting from upfront thinking |
61 | | - |
62 | | -**Skip specs for:** |
63 | | - |
64 | | -- Bug fixes |
65 | | -- Trivial changes |
66 | | -- Routine maintenance |
67 | | -- Self-explanatory refactors |
68 | | -- Simple one-file changes |
69 | | - |
70 | | -### Discovery |
71 | | - |
72 | | -Before starting work, understand project context: |
73 | | - |
74 | | -```bash |
75 | | -# View work distribution |
76 | | -lean-spec stats |
| 48 | +1. **Discover context** → Use `board` tool to see project state |
| 49 | +2. **Search for related work** → Use `search` tool before creating new specs |
| 50 | +3. **Never create files manually** → Always use `create` tool for new specs |
77 | 51 |
|
78 | | -# See specs by status |
79 | | -lean-spec board |
| 52 | +> **Why?** Skipping discovery creates duplicate work. Manual file creation breaks LeanSpec tooling. |
80 | 53 |
|
81 | | -# Show statistics and velocity |
82 | | -lean-spec stats |
| 54 | +### First Principles (Priority Order) |
83 | 55 |
|
84 | | -# Find specs by tag |
85 | | -lean-spec list --tag=api |
| 56 | +1. **Context Economy** - <2,000 tokens optimal, >3,500 needs splitting |
| 57 | +2. **Signal-to-Noise** - Every word must inform a decision |
| 58 | +3. **Intent Over Implementation** - Capture why, let how emerge |
| 59 | +4. **Bridge the Gap** - Both human and AI must understand |
| 60 | +5. **Progressive Disclosure** - Add complexity only when pain is felt |
86 | 61 |
|
87 | | -# Full-text search |
88 | | -lean-spec search "<query>" |
| 62 | +### When to Create a Spec |
89 | 63 |
|
90 | | -# View a spec |
91 | | -lean-spec view NNN |
| 64 | +| ✅ Write spec | ❌ Skip spec | |
| 65 | +| ------------------------------------------ | -------------------------- | |
| 66 | +| Multi-part features (>2 days work) | Bug fixes | |
| 67 | +| Breaking changes | Trivial changes | |
| 68 | +| Design decisions | Self-explanatory refactors | |
| 69 | +| Architecture affecting multiple components | Simple one-file changes | |
| 70 | + |
| 71 | +### 🔧 Managing Specs |
| 72 | + |
| 73 | +#### MCP Tools (Preferred) with CLI Fallback |
| 74 | + |
| 75 | +| Action | MCP Tool | CLI Fallback | |
| 76 | +| -------------- | -------- | ---------------------------------------------- | |
| 77 | +| Project status | `board` | `lean-spec board` | |
| 78 | +| List specs | `list` | `lean-spec list` | |
| 79 | +| Search specs | `search` | `lean-spec search "query"` | |
| 80 | +| View spec | `view` | `lean-spec view <spec>` | |
| 81 | +| Create spec | `create` | `lean-spec create <name>` | |
| 82 | +| Update spec | `update` | `lean-spec update <spec> --status <status>` | |
| 83 | +| Link specs | `link` | `lean-spec link <spec> --depends-on <other>` | |
| 84 | +| Unlink specs | `unlink` | `lean-spec unlink <spec> --depends-on <other>` | |
| 85 | +| Dependencies | `deps` | `lean-spec deps <spec>` | |
| 86 | +| Token count | `tokens` | `lean-spec tokens <spec>` | |
| 87 | + |
| 88 | +### ⚠️ Core Rules |
| 89 | + |
| 90 | +| Rule | Details | |
| 91 | +| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------- | |
| 92 | +| **NEVER edit frontmatter manually** | Use `update`, `link`, `unlink` for: `status`, `priority`, `tags`, `assignee`, `transitions`, timestamps, `depends_on` | |
| 93 | +| **ALWAYS link spec references** | Content mentions another spec → `lean-spec link <spec> --depends-on <other>` | |
| 94 | +| **Track status transitions** | `planned` → `in-progress` (before coding) → `complete` (after done) | |
| 95 | +| **No nested code blocks** | Use indentation instead | |
| 96 | + |
| 97 | +### 🚫 Common Mistakes |
| 98 | + |
| 99 | +| ❌ Don't | ✅ Do Instead | |
| 100 | +| -------------------------- | ------------------------------------- | |
| 101 | +| Create spec files manually | Use `create` tool | |
| 102 | +| Skip discovery | Run `board` and `search` first | |
| 103 | +| Leave status as "planned" | Update to `in-progress` before coding | |
| 104 | +| Edit frontmatter manually | Use `update` tool | |
| 105 | + |
| 106 | +### 📋 SDD Workflow |
92 | 107 |
|
93 | | -# Check dependencies |
94 | | -lean-spec deps <spec> |
| 108 | +``` |
| 109 | +BEFORE: board → search → check existing specs |
| 110 | +DURING: update status to in-progress → code → document decisions → link dependencies |
| 111 | +AFTER: update status to complete → document learnings |
95 | 112 | ``` |
96 | 113 |
|
97 | | -These commands help you understand what exists, what's in progress, and what depends on what. |
98 | | - |
99 | | -**Core fields:** |
| 114 | +**Status tracks implementation, NOT spec writing.** |
100 | 115 |
|
101 | | -- `status` are required |
102 | | -- `tags` help with discovery and organization |
103 | | -- `priority` helps teams plan work |
| 116 | +### Spec Dependencies |
104 | 117 |
|
105 | | -### Workflow |
| 118 | +Use `depends_on` to express blocking relationships between specs: |
106 | 119 |
|
107 | | -1. **Discover context** - Run `lean-spec stats` or `lean-spec board` to see current state |
108 | | -2. **Search existing specs** - Use `lean-spec search` or `lean-spec list` to find relevant work |
109 | | -3. **Check dependencies** - Run `lean-spec deps <spec>` if working on existing spec |
110 | | -4. **Create or update spec** - Add frontmatter with required fields and helpful metadata |
111 | | -5. **Implement changes** - Keep spec in sync as you learn |
112 | | -6. **Update status** - Mark progress: `planned` → `in-progress` → `complete` |
113 | | -7. **Archive when done** - `lean-spec archive <spec>` moves to archive |
| 120 | +- **`depends_on`** = True blocker, work order matters, directional (A depends on B) |
114 | 121 |
|
115 | | -### Update Commands |
| 122 | +Link dependencies when one spec builds on another: |
116 | 123 |
|
117 | 124 | ```bash |
118 | | -# Update spec status |
119 | | -lean-spec update <spec> --status in-progress |
120 | | - |
121 | | -# Or edit frontmatter directly in the markdown file |
| 125 | +lean-spec link <spec> --depends-on <other-spec> |
122 | 126 | ``` |
123 | 127 |
|
| 128 | +### Token Thresholds |
| 129 | + |
| 130 | +| Tokens | Status | |
| 131 | +| ----------- | --------------------- | |
| 132 | +| <2,000 | ✅ Optimal | |
| 133 | +| 2,000-3,500 | ✅ Good | |
| 134 | +| 3,500-5,000 | ⚠️ Consider splitting | |
| 135 | +| >5,000 | 🔴 Must split | |
| 136 | + |
124 | 137 | ### Quality Standards |
125 | 138 |
|
126 | 139 | - Code is clear and maintainable |
127 | 140 | - Tests cover critical paths |
128 | 141 | - No unnecessary complexity |
129 | 142 | - Documentation where needed (not everywhere) |
130 | 143 | - Specs stay in sync with implementation |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +**Remember:** LeanSpec tracks what you're building. Keep specs in sync with your work! |
0 commit comments