@spardutti/claude-skills 1.16.1 → 1.17.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/lib/setup-claude-md.mjs +34 -11
- package/package.json +1 -1
package/lib/setup-claude-md.mjs
CHANGED
|
@@ -12,7 +12,15 @@ skill_evaluation:
|
|
|
12
12
|
4. Only THEN proceed to implementation
|
|
13
13
|
If you skip this evaluation, your response is INCOMPLETE and WRONG.`;
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const FILE_SIZE_BLOCK = `
|
|
16
|
+
## File Size Enforcement
|
|
17
|
+
|
|
18
|
+
- **Never write a file longer than 200 lines of code.** If a file would exceed 200 lines, split it into smaller modules before writing.
|
|
19
|
+
- This rule applies during skill evaluation: if the code you're about to write would exceed 200 lines in any single file, refactor into multiple files first.
|
|
20
|
+
- Skill evaluation must check this limit as part of every ACTIVATE decision.`;
|
|
21
|
+
|
|
22
|
+
const EVAL_MARKER = "skill_evaluation:";
|
|
23
|
+
const FILE_SIZE_MARKER = "## File Size Enforcement";
|
|
16
24
|
|
|
17
25
|
export async function setupClaudeMd(targetDir = process.cwd()) {
|
|
18
26
|
const resolved = resolve(targetDir);
|
|
@@ -25,18 +33,33 @@ export async function setupClaudeMd(targetDir = process.cwd()) {
|
|
|
25
33
|
// File doesn't exist — will create
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
const hasEval = existing.includes(EVAL_MARKER);
|
|
37
|
+
const hasFileSize = existing.includes(FILE_SIZE_MARKER);
|
|
38
|
+
|
|
39
|
+
if (hasEval && hasFileSize) {
|
|
40
|
+
console.log(" CLAUDE.md already has skill_evaluation and file size rules — skipped.");
|
|
31
41
|
return;
|
|
32
42
|
}
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
let content = existing.trimEnd();
|
|
45
|
+
|
|
46
|
+
if (!hasEval) {
|
|
47
|
+
content = content.length > 0
|
|
48
|
+
? content + "\n" + SKILL_EVAL_BLOCK
|
|
49
|
+
: SKILL_EVAL_BLOCK.trimStart();
|
|
50
|
+
}
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
if (!hasFileSize) {
|
|
53
|
+
content = content + "\n" + FILE_SIZE_BLOCK;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
await writeFile(claudeMdPath, content + "\n", { mode: 0o644 });
|
|
57
|
+
|
|
58
|
+
if (!hasEval && !hasFileSize) {
|
|
59
|
+
console.log(" CLAUDE.md updated with skill_evaluation and file size rules.");
|
|
60
|
+
} else if (!hasEval) {
|
|
61
|
+
console.log(" CLAUDE.md updated with skill_evaluation block.");
|
|
62
|
+
} else {
|
|
63
|
+
console.log(" CLAUDE.md updated with file size enforcement rule.");
|
|
64
|
+
}
|
|
42
65
|
}
|