claude-code-starter 0.0.1

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/README.md ADDED
@@ -0,0 +1,509 @@
1
+ # Claude Code Framework
2
+
3
+ A lightweight framework for AI-assisted development. Drop it anywhere, run one command.
4
+
5
+ **Version:** 0.0.1
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # Install globally via npm
11
+ npm install -g claude-code-starter
12
+
13
+ # Or use npx (no install required)
14
+ npx claude-code-starter
15
+ ```
16
+
17
+ After global installation, run with `claude-code-starter`. Or just use `npx` without installing.
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # Navigate to your project
23
+ cd /path/to/your-project
24
+
25
+ # Initialize the framework
26
+ npx claude-code-starter
27
+
28
+ # Then start Claude:
29
+ claude
30
+ ```
31
+
32
+ ## CLI Options
33
+
34
+ ```bash
35
+ npx claude-code-starter --help # Show help message
36
+ npx claude-code-starter --version # Show version number
37
+ npx claude-code-starter --force # Force overwrite CLAUDE.md and settings.json
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Examples
43
+
44
+ ### Example 1: New Project
45
+
46
+ ```bash
47
+ mkdir my-new-app
48
+ cd my-new-app
49
+ npx claude-code-starter
50
+ ```
51
+
52
+ Output:
53
+ ```
54
+ ╔═══════════════════════════════════════╗
55
+ ║ Claude Code Framework v0.0.1 ║
56
+ ╚═══════════════════════════════════════╝
57
+
58
+ Setting up framework files...
59
+ Created CLAUDE.md
60
+ Created .claude/settings.json
61
+ Updated .claude/commands/
62
+ Updated .claude/skills/
63
+
64
+ New project detected
65
+
66
+ What are you building?
67
+ > A REST API for managing todo items
68
+
69
+ Ready! Run claude to start working on: A REST API for managing todo items
70
+
71
+ Tip: Add .claude/ to your global .gitignore
72
+ ```
73
+
74
+ Then:
75
+ ```bash
76
+ claude
77
+ ```
78
+
79
+ Claude will start with context about your task and begin helping you build it.
80
+
81
+ ---
82
+
83
+ ### Example 2: Existing Project
84
+
85
+ ```bash
86
+ cd /path/to/my-express-app
87
+ npx claude-code-starter
88
+ ```
89
+
90
+ Output:
91
+ ```
92
+ ╔═══════════════════════════════════════╗
93
+ ║ Claude Code Framework v0.0.1 ║
94
+ ╚═══════════════════════════════════════╝
95
+
96
+ Setting up framework files...
97
+ Created CLAUDE.md
98
+ Created .claude/settings.json
99
+ Updated .claude/commands/
100
+ Updated .claude/skills/
101
+
102
+ Detected existing project
103
+ Tech stack: Node.js TypeScript
104
+
105
+ Analyzing codebase...
106
+
107
+ Files: 47 source files
108
+ Directories: src/ lib/ tests/
109
+ Frameworks: Express
110
+
111
+ Ready! Run claude to start.
112
+
113
+ Tip: Add .claude/ to your global .gitignore
114
+ ```
115
+
116
+ ---
117
+
118
+ ### Example 3: Starting a Task
119
+
120
+ ```
121
+ You: /task Add user authentication with JWT
122
+
123
+ Claude: I'll set up JWT authentication. Let me first understand your current
124
+ project structure...
125
+
126
+ [Claude reads files, creates a plan, updates .claude/state/task.md]
127
+
128
+ I've analyzed your project. Here's my plan:
129
+
130
+ 1. Install dependencies (jsonwebtoken, bcrypt)
131
+ 2. Create auth middleware in src/middleware/auth.ts
132
+ 3. Add login/register endpoints
133
+ 4. Protect existing routes
134
+
135
+ Starting with step 1...
136
+ ```
137
+
138
+ ---
139
+
140
+ ### Example 4: Checking Status
141
+
142
+ ```
143
+ You: /status
144
+
145
+ Claude: ## Current Status
146
+
147
+ **Task:** Add user authentication with JWT
148
+ **Status:** In Progress
149
+
150
+ ### Progress
151
+ - [x] Installed dependencies
152
+ - [x] Created auth middleware
153
+ - [ ] Add login/register endpoints
154
+ - [ ] Protect existing routes
155
+
156
+ ### Decisions Made
157
+ - Using RS256 for JWT signing
158
+ - Storing refresh tokens in httpOnly cookies
159
+
160
+ ### Next Steps
161
+ Creating the login endpoint in src/routes/auth.ts
162
+ ```
163
+
164
+ ---
165
+
166
+ ### Example 5: Completing a Task
167
+
168
+ ```
169
+ You: /done
170
+
171
+ Claude: ## Task Complete
172
+
173
+ **Task:** Add user authentication with JWT
174
+
175
+ ### Summary
176
+ Implemented full JWT authentication system with:
177
+ - Login/register endpoints
178
+ - Token refresh mechanism
179
+ - Protected route middleware
180
+
181
+ ### Files Changed
182
+ - src/middleware/auth.ts (new)
183
+ - src/routes/auth.ts (new)
184
+ - src/routes/index.ts (modified)
185
+ - package.json (modified)
186
+
187
+ ### Follow-up
188
+ - Consider adding rate limiting to auth endpoints
189
+ - Add password reset functionality
190
+
191
+ State cleared. Ready for next task.
192
+ ```
193
+
194
+ ---
195
+
196
+ ### Example 6: Deep Analysis
197
+
198
+ ```
199
+ You: /analyze authentication flow
200
+
201
+ Claude: ## Analysis: Authentication Flow
202
+
203
+ ### Entry Points
204
+ - `POST /api/auth/login` → src/routes/auth.ts:23
205
+ - `POST /api/auth/register` → src/routes/auth.ts:45
206
+ - `POST /api/auth/refresh` → src/routes/auth.ts:67
207
+
208
+ ### Middleware Chain
209
+ 1. `validateBody()` → src/middleware/validate.ts:12
210
+ 2. `authMiddleware()` → src/middleware/auth.ts:8
211
+
212
+ ### Token Flow
213
+ ```
214
+ Login Request
215
+
216
+ Validate credentials (bcrypt.compare)
217
+
218
+ Generate access token (15min) + refresh token (7d)
219
+
220
+ Set refresh token as httpOnly cookie
221
+
222
+ Return access token in response body
223
+ ```
224
+
225
+ ### Potential Issues
226
+ - No rate limiting on login attempts
227
+ - Refresh tokens not stored in DB (can't revoke)
228
+
229
+ ### Recommendations
230
+ 1. Add rate limiting with express-rate-limit
231
+ 2. Store refresh tokens in Redis for revocation
232
+ ```
233
+
234
+ ---
235
+
236
+ ### Example 7: Resuming Work
237
+
238
+ When you close Claude and come back later:
239
+
240
+ ```bash
241
+ claude
242
+ ```
243
+
244
+ Claude reads `.claude/state/task.md` (as instructed by CLAUDE.md) and continues:
245
+
246
+ ```
247
+ Claude: Welcome back. I see you were working on:
248
+
249
+ **Task:** Add user authentication with JWT
250
+ **Status:** In Progress
251
+
252
+ Last time we completed the auth middleware. Next step is
253
+ creating the login endpoint.
254
+
255
+ Should I continue with that?
256
+ ```
257
+
258
+ ---
259
+
260
+ ### Example 8: Using Skills
261
+
262
+ Skills are referenced when relevant. You can also ask directly:
263
+
264
+ ```
265
+ You: I'm debugging why login fails for some users. Help me use
266
+ the systematic debugging approach.
267
+
268
+ Claude: I'll follow the systematic debugging methodology.
269
+
270
+ ### 1. Reproduce
271
+ First, let me understand the failure pattern...
272
+ - Which users fail? New users? Existing users?
273
+ - Any error messages in logs?
274
+
275
+ ### 2. Isolate
276
+ [Claude narrows down the issue]
277
+
278
+ ### 3. Trace
279
+ Looking at the code path:
280
+ - src/routes/auth.ts:23 → login handler
281
+ - src/services/auth.ts:15 → validatePassword
282
+ ...
283
+
284
+ ### 4. Root Cause
285
+ Found it: The password comparison fails for users migrated
286
+ from the old system because they use MD5 hashing, not bcrypt.
287
+
288
+ ### 5. Fix
289
+ I'll add a migration check in the login flow...
290
+ ```
291
+
292
+ ---
293
+
294
+ ### Example 9: Pattern Discovery
295
+
296
+ ```
297
+ You: I need to add a new API endpoint. What patterns does this
298
+ project use?
299
+
300
+ Claude: Let me analyze the existing patterns...
301
+
302
+ ### API Endpoint Pattern
303
+ Based on src/routes/*.ts:
304
+
305
+ ```typescript
306
+ // Pattern: Route files export a router
307
+ import { Router } from 'express';
308
+ import { validateBody } from '../middleware/validate';
309
+ import { schema } from '../schemas/resourceSchema';
310
+
311
+ const router = Router();
312
+
313
+ router.post('/',
314
+ validateBody(schema),
315
+ async (req, res, next) => {
316
+ try {
317
+ const result = await service.create(req.body);
318
+ res.status(201).json(result);
319
+ } catch (error) {
320
+ next(error);
321
+ }
322
+ }
323
+ );
324
+
325
+ export default router;
326
+ ```
327
+
328
+ ### Conventions Found
329
+ - Validation middleware before handlers
330
+ - Async handlers with try/catch
331
+ - Services handle business logic
332
+ - 201 for creates, 200 for updates
333
+
334
+ Should I create your new endpoint following this pattern?
335
+ ```
336
+
337
+ ---
338
+
339
+ ### Example 10: Multi-Step Feature
340
+
341
+ ```
342
+ You: /task Build a complete user profile feature with avatar upload
343
+
344
+ Claude: This is a multi-step feature. I'll break it down:
345
+
346
+ ## Plan
347
+
348
+ 1. **Database**: Add profile fields to User model
349
+ 2. **Storage**: Set up file upload for avatars
350
+ 3. **API**: Create profile endpoints (GET/PATCH)
351
+ 4. **Validation**: Add profile update schema
352
+ 5. **Tests**: Write tests for new endpoints
353
+
354
+ I'll update state as we complete each step.
355
+
356
+ Starting with the database changes...
357
+
358
+ [After completing step 1]
359
+
360
+ ✓ Step 1 complete. Updated .claude/state/task.md
361
+
362
+ Moving to step 2: Setting up avatar uploads...
363
+ ```
364
+
365
+ ---
366
+
367
+ ## Structure
368
+
369
+ After init, your project has:
370
+
371
+ ```
372
+ your-project/
373
+ ├── CLAUDE.md # Instructions for Claude
374
+ └── .claude/
375
+ ├── .version # Framework version
376
+ ├── settings.json # Permissions
377
+ ├── commands/ # Slash commands
378
+ │ ├── task.md
379
+ │ ├── status.md
380
+ │ ├── done.md
381
+ │ └── analyze.md
382
+ ├── skills/ # Reference guides
383
+ │ ├── pattern-discovery.md
384
+ │ ├── systematic-debugging.md
385
+ │ └── testing-methodology.md
386
+ └── state/
387
+ └── task.md # Current task state
388
+ ```
389
+
390
+ ## Commands
391
+
392
+ | Command | What it does |
393
+ |---------|-------------|
394
+ | `/task <desc>` | Start working on something |
395
+ | `/status` | Show current task |
396
+ | `/done` | Mark task complete |
397
+ | `/analyze <area>` | Deep dive into code |
398
+
399
+ ## Skills
400
+
401
+ The framework includes methodology guides in `.claude/skills/`:
402
+
403
+ | Skill | Use When |
404
+ |-------|----------|
405
+ | **pattern-discovery.md** | Adding new code that should match existing patterns |
406
+ | **systematic-debugging.md** | Investigating bugs or unexpected behavior |
407
+ | **testing-methodology.md** | Writing tests or improving test coverage |
408
+
409
+ Claude references these when the situation calls for it.
410
+
411
+ ## State Management
412
+
413
+ All state lives in `.claude/state/task.md`. Example:
414
+
415
+ ```markdown
416
+ # Current Task
417
+
418
+ ## Status: In Progress
419
+
420
+ **Task:** Add user authentication
421
+
422
+ ## Context
423
+
424
+ Building JWT-based auth for the Express API.
425
+
426
+ ## Next Steps
427
+
428
+ 1. Create auth middleware
429
+ 2. Add login endpoint
430
+ 3. Test
431
+
432
+ ## Decisions
433
+
434
+ - Using RS256 for JWT signing
435
+ - Refresh tokens in httpOnly cookies
436
+ - Access tokens expire in 15 minutes
437
+ ```
438
+
439
+ When you resume a session, Claude reads this file and continues where you left off.
440
+
441
+ ## Global .gitignore
442
+
443
+ Add `.claude/` to your global gitignore so it's ignored in all projects:
444
+
445
+ ```bash
446
+ echo ".claude/" >> ~/.gitignore
447
+ git config --global core.excludesfile ~/.gitignore
448
+ ```
449
+
450
+ ## Permissions
451
+
452
+ The `settings.json` pre-approves common dev commands:
453
+
454
+ - **Git**: status, diff, log, add, commit, etc.
455
+ - **Package managers**: npm, yarn, pnpm, bun, pip, cargo
456
+ - **Build tools**: node, tsc, make, docker
457
+ - **Test runners**: jest, vitest
458
+ - **Linters**: eslint, prettier
459
+
460
+ Edit `.claude/settings.json` to customize for your stack.
461
+
462
+ ## Troubleshooting
463
+
464
+ ### Init script fails on macOS
465
+
466
+ The script is compatible with Bash 3.x (macOS default). If you see errors:
467
+
468
+ ```bash
469
+ # Check your bash version
470
+ bash --version
471
+
472
+ # If installed globally, run with explicit bash
473
+ bash $(which claude-code-starter)
474
+ ```
475
+
476
+ ### Commands not recognized
477
+
478
+ If `/task`, `/status`, etc. don't work:
479
+
480
+ 1. Check that `.claude/commands/` exists in your project
481
+ 2. Verify files have YAML frontmatter (lines starting with `---`)
482
+ 3. Re-run init to refresh command files
483
+
484
+ ### Settings keep resetting
485
+
486
+ The init script preserves your `settings.json` if it exists. If it's being overwritten:
487
+
488
+ 1. Check you're not running from inside the framework folder
489
+ 2. Verify `.claude/settings.json` exists before running init
490
+
491
+ ### Claude doesn't read task state
492
+
493
+ Make sure `CLAUDE.md` exists in your project root. It tells Claude to check `.claude/state/task.md` on startup.
494
+
495
+ ### Framework version
496
+
497
+ Check your installed version:
498
+
499
+ ```bash
500
+ cat .claude/.version
501
+ ```
502
+
503
+ ## Tips
504
+
505
+ 1. **Be specific with tasks** - "Add login endpoint" is better than "work on auth"
506
+ 2. **Check status often** - `/status` helps you and Claude stay aligned
507
+ 3. **Let Claude update state** - Don't manually edit `.claude/state/task.md`
508
+ 4. **Use analyze for exploration** - `/analyze` before diving into unfamiliar code
509
+ 5. **Complete tasks properly** - `/done` creates a clean break for the next task