@lenne.tech/cli 1.0.0 → 1.0.2
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/build/commands/claude/install-commands.js +337 -0
- package/build/commands/claude/install-mcps.js +256 -0
- package/build/commands/claude/install-skills.js +91 -20
- package/build/commands/server/add-property.js +22 -41
- package/build/extensions/server.js +142 -46
- package/build/lib/mcp-registry.js +71 -0
- package/build/templates/claude-commands/code-cleanup.md +82 -0
- package/build/templates/claude-commands/commit-message.md +21 -0
- package/build/templates/claude-commands/mr-description-clipboard.md +48 -0
- package/build/templates/claude-commands/mr-description.md +33 -0
- package/build/templates/claude-commands/sec-review.md +62 -0
- package/build/templates/claude-commands/skill-optimize.md +481 -0
- package/build/templates/claude-commands/test-generate.md +45 -0
- package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +265 -0
- package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +276 -0
- package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +182 -0
- package/build/templates/claude-skills/building-stories-with-tdd/examples.md +1383 -0
- package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +197 -0
- package/build/templates/claude-skills/building-stories-with-tdd/reference.md +1427 -0
- package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +307 -0
- package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +1004 -0
- package/build/templates/claude-skills/generating-nest-servers/SKILL.md +303 -0
- package/build/templates/claude-skills/generating-nest-servers/configuration.md +285 -0
- package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +133 -0
- package/build/templates/claude-skills/generating-nest-servers/description-management.md +226 -0
- package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/examples.md +138 -5
- package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +259 -0
- package/build/templates/claude-skills/generating-nest-servers/quality-review.md +864 -0
- package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/reference.md +83 -13
- package/build/templates/claude-skills/generating-nest-servers/security-rules.md +371 -0
- package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +262 -0
- package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +1061 -0
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/SKILL.md +22 -10
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/examples.md +7 -3
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/reference.md +10 -3
- package/package.json +2 -2
- package/build/templates/claude-skills/nest-server-generator/SKILL.md +0 -2833
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Perform security review of code changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Perform a complete security review:
|
|
6
|
+
|
|
7
|
+
## 🔐 1. Controller/Resolver Security
|
|
8
|
+
|
|
9
|
+
Check all modified Controller/Resolver files:
|
|
10
|
+
- [ ] Were @Restricted decorators removed or weakened?
|
|
11
|
+
- [ ] Were @Roles decorators made more permissive?
|
|
12
|
+
- [ ] Are there new endpoints without security decorators?
|
|
13
|
+
- [ ] Are the roles appropriate (not too open)?
|
|
14
|
+
|
|
15
|
+
## 🔐 2. Model Security
|
|
16
|
+
|
|
17
|
+
Check all modified Model files:
|
|
18
|
+
- [ ] Is securityCheck() method correctly implemented?
|
|
19
|
+
- [ ] Admin check: `user?.hasRole(RoleEnum.ADMIN)`
|
|
20
|
+
- [ ] Creator check: `equalIds(user, this.createdBy)`
|
|
21
|
+
- [ ] Were security checks weakened?
|
|
22
|
+
- [ ] Are sensitive properties protected with @Restricted?
|
|
23
|
+
|
|
24
|
+
## 🔐 3. Input Validation
|
|
25
|
+
|
|
26
|
+
Check all Input/DTO files:
|
|
27
|
+
- [ ] Are all inputs validated?
|
|
28
|
+
- [ ] Required fields correctly marked?
|
|
29
|
+
- [ ] Type safety ensured?
|
|
30
|
+
- [ ] No unsafe data types (e.g., any)?
|
|
31
|
+
|
|
32
|
+
## 🔐 4. Ownership & Authorization
|
|
33
|
+
|
|
34
|
+
Check service methods:
|
|
35
|
+
- [ ] Update/Delete: Ownership checks present?
|
|
36
|
+
- [ ] Check: `userId === object.createdBy` OR `user.isAdmin`
|
|
37
|
+
- [ ] serviceOptions.roles correctly set?
|
|
38
|
+
- [ ] No authorization bypasses?
|
|
39
|
+
|
|
40
|
+
## 🔐 5. Data Exposure
|
|
41
|
+
|
|
42
|
+
Check GraphQL/REST responses:
|
|
43
|
+
- [ ] Sensitive fields marked with `hideField: true`?
|
|
44
|
+
- [ ] Passwords/Tokens not in responses?
|
|
45
|
+
- [ ] securityCheck() filters correctly?
|
|
46
|
+
|
|
47
|
+
## 🔐 6. Test Coverage
|
|
48
|
+
|
|
49
|
+
Check tests:
|
|
50
|
+
- [ ] Security failure tests present (403 responses)?
|
|
51
|
+
- [ ] Tests with different roles (Admin, User, Other)?
|
|
52
|
+
- [ ] Ownership tests present?
|
|
53
|
+
|
|
54
|
+
## 📋 Report
|
|
55
|
+
|
|
56
|
+
Create a list of all findings:
|
|
57
|
+
- **Critical**: Severe security issues
|
|
58
|
+
- **Warning**: Potential problems
|
|
59
|
+
- **Info**: Improvement suggestions
|
|
60
|
+
- **OK**: Everything secure
|
|
61
|
+
|
|
62
|
+
**On Critical/Warning findings: STOP and inform the developer!**
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Optimize and validate Claude skill files against best practices
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze and optimize skill files for better Claude Code performance and compliance with official best practices.
|
|
6
|
+
|
|
7
|
+
## 🎯 Step 1: Fetch Latest Best Practices
|
|
8
|
+
|
|
9
|
+
**🚨 MANDATORY: Execute this step FIRST at every invocation!**
|
|
10
|
+
|
|
11
|
+
Use WebFetch to download current official requirements:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Extract and analyze:
|
|
18
|
+
- Current file size recommendations (lines/tokens)
|
|
19
|
+
- Frontmatter requirements (name, description formats)
|
|
20
|
+
- Naming conventions (gerund vs noun vs action forms)
|
|
21
|
+
- Progressive disclosure patterns
|
|
22
|
+
- Content quality requirements
|
|
23
|
+
- Anti-patterns to avoid
|
|
24
|
+
- Any new requirements since last check
|
|
25
|
+
|
|
26
|
+
## ✅ Step 2: Validate All Skills
|
|
27
|
+
|
|
28
|
+
Run automated validation checks on all skills in `src/templates/claude-skills/`:
|
|
29
|
+
|
|
30
|
+
### A. Frontmatter Validation
|
|
31
|
+
|
|
32
|
+
Check required YAML frontmatter fields:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
echo "=== Frontmatter Validation ==="
|
|
36
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
37
|
+
name=$(basename $(dirname "$skill"))
|
|
38
|
+
echo "--- $name ---"
|
|
39
|
+
|
|
40
|
+
# Check name field
|
|
41
|
+
skill_name=$(grep "^name:" "$skill" | cut -d: -f2 | tr -d ' ')
|
|
42
|
+
if [ -n "$skill_name" ]; then
|
|
43
|
+
# Validate format: lowercase, numbers, hyphens only, max 64 chars
|
|
44
|
+
if echo "$skill_name" | grep -qE '^[a-z0-9-]+$'; then
|
|
45
|
+
len=${#skill_name}
|
|
46
|
+
if [ "$len" -le 64 ]; then
|
|
47
|
+
echo "✅ name: $skill_name ($len chars)"
|
|
48
|
+
else
|
|
49
|
+
echo "❌ name: $skill_name (TOO LONG: $len chars, max 64)"
|
|
50
|
+
fi
|
|
51
|
+
else
|
|
52
|
+
echo "❌ name: $skill_name (INVALID: use lowercase, numbers, hyphens only)"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Check for reserved words
|
|
56
|
+
if echo "$skill_name" | grep -qE '(anthropic|claude)'; then
|
|
57
|
+
echo "⚠️ WARNING: name contains reserved word"
|
|
58
|
+
fi
|
|
59
|
+
else
|
|
60
|
+
echo "❌ name: MISSING"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Check description field
|
|
64
|
+
desc=$(grep "^description:" "$skill" | cut -d: -f2-)
|
|
65
|
+
if [ -n "$desc" ]; then
|
|
66
|
+
desc_len=${#desc}
|
|
67
|
+
if [ "$desc_len" -le 1024 ]; then
|
|
68
|
+
echo "✅ description: $desc_len chars"
|
|
69
|
+
|
|
70
|
+
# Check for first/second person (should be third person)
|
|
71
|
+
if echo "$desc" | grep -qiE '\b(I|you|your|my)\b'; then
|
|
72
|
+
echo "⚠️ WARNING: description uses first/second person (should be third person)"
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Check for vagueness
|
|
76
|
+
if echo "$desc" | grep -qiE '\b(helps|processes|manages|handles)\s+(with|data|files)?\s*$'; then
|
|
77
|
+
echo "⚠️ WARNING: description may be too vague (add specifics and trigger terms)"
|
|
78
|
+
fi
|
|
79
|
+
else
|
|
80
|
+
echo "❌ description: TOO LONG ($desc_len chars, max 1024)"
|
|
81
|
+
fi
|
|
82
|
+
else
|
|
83
|
+
echo "❌ description: MISSING"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
echo ""
|
|
87
|
+
done
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Validation criteria:**
|
|
91
|
+
- [ ] `name` exists, lowercase/numbers/hyphens only, max 64 chars
|
|
92
|
+
- [ ] `name` doesn't contain reserved words ("anthropic", "claude")
|
|
93
|
+
- [ ] `description` exists, max 1024 chars
|
|
94
|
+
- [ ] `description` in third person (not "I" or "you")
|
|
95
|
+
- [ ] `description` includes specific actions and trigger terms
|
|
96
|
+
- [ ] No XML tags in either field
|
|
97
|
+
|
|
98
|
+
### B. File Size Validation
|
|
99
|
+
|
|
100
|
+
**Official guideline: SKILL.md body < 500 lines**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
echo "=== File Size Validation ==="
|
|
104
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
105
|
+
name=$(basename $(dirname "$skill"))
|
|
106
|
+
|
|
107
|
+
# Count body lines (excluding frontmatter)
|
|
108
|
+
frontmatter_end=$(grep -n "^---$" "$skill" | tail -1 | cut -d: -f1)
|
|
109
|
+
body_lines=$(tail -n +$((frontmatter_end + 1)) "$skill" | wc -l)
|
|
110
|
+
|
|
111
|
+
printf "%-30s %5d lines " "$name:" "$body_lines"
|
|
112
|
+
|
|
113
|
+
if [ "$body_lines" -lt 500 ]; then
|
|
114
|
+
echo "✅ OPTIMAL"
|
|
115
|
+
elif [ "$body_lines" -lt 800 ]; then
|
|
116
|
+
echo "⚠️ ACCEPTABLE (consider optimization)"
|
|
117
|
+
else
|
|
118
|
+
echo "❌ TOO LARGE (needs optimization)"
|
|
119
|
+
fi
|
|
120
|
+
done
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Size targets:**
|
|
124
|
+
- ✅ **Optimal:** < 500 lines (Claude official recommendation)
|
|
125
|
+
- ⚠️ **Acceptable:** 500-800 lines (borderline)
|
|
126
|
+
- ❌ **Too Large:** > 800 lines (MUST optimize)
|
|
127
|
+
|
|
128
|
+
### C. Progressive Disclosure Check
|
|
129
|
+
|
|
130
|
+
**Official requirement: One-level-deep references only**
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
echo "=== Progressive Disclosure Check ==="
|
|
134
|
+
for skill_dir in src/templates/claude-skills/*/; do
|
|
135
|
+
skill_name=$(basename "$skill_dir")
|
|
136
|
+
echo "=== $skill_name ==="
|
|
137
|
+
|
|
138
|
+
# Count reference files (one level deep)
|
|
139
|
+
ref_files=$(find "$skill_dir" -maxdepth 1 -name "*.md" ! -name "SKILL.md")
|
|
140
|
+
ref_count=$(echo "$ref_files" | grep -c ".")
|
|
141
|
+
|
|
142
|
+
if [ "$ref_count" -gt 0 ]; then
|
|
143
|
+
echo "📄 Reference files: $ref_count"
|
|
144
|
+
echo "$ref_files" | while read -r file; do
|
|
145
|
+
filename=$(basename "$file")
|
|
146
|
+
lines=$(wc -l < "$file")
|
|
147
|
+
|
|
148
|
+
# Check if file > 100 lines should have TOC
|
|
149
|
+
if [ "$lines" -gt 100 ]; then
|
|
150
|
+
if grep -q "^## Table of Contents" "$file" || grep -q "^# Table of Contents" "$file"; then
|
|
151
|
+
echo " ✅ $filename ($lines lines, has TOC)"
|
|
152
|
+
else
|
|
153
|
+
echo " ⚠️ $filename ($lines lines, needs TOC)"
|
|
154
|
+
fi
|
|
155
|
+
else
|
|
156
|
+
echo " ✅ $filename ($lines lines)"
|
|
157
|
+
fi
|
|
158
|
+
done
|
|
159
|
+
else
|
|
160
|
+
echo "📄 Reference files: 0"
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# Check for nested files (anti-pattern)
|
|
164
|
+
nested=$(find "$skill_dir" -mindepth 2 -name "*.md" 2>/dev/null)
|
|
165
|
+
if [ -n "$nested" ]; then
|
|
166
|
+
echo " ❌ WARNING: Nested files found (avoid deep nesting):"
|
|
167
|
+
echo "$nested" | sed 's/^/ /'
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Check for Windows-style paths in SKILL.md
|
|
171
|
+
if grep -q '\\' "$skill_dir/SKILL.md"; then
|
|
172
|
+
echo " ⚠️ WARNING: Windows-style backslashes found (use forward slashes)"
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
echo ""
|
|
176
|
+
done
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Rules:**
|
|
180
|
+
- ✅ Reference files one level deep from SKILL.md
|
|
181
|
+
- ✅ Files > 100 lines have table of contents
|
|
182
|
+
- ✅ Forward slashes in all paths
|
|
183
|
+
- ✅ Descriptive file names (not `doc1.md`, `utils.md`)
|
|
184
|
+
- ❌ No nested references (file → file → file)
|
|
185
|
+
|
|
186
|
+
### D. Naming Convention Check
|
|
187
|
+
|
|
188
|
+
**Recommended: Gerund form (processing-pdfs, analyzing-data)**
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
echo "=== Naming Convention Check ==="
|
|
192
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
193
|
+
skill_name=$(grep "^name:" "$skill" | cut -d: -f2 | tr -d ' ')
|
|
194
|
+
|
|
195
|
+
# Check if gerund form (-ing)
|
|
196
|
+
if echo "$skill_name" | grep -qE -- '-(ing|izing|ising)(-|$)'; then
|
|
197
|
+
echo "✅ $skill_name (gerund form - recommended)"
|
|
198
|
+
# Check if action-oriented
|
|
199
|
+
elif echo "$skill_name" | grep -qE '^(process|analyze|manage|generate|create|build|test)-'; then
|
|
200
|
+
echo "⚠️ $skill_name (action-oriented - acceptable)"
|
|
201
|
+
# Check if noun phrase
|
|
202
|
+
elif echo "$skill_name" | grep -qE -- '-ing$'; then
|
|
203
|
+
echo "✅ $skill_name (noun phrase with -ing - acceptable)"
|
|
204
|
+
else
|
|
205
|
+
# Check for anti-patterns
|
|
206
|
+
if echo "$skill_name" | grep -qE '^(helper|utils|tools|common)'; then
|
|
207
|
+
echo "❌ $skill_name (VAGUE: avoid helper/utils/tools)"
|
|
208
|
+
else
|
|
209
|
+
echo "⚠️ $skill_name (consider gerund form: ${skill_name}ing or processing-${skill_name})"
|
|
210
|
+
fi
|
|
211
|
+
fi
|
|
212
|
+
done
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### E. Content Quality Scan
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
echo "=== Content Quality Scan ==="
|
|
219
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
220
|
+
name=$(basename $(dirname "$skill"))
|
|
221
|
+
echo "--- $name ---"
|
|
222
|
+
|
|
223
|
+
# Check for common anti-patterns
|
|
224
|
+
if grep -qi "magic number" "$skill"; then
|
|
225
|
+
echo "⚠️ Uses term 'magic number' - ensure values are justified"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
if grep -qE '\b(TODO|FIXME|XXX)\b' "$skill"; then
|
|
229
|
+
echo "⚠️ Contains TODO/FIXME markers"
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
if grep -q "as of [0-9][0-9][0-9][0-9]" "$skill"; then
|
|
233
|
+
echo "⚠️ Contains time-sensitive information (use 'old patterns' section)"
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
# Check for inconsistent terminology
|
|
237
|
+
if grep -qi "repository" "$skill" && grep -qi "repo" "$skill"; then
|
|
238
|
+
echo "⚠️ Inconsistent terminology: 'repository' and 'repo' both used"
|
|
239
|
+
fi
|
|
240
|
+
|
|
241
|
+
echo ""
|
|
242
|
+
done
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## 📊 Step 3: Compare Against Fetched Best Practices
|
|
246
|
+
|
|
247
|
+
Cross-reference validation results with the best practices document from Step 1:
|
|
248
|
+
|
|
249
|
+
1. **Verify size limits:** Still 500 lines body?
|
|
250
|
+
2. **Check naming:** Still gerund-preferred?
|
|
251
|
+
3. **Review frontmatter:** Any new required fields?
|
|
252
|
+
4. **Scan anti-patterns:** Any new patterns to avoid?
|
|
253
|
+
5. **Note changes:** Document differences from current implementation
|
|
254
|
+
|
|
255
|
+
If official guidelines have changed, update validation criteria accordingly.
|
|
256
|
+
|
|
257
|
+
## 🔧 Step 4: Optimization (If Needed)
|
|
258
|
+
|
|
259
|
+
For skills > 500 lines, perform extraction:
|
|
260
|
+
|
|
261
|
+
### A. Identify Large Sections
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Analyze section sizes in oversized SKILL.md
|
|
265
|
+
awk '/^## / {
|
|
266
|
+
if (prev) print prev " " NR-start " lines"
|
|
267
|
+
prev=$0
|
|
268
|
+
start=NR
|
|
269
|
+
}
|
|
270
|
+
END {
|
|
271
|
+
if (prev) print prev " " NR-start " lines"
|
|
272
|
+
}' SKILL.md | sort -t' ' -k3 -rn
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Candidates for extraction (> 100 lines):**
|
|
276
|
+
- Detailed workflows and processes
|
|
277
|
+
- Extensive example collections
|
|
278
|
+
- Long checklists
|
|
279
|
+
- Reference tables
|
|
280
|
+
- Troubleshooting guides
|
|
281
|
+
- Historical context sections
|
|
282
|
+
|
|
283
|
+
### B. Extract Content
|
|
284
|
+
|
|
285
|
+
**1. Create reference file:**
|
|
286
|
+
|
|
287
|
+
```markdown
|
|
288
|
+
---
|
|
289
|
+
name: skill-name-topic
|
|
290
|
+
description: Detailed [topic] for skill-name skill
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
# [Topic Title]
|
|
294
|
+
|
|
295
|
+
## Table of Contents
|
|
296
|
+
(If file > 100 lines, REQUIRED)
|
|
297
|
+
|
|
298
|
+
[Content extracted from SKILL.md]
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**2. Replace in SKILL.md:**
|
|
302
|
+
|
|
303
|
+
```markdown
|
|
304
|
+
## [Topic]
|
|
305
|
+
|
|
306
|
+
**📖 Complete [topic] details: `topic-name.md`**
|
|
307
|
+
|
|
308
|
+
**Quick overview:**
|
|
309
|
+
- Essential point 1
|
|
310
|
+
- Essential point 2
|
|
311
|
+
- Essential point 3
|
|
312
|
+
|
|
313
|
+
**Critical checklist:**
|
|
314
|
+
- [ ] Must-know item 1
|
|
315
|
+
- [ ] Must-know item 2
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### C. Keep vs Extract
|
|
319
|
+
|
|
320
|
+
**Keep in SKILL.md:**
|
|
321
|
+
- Core workflow (numbered steps)
|
|
322
|
+
- Critical warnings
|
|
323
|
+
- "When to Use" section
|
|
324
|
+
- Quick command reference
|
|
325
|
+
- Essential checklists (< 10 items)
|
|
326
|
+
|
|
327
|
+
**Extract to separate files:**
|
|
328
|
+
- Detailed workflows (> 100 lines)
|
|
329
|
+
- Extensive examples (> 50 lines)
|
|
330
|
+
- Reference documentation
|
|
331
|
+
- Troubleshooting guides
|
|
332
|
+
- Historical "old patterns" sections
|
|
333
|
+
|
|
334
|
+
## 📋 Step 5: Generate Report
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
echo "=================================="
|
|
338
|
+
echo " Skill Validation Report"
|
|
339
|
+
echo "=================================="
|
|
340
|
+
echo ""
|
|
341
|
+
echo "📊 Summary:"
|
|
342
|
+
total=$(find src/templates/claude-skills -name "SKILL.md" | wc -l)
|
|
343
|
+
echo "Total skills validated: $total"
|
|
344
|
+
echo ""
|
|
345
|
+
|
|
346
|
+
echo "📏 Size Distribution:"
|
|
347
|
+
optimal=0
|
|
348
|
+
acceptable=0
|
|
349
|
+
too_large=0
|
|
350
|
+
|
|
351
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
352
|
+
frontmatter_end=$(grep -n "^---$" "$skill" | tail -1 | cut -d: -f1)
|
|
353
|
+
body_lines=$(tail -n +$((frontmatter_end + 1)) "$skill" | wc -l)
|
|
354
|
+
|
|
355
|
+
if [ "$body_lines" -lt 500 ]; then
|
|
356
|
+
optimal=$((optimal + 1))
|
|
357
|
+
elif [ "$body_lines" -lt 800 ]; then
|
|
358
|
+
acceptable=$((acceptable + 1))
|
|
359
|
+
else
|
|
360
|
+
too_large=$((too_large + 1))
|
|
361
|
+
fi
|
|
362
|
+
done
|
|
363
|
+
|
|
364
|
+
echo " ✅ Optimal (< 500 lines): $optimal"
|
|
365
|
+
echo " ⚠️ Acceptable (500-800): $acceptable"
|
|
366
|
+
echo " ❌ Too large (> 800): $too_large"
|
|
367
|
+
echo ""
|
|
368
|
+
|
|
369
|
+
echo "📋 Frontmatter Compliance:"
|
|
370
|
+
complete=0
|
|
371
|
+
incomplete=0
|
|
372
|
+
|
|
373
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
374
|
+
if grep -q "^name:" "$skill" && grep -q "^description:" "$skill"; then
|
|
375
|
+
complete=$((complete + 1))
|
|
376
|
+
else
|
|
377
|
+
incomplete=$((incomplete + 1))
|
|
378
|
+
fi
|
|
379
|
+
done
|
|
380
|
+
|
|
381
|
+
echo " ✅ Complete: $complete"
|
|
382
|
+
echo " ❌ Incomplete: $incomplete"
|
|
383
|
+
echo ""
|
|
384
|
+
|
|
385
|
+
echo "🔍 Issues Requiring Attention:"
|
|
386
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
387
|
+
name=$(basename $(dirname "$skill"))
|
|
388
|
+
issues=""
|
|
389
|
+
|
|
390
|
+
# Check size
|
|
391
|
+
frontmatter_end=$(grep -n "^---$" "$skill" | tail -1 | cut -d: -f1)
|
|
392
|
+
body_lines=$(tail -n +$((frontmatter_end + 1)) "$skill" | wc -l)
|
|
393
|
+
if [ "$body_lines" -gt 800 ]; then
|
|
394
|
+
issues="${issues}- Size: $body_lines lines (optimize)\n"
|
|
395
|
+
fi
|
|
396
|
+
|
|
397
|
+
# Check frontmatter
|
|
398
|
+
if ! grep -q "^name:" "$skill"; then
|
|
399
|
+
issues="${issues}- Missing 'name' field\n"
|
|
400
|
+
fi
|
|
401
|
+
if ! grep -q "^description:" "$skill"; then
|
|
402
|
+
issues="${issues}- Missing 'description' field\n"
|
|
403
|
+
fi
|
|
404
|
+
|
|
405
|
+
# Check naming
|
|
406
|
+
skill_name=$(grep "^name:" "$skill" | cut -d: -f2 | tr -d ' ')
|
|
407
|
+
if echo "$skill_name" | grep -qE '^(helper|utils|tools)'; then
|
|
408
|
+
issues="${issues}- Vague name: $skill_name\n"
|
|
409
|
+
fi
|
|
410
|
+
|
|
411
|
+
if [ -n "$issues" ]; then
|
|
412
|
+
echo ""
|
|
413
|
+
echo "$name:"
|
|
414
|
+
echo -e "$issues"
|
|
415
|
+
fi
|
|
416
|
+
done
|
|
417
|
+
|
|
418
|
+
echo ""
|
|
419
|
+
echo "=================================="
|
|
420
|
+
echo "✅ Validation Complete"
|
|
421
|
+
echo "=================================="
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## 🎯 Step 6: Action Items
|
|
425
|
+
|
|
426
|
+
Based on validation, create specific action items for each skill needing work:
|
|
427
|
+
|
|
428
|
+
**Priority 1 (Critical):**
|
|
429
|
+
- Missing frontmatter fields → Add immediately
|
|
430
|
+
- Invalid name format → Fix format
|
|
431
|
+
- > 800 lines → Extract content
|
|
432
|
+
|
|
433
|
+
**Priority 2 (Important):**
|
|
434
|
+
- 500-800 lines → Consider extraction
|
|
435
|
+
- Vague descriptions → Add specifics and trigger terms
|
|
436
|
+
- Missing TOC in large files → Add table of contents
|
|
437
|
+
|
|
438
|
+
**Priority 3 (Nice to have):**
|
|
439
|
+
- Improve naming (→ gerund form)
|
|
440
|
+
- Add concrete examples
|
|
441
|
+
- Fix inconsistent terminology
|
|
442
|
+
|
|
443
|
+
## ✅ Step 7: Verification
|
|
444
|
+
|
|
445
|
+
Before completing, verify:
|
|
446
|
+
- [ ] All skills have valid frontmatter (name + description)
|
|
447
|
+
- [ ] All descriptions in third person with trigger terms
|
|
448
|
+
- [ ] All names follow format (lowercase, hyphens, max 64 chars)
|
|
449
|
+
- [ ] All SKILL.md files < 800 lines (ideally < 500)
|
|
450
|
+
- [ ] Reference files > 100 lines have table of contents
|
|
451
|
+
- [ ] No deeply nested file references
|
|
452
|
+
- [ ] All paths use forward slashes
|
|
453
|
+
- [ ] No vague names (helper, utils, tools)
|
|
454
|
+
- [ ] Cross-referenced with latest best practices from Step 1
|
|
455
|
+
|
|
456
|
+
## 📚 References
|
|
457
|
+
|
|
458
|
+
Official documentation:
|
|
459
|
+
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
|
|
460
|
+
- https://www.anthropic.com/engineering/claude-code-best-practices
|
|
461
|
+
|
|
462
|
+
## 💡 Tips for Command Execution
|
|
463
|
+
|
|
464
|
+
**For autonomous execution:**
|
|
465
|
+
1. Start with WebFetch in Step 1 (MANDATORY)
|
|
466
|
+
2. Run all validation scripts sequentially
|
|
467
|
+
3. Generate full report in Step 5
|
|
468
|
+
4. List specific action items for each skill
|
|
469
|
+
5. Provide clear next steps to user
|
|
470
|
+
|
|
471
|
+
**For interactive use:**
|
|
472
|
+
- Show progress between steps
|
|
473
|
+
- Highlight critical issues immediately
|
|
474
|
+
- Provide examples of good fixes
|
|
475
|
+
- Ask for clarification on borderline cases
|
|
476
|
+
|
|
477
|
+
**Success indicators:**
|
|
478
|
+
- All skills pass frontmatter validation
|
|
479
|
+
- 80%+ skills under 500 lines
|
|
480
|
+
- All issues documented with action items
|
|
481
|
+
- Report includes comparison with latest best practices
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate comprehensive tests for changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze recent changes and create appropriate tests:
|
|
6
|
+
|
|
7
|
+
1. **Identify all changed/new modules**:
|
|
8
|
+
```bash
|
|
9
|
+
git status --short
|
|
10
|
+
git diff --name-only
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **For each new module** in `src/server/modules/`:
|
|
14
|
+
- Create E2E test in `tests/modules/<module-name>.e2e-spec.ts`
|
|
15
|
+
- Analyze existing tests as templates
|
|
16
|
+
- Fully understand TestHelper (read source code)
|
|
17
|
+
|
|
18
|
+
3. **For each modified module**:
|
|
19
|
+
- Update existing test in `tests/modules/`
|
|
20
|
+
- Test new/changed properties
|
|
21
|
+
- Test changed validations
|
|
22
|
+
|
|
23
|
+
4. **Security Testing**:
|
|
24
|
+
- Check @Restricted/@Roles decorators
|
|
25
|
+
- Test with Admin User (user.roles contains 'admin')
|
|
26
|
+
- Test with Creator (user.id === object.createdBy)
|
|
27
|
+
- Test with Other User (should fail with 403)
|
|
28
|
+
- Test permission failures
|
|
29
|
+
|
|
30
|
+
5. **Test Execution**:
|
|
31
|
+
```bash
|
|
32
|
+
npm run test:e2e
|
|
33
|
+
```
|
|
34
|
+
- On errors: Debug with console.log
|
|
35
|
+
- Fix errors
|
|
36
|
+
- Re-run tests
|
|
37
|
+
|
|
38
|
+
6. **Cleanup**:
|
|
39
|
+
- Remove all console.log statements
|
|
40
|
+
- Verify tests still pass
|
|
41
|
+
|
|
42
|
+
**Important:**
|
|
43
|
+
- NEVER weaken @Restricted/@Roles to fix tests
|
|
44
|
+
- ALWAYS test with least privileged user
|
|
45
|
+
- ALWAYS follow existing test patterns
|