claude-skills-cli 0.0.3 → 0.0.5

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.
Files changed (37) hide show
  1. package/README.md +59 -226
  2. package/dist/commands/init.js +29 -20
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/commands/install.js +69 -0
  5. package/dist/commands/install.js.map +1 -0
  6. package/dist/commands/package.js +5 -9
  7. package/dist/commands/package.js.map +1 -1
  8. package/dist/commands/stats.js +154 -0
  9. package/dist/commands/stats.js.map +1 -0
  10. package/dist/commands/validate.js +1 -1
  11. package/dist/commands/validate.js.map +1 -1
  12. package/dist/core/templates.js +63 -12
  13. package/dist/core/templates.js.map +1 -1
  14. package/dist/core/validator.js +31 -10
  15. package/dist/core/validator.js.map +1 -1
  16. package/dist/index.js +28 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/skills/skill-creator/SKILL.md +143 -0
  19. package/dist/skills/skill-creator/references/anthropic-resources.md +504 -0
  20. package/dist/skills/skill-creator/references/cli-reference.md +507 -0
  21. package/dist/skills/skill-creator/references/skill-examples.md +413 -0
  22. package/{skills → dist/skills}/skill-creator/references/writing-guide.md +156 -131
  23. package/dist/skills/skill-creator/skill-creator/SKILL.md +143 -0
  24. package/dist/skills/skill-creator/skill-creator/references/anthropic-resources.md +504 -0
  25. package/dist/skills/skill-creator/skill-creator/references/cli-reference.md +507 -0
  26. package/dist/skills/skill-creator/skill-creator/references/skill-examples.md +413 -0
  27. package/dist/skills/skill-creator/skill-creator/references/writing-guide.md +619 -0
  28. package/dist/utils/fs.js +2 -2
  29. package/dist/utils/fs.js.map +1 -1
  30. package/dist/utils/output.js +2 -1
  31. package/dist/utils/output.js.map +1 -1
  32. package/docs/SKILL-DEVELOPMENT.md +38 -35
  33. package/docs/SKILL-EXAMPLES.md +73 -63
  34. package/docs/SKILLS-ARCHITECTURE.md +42 -41
  35. package/package.json +2 -2
  36. package/skills/skill-creator/SKILL.md +0 -345
  37. package/skills/skill-creator/references/skill-examples.md +0 -403
