tlc-claude-code 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/init.md ADDED
@@ -0,0 +1,219 @@
1
+ # /tlc:init - Initialize TLC in Existing Project
2
+
3
+ Add TLC workflow to an existing codebase. Analyzes what you have, identifies gaps, and offers to write tests for existing code.
4
+
5
+ ## When to Use
6
+
7
+ - You have existing code without tests
8
+ - You have existing code with some tests
9
+ - You're joining a project mid-development
10
+ - You want to adopt TLC on a "vibe coded" project
11
+
12
+ This command will:
13
+ 1. Set up test infrastructure (if missing)
14
+ 2. **Analyze your existing code** to understand what it does
15
+ 3. **Identify untested modules** and critical paths
16
+ 4. **Ask if you want retrospective tests** written for existing code
17
+
18
+ For brand new projects with no code, use `/tlc:new-project` instead.
19
+
20
+ ## Process
21
+
22
+ ### 1. Scan for Existing Code
23
+
24
+ Check for source files:
25
+ - `src/`, `lib/`, `app/`, `pkg/`, or root-level code files
26
+ - `package.json`, `pyproject.toml`, `go.mod`, `Gemfile`, `Cargo.toml`
27
+
28
+ If no code found, suggest running `/tlc:new-project` instead.
29
+
30
+ ### 2. Detect Stack
31
+
32
+ | Indicator | Stack |
33
+ |-----------|-------|
34
+ | `package.json` + React/Next deps | Next.js / React |
35
+ | `package.json` (no framework) | Node.js |
36
+ | `pyproject.toml` / `requirements.txt` | Python |
37
+ | `go.mod` | Go |
38
+ | `Gemfile` | Ruby |
39
+ | `Cargo.toml` | Rust |
40
+
41
+ ### 3. Scan for Existing Tests
42
+
43
+ Look for test indicators:
44
+
45
+ **Directories:**
46
+ - `tests/`, `test/`, `__tests__/`, `spec/`
47
+
48
+ **Files:**
49
+ - `*_test.py`, `test_*.py`
50
+ - `*.test.ts`, `*.test.js`, `*.spec.ts`, `*.spec.js`
51
+ - `*_test.go`
52
+ - `*_spec.rb`
53
+
54
+ **Config files:**
55
+ - `vitest.config.*`, `jest.config.*`, `pytest.ini`, `pyproject.toml` [tool.pytest]
56
+ - `.rspec`, `spec/spec_helper.rb`
57
+
58
+ ### 4. Set Up Test Framework (if missing)
59
+
60
+ If no tests found, set up based on detected stack:
61
+
62
+ | Stack | Framework | Setup |
63
+ |-------|-----------|-------|
64
+ | Next.js / React | Vitest | `npm install -D vitest @testing-library/react` |
65
+ | Node.js | Vitest | `npm install -D vitest` |
66
+ | Python | pytest | `pip install pytest` or add to pyproject.toml |
67
+ | Go | go test | Built-in, no setup needed |
68
+ | Ruby | RSpec | `gem install rspec && rspec --init` |
69
+ | Rust | cargo test | Built-in, no setup needed |
70
+
71
+ Create config file and test directory structure.
72
+
73
+ Add test scripts to package.json / pyproject.toml / Makefile:
74
+ ```json
75
+ "scripts": {
76
+ "test": "vitest run",
77
+ "test:watch": "vitest"
78
+ }
79
+ ```
80
+
81
+ ### 5. If Tests Already Exist
82
+
83
+ - Skip framework setup
84
+ - Note existing test patterns for consistency
85
+ - Report: "Found existing test framework: [vitest/jest/pytest/etc]"
86
+ - Report: "Found X existing test files"
87
+
88
+ ### 6. Analyze Existing Code Structure
89
+
90
+ Scan the codebase and generate summary:
91
+ - Main directories and their purpose
92
+ - Key modules/components identified
93
+ - Entry points (main files, API routes, etc.)
94
+ - Dependencies and their roles
95
+
96
+ ### 7. Identify Untested Code
97
+
98
+ Compare source files against test files to identify:
99
+ - Modules/components with no corresponding tests
100
+ - Key functions that lack test coverage
101
+ - Critical paths (auth, payments, data mutations) without tests
102
+
103
+ Present findings:
104
+ ```
105
+ Code Coverage Analysis:
106
+
107
+ Tested:
108
+ ✓ src/auth/login.ts (tests/auth/login.test.ts)
109
+ ✓ src/utils/format.ts (tests/utils/format.test.ts)
110
+
111
+ Untested:
112
+ ✗ src/api/users.ts - CRUD operations, no tests
113
+ ✗ src/services/payment.ts - payment processing, no tests
114
+ ✗ src/components/Dashboard.tsx - main UI, no tests
115
+
116
+ Critical paths without tests: 2 (auth, payments)
117
+ ```
118
+
119
+ ### 8. Offer Retrospective Test Writing
120
+
121
+ Ask the user:
122
+
123
+ ```
124
+ Would you like to write tests for existing code?
125
+
126
+ 1) Yes - prioritize critical paths first
127
+ 2) Yes - write tests for everything
128
+ 3) No - only use TLC for new features going forward
129
+ ```
130
+
131
+ **If option 1 or 2 selected:**
132
+
133
+ Create `.planning/BACKLOG.md` with test tasks:
134
+
135
+ ```markdown
136
+ # Test Backlog
137
+
138
+ ## Critical (write first)
139
+ - [ ] src/services/payment.ts - payment processing logic
140
+ - [ ] src/api/auth.ts - authentication flows
141
+
142
+ ## High Priority
143
+ - [ ] src/api/users.ts - user CRUD operations
144
+ - [ ] src/middleware/validation.ts - input validation
145
+
146
+ ## Standard
147
+ - [ ] src/utils/helpers.ts - utility functions
148
+ - [ ] src/components/Dashboard.tsx - dashboard rendering
149
+ ```
150
+
151
+ Then ask:
152
+ ```
153
+ Start writing tests now, or save backlog for later?
154
+
155
+ 1) Start now - begin with critical paths
156
+ 2) Later - I'll run /tlc:build backlog when ready
157
+ ```
158
+
159
+ **If "Start now":** Begin writing tests for the first critical path item using Red-Green-Refactor (but code already exists, so focus on capturing current behavior).
160
+
161
+ ### 9. Create or Update PROJECT.md
162
+
163
+ If PROJECT.md doesn't exist, create it with:
164
+
165
+ ```markdown
166
+ # [Project Name]
167
+
168
+ ## Overview
169
+ [Inferred from code structure and README if present]
170
+
171
+ ## Tech Stack
172
+ - [Detected stack]
173
+ - [Key dependencies]
174
+
175
+ ## Project Structure
176
+ [Generated from scan]
177
+
178
+ ## Development Methodology: Test-Led Development
179
+
180
+ This project uses TLC. All new implementation follows Red -> Green -> Refactor:
181
+
182
+ 1. **Red**: Write failing tests that define expected behavior
183
+ 2. **Green**: Write minimum code to make tests pass
184
+ 3. **Refactor**: Clean up while keeping tests green
185
+
186
+ Tests are written BEFORE implementation, not after.
187
+
188
+ ## Test Framework
189
+ - Framework: [detected or installed]
190
+ - Run tests: `[test command]`
191
+ - Test directory: `[path]`
192
+ ```
193
+
194
+ If PROJECT.md exists, append the TLC section only.
195
+
196
+ ### 10. Report Summary
197
+
198
+ ```
199
+ TLC initialized for [project name]
200
+
201
+ Stack: [detected]
202
+ Test framework: [framework] (existing/newly configured)
203
+ Test directory: [path]
204
+ Existing tests: [count] files
205
+ Untested files: [count] identified
206
+
207
+ Next steps:
208
+ - Run /tlc:build backlog to write tests for existing code
209
+ - Run /tlc:discuss to plan new features with TLC
210
+ - Run /tlc:quick for ad-hoc tasks with tests
211
+ ```
212
+
213
+ ## Usage
214
+
215
+ ```
216
+ /tlc:init
217
+ ```
218
+
219
+ No arguments needed. Auto-detects everything.
package/install.sh ADDED
@@ -0,0 +1,65 @@
1
+ #!/bin/bash
2
+ # Install TLC - Test Led Coding for Claude Code
3
+ # Usage: ./install.sh [--global | --local]
4
+
5
+ set -e
6
+
7
+ # Determine install location
8
+ if [[ "$1" == "--global" || "$1" == "-g" ]]; then
9
+ INSTALL_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/commands/tlc"
10
+ echo "Installing globally to $INSTALL_DIR"
11
+ elif [[ "$1" == "--local" || "$1" == "-l" ]]; then
12
+ INSTALL_DIR="./.claude/commands/tlc"
13
+ echo "Installing locally to $INSTALL_DIR"
14
+ else
15
+ echo "TLC - Test Led Coding Installer"
16
+ echo ""
17
+ echo "Where would you like to install?"
18
+ echo " 1) Global (~/.claude/commands/tlc) - available in all projects"
19
+ echo " 2) Local (./.claude/commands/tlc) - this project only"
20
+ echo ""
21
+ read -p "Choice [1/2]: " choice
22
+
23
+ if [[ "$choice" == "2" ]]; then
24
+ INSTALL_DIR="./.claude/commands/tlc"
25
+ else
26
+ INSTALL_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/commands/tlc"
27
+ fi
28
+ fi
29
+
30
+ # Create directory
31
+ mkdir -p "$INSTALL_DIR"
32
+
33
+ # Get script directory
34
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
35
+
36
+ # Copy command files
37
+ cp "$SCRIPT_DIR/tlc.md" "$INSTALL_DIR/" 2>/dev/null || true
38
+ cp "$SCRIPT_DIR/new-project.md" "$INSTALL_DIR/"
39
+ cp "$SCRIPT_DIR/init.md" "$INSTALL_DIR/" 2>/dev/null || true
40
+ cp "$SCRIPT_DIR/coverage.md" "$INSTALL_DIR/" 2>/dev/null || true
41
+ cp "$SCRIPT_DIR/discuss.md" "$INSTALL_DIR/"
42
+ cp "$SCRIPT_DIR/plan.md" "$INSTALL_DIR/"
43
+ cp "$SCRIPT_DIR/build.md" "$INSTALL_DIR/"
44
+ cp "$SCRIPT_DIR/verify.md" "$INSTALL_DIR/"
45
+ cp "$SCRIPT_DIR/status.md" "$INSTALL_DIR/"
46
+ cp "$SCRIPT_DIR/progress.md" "$INSTALL_DIR/"
47
+ cp "$SCRIPT_DIR/complete.md" "$INSTALL_DIR/"
48
+ cp "$SCRIPT_DIR/new-milestone.md" "$INSTALL_DIR/"
49
+ cp "$SCRIPT_DIR/quick.md" "$INSTALL_DIR/"
50
+ cp "$SCRIPT_DIR/help.md" "$INSTALL_DIR/"
51
+
52
+ echo ""
53
+ echo "TLC commands installed to $INSTALL_DIR"
54
+ echo ""
55
+ echo "Restart Claude Code to load new commands."
56
+ echo ""
57
+ echo "Quick Start:"
58
+ echo " /tlc Smart entry point - knows what to do next"
59
+ echo ""
60
+ echo "Or use specific commands:"
61
+ echo " /tlc:new-project Start new project"
62
+ echo " /tlc:init Add TLC to existing code"
63
+ echo " /tlc:coverage Find and fix test gaps"
64
+ echo ""
65
+ echo "Run /tlc:help for full command list."
@@ -0,0 +1,172 @@
1
+ # /tlc:new-milestone - Start Next Version
2
+
3
+ Begin the next milestone after completing the previous one.
4
+
5
+ ## What This Does
6
+
7
+ 1. Gathers requirements for next version
8
+ 2. Creates new roadmap with phases
9
+ 3. Prepares for development
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /tlc:new-milestone [name]
15
+ ```
16
+
17
+ Example:
18
+ ```
19
+ /tlc:new-milestone v2.0
20
+ ```
21
+
22
+ ## Process
23
+
24
+ ### Step 1: Check Previous Milestone
25
+
26
+ Verify previous milestone is complete:
27
+ - All phases verified
28
+ - Git tag exists
29
+ - Files archived
30
+
31
+ If not complete:
32
+ ```
33
+ Previous milestone not complete.
34
+
35
+ Run /tlc:complete first.
36
+ ```
37
+
38
+ ### Step 2: Name the Milestone
39
+
40
+ If not provided:
41
+ ```
42
+ What's the next version?
43
+
44
+ 1) v2.0 (major - breaking changes)
45
+ 2) v1.1 (minor - new features)
46
+ 3) v1.0.1 (patch - bug fixes)
47
+ 4) Custom name
48
+
49
+ >
50
+ ```
51
+
52
+ ### Step 3: Gather Requirements
53
+
54
+ ```
55
+ What's new in {version}?
56
+
57
+ Describe the main goals for this milestone:
58
+ >
59
+ ```
60
+
61
+ Follow-up questions:
62
+ ```
63
+ Any specific features planned?
64
+ -
65
+ -
66
+ -
67
+
68
+ Breaking changes from v1.0?
69
+
70
+ Target timeline?
71
+ ```
72
+
73
+ ### Step 4: Create Roadmap
74
+
75
+ Based on requirements, create phases:
76
+
77
+ ```
78
+ Milestone: v2.0
79
+
80
+ Proposed phases:
81
+
82
+ 1. API v2 - New endpoint structure
83
+ 2. Dashboard Redesign - Updated UI
84
+ 3. Team Features - Multi-user support
85
+ 4. Performance - Caching, optimization
86
+
87
+ Look good? (Y/n/adjust)
88
+ ```
89
+
90
+ ### Step 5: Save Roadmap
91
+
92
+ Create `.planning/ROADMAP.md`:
93
+
94
+ ```markdown
95
+ # Roadmap - v2.0
96
+
97
+ ## Overview
98
+
99
+ {Description of milestone goals}
100
+
101
+ ## Phases
102
+
103
+ ### Phase 1: API v2
104
+ Restructure API endpoints for v2 compatibility.
105
+
106
+ ### Phase 2: Dashboard Redesign
107
+ Update UI with new design system.
108
+
109
+ ### Phase 3: Team Features
110
+ Add multi-user support and permissions.
111
+
112
+ ### Phase 4: Performance
113
+ Implement caching and optimize queries.
114
+
115
+ ## Timeline
116
+
117
+ Target: {date}
118
+
119
+ ## Notes
120
+
121
+ {Any constraints or considerations}
122
+ ```
123
+
124
+ ### Step 6: Update PROJECT.md
125
+
126
+ Add new milestone section:
127
+ ```markdown
128
+ ## Current Milestone: v2.0
129
+
130
+ Goal: {description}
131
+
132
+ Phases: 4
133
+ Status: Not started
134
+ ```
135
+
136
+ ### Step 7: Ready to Build
137
+
138
+ ```
139
+ ✅ Milestone v2.0 created!
140
+
141
+ Roadmap: .planning/ROADMAP.md
142
+ Phases: 4
143
+
144
+ Start with /tlc to begin Phase 1.
145
+ ```
146
+
147
+ ## Example
148
+
149
+ ```
150
+ > /tlc:new-milestone
151
+
152
+ Previous milestone v1.0 complete ✓
153
+
154
+ Version name? > v2.0
155
+
156
+ What's new in v2.0?
157
+ > Adding team features and redesigning the dashboard
158
+
159
+ Breaking changes? > API endpoints will change
160
+
161
+ Proposed phases:
162
+ 1. API v2 - New structure
163
+ 2. Dashboard Redesign
164
+ 3. Team Features
165
+ 4. Migration Tools
166
+
167
+ Proceed? (Y/n) > y
168
+
169
+ ✅ v2.0 roadmap created!
170
+
171
+ Run /tlc to start Phase 1.
172
+ ```
package/new-project.md ADDED
@@ -0,0 +1,259 @@
1
+ # /tlc:new-project - Start a New Project
2
+
3
+ Initialize a new project with test-led development.
4
+
5
+ ## What This Does
6
+
7
+ 1. Gather requirements and context
8
+ 2. Suggest tech stack based on your needs
9
+ 3. Create roadmap
10
+ 4. Set up test infrastructure
11
+
12
+ ## Process
13
+
14
+ ### Step 1: Understand What You're Building
15
+
16
+ Start by understanding the project:
17
+
18
+ **Core purpose:**
19
+ ```
20
+ What are you building? (1-2 sentences)
21
+ ```
22
+
23
+ **Target users:**
24
+ ```
25
+ Who uses this?
26
+
27
+ 1) Just me / internal tool
28
+ 2) Small team (<10 users)
29
+ 3) Startup scale (100-10K users)
30
+ 4) Growth stage (10K-100K users)
31
+ 5) Enterprise / high scale (100K+ users)
32
+ ```
33
+
34
+ **Data characteristics:**
35
+ ```
36
+ What kind of data?
37
+
38
+ 1) Simple CRUD - users, posts, etc.
39
+ 2) Relational - complex relationships, joins
40
+ 3) Document-oriented - flexible schemas
41
+ 4) Time-series - logs, metrics, events
42
+ 5) Graph - relationships are the data
43
+ 6) Minimal / stateless
44
+ ```
45
+
46
+ **Real-time requirements:**
47
+ ```
48
+ Do you need real-time features?
49
+
50
+ 1) No - standard request/response
51
+ 2) Some - notifications, live updates
52
+ 3) Heavy - chat, collaboration, streaming
53
+ ```
54
+
55
+ **Existing constraints:**
56
+ ```
57
+ Any constraints I should know?
58
+
59
+ - Team experience (what languages/tools do you know?)
60
+ - Existing infrastructure (AWS, GCP, on-prem?)
61
+ - Budget considerations
62
+ - Compliance requirements (HIPAA, SOC2, etc.)
63
+ - Timeline pressure
64
+ ```
65
+
66
+ ### Step 2: Suggest Tech Stack
67
+
68
+ Based on answers, suggest appropriate stack:
69
+
70
+ **Example: Internal tool, small team, simple CRUD**
71
+ ```
72
+ Suggested Stack:
73
+
74
+ | Component | Recommendation | Why |
75
+ |-----------|----------------|-----|
76
+ | Language | TypeScript | Type safety, good tooling |
77
+ | Framework | Next.js | Full-stack, fast to build |
78
+ | Database | SQLite or Postgres | Simple, reliable |
79
+ | Architecture | Monolith | No need for complexity |
80
+ | Hosting | Vercel or Railway | Easy deploy, free tier |
81
+
82
+ Alternatives to consider:
83
+ - Python + FastAPI if more comfortable with Python
84
+ - Supabase if you want auth + DB bundled
85
+ ```
86
+
87
+ **Example: Growth stage SaaS, real-time, complex data**
88
+ ```
89
+ Suggested Stack:
90
+
91
+ | Component | Recommendation | Why |
92
+ |-----------|----------------|-----|
93
+ | Language | TypeScript | Type safety at scale |
94
+ | Framework | Next.js + tRPC | Type-safe API layer |
95
+ | Database | PostgreSQL | Reliable, scalable |
96
+ | Cache | Redis | Sessions, real-time |
97
+ | Architecture | Modular monolith | Scale when needed |
98
+ | Hosting | Docker + K8s ready | Portable, scalable |
99
+
100
+ Alternatives to consider:
101
+ - Go if performance is critical
102
+ - Microservices if team is large enough
103
+ ```
104
+
105
+ **Example: High-performance API, minimal latency**
106
+ ```
107
+ Suggested Stack:
108
+
109
+ | Component | Recommendation | Why |
110
+ |-----------|----------------|-----|
111
+ | Language | Go or Rust | Performance, efficiency |
112
+ | Framework | stdlib or Axum | Minimal overhead |
113
+ | Database | PostgreSQL + Redis | Speed + reliability |
114
+ | Architecture | Microservices | Scale independently |
115
+ | Hosting | Kubernetes | Production-grade |
116
+ ```
117
+
118
+ ### Step 3: Confirm or Adjust
119
+
120
+ ```
121
+ Does this stack work for you?
122
+
123
+ 1) Yes, proceed with this
124
+ 2) I'd prefer [language] instead
125
+ 3) Let's discuss alternatives
126
+ ```
127
+
128
+ Allow user to override any decision with rationale captured.
129
+
130
+ ### Step 4: Record Decisions
131
+
132
+ Create PROJECT.md with tech decisions:
133
+
134
+ ```markdown
135
+ # Project Name
136
+
137
+ ## Overview
138
+ [From step 1 discussion]
139
+
140
+ ## Tech Stack
141
+
142
+ | Decision | Choice | Rationale |
143
+ |----------|--------|-----------|
144
+ | Language | TypeScript | Team familiarity |
145
+ | Framework | Next.js | Full-stack, good DX |
146
+ | Database | PostgreSQL | Relational data needs |
147
+ | Architecture | Modular monolith | Start simple |
148
+ | Hosting | Docker + Railway | Easy CI/CD |
149
+
150
+ ## Constraints
151
+ - Timeline: MVP in 4 weeks
152
+ - Team: Solo developer
153
+ - Budget: Minimal hosting costs
154
+ ```
155
+
156
+ ### Step 5: Create Roadmap
157
+
158
+ Based on the project scope, break into phases:
159
+
160
+ **Phase breakdown approach:**
161
+ - Each phase = one coherent feature or component
162
+ - Phase should be completable in focused work
163
+ - Phase has clear "done" criteria
164
+
165
+ **Example phases for a SaaS app:**
166
+ ```
167
+ Phase 1: Project Setup
168
+ - Initialize repo, dependencies
169
+ - Set up test framework
170
+ - Create base configuration
171
+
172
+ Phase 2: Authentication
173
+ - User registration
174
+ - Login/logout
175
+ - Session management
176
+
177
+ Phase 3: Core Feature
178
+ - Main functionality
179
+ - Data models
180
+ - API endpoints
181
+
182
+ Phase 4: User Dashboard
183
+ - UI components
184
+ - Data display
185
+ - User settings
186
+ ```
187
+
188
+ Create `.planning/ROADMAP.md`:
189
+
190
+ ```markdown
191
+ # Roadmap - v1.0
192
+
193
+ ## Overview
194
+ {From project discussion}
195
+
196
+ ## Phases
197
+
198
+ ### Phase 1: Project Setup
199
+ Initialize project with chosen stack and test infrastructure.
200
+
201
+ ### Phase 2: Authentication
202
+ User registration, login, and session management.
203
+
204
+ ### Phase 3: {Core Feature}
205
+ {Description based on project goals}
206
+
207
+ ### Phase 4: {Next Feature}
208
+ {Description}
209
+
210
+ ## Milestone
211
+ Target: v1.0 MVP
212
+ ```
213
+
214
+ ### Step 6: Append TLC Conventions
215
+
216
+ ```markdown
217
+ ## Development Methodology: Test-Led Development
218
+
219
+ This project uses TLC. All implementation follows Red → Green → Refactor:
220
+
221
+ 1. **Red**: Write failing tests that define expected behavior
222
+ 2. **Green**: Write minimum code to make tests pass
223
+ 3. **Refactor**: Clean up while keeping tests green
224
+
225
+ Tests are written BEFORE implementation, not after.
226
+
227
+ ## Test Framework
228
+ - [Framework based on stack]
229
+ - Run: `npm test` / `pytest` / `go test`
230
+ ```
231
+
232
+ ### Step 7: Set Up Project Structure
233
+
234
+ Scaffold based on chosen stack:
235
+
236
+ ```
237
+ project/
238
+ ├── src/
239
+ ├── tests/
240
+ ├── .env.example
241
+ ├── docker-compose.yml
242
+ ├── Dockerfile
243
+ ├── [package.json | pyproject.toml | go.mod]
244
+ ├── [vitest.config.ts | pytest.ini]
245
+ └── PROJECT.md
246
+ ```
247
+
248
+ ## Usage
249
+
250
+ ```
251
+ /tlc:new-project
252
+ ```
253
+
254
+ Interactive flow that:
255
+ 1. Understands what you're building
256
+ 2. Suggests appropriate tech
257
+ 3. Lets you adjust
258
+ 4. Creates roadmap
259
+ 5. Sets up tests