@codeyam/codeyam-cli 0.1.0-staging.2a88920 → 0.1.0-staging.483fdc2
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/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +253 -0
- package/analyzer-template/project/writeMockDataTsx.ts +66 -6
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +65 -6
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +146 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/utils/reviewedRules.js +92 -0
- package/codeyam-cli/src/utils/reviewedRules.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CX9f-5xM.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{manifest-a78b90a2.js → manifest-bba56ec1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DuTFSyJ2.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/{root-eVAaavTS.js → root-DTfSQARG.js} +6 -6
- package/codeyam-cli/src/webserver/build/server/assets/{index-BM6TDT1Y.js → index-TD1f-DHV.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BQ-1XyEa.js +258 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/templates/codeyam:memory.md +172 -110
- package/codeyam-cli/templates/codeyam:new-rule.md +40 -1
- package/codeyam-cli/templates/rule-reflection-hook.py +1 -0
- package/codeyam-cli/templates/rules-instructions.md +33 -0
- package/package.json +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +180 -0
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory--GCbFsBE.js +0 -92
- package/codeyam-cli/src/webserver/build/server/assets/server-build-dYC34MHw.js +0 -257
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Y as H,Z as I,M as J,N as K,W as L,O as _,R as $,T as rr,V as tr,U as or,X as ir,Q as pr}from"./assets/server-build-
|
|
1
|
+
import{Y as H,Z as I,M as J,N as K,W as L,O as _,R as $,T as rr,V as tr,U as or,X as ir,Q as pr}from"./assets/server-build-BQ-1XyEa.js";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"fetch-retry";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"typescript";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{H as allowedActionOrigins,I as assets,J as assetsBuildDirectory,K as basename,L as entry,_ as future,$ as isSpaMode,rr as prerender,tr as publicPath,or as routeDiscovery,ir as routes,pr as ssr};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"buildTimestamp": "2026-02-
|
|
3
|
-
"buildTime":
|
|
4
|
-
"buildNumber":
|
|
5
|
-
"semanticVersion": "0.1.
|
|
6
|
-
"version": "0.1.
|
|
2
|
+
"buildTimestamp": "2026-02-04T17:33:55.043Z",
|
|
3
|
+
"buildTime": 1770226435043,
|
|
4
|
+
"buildNumber": 583,
|
|
5
|
+
"semanticVersion": "0.1.583",
|
|
6
|
+
"version": "0.1.583 (2026-02-04T17:33)"
|
|
7
7
|
}
|
|
@@ -3,13 +3,29 @@ name: codeyam:memory
|
|
|
3
3
|
autoApprove: true
|
|
4
4
|
description: |
|
|
5
5
|
Generate and maintain Claude Rules for your codebase based on thorough analysis.
|
|
6
|
-
Use when: User wants to set up memory, claude rules, document confusing areas,
|
|
6
|
+
Use when: User wants to set up memory, claude rules, document confusing areas,
|
|
7
7
|
or ensure Claude has proper context for working in the codebase.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# CodeYam Memory Assistant
|
|
11
11
|
|
|
12
|
-
This skill helps you generate and maintain Claude Rules (`.claude/rules/`) that provide context-specific guidance. The goal is
|
|
12
|
+
This skill helps you generate and maintain Claude Rules (`.claude/rules/`) that provide context-specific guidance. The goal is to **document genuinely confusing aspects** of the codebase—not things Claude can figure out by reading code.
|
|
13
|
+
|
|
14
|
+
## Core Principle: Document Confusion, Not Information
|
|
15
|
+
|
|
16
|
+
**Good rules** explain things that are NOT obvious from reading the code:
|
|
17
|
+
|
|
18
|
+
- Historical context (why code evolved this way)
|
|
19
|
+
- Hidden relationships (files that must change together)
|
|
20
|
+
- Gotchas that caused bugs
|
|
21
|
+
- Non-obvious conventions
|
|
22
|
+
|
|
23
|
+
**Bad rules** document things Claude can easily ascertain:
|
|
24
|
+
|
|
25
|
+
- What functions do (Claude can read the code)
|
|
26
|
+
- Type definitions (Claude can see them)
|
|
27
|
+
- Directory structure (Claude can explore it)
|
|
28
|
+
- Basic patterns (Claude knows common patterns)
|
|
13
29
|
|
|
14
30
|
## When to Use This Skill
|
|
15
31
|
|
|
@@ -66,176 +82,170 @@ Ensure `.codeyam/bin/memory-hook.sh` exists and is executable (`chmod +x`).
|
|
|
66
82
|
|
|
67
83
|
---
|
|
68
84
|
|
|
69
|
-
## Phase 2:
|
|
85
|
+
## Phase 2: Confusion Archaeology
|
|
70
86
|
|
|
71
|
-
|
|
87
|
+
The goal is to find areas where developers have **struggled**—not just areas that are complex. High churn alone doesn't mean confusion; we're looking for patterns that indicate something is genuinely non-obvious.
|
|
72
88
|
|
|
73
|
-
### 2A.
|
|
89
|
+
### 2A. Find Confusion Signals in Commit History
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
**Files with rapid successive changes** (same file, multiple commits in short windows = iteration/confusion):
|
|
76
92
|
|
|
77
93
|
```bash
|
|
78
|
-
#
|
|
79
|
-
git log --
|
|
94
|
+
# Files changed 3+ times in last month (rapid iteration signal)
|
|
95
|
+
git log --since="1 month ago" --name-only --pretty=format: | sort | uniq -c | sort -rn | awk '$1 >= 3 {print}' | head -20
|
|
96
|
+
```
|
|
80
97
|
|
|
81
|
-
|
|
82
|
-
git log --since="6 months ago" --format="%h %s" | awk 'length($0) > 80' | head -20
|
|
98
|
+
**Reverts** (definite confusion signals—someone made a change that didn't work):
|
|
83
99
|
|
|
84
|
-
|
|
85
|
-
git log --
|
|
100
|
+
```bash
|
|
101
|
+
git log --since="6 months ago" --oneline --grep="[Rr]evert" | head -10
|
|
86
102
|
```
|
|
87
103
|
|
|
88
|
-
|
|
104
|
+
**Correction language** (commits that fix misunderstandings):
|
|
89
105
|
|
|
90
106
|
```bash
|
|
91
|
-
git
|
|
92
|
-
git log -1 --format="%B" <commit-hash>
|
|
107
|
+
git log --since="6 months ago" --oneline | grep -iE "(oops|forgot|actually|wrong|typo|missing|should have|meant to)" | head -15
|
|
93
108
|
```
|
|
94
109
|
|
|
95
|
-
|
|
110
|
+
**Files with multiple fix commits** (confusion hotspots):
|
|
96
111
|
|
|
97
112
|
```bash
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
git log --since="3 months ago" --oneline --grep="fix" -i --name-only --pretty=format: | sort | uniq -c | sort -rn | awk '$1 >= 2 {print}' | head -15
|
|
114
|
+
```
|
|
100
115
|
|
|
101
|
-
|
|
102
|
-
git shortlog -sn --since="6 months ago" -- . | head -20
|
|
116
|
+
**Long commit messages** (someone felt the need to explain—complexity that needs documentation):
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
git log --since="6 months ago" --
|
|
118
|
+
```bash
|
|
119
|
+
git log --since="6 months ago" --format="%h %s" | awk 'length($0) > 100' | head -15
|
|
106
120
|
```
|
|
107
121
|
|
|
108
|
-
|
|
122
|
+
### 2B. Dig Into High-Confusion Files
|
|
109
123
|
|
|
110
|
-
|
|
124
|
+
For each file that shows confusion signals, examine its evolution:
|
|
111
125
|
|
|
112
126
|
```bash
|
|
113
|
-
#
|
|
114
|
-
|
|
127
|
+
# View the story of changes to understand what kept going wrong
|
|
128
|
+
git log --since="6 months ago" --oneline -- path/to/confusing-file.ts
|
|
115
129
|
|
|
116
|
-
#
|
|
117
|
-
|
|
130
|
+
# Read the full commit messages for context
|
|
131
|
+
git log --since="6 months ago" --format="%h %s%n%b" -- path/to/confusing-file.ts | head -100
|
|
118
132
|
```
|
|
119
133
|
|
|
120
|
-
|
|
134
|
+
**As you analyze, ask:**
|
|
121
135
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
- What was the initial implementation?
|
|
137
|
+
- What kept breaking or needed fixing?
|
|
138
|
+
- What was non-obvious about the fix?
|
|
139
|
+
- What knowledge would have prevented the issue?
|
|
140
|
+
|
|
141
|
+
### 2C. Find Hidden Dependencies
|
|
125
142
|
|
|
126
|
-
|
|
127
|
-
find . -name "*.config.*" -o -name "*.rc" -o -name ".env*" -o -name "tsconfig*" -o -name "package.json" 2>/dev/null | grep -v node_modules | head -30
|
|
143
|
+
**Files that always change together** (may have non-obvious relationships):
|
|
128
144
|
|
|
129
|
-
|
|
130
|
-
|
|
145
|
+
```bash
|
|
146
|
+
# Look for file pairs that frequently appear in the same commits
|
|
147
|
+
git log --since="3 months ago" --name-only --pretty=format: | awk 'NF' | sort | uniq -c | sort -rn | head -30
|
|
131
148
|
```
|
|
132
149
|
|
|
133
|
-
|
|
150
|
+
When you see the same files appearing together repeatedly, investigate why they're coupled.
|
|
134
151
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
152
|
+
### 2D. Scan for Developer Notes
|
|
153
|
+
|
|
154
|
+
**TODO/FIXME/HACK comments** often mark confusion points:
|
|
138
155
|
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
```bash
|
|
157
|
+
grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.py" . 2>/dev/null | head -30
|
|
141
158
|
```
|
|
142
159
|
|
|
143
|
-
|
|
160
|
+
Focus on comments that explain **why** something is the way it is, not just **what** needs to be done.
|
|
161
|
+
|
|
162
|
+
### 2E. Review Existing Documentation
|
|
144
163
|
|
|
145
|
-
Read these files if they exist:
|
|
164
|
+
Read these files if they exist to understand what's already documented:
|
|
146
165
|
|
|
147
166
|
- `README.md`
|
|
148
167
|
- `CLAUDE.md`
|
|
149
168
|
- `CONTRIBUTING.md`
|
|
150
169
|
- `docs/` directory
|
|
151
|
-
- Any `*.md` files in the root
|
|
152
170
|
|
|
153
|
-
Note what's
|
|
154
|
-
|
|
155
|
-
### 2G. Examine Import/Dependency Patterns
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
# Find files with many imports (high coupling)
|
|
159
|
-
for f in $(find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" 2>/dev/null | grep -v node_modules | head -100); do
|
|
160
|
-
count=$(grep -c "^import\|^from\|require(" "$f" 2>/dev/null || echo 0)
|
|
161
|
-
if [ "$count" -gt 15 ]; then
|
|
162
|
-
echo "$count $f"
|
|
163
|
-
fi
|
|
164
|
-
done | sort -rn | head -20
|
|
165
|
-
|
|
166
|
-
# Find commonly imported local modules (core utilities)
|
|
167
|
-
grep -rh "from '\.\|from \"\.\|require('\.\|require(\"\." --include="*.ts" --include="*.tsx" --include="*.js" . 2>/dev/null | sort | uniq -c | sort -rn | head -20
|
|
168
|
-
```
|
|
171
|
+
Note gaps between what's documented and the confusion signals you found.
|
|
169
172
|
|
|
170
173
|
---
|
|
171
174
|
|
|
172
|
-
## Phase 3:
|
|
175
|
+
## Phase 3: Distinguish Important from Confusing
|
|
173
176
|
|
|
174
|
-
|
|
177
|
+
Not all high-churn areas need documentation. Filter your findings:
|
|
175
178
|
|
|
176
|
-
|
|
177
|
-
2. **Identify themes**:
|
|
178
|
-
- Architecture patterns (how things connect)
|
|
179
|
-
- Testing complexity (special setup needed)
|
|
180
|
-
- Configuration/environment gotchas
|
|
181
|
-
- Historical workarounds still in place
|
|
182
|
-
- Non-obvious conventions
|
|
179
|
+
### Skip These (High Churn but NOT Confusing)
|
|
183
180
|
|
|
184
|
-
|
|
181
|
+
- Lock files (`pnpm-lock.yaml`, `package-lock.json`)
|
|
182
|
+
- Build outputs (`dist/`, `build/`)
|
|
183
|
+
- Generated files (`.build-info.json`, etc.)
|
|
184
|
+
- Files with mechanical changes (version bumps, auto-formatting)
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
### Document These (High Churn AND Confusing)
|
|
187
187
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
188
|
+
- Files with multiple fix commits in short windows
|
|
189
|
+
- Files with reverts (someone's approach didn't work)
|
|
190
|
+
- Files where commit messages explain complex reasoning
|
|
191
|
+
- Files where the same area keeps breaking
|
|
192
|
+
- Files that must change together but aren't obviously related
|
|
191
193
|
|
|
192
|
-
|
|
194
|
+
### Confusion Scoring
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
Prioritize areas with stronger confusion signals:
|
|
195
197
|
|
|
196
|
-
|
|
198
|
+
| Signal | Weight | Example |
|
|
199
|
+
| ------------------------- | ------ | --------------------------------- |
|
|
200
|
+
| Reverts | 5 | "Revert 'Track useState sources'" |
|
|
201
|
+
| Correction language | 5 | "Oops, forgot to import..." |
|
|
202
|
+
| Follow-up fix within days | 5 | Fix commit 2 days after change |
|
|
203
|
+
| "Workaround" or "hack" | 3 | "Workaround for webpack issue" |
|
|
204
|
+
| Long commit message | 3 | >100 chars explaining complexity |
|
|
205
|
+
| Multiple fix commits | 2 | 3+ fixes to same file |
|
|
206
|
+
| Numbered fix series | 1 | "Analysis Fixes 4", "Fixes 5" |
|
|
197
207
|
|
|
198
|
-
|
|
208
|
+
Focus your documentation efforts on areas with the highest confusion scores.
|
|
199
209
|
|
|
200
|
-
|
|
210
|
+
---
|
|
201
211
|
|
|
202
|
-
|
|
212
|
+
## Phase 4: Ask Evidence-Based Questions
|
|
203
213
|
|
|
204
|
-
**
|
|
214
|
+
Questions must reference **specific confusion evidence** you found. Don't ask generic questions about files; ask about the specific commits, patterns, or problems you discovered.
|
|
205
215
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
Always include "I'm not sure - please investigate" as an option so users can delegate investigation to you.
|
|
217
|
+
|
|
218
|
+
### Question Examples
|
|
209
219
|
|
|
210
|
-
**For
|
|
220
|
+
**For rapid successive changes:**
|
|
211
221
|
|
|
212
|
-
> "`
|
|
222
|
+
> "I found 5 commits to `ScopeDataStructure.ts` in 3 weeks, including 'Fix exponential blowup' and 'scope data structure optimization'. What kept causing issues here? What would someone need to know to avoid similar problems?"
|
|
213
223
|
>
|
|
214
|
-
> Options: [Explain the
|
|
224
|
+
> Options: [Explain the pattern] [I'm not sure - please investigate]
|
|
215
225
|
|
|
216
|
-
**For
|
|
226
|
+
**For reverts:**
|
|
217
227
|
|
|
218
|
-
> "Commit `
|
|
228
|
+
> "Commit `a9fbd6385` reverted 'Track useState initialization sources'. Why didn't that approach work? What should be done instead?"
|
|
219
229
|
>
|
|
220
|
-
> Options: [Explain] [I'm not sure - please investigate]
|
|
230
|
+
> Options: [Explain what went wrong] [I'm not sure - please investigate]
|
|
221
231
|
|
|
222
|
-
**For
|
|
232
|
+
**For correction commits:**
|
|
223
233
|
|
|
224
|
-
> "
|
|
234
|
+
> "Commit `31e4a3842` says 'Oops, lost an import'. What import was lost and why is it easy to miss?"
|
|
225
235
|
>
|
|
226
|
-
> Options: [Explain
|
|
236
|
+
> Options: [Explain the gotcha] [I'm not sure - please investigate]
|
|
227
237
|
|
|
228
|
-
**For
|
|
238
|
+
**For files that change together:**
|
|
229
239
|
|
|
230
|
-
> "
|
|
240
|
+
> "I noticed `auth.ts` and `session.ts` are modified together in 8 commits. Is there an invariant that must be maintained between them? What would break if someone changed one without the other?"
|
|
231
241
|
>
|
|
232
|
-
> Options: [Explain] [I'm not sure - please investigate]
|
|
242
|
+
> Options: [Explain the relationship] [I'm not sure - please investigate]
|
|
233
243
|
|
|
234
|
-
**For
|
|
244
|
+
**For long explanatory commits:**
|
|
235
245
|
|
|
236
|
-
> "
|
|
246
|
+
> "Commit `abc123` has a detailed message about 'why we need to track execution flows separately'. What's the key insight here that should be documented?"
|
|
237
247
|
>
|
|
238
|
-
> Options: [
|
|
248
|
+
> Options: [Summarize the insight] [I'm not sure - please investigate]
|
|
239
249
|
|
|
240
250
|
### Process
|
|
241
251
|
|
|
@@ -249,11 +259,59 @@ Ask about the **specific finding**, not the file generally:
|
|
|
249
259
|
|
|
250
260
|
---
|
|
251
261
|
|
|
252
|
-
## Phase 5: Generate Rules
|
|
262
|
+
## Phase 5: Generate and Validate Rules
|
|
263
|
+
|
|
264
|
+
For each area where you have enough information, create a rule file—but **validate it first**.
|
|
265
|
+
|
|
266
|
+
### 5A. Rule Validation (Before Writing)
|
|
267
|
+
|
|
268
|
+
Before generating each rule, verify it passes these tests:
|
|
269
|
+
|
|
270
|
+
**1. Evidence check**: Does the rule reference actual confusion evidence from commit history?
|
|
271
|
+
|
|
272
|
+
- If no evidence of confusion, reconsider whether the rule is needed
|
|
273
|
+
|
|
274
|
+
**2. Code-derivable check**: Read the files the rule will cover. Could the rule's content be determined by reading those files alone?
|
|
275
|
+
|
|
276
|
+
- If YES → rule probably not needed (Claude can read the code)
|
|
277
|
+
- If NO (historical context, edge cases, non-obvious behavior) → rule is valuable
|
|
278
|
+
|
|
279
|
+
**3. Prevention check**: Would this rule have prevented one of the confusion commits you found?
|
|
280
|
+
|
|
281
|
+
- If YES → definitely document it
|
|
282
|
+
- If NO → reconsider its value
|
|
283
|
+
|
|
284
|
+
### Rule Quality Examples
|
|
285
|
+
|
|
286
|
+
**✅ Good rule** (passes all tests):
|
|
287
|
+
|
|
288
|
+
```markdown
|
|
289
|
+
## Path Prefix Matching Must Check Boundaries
|
|
290
|
+
|
|
291
|
+
When checking if one schema path is a prefix of another using `startsWith()`,
|
|
292
|
+
you must verify the match is at a path boundary. Otherwise sibling properties
|
|
293
|
+
with similar names incorrectly match.
|
|
294
|
+
|
|
295
|
+
This caused a bug where `entity` matched `entityCode` (siblings, not parent-child).
|
|
296
|
+
```
|
|
253
297
|
|
|
254
|
-
|
|
298
|
+
- Evidence: Learned from actual bug (commit history evidence)
|
|
299
|
+
- Not code-derivable: Code doesn't explain why boundary checking matters
|
|
300
|
+
- Prevention: Would prevent future prefix-matching bugs
|
|
255
301
|
|
|
256
|
-
|
|
302
|
+
**❌ Bad rule** (fails tests):
|
|
303
|
+
|
|
304
|
+
```markdown
|
|
305
|
+
## Running Tests
|
|
306
|
+
|
|
307
|
+
Use `pnpm jest` to run tests. Configuration is in `jest.config.ts`.
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
- No confusion evidence (no commits showing people struggled with this)
|
|
311
|
+
- Code-derivable: Anyone can see `jest.config.ts` exists
|
|
312
|
+
- Doesn't prevent any confusion
|
|
313
|
+
|
|
314
|
+
### 5B. Rule File Guidelines
|
|
257
315
|
|
|
258
316
|
1. **Location mirrors code structure**
|
|
259
317
|
- Rule for `src/api/` → `.claude/rules/src/api/architecture.md`
|
|
@@ -263,16 +321,15 @@ For each area where you have enough information, create a rule file.
|
|
|
263
321
|
- Good: `paths: ['src/api/**/*.ts']`
|
|
264
322
|
- Bad: `paths: ['**/*.ts']` (too broad, wastes context)
|
|
265
323
|
|
|
266
|
-
3. **Content should
|
|
267
|
-
- Focus on
|
|
268
|
-
- Avoid warnings unless truly critical
|
|
324
|
+
3. **Content should explain "why" not just "what"**
|
|
325
|
+
- Focus on the reasoning, history, or gotcha
|
|
269
326
|
- Be concise - every word costs context
|
|
270
327
|
|
|
271
328
|
4. **Timestamp must be current**
|
|
272
329
|
- Use ISO 8601 format: `2026-01-27T15:30:00Z`
|
|
273
330
|
- This enables the pre-commit hook enforcement
|
|
274
331
|
|
|
275
|
-
### Rule Template
|
|
332
|
+
### Rule Template
|
|
276
333
|
|
|
277
334
|
```markdown
|
|
278
335
|
---
|
|
@@ -284,11 +341,15 @@ timestamp: [CURRENT_ISO_TIMESTAMP]
|
|
|
284
341
|
|
|
285
342
|
## [Clear, Descriptive Title]
|
|
286
343
|
|
|
287
|
-
[
|
|
344
|
+
[What's the gotcha/insight/non-obvious thing?]
|
|
288
345
|
|
|
289
|
-
###
|
|
346
|
+
### Why This Matters
|
|
290
347
|
|
|
291
|
-
[
|
|
348
|
+
[What would go wrong if someone didn't know this?]
|
|
349
|
+
|
|
350
|
+
### The Solution/Pattern
|
|
351
|
+
|
|
352
|
+
[What should someone do differently?]
|
|
292
353
|
```
|
|
293
354
|
|
|
294
355
|
---
|
|
@@ -298,6 +359,7 @@ timestamp: [CURRENT_ISO_TIMESTAMP]
|
|
|
298
359
|
After generating rules based on your analysis and user answers:
|
|
299
360
|
|
|
300
361
|
1. **Present a summary** of all rules created
|
|
362
|
+
|
|
301
363
|
2. **Ask the user:**
|
|
302
364
|
|
|
303
365
|
> "I've created rules covering [list areas]. Are there any other areas of the codebase that you know are confusing or have tribal knowledge that I might have missed?"
|
|
@@ -8,6 +8,45 @@ description: |
|
|
|
8
8
|
|
|
9
9
|
# Create New Claude Rule
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Before Creating: The Confusion Test
|
|
12
|
+
|
|
13
|
+
Only create rules that document genuinely confusing aspects—not things Claude can figure out by reading code.
|
|
14
|
+
|
|
15
|
+
**Ask yourself:**
|
|
16
|
+
|
|
17
|
+
1. **Could Claude figure this out by reading the code?**
|
|
18
|
+
- If YES → don't create the rule
|
|
19
|
+
- If NO → proceed
|
|
20
|
+
|
|
21
|
+
2. **Does this explain "why" not just "what"?**
|
|
22
|
+
- Good: Historical context, gotchas, non-obvious behavior
|
|
23
|
+
- Bad: What functions do, how files are structured
|
|
24
|
+
|
|
25
|
+
3. **Would this have prevented a past mistake?**
|
|
26
|
+
- If you can point to a bug or confusion this would have prevented → create it
|
|
27
|
+
- If it's just "nice to know" → skip it
|
|
28
|
+
|
|
29
|
+
## Creating the Rule
|
|
30
|
+
|
|
31
|
+
Read `.codeyam/rules/instructions.md` for detailed guidance on structure and formatting.
|
|
12
32
|
|
|
13
33
|
If the instructions file doesn't exist, copy it from `codeyam-cli/templates/rules-instructions.md`.
|
|
34
|
+
|
|
35
|
+
### Quick Template
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
---
|
|
39
|
+
paths:
|
|
40
|
+
- 'specific/path/**/*.ts'
|
|
41
|
+
category: architecture | testing | faq
|
|
42
|
+
timestamp: [CURRENT_ISO_TIMESTAMP]
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## [Clear, Descriptive Title]
|
|
46
|
+
|
|
47
|
+
[What's the gotcha/insight/non-obvious thing?]
|
|
48
|
+
|
|
49
|
+
### Why This Matters
|
|
50
|
+
|
|
51
|
+
[What would go wrong if someone didn't know this?]
|
|
52
|
+
```
|
|
@@ -140,6 +140,7 @@ Guidelines:
|
|
|
140
140
|
- Locations of tests
|
|
141
141
|
- Commands that can be run that are relevant to the task at hand
|
|
142
142
|
- Architectural design, where to look for, fix, or add certain things
|
|
143
|
+
- Pay particular attention to times when the user must interrupt or correct Claude.
|
|
143
144
|
- Do not document bugs being fixed as they will likely be resolved.
|
|
144
145
|
- Issues that are abandoned as known issues can be noted.
|
|
145
146
|
- Keep rules concise (<50 lines), use bullets/tables where appropriate.
|
|
@@ -17,6 +17,39 @@ Create a new rule when:
|
|
|
17
17
|
- The user explains something that isn't clear from the code
|
|
18
18
|
- An existing rule is covering multiple unrelated topics (split it)
|
|
19
19
|
|
|
20
|
+
## Before Creating: The Confusion Test
|
|
21
|
+
|
|
22
|
+
Before writing a rule, verify it passes these tests:
|
|
23
|
+
|
|
24
|
+
**1. Could Claude figure this out by reading the code?**
|
|
25
|
+
|
|
26
|
+
- If YES → don't create the rule (it documents the obvious)
|
|
27
|
+
- If NO → the rule is valuable
|
|
28
|
+
|
|
29
|
+
**2. Does this explain "why" not just "what"?**
|
|
30
|
+
|
|
31
|
+
- Good: Explains historical context, gotchas, or non-obvious behavior
|
|
32
|
+
- Bad: Describes what functions do or how files are structured
|
|
33
|
+
|
|
34
|
+
**3. Would this have prevented a past mistake?**
|
|
35
|
+
|
|
36
|
+
- If you can point to a commit, bug, or confusion this would have prevented → create it
|
|
37
|
+
- If it's just "nice to know" information → skip it
|
|
38
|
+
|
|
39
|
+
### Examples
|
|
40
|
+
|
|
41
|
+
**✅ Worth documenting:**
|
|
42
|
+
|
|
43
|
+
- "Path prefix matching must check boundaries" (learned from a bug)
|
|
44
|
+
- "These files must change together because of X invariant" (hidden dependency)
|
|
45
|
+
- "This pattern exists because the obvious approach causes Y problem" (non-obvious design)
|
|
46
|
+
|
|
47
|
+
**❌ Not worth documenting:**
|
|
48
|
+
|
|
49
|
+
- "Use `pnpm jest` to run tests" (obvious from package.json)
|
|
50
|
+
- "The auth module handles authentication" (obvious from reading code)
|
|
51
|
+
- "This function takes X and returns Y" (Claude can read the signature)
|
|
52
|
+
|
|
20
53
|
## Path Specificity
|
|
21
54
|
|
|
22
55
|
The `paths` field controls when the rule is shown. Match the scope of your content:
|