claude-code-autoconfig 1.0.113 → 1.0.115
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/.claude/commands/autoconfig-update.md +147 -146
- package/.claude/commands/autoconfig.md +366 -365
- package/.claude/commands/commit-and-push.md +22 -21
- package/.claude/commands/enable-retro.md +1 -0
- package/.claude/commands/gls.md +89 -88
- package/.claude/commands/recover-context.md +1 -0
- package/.claude/commands/show-docs.md +1 -0
- package/.claude/commands/sync-claude-md.md +1 -0
- package/.claude/commands/test.md +11 -10
- package/.claude/feedback/FEEDBACK.md +12 -0
- package/bin/cli.js +36 -12
- package/package.json +1 -1
- package/.claude/updates/002-recover-context.md +0 -148
|
@@ -1,366 +1,367 @@
|
|
|
1
|
-
<!-- @description The command you just ran. Analyzes your project and populates CLAUDE.md with real context. Re-run anytime your stack changes. -->
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
-
|
|
30
|
-
- `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- `
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
-
|
|
51
|
-
- `*
|
|
52
|
-
- `
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
- `
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `**/manifest.
|
|
73
|
-
| `**/
|
|
74
|
-
| `**/
|
|
75
|
-
|
|
|
76
|
-
| `
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- `
|
|
90
|
-
- `
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- **
|
|
118
|
-
- **
|
|
119
|
-
- **
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- `
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
- **
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
"
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
Read(./.env
|
|
242
|
-
Read(
|
|
243
|
-
|
|
244
|
-
Edit(./.env
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Edit(./
|
|
258
|
-
Edit(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
Bash(npm run
|
|
268
|
-
Bash(npm run
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
- `'
|
|
323
|
-
- `'
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
-
|
|
336
|
-
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
1
|
+
<!-- @description The command you just ran. Analyzes your project and populates CLAUDE.md with real context. Re-run anytime your stack changes. -->
|
|
2
|
+
<!-- @version 1 -->
|
|
3
|
+
|
|
4
|
+
# Autoconfig
|
|
5
|
+
|
|
6
|
+
Analyze this project and configure Claude Code with real context.
|
|
7
|
+
|
|
8
|
+
**Setup Note**: During autoconfig, prefer Glob/Read/Write tools over Bash commands. This ensures smooth setup without permission prompts. Only use Bash for opening the guide at the end.
|
|
9
|
+
|
|
10
|
+
## Step 1: Detect Environment
|
|
11
|
+
|
|
12
|
+
**Operating System:**
|
|
13
|
+
Check the platform and note it for command syntax:
|
|
14
|
+
- Windows → use `del`, `rmdir`, backslashes, `.cmd`/`.ps1` scripts
|
|
15
|
+
- macOS/Linux → use `rm`, `mkdir -p`, forward slashes, `.sh` scripts
|
|
16
|
+
|
|
17
|
+
Include this in CLAUDE.md so all commands use the correct syntax.
|
|
18
|
+
|
|
19
|
+
## Step 2: Scan the Project
|
|
20
|
+
|
|
21
|
+
Look for these indicators to understand the project:
|
|
22
|
+
|
|
23
|
+
**Package/Config Files:**
|
|
24
|
+
- `package.json` → Node.js, npm scripts, dependencies
|
|
25
|
+
- `requirements.txt` / `pyproject.toml` / `setup.py` → Python
|
|
26
|
+
- `Cargo.toml` → Rust
|
|
27
|
+
- `go.mod` → Go
|
|
28
|
+
- `Gemfile` → Ruby
|
|
29
|
+
- `pom.xml` / `build.gradle` → Java
|
|
30
|
+
- `*.csproj` / `*.sln` → .NET
|
|
31
|
+
- `composer.json` → PHP
|
|
32
|
+
|
|
33
|
+
**Framework Indicators:**
|
|
34
|
+
- `next.config.*` / `app/` directory → Next.js
|
|
35
|
+
- `vite.config.*` → Vite
|
|
36
|
+
- `angular.json` → Angular
|
|
37
|
+
- `svelte.config.*` → Svelte
|
|
38
|
+
- `remix.config.*` → Remix
|
|
39
|
+
- `nuxt.config.*` → Nuxt
|
|
40
|
+
- `django` in imports → Django
|
|
41
|
+
- `flask` in imports → Flask
|
|
42
|
+
- `fastapi` in imports → FastAPI
|
|
43
|
+
- `express` in dependencies → Express
|
|
44
|
+
- `rails` / `Gemfile` with rails → Rails
|
|
45
|
+
- `laravel` → Laravel
|
|
46
|
+
|
|
47
|
+
**Testing Frameworks:**
|
|
48
|
+
- `jest.config.*` / `@jest` in deps → Jest
|
|
49
|
+
- `vitest.config.*` → Vitest
|
|
50
|
+
- `pytest.ini` / `conftest.py` → Pytest
|
|
51
|
+
- `*_test.go` files → Go testing
|
|
52
|
+
- `*_spec.rb` files → RSpec
|
|
53
|
+
- `cypress/` or `playwright/` → E2E testing
|
|
54
|
+
|
|
55
|
+
**Infrastructure:**
|
|
56
|
+
- `Dockerfile` / `docker-compose.*` → Docker
|
|
57
|
+
- `*.tf` files → Terraform
|
|
58
|
+
- `k8s/` or `kubernetes/` → Kubernetes
|
|
59
|
+
- `.github/workflows/` → GitHub Actions
|
|
60
|
+
- `serverless.yml` → Serverless Framework
|
|
61
|
+
|
|
62
|
+
## Step 2b: Detect Version Divergence
|
|
63
|
+
|
|
64
|
+
Scan for version declarations across the project. Multiple version sources that disagree can cause release failures (e.g., package.json says 1.0.74 but a hardcoded constant says 1.0.72).
|
|
65
|
+
|
|
66
|
+
**Version Sources to Check:**
|
|
67
|
+
|
|
68
|
+
| Source | Detection Method |
|
|
69
|
+
|--------|------------------|
|
|
70
|
+
| `package.json` | Parse JSON, read `version` field |
|
|
71
|
+
| `**/*.{ts,js,mjs}` | Regex: `/(?:export\s+)?(?:const\|let\|var)\s+((?:BASE_\|APP_\|LIB_)?VERSION)\s*=\s*['"](\d+\.\d+\.\d+)['"]/i` |
|
|
72
|
+
| `**/manifest.json` | Parse JSON, read `version` field |
|
|
73
|
+
| `**/manifest.config.{ts,js}` | Regex: `/version:\s*['"](\d+\.\d+\.\d+)['"]/` |
|
|
74
|
+
| `**/Info.plist` | Regex: `/<key>CFBundleShortVersionString<\/key>\s*<string>(\d+\.\d+\.\d+)<\/string>/` |
|
|
75
|
+
| `**/build.gradle` | Regex: `/versionName\s+['"](\d+\.\d+\.\d+)['"]/` |
|
|
76
|
+
| `pyproject.toml` | Parse TOML, read `project.version` or `tool.poetry.version` |
|
|
77
|
+
| `Cargo.toml` | Parse TOML, read `package.version` |
|
|
78
|
+
|
|
79
|
+
**Algorithm:**
|
|
80
|
+
|
|
81
|
+
1. Glob for each file pattern
|
|
82
|
+
2. Extract version using the appropriate method (JSON parse, regex, TOML parse)
|
|
83
|
+
3. Collect results as `{ file, identifier, version }`
|
|
84
|
+
4. Compare all collected versions
|
|
85
|
+
5. **If all versions match** → no action needed
|
|
86
|
+
6. **If versions diverge** → flag for CLAUDE.md
|
|
87
|
+
|
|
88
|
+
**Skip these locations** (generated/vendored):
|
|
89
|
+
- `node_modules/**`
|
|
90
|
+
- `dist/**`
|
|
91
|
+
- `build/**`
|
|
92
|
+
- `.git/**`
|
|
93
|
+
|
|
94
|
+
**Edge Cases:**
|
|
95
|
+
- If version field references a function or variable (not a literal), note it as "dynamic"
|
|
96
|
+
- For monorepos, compare root package.json against workspace packages
|
|
97
|
+
- If only one version source exists, no comparison needed — skip silently
|
|
98
|
+
|
|
99
|
+
## Step 3: Populate CLAUDE.md
|
|
100
|
+
|
|
101
|
+
Focus on what Claude Code actually needs to work effectively. Claude can explore the codebase itself — don't document what it can discover.
|
|
102
|
+
|
|
103
|
+
**Wrap content in markers** so `/sync-claude-md` knows what's auto-generated:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
<!-- AUTO-GENERATED BY /autoconfig at {TIMESTAMP} UTC — Do not edit. Use .claude/feedback/ for corrections. -->
|
|
107
|
+
|
|
108
|
+
# Project Name
|
|
109
|
+
...content...
|
|
110
|
+
|
|
111
|
+
<!-- END AUTO-GENERATED at {TIMESTAMP} UTC — Use .claude/feedback/ for corrections. -->
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Replace `{TIMESTAMP}` with the current UTC time in format `YYYY-MM-DD HH:MM:SS` (e.g., `2026-01-14 16:30:45`). Use the same timestamp in both markers.
|
|
115
|
+
|
|
116
|
+
**Always include:**
|
|
117
|
+
- **Project name + one-liner**: What is this thing?
|
|
118
|
+
- **Tech stack**: One to two lines max. Only mention choices Claude wouldn't guess from config files alone (e.g., "Firebase Auth via WEB_OAUTH" is worth including; "React 18 with TypeScript" is not — Claude sees that in `package.json`). Do NOT list individual dependencies, testing libraries, or build tools that appear in `package.json`/`requirements.txt` — Claude reads those files directly.
|
|
119
|
+
- **Commands**: How to run, test, build, deploy — Claude needs these to execute tasks
|
|
120
|
+
- **Non-obvious conventions**: Multi-schema databases, monorepo structure, unusual patterns Claude wouldn't infer
|
|
121
|
+
|
|
122
|
+
**Include if divergence detected (from Step 2b):**
|
|
123
|
+
- **Version Management**: Only add this section if version divergence was found
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
## Version Management
|
|
127
|
+
|
|
128
|
+
⚠️ Multiple version sources detected with different values:
|
|
129
|
+
- `package.json:version` → "X.Y.Z"
|
|
130
|
+
- `{file}:{identifier}` → "A.B.C"
|
|
131
|
+
|
|
132
|
+
Verify which source is authoritative before releases.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Place this section near the top (after Tech Stack, before Commands) since version issues block releases.
|
|
136
|
+
|
|
137
|
+
**Include if relevant:**
|
|
138
|
+
- **Deployment flow**: If non-standard or involves multiple steps
|
|
139
|
+
- **Key architectural decisions**: Only when the project has non-standard module boundaries (e.g., Chrome extension background/content split, microservice routing, multi-entrypoint builds). For standard single-entrypoint apps (Next.js, Express, Django), skip it — Claude can infer the architecture from the file structure.
|
|
140
|
+
|
|
141
|
+
**Skip these — Claude can discover them:**
|
|
142
|
+
- Detailed project structure trees (Claude can run `ls` or `tree`)
|
|
143
|
+
- Exhaustive route/endpoint lists (Claude can grep)
|
|
144
|
+
- File-by-file descriptions (Claude can read files)
|
|
145
|
+
- Database model lists (Claude can read schema files)
|
|
146
|
+
- Individual dependency names or versions (Claude reads `package.json`/`requirements.txt` directly)
|
|
147
|
+
- Standard framework patterns (e.g., "uses app router" for Next.js — Claude sees `app/` directory)
|
|
148
|
+
|
|
149
|
+
**Keep it tight.** A 30-line CLAUDE.md that hits the essentials beats a 200-line doc Claude has to parse every session.
|
|
150
|
+
|
|
151
|
+
**Always end with:**
|
|
152
|
+
```markdown
|
|
153
|
+
## Team Feedback
|
|
154
|
+
See `.claude/feedback/` for corrections and guidance from the team.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This pointer persists across autoconfig runs and directs Claude to team-maintained content.
|
|
158
|
+
|
|
159
|
+
## Step 4: Create Rules Directory
|
|
160
|
+
|
|
161
|
+
Create `.claude/rules/` directory if it doesn't exist by writing a `.gitkeep` file to it:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Write .claude/rules/.gitkeep with empty content
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Important**: Use Write tool to create the directory (by creating a placeholder file), not `mkdir` Bash commands. This avoids permission prompts during setup.
|
|
168
|
+
|
|
169
|
+
Rules are path-scoped context files that load automatically when Claude works on matching files. Effective rules require deep understanding of your codebase patterns, team conventions, and quality goals — they should be crafted intentionally, not auto-generated.
|
|
170
|
+
|
|
171
|
+
## Step 5: Configure Formatter (JS/Node Projects)
|
|
172
|
+
|
|
173
|
+
**Only for projects with `package.json`:**
|
|
174
|
+
|
|
175
|
+
1. Check if `scripts.format` already exists in `package.json`
|
|
176
|
+
|
|
177
|
+
2. **If `scripts.format` exists:**
|
|
178
|
+
- Skip to adding the hook (Step 5b)
|
|
179
|
+
|
|
180
|
+
3. **If `scripts.format` does NOT exist:**
|
|
181
|
+
- Ask the user:
|
|
182
|
+
```
|
|
183
|
+
No formatter detected. Adding one ensures Claude's output
|
|
184
|
+
matches your project's style.
|
|
185
|
+
|
|
186
|
+
Should I add Prettier to this project? (y/n)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
4. **If user says yes:**
|
|
190
|
+
- Run: `npm install -D prettier`
|
|
191
|
+
- Add to `package.json` scripts:
|
|
192
|
+
```json
|
|
193
|
+
"format": "[ -f .prettierrc ] && prettier --write . || echo 'Create .prettierrc to enable formatting'"
|
|
194
|
+
```
|
|
195
|
+
- Create `.prettierrc.example` in project root:
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"semi": true,
|
|
199
|
+
"singleQuote": false,
|
|
200
|
+
"tabWidth": 2
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
- Inform user: "Formatting is ready but inactive. Rename `.prettierrc.example` to `.prettierrc` when your team decides on style preferences."
|
|
204
|
+
|
|
205
|
+
5. **If user says no:**
|
|
206
|
+
- Skip formatter setup, continue to Step 6
|
|
207
|
+
|
|
208
|
+
**Step 5b: Add PostToolUse Format Hook**
|
|
209
|
+
|
|
210
|
+
If the project has `scripts.format` (either existing or just added), add the format hook to `.claude/settings.json`:
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"hooks": {
|
|
215
|
+
"PostToolUse": [
|
|
216
|
+
{
|
|
217
|
+
"matcher": "Write|Edit",
|
|
218
|
+
"hooks": [
|
|
219
|
+
{ "type": "command", "command": "node .claude/hooks/format.js" }
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The format hook script (`.claude/hooks/format.js`) runs `npm run format` after Write/Edit operations on source files. Users can customize this script to add file filtering or different formatting logic.
|
|
228
|
+
|
|
229
|
+
**Important:** Merge this with any existing hooks. Don't overwrite existing hooks.
|
|
230
|
+
|
|
231
|
+
## Step 6: Configure Settings
|
|
232
|
+
|
|
233
|
+
Update `.claude/settings.json` using the official schema.
|
|
234
|
+
|
|
235
|
+
### Deny Patterns (files Claude shouldn't read/write)
|
|
236
|
+
|
|
237
|
+
Use `Read()` for blocking reads, `Edit()` for blocking writes:
|
|
238
|
+
|
|
239
|
+
**Always deny (security):**
|
|
240
|
+
```
|
|
241
|
+
Read(./.env)
|
|
242
|
+
Read(./.env.*)
|
|
243
|
+
Read(./secrets/**)
|
|
244
|
+
Edit(./.env)
|
|
245
|
+
Edit(./.env.*)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Always deny (Windows artifacts):**
|
|
249
|
+
```
|
|
250
|
+
Write(./nul)
|
|
251
|
+
Edit(./nul)
|
|
252
|
+
```
|
|
253
|
+
These prevent accidental `nul` file creation from bash/Windows command translation issues.
|
|
254
|
+
|
|
255
|
+
**Often deny (generated/vendor):**
|
|
256
|
+
```
|
|
257
|
+
Edit(./node_modules/**)
|
|
258
|
+
Edit(./dist/**)
|
|
259
|
+
Edit(./.git/**)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Allow Patterns (auto-approve without prompting)
|
|
263
|
+
|
|
264
|
+
Use `Bash()` patterns with prefix matching:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Bash(npm run test:*)
|
|
268
|
+
Bash(npm run lint:*)
|
|
269
|
+
Bash(npm run build)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Environment Variables
|
|
273
|
+
|
|
274
|
+
Set session-level env vars:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"env": {
|
|
279
|
+
"NODE_ENV": "development"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Keep it minimal** — only include patterns that actually exist in this project.
|
|
285
|
+
|
|
286
|
+
## Guidelines
|
|
287
|
+
|
|
288
|
+
- Replace ALL placeholder content with real values from THIS project
|
|
289
|
+
- Delete sections that don't apply — no empty stubs
|
|
290
|
+
- Optimize for Claude's efficiency, not human documentation
|
|
291
|
+
- When uncertain, leave it out — Claude can ask or explore
|
|
292
|
+
|
|
293
|
+
## Step 7: Configure MEMORY.md
|
|
294
|
+
|
|
295
|
+
Claude Code has a persistent auto memory file (`MEMORY.md`) that loads into the system prompt at the start of every session. Write the debugging methodology to this file so Claude always follows evidence-based troubleshooting.
|
|
296
|
+
|
|
297
|
+
**Locate the MEMORY.md file:**
|
|
298
|
+
|
|
299
|
+
The file lives at `~/.claude/projects/{encoded-project-path}/memory/MEMORY.md` where the project path is encoded by replacing path separators with dashes and removing colons (e.g., `C:\CODE\my-project` becomes `C--CODE-my-project`).
|
|
300
|
+
|
|
301
|
+
**Before writing, read MEMORY.md first.** If a `## Debugging` section (or similar heading like `## Debugging — Evidence Before Solutions`) already exists, **skip this step entirely** — never duplicate or overwrite user-curated memory content.
|
|
302
|
+
|
|
303
|
+
**Only if no debugging section exists**, write this content (append if file already exists, create if it doesn't):
|
|
304
|
+
|
|
305
|
+
```markdown
|
|
306
|
+
## Debugging — Evidence Before Solutions
|
|
307
|
+
NEVER guess the root cause and jump to coding a fix. Ask yourself: is the cause deterministic and verifiable from the error alone (e.g., stack trace, compile error)? If yes, fix it directly. If not:
|
|
308
|
+
1. Add logging / check actual data first
|
|
309
|
+
2. Confirm root cause with evidence
|
|
310
|
+
3. Only then propose and implement a fix
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Important**: Use the Write tool (or Edit to append). Do not skip this step on first-time setup — it ensures Claude investigates root causes before making changes in every future session. But never overwrite existing user content in MEMORY.md.
|
|
314
|
+
|
|
315
|
+
## Step 8: Update the Docs
|
|
316
|
+
|
|
317
|
+
After populating CLAUDE.md, update the docs file previews to show actual project content:
|
|
318
|
+
|
|
319
|
+
1. Open `.claude/docs/autoconfig.docs.html`
|
|
320
|
+
2. Find the `fileContents` JavaScript object
|
|
321
|
+
3. Update these entries with the real content just generated:
|
|
322
|
+
- `'claude-md'` → the CLAUDE.md content from Step 3
|
|
323
|
+
- `'memory-md'` → the MEMORY.md content from Step 7
|
|
324
|
+
- `'settings'` → the settings.json content from Step 6
|
|
325
|
+
4. Use template literal syntax and escape any backticks in the content
|
|
326
|
+
|
|
327
|
+
This ensures double-clicking these files in the docs shows real project content, not stale placeholders.
|
|
328
|
+
|
|
329
|
+
## After Completion
|
|
330
|
+
|
|
331
|
+
### Open Docs & Finale
|
|
332
|
+
|
|
333
|
+
**Only if `.claude/docs/autoconfig.docs.html` exists**, open it in the user's browser:
|
|
334
|
+
|
|
335
|
+
- macOS: `open .claude/docs/autoconfig.docs.html`
|
|
336
|
+
- Linux: `xdg-open .claude/docs/autoconfig.docs.html`
|
|
337
|
+
- Windows: `powershell -NoProfile -Command "Start-Process '.claude/docs/autoconfig.docs.html'"`
|
|
338
|
+
|
|
339
|
+
If the docs file exists, output:
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
✅ Setup complete! The interactive docs are now open in your browser.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
If the docs file does NOT exist (e.g., user ran `/autoconfig` without the full npx install), output:
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
✅ Setup complete!
|
|
352
|
+
|
|
353
|
+
Run `/show-docs` to view the interactive documentation (requires full install via `npx claude-code-autoconfig`).
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
**IMPORTANT**: Do not add any additional text, summaries, or details after this message. The finale should be clean and punchy - end here.
|
|
358
|
+
|
|
359
|
+
### Windows Cleanup
|
|
360
|
+
|
|
361
|
+
On Windows, if a `nul` file was accidentally created in the project root (a common artifact from bash/Unix command translation), delete it silently using the Bash tool:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
del nul 2>NUL
|
|
365
|
+
```
|
|
366
|
+
|
|
366
367
|
Do this cleanup silently without any output to the user.
|