@@ -0,0 +1,507 @@
1
+ # claude-skills-cli Reference
2
+
3
+ Complete command-line reference for the `claude-skills-cli` tool
4
+ (TypeScript/Node).
5
+
6
+ ## Installation
7
+
8
+ ### Global Installation
9
+
10
+ ```bash
11
+ npm install -g claude-skills-cli
12
+ claude-skills --version
13
+ ```
14
+
15
+ ### Using npx (No Installation)
16
+
17
+ ```bash
18
+ npx claude-skills <command>
19
+ ```
20
+
21
+ ### Using pnpm
22
+
23
+ ```bash
24
+ pnpx claude-skills-cli <command>
25
+ ```
26
+
27
+ ### As Dev Dependency
28
+
29
+ ```bash
30
+ npm install --save-dev claude-skills-cli
31
+
32
+ # Use via package.json scripts
33
+ {
34
+ "scripts": {
35
+ "skill:init": "claude-skills init",
36
+ "skill:validate": "claude-skills validate",
37
+ "skill:package": "claude-skills package"
38
+ }
39
+ }
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Commands
45
+
46
+ ### `init` - Create New Skill
47
+
48
+ Create a new skill directory with standard structure.
49
+
50
+ #### Syntax
51
+
52
+ ```bash
53
+ claude-skills init [options]
54
+ ```
55
+
56
+ #### Options
57
+
58
+ | Option | Type | Required | Description |
59
+ | ---------------------- | ------ | -------- | ---------------------------------------------------- |
60
+ | `--name <name>` | string | Yes\* | Skill name (kebab-case, lowercase) |
61
+ | `--description <desc>` | string | No | Skill description (default: "TODO: Add description") |
62
+ | `--path <path>` | string | No | Custom path (mutually exclusive with --name) |
63
+
64
+ \*Either `--name` or `--path` must be provided
65
+
66
+ #### Examples
67
+
68
+ ```bash
69
+ # Create skill with default location (.claude/skills/)
70
+ npx claude-skills init --name my-skill
71
+
72
+ # With description
73
+ npx claude-skills init --name my-skill \
74
+ --description "SQLite queries. Use when writing database operations"
75
+
76
+ # Custom path
77
+ npx claude-skills init --path /custom/path/my-skill
78
+
79
+ # Custom path with description
80
+ npx claude-skills init --path /custom/path/my-skill \
81
+ --description "Brief description"
82
+ ```
83
+
84
+ #### Created Structure
85
+
86
+ ```
87
+ .claude/skills/my-skill/
88
+ ├── SKILL.md # Main skill instructions
89
+ ├── README.md # Skill documentation
90
+ └── references/ # Level 3 detailed documentation
91
+ ```
92
+
93
+ #### Name Validation
94
+
95
+ - Must be lowercase
96
+ - Must be kebab-case (alphanumeric with hyphens)
97
+ - No spaces or special characters
98
+ - Example valid names: `database-queries`, `auth-patterns`,
99
+ `ui-components`
100
+
101
+ #### Output
102
+
103
+ ```
104
+ ✅ Skill created at: .claude/skills/my-skill
105
+
106
+ Next steps:
107
+ 1. Edit .claude/skills/my-skill/SKILL.md with your skill instructions
108
+ 2. Add detailed documentation to references/
109
+ 3. Add executable scripts to scripts/
110
+ 4. Remove example files you don't need
111
+
112
+ Validate with: claude-skills validate .claude/skills/my-skill
113
+ ```
114
+
115
+ ---
116
+
117
+ ### `validate` - Validate Skill Structure
118
+
119
+ Validate skill structure and progressive disclosure compliance.
120
+
121
+ #### Syntax
122
+
123
+ ```bash
124
+ claude-skills validate <skill_path> [options]
125
+ ```
126
+
127
+ #### Arguments
128
+
129
+ | Argument | Type | Required | Description |
130
+ | -------------- | ------ | -------- | ----------------------- |
131
+ | `<skill_path>` | string | Yes | Path to skill directory |
132
+
133
+ #### Options
134
+
135
+ | Option | Type | Description |
136
+ | ---------- | ------- | -------------------------------------- |
137
+ | `--strict` | boolean | Treat warnings as errors (exit code 1) |
138
+
139
+ #### Examples
140
+
141
+ ```bash
142
+ # Validate skill
143
+ npx claude-skills validate .claude/skills/my-skill
144
+
145
+ # Strict mode (warnings = errors)
146
+ npx claude-skills validate .claude/skills/my-skill --strict
147
+
148
+ # Validate multiple skills
149
+ npx claude-skills validate .claude/skills/skill-1
150
+ npx claude-skills validate .claude/skills/skill-2
151
+ ```
152
+
153
+ #### Validation Checks
154
+
155
+ **Level 1 (Metadata):**
156
+
157
+ - Description length: <200 chars (optimal), <300 chars (warning),
158
+ <1024 chars (max)
159
+ - Description includes trigger keywords ("Use when...", "Use for...",
160
+ "Use to...")
161
+ - Description comma count (warns if >3, suggesting list bloat)
162
+ - Name format (lowercase, kebab-case)
163
+ - Name length (<64 chars)
164
+ - Name matches directory name
165
+
166
+ **Level 2 (SKILL.md Body):**
167
+
168
+ - Line count: ~50 (optimal), <80 (good), <150 (warning)
169
+ - Word count: <1000 (optimal), <5000 (max)
170
+ - Code blocks: 1-2 (optimal), ≤3 (good), >3 (warning)
171
+ - Sections: 3-5 (optimal), ≤8 (good), >8 (warning)
172
+ - Long paragraphs: ≤3 (warns if >3 paragraphs over 100 words)
173
+ - "Quick Start" section present
174
+ - Links to references/ when body is long (>60 lines)
175
+ - No TODO placeholders
176
+
177
+ **Level 3 (References):**
178
+
179
+ - Referenced files exist (errors on broken links)
180
+ - No empty directories (warnings)
181
+ - Scripts are executable (warnings)
182
+ - Scripts have shebang (#!)
183
+
184
+ #### Output Format
185
+
186
+ **Valid Skill:**
187
+
188
+ ```
189
+ ✅ Skill is valid!
190
+
191
+ 📊 Progressive Disclosure Stats:
192
+
193
+ Level 1 (Metadata - Always Loaded):
194
+ Description: 156 chars, ~18 tokens ✅ Optimal
195
+ (Target: <200 chars, <30 tokens for Level 1 efficiency)
196
+
197
+ Level 2 (SKILL.md Body - Loaded when triggered):
198
+ Lines: 48 (target: ~50, max: ~150) ✅ Excellent
199
+ Words: 342 (recommended: <1000, max: <5000) ✅ Excellent
200
+ Est. tokens: ~445 (budget: <6500) within budget
201
+ Code blocks: 1 ✅
202
+ Sections: 5 ✅
203
+
204
+ Level 3+ (References - Loaded as needed):
205
+ Use references/ directory for detailed docs (unlimited size)
206
+
207
+ Overall Assessment:
208
+ ✅ Excellent progressive disclosure!
209
+ ```
210
+
211
+ **With Warnings:**
212
+
213
+ ```
214
+ ⚠️ Skill is valid (with warnings)
215
+
216
+ ⚠️ Warnings:
217
+ ⚠️ Description contains long lists (5 commas)
218
+ → Move detailed lists to Level 2 (SKILL.md body) or Level 3 (references/)
219
+ ⚠️ SKILL.md body is 85 lines (recommended: ~50, max: ~80)
220
+ → Consider moving detailed examples to references/ for Level 3 loading
221
+
222
+ 📊 Progressive Disclosure Stats:
223
+ [... stats output ...]
224
+ ```
225
+
226
+ **With Errors:**
227
+
228
+ ```
229
+ ❌ Skill validation failed
230
+
231
+ ❌ Errors:
232
+ ❌ Referenced file not found: references/examples.md
233
+ → Linked from: [references/examples.md]
234
+ → Create the file or remove the broken link
235
+ ❌ Description too long (max 1024 chars per Anthropic): 1250
236
+
237
+ 📊 Progressive Disclosure Stats:
238
+ [... stats output ...]
239
+ ```
240
+
241
+ #### Exit Codes
242
+
243
+ | Code | Meaning |
244
+ | ---- | --------------------------------------------- |
245
+ | 0 | Valid (no errors) |
246
+ | 1 | Invalid (has errors) |
247
+ | 1 | Valid but has warnings (only with `--strict`) |
248
+
249
+ ---
250
+
251
+ ### `package` - Create Distribution Zip
252
+
253
+ Package skill into a zip file for distribution.
254
+
255
+ #### Syntax
256
+
257
+ ```bash
258
+ claude-skills package <skill_path> [options]
259
+ ```
260
+
261
+ #### Arguments
262
+
263
+ | Argument | Type | Required | Description |
264
+ | -------------- | ------ | -------- | ----------------------- |
265
+ | `<skill_path>` | string | Yes | Path to skill directory |
266
+
267
+ #### Options
268
+
269
+ | Option | Type | Description |
270
+ | ------------------- | ------- | ----------------------------------- |
271
+ | `--output <path>` | string | Output directory (default: `dist/`) |
272
+ | `--skip-validation` | boolean | Skip validation before packaging |
273
+
274
+ #### Examples
275
+
276
+ ```bash
277
+ # Package skill (validates first)
278
+ npx claude-skills package .claude/skills/my-skill
279
+
280
+ # Custom output directory
281
+ npx claude-skills package .claude/skills/my-skill --output builds/
282
+
283
+ # Skip validation (not recommended)
284
+ npx claude-skills package .claude/skills/my-skill --skip-validation
285
+ ```
286
+
287
+ #### Excluded Files
288
+
289
+ The packager automatically excludes:
290
+
291
+ - Hidden files (`.gitignore`, `.git/`, `.env`, etc.)
292
+ - Editor temp files (`.swp`, `~`, `.bak`)
293
+ - OS files (`.DS_Store`)
294
+
295
+ #### Output
296
+
297
+ ```
298
+ ✅ Skill validation passed
299
+
300
+ 📦 Packaging skill: my-skill
301
+ ✅ Package created: dist/my-skill.zip
302
+ ```
303
+
304
+ **With validation errors (without --skip-validation):**
305
+
306
+ ```
307
+ ❌ Skill validation failed
308
+ Packaging aborted. Fix errors or use --skip-validation
309
+ ```
310
+
311
+ #### Distribution
312
+
313
+ The created zip can be:
314
+
315
+ 1. Uploaded to Claude.ai (Settings > Features > Skills)
316
+ 2. Uploaded via API (`/v1/skills` endpoint)
317
+ 3. Shared with team members
318
+ 4. Version controlled in git
319
+
320
+ ---
321
+
322
+ ## Common Workflows
323
+
324
+ ### Create and Validate New Skill
325
+
326
+ ```bash
327
+ # 1. Create skill
328
+ npx claude-skills init --name database-queries \
329
+ --description "SQLite queries. Use when writing SELECT, INSERT, UPDATE"
330
+
331
+ # 2. Edit SKILL.md
332
+ vim .claude/skills/database-queries/SKILL.md
333
+
334
+ # 3. Add references
335
+ vim .claude/skills/database-queries/references/schema.md
336
+
337
+ # 4. Validate
338
+ npx claude-skills validate .claude/skills/database-queries
339
+
340
+ # 5. Fix any issues, re-validate
341
+ npx claude-skills validate .claude/skills/database-queries
342
+
343
+ # 6. Package
344
+ npx claude-skills package .claude/skills/database-queries
345
+ ```
346
+
347
+ ### Strict Validation in CI
348
+
349
+ ```bash
350
+ # package.json
351
+ {
352
+ "scripts": {
353
+ "test:skills": "claude-skills validate .claude/skills/* --strict"
354
+ }
355
+ }
356
+
357
+ # Run in CI
358
+ npm run test:skills
359
+ ```
360
+
361
+ ### Batch Validate All Skills
362
+
363
+ ```bash
364
+ # Bash script to validate all skills
365
+ for skill in .claude/skills/*/; do
366
+ echo "Validating $skill"
367
+ npx claude-skills validate "$skill" || exit 1
368
+ done
369
+ ```
370
+
371
+ ### Quick Skill Creation
372
+
373
+ ```bash
374
+ # One-liner with validation
375
+ npx claude-skills init --name my-skill --description "Brief desc" && \
376
+ npx claude-skills validate .claude/skills/my-skill
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Environment Variables
382
+
383
+ Currently, the CLI does not use environment variables. All
384
+ configuration is via command-line flags.
385
+
386
+ ---
387
+
388
+ ## Error Messages
389
+
390
+ ### Common Errors
391
+
392
+ **Invalid skill name:**
393
+
394
+ ```
395
+ ❌ Skill name must be lowercase: MySkill
396
+ ```
397
+
398
+ **Missing required field:**
399
+
400
+ ```
401
+ ❌ SKILL.md frontmatter missing 'description' field
402
+ ```
403
+
404
+ **Broken reference link:**
405
+
406
+ ```
407
+ ❌ Referenced file not found: references/examples.md
408
+ → Linked from: [references/examples.md]
409
+ → Create the file or remove the broken link
410
+ ```
411
+
412
+ **Description too long:**
413
+
414
+ ```
415
+ ❌ Description too long (max 1024 chars per Anthropic): 1250
416
+ ```
417
+
418
+ ---
419
+
420
+ ## Tips and Best Practices
421
+
422
+ ### Naming Skills
423
+
424
+ ✅ Good names:
425
+
426
+ - `database-queries`
427
+ - `auth-patterns`
428
+ - `ui-components`
429
+ - `api-client`
430
+
431
+ ❌ Bad names:
432
+
433
+ - `DatabaseQueries` (not lowercase)
434
+ - `db queries` (spaces not allowed)
435
+ - `api_client` (underscores not recommended)
436
+
437
+ ### Writing Descriptions
438
+
439
+ ✅ Good descriptions:
440
+
441
+ ```yaml
442
+ description:
443
+ SQLite database operations using better-sqlite3 for contacts,
444
+ companies, and interactions. Use when writing SELECT, INSERT,
445
+ UPDATE, or DELETE operations.
446
+ ```
447
+
448
+ ❌ Bad descriptions:
449
+
450
+ ```yaml
451
+ description: Database helper
452
+ ```
453
+
454
+ ### Progressive Disclosure
455
+
456
+ **Keep Level 1 & 2 lean:**
457
+
458
+ - Level 1: <200 chars, keyword-rich
459
+ - Level 2: ~50 lines, quick reference
460
+ - Level 3: Move details to references/
461
+
462
+ ### Validation Workflow
463
+
464
+ 1. Run `validate` frequently during development
465
+ 2. Fix errors before warnings
466
+ 3. Use `--strict` in CI/CD pipelines
467
+ 4. Aim for "✅ Excellent progressive disclosure!"
468
+
469
+ ---
470
+
471
+ ## Package.json Integration
472
+
473
+ ```json
474
+ {
475
+ "scripts": {
476
+ "skill:new": "claude-skills init",
477
+ "skill:validate": "claude-skills validate .claude/skills/*",
478
+ "skill:validate:strict": "claude-skills validate .claude/skills/* --strict",
479
+ "skill:package": "claude-skills package",
480
+ "skill:check": "npm run skill:validate:strict"
481
+ },
482
+ "devDependencies": {
483
+ "claude-skills-cli": "^0.0.3"
484
+ }
485
+ }
486
+ ```
487
+
488
+ ---
489
+
490
+ ## Version Information
491
+
492
+ ```bash
493
+ # Check CLI version
494
+ npx claude-skills --version
495
+
496
+ # Show help
497
+ npx claude-skills --help
498
+ npx claude-skills init --help
499
+ ```
500
+
501
+ ---
502
+
503
+ ## Resources
504
+
505
+ - [GitHub Repository](https://github.com/spences10/claude-skills-cli)
506
+ - [Anthropic Skills Documentation](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview)
507
+ - [Anthropic Skills Repository](https://github.com/anthropics/skills)