claude-skills-cli 0.0.1

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.
@@ -0,0 +1,594 @@
1
+ # Skill Writing Guide
2
+
3
+ Detailed guidelines for writing effective Claude skills.
4
+
5
+ ## Voice and Tone
6
+
7
+ ### Use Imperative Voice
8
+
9
+ Claude responds best to direct instructions.
10
+
11
+ #### ✅ Good Examples
12
+
13
+ ```markdown
14
+ Use prepared statements for all database queries.
15
+ Generate IDs with nanoid() before inserting records.
16
+ Store timestamps as Unix epoch milliseconds.
17
+ Validate input before saving to database.
18
+ ```
19
+
20
+ #### ❌ Bad Examples
21
+
22
+ ```markdown
23
+ You should use prepared statements for database queries.
24
+ You'll want to generate IDs with nanoid().
25
+ It's best if you store timestamps as Unix epoch.
26
+ Try to validate input before saving.
27
+ ```
28
+
29
+ ### Be Specific, Not Vague
30
+
31
+ Provide concrete instructions, not general advice.
32
+
33
+ #### ✅ Good Examples
34
+
35
+ ```typescript
36
+ // Use nanoid() for ID generation
37
+ import { nanoid } from 'nanoid';
38
+ const id = nanoid();
39
+
40
+ // Store timestamps with Date.now()
41
+ const created_at = Date.now();
42
+ ```
43
+
44
+ #### ❌ Bad Examples
45
+
46
+ ```typescript
47
+ // Use an appropriate ID generator
48
+ const id = generateId();
49
+
50
+ // Store timestamps in a suitable format
51
+ const created_at = getCurrentTime();
52
+ ```
53
+
54
+ ### Avoid Conceptual Explanations
55
+
56
+ Focus on procedural steps, not theory.
57
+
58
+ #### ✅ Good (Procedural)
59
+
60
+ ```markdown
61
+ To query contacts:
62
+
63
+ 1. Prepare the statement
64
+ 2. Bind user_id for security
65
+ 3. Execute with .get() or .all()
66
+ ```
67
+
68
+ #### ❌ Bad (Conceptual)
69
+
70
+ ```markdown
71
+ When thinking about database queries, consider the relational
72
+ model and how data integrity affects your design choices...
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Description Writing
78
+
79
+ The description determines when Claude triggers your skill. Make it count.
80
+
81
+ ### Description Formula
82
+
83
+ ```
84
+ [Technology] + [Operations] + [Data Types] + [Trigger Phrase]
85
+ ```
86
+
87
+ ### Examples
88
+
89
+ #### Database Skill
90
+
91
+ ```yaml
92
+ description: SQLite database operations using better-sqlite3 for contacts, companies, interactions, and social_links tables. Use when writing SELECT, INSERT, UPDATE, DELETE operations with prepared statements.
93
+ ```
94
+
95
+ **Breakdown**:
96
+
97
+ - Technology: "SQLite", "better-sqlite3"
98
+ - Operations: "SELECT, INSERT, UPDATE, DELETE"
99
+ - Data types: "contacts, companies, interactions, social_links"
100
+ - Trigger: "Use when writing...operations"
101
+
102
+ #### Component Skill
103
+
104
+ ```yaml
105
+ description: Create type-safe Svelte 5 components with $props(), $derived, and snippets following devhub-crm conventions. Use when building components, implementing forms, or working with reactive stores and SvelteKit routing.
106
+ ```
107
+
108
+ **Breakdown**:
109
+
110
+ - Technology: "Svelte 5", "$props(), $derived"
111
+ - Operations: "building components", "implementing forms"
112
+ - Data types: "reactive stores", "SvelteKit routing"
113
+ - Trigger: "Use when building...or working with"
114
+
115
+ ### Description Checklist
116
+
117
+ - [ ] Includes technology names
118
+ - [ ] Lists specific operations
119
+ - [ ] Mentions data types or domains
120
+ - [ ] Has "Use when..." trigger phrase
121
+ - [ ] Contains searchable keywords
122
+ - [ ] Under 1024 characters
123
+ - [ ] Over 50 characters (not too short)
124
+
125
+ ---
126
+
127
+ ## Structure Patterns
128
+
129
+ ### Quick Start Section
130
+
131
+ Show the most common operation immediately.
132
+
133
+ ````markdown
134
+ ## Quick Start
135
+
136
+ ```typescript
137
+ import { db } from '$lib/server/db';
138
+
139
+ const stmt = db.prepare('SELECT * FROM contacts WHERE user_id = ?');
140
+ const contacts = stmt.all(user_id) as Contact[];
141
+ ```
142
+ ````
143
+
144
+ ````
145
+
146
+ **Guidelines**:
147
+ - Minimal working example
148
+ - Most common use case
149
+ - Copy-paste ready
150
+ - Includes imports
151
+ - Shows types
152
+
153
+ ### Core Patterns Section
154
+
155
+ Provide 3-5 essential patterns.
156
+
157
+ ```markdown
158
+ ## Core Patterns
159
+
160
+ ### SELECT Operations
161
+
162
+ ```typescript
163
+ // Single row
164
+ const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
165
+ const contact = stmt.get(id) as Contact | undefined;
166
+
167
+ // Multiple rows
168
+ const stmt = db.prepare('SELECT * FROM contacts WHERE user_id = ?');
169
+ const contacts = stmt.all(user_id) as Contact[];
170
+ ````
171
+
172
+ ### INSERT Operations
173
+
174
+ ```typescript
175
+ const stmt = db.prepare(`
176
+ INSERT INTO contacts (id, user_id, name, created_at)
177
+ VALUES (?, ?, ?, ?)
178
+ `);
179
+ stmt.run(nanoid(), user_id, name, Date.now());
180
+ ```
181
+
182
+ ````
183
+
184
+ **Guidelines**:
185
+ - One pattern per subsection
186
+ - Include code examples
187
+ - Show variations
188
+ - Real project code
189
+ - Not invented examples
190
+
191
+ ### Advanced Usage Section
192
+
193
+ Link to detailed references.
194
+
195
+ ```markdown
196
+ ## Advanced Usage
197
+
198
+ For detailed information:
199
+ - [references/schema.md](references/schema.md) - Complete database schema
200
+ - [references/relationships.md](references/relationships.md) - Table relationships
201
+ - [references/query-examples.md](references/query-examples.md) - 20+ query patterns
202
+ ````
203
+
204
+ **Guidelines**:
205
+
206
+ - Brief descriptions of each reference
207
+ - Descriptive link text
208
+ - Organized by topic
209
+ - Not "click here"
210
+
211
+ ---
212
+
213
+ ## Code Examples
214
+
215
+ ### Use Real Code
216
+
217
+ Pull examples from actual codebase, not invented scenarios.
218
+
219
+ #### ✅ Good (Real)
220
+
221
+ ```typescript
222
+ // From src/lib/server/contacts.ts
223
+ const stmt = db.prepare(`
224
+ SELECT c.*, COUNT(i.id) as interaction_count
225
+ FROM contacts c
226
+ LEFT JOIN interactions i ON c.id = i.contact_id
227
+ WHERE c.user_id = ?
228
+ GROUP BY c.id
229
+ `);
230
+ ```
231
+
232
+ #### ❌ Bad (Generic)
233
+
234
+ ```typescript
235
+ // Generic example
236
+ const result = database.query('SELECT * FROM table');
237
+ ```
238
+
239
+ ### Include Context
240
+
241
+ Show imports, types, and surrounding context.
242
+
243
+ ```typescript
244
+ // ✅ Complete context
245
+ import { db } from '$lib/server/db';
246
+ import { nanoid } from 'nanoid';
247
+ import type { Contact } from '$lib/types';
248
+
249
+ const create_contact = (user_id: string, name: string): Contact => {
250
+ const stmt = db.prepare(`
251
+ INSERT INTO contacts (id, user_id, name, created_at)
252
+ VALUES (?, ?, ?, ?)
253
+ `);
254
+ const id = nanoid();
255
+ stmt.run(id, user_id, name, Date.now());
256
+ return { id, user_id, name, created_at: Date.now() };
257
+ };
258
+ ```
259
+
260
+ ### Comment Strategically
261
+
262
+ Explain WHY, not WHAT.
263
+
264
+ ```typescript
265
+ // ✅ Good comments (explain why)
266
+ // Use prepared statements to prevent SQL injection
267
+ const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
268
+
269
+ // Always include user_id for row-level security
270
+ const stmt = db.prepare('SELECT * FROM contacts WHERE id = ? AND user_id = ?');
271
+
272
+ // ❌ Bad comments (state the obvious)
273
+ // This prepares a statement
274
+ const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
275
+
276
+ // This runs the query
277
+ const result = stmt.get(id);
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Reference Files
283
+
284
+ ### When to Create References
285
+
286
+ Create reference files when:
287
+
288
+ - SKILL.md exceeds ~5k words
289
+ - Content is only needed in specific scenarios
290
+ - You have exhaustive documentation
291
+ - Topic deserves deep treatment
292
+
293
+ ### Reference File Structure
294
+
295
+ ````markdown
296
+ # Topic Name
297
+
298
+ ## Overview
299
+
300
+ Brief introduction to the topic.
301
+
302
+ ## Section 1: Subtopic
303
+
304
+ Detailed content with examples...
305
+
306
+ ```typescript
307
+ // Code examples
308
+ ```
309
+ ````
310
+
311
+ ## Section 2: Another Subtopic
312
+
313
+ More detailed content...
314
+
315
+ ## Examples
316
+
317
+ Real-world usage examples.
318
+
319
+ ## Notes
320
+
321
+ Important considerations.
322
+
323
+ ````
324
+
325
+ ### Reference File Naming
326
+
327
+ Use descriptive, searchable names:
328
+
329
+ #### ✅ Good Names
330
+ - `authentication-flow.md`
331
+ - `api-endpoints-reference.md`
332
+ - `component-library-catalog.md`
333
+ - `query-patterns-complex.md`
334
+
335
+ #### ❌ Bad Names
336
+ - `auth.md`
337
+ - `api.md`
338
+ - `components.md`
339
+ - `queries.md`
340
+
341
+ ### Linking to References
342
+
343
+ Always provide context for links:
344
+
345
+ ```markdown
346
+ For complete database schema with all table definitions and relationships:
347
+ [references/schema.md](references/schema.md)
348
+
349
+ For 20+ common query patterns including joins and aggregations:
350
+ [references/query-examples.md](references/query-examples.md)
351
+ ````
352
+
353
+ Not just:
354
+
355
+ ```markdown
356
+ See [schema.md](references/schema.md) and [examples](references/query-examples.md).
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Scripts
362
+
363
+ ### When to Create Scripts
364
+
365
+ Create scripts for:
366
+
367
+ - **Validation**: Check data consistency, format correctness
368
+ - **Generation**: Create boilerplate, scaffolding
369
+ - **Analysis**: Parse files, generate reports
370
+ - **Testing**: Verify configuration, connectivity
371
+
372
+ ### Script Structure
373
+
374
+ ```python
375
+ #!/usr/bin/env python3
376
+ """
377
+ Clear description of what this script does.
378
+
379
+ This script [main purpose] by [method]. Use it to [when to use].
380
+
381
+ Usage:
382
+ python script_name.py [arguments]
383
+
384
+ Example:
385
+ python validate_schema.py --check-all
386
+ python validate_schema.py --table contacts
387
+
388
+ Options:
389
+ --check-all Check all tables
390
+ --table NAME Check specific table
391
+ --verbose Show detailed output
392
+ """
393
+
394
+ import argparse
395
+ import sys
396
+
397
+
398
+ def main():
399
+ parser = argparse.ArgumentParser(description="Script description")
400
+ parser.add_argument("--verbose", action="store_true")
401
+
402
+ args = parser.parse_args()
403
+
404
+ try:
405
+ result = perform_operation(args)
406
+ print(f"✅ Success: {result}")
407
+ return 0
408
+ except Exception as e:
409
+ print(f"❌ Error: {e}", file=sys.stderr)
410
+ return 1
411
+
412
+
413
+ def perform_operation(args):
414
+ """Main logic here."""
415
+ pass
416
+
417
+
418
+ if __name__ == "__main__":
419
+ sys.exit(main())
420
+ ```
421
+
422
+ ### Script Best Practices
423
+
424
+ - Include shebang (`#!/usr/bin/env python3`)
425
+ - Detailed docstring with usage examples
426
+ - Argument parsing with help text
427
+ - Error handling with meaningful messages
428
+ - Exit codes (0 = success, 1 = error)
429
+ - Clear output formatting (✅ ❌ ⚠️)
430
+
431
+ ---
432
+
433
+ ## Assets
434
+
435
+ ### When to Create Assets
436
+
437
+ Add assets when you have:
438
+
439
+ - **Templates**: Boilerplate that gets copied/modified
440
+ - **Images**: Logos, icons, diagrams
441
+ - **Config**: Standard configuration files
442
+ - **Data**: Seed data, examples
443
+
444
+ ### Asset Organization
445
+
446
+ ```
447
+ assets/
448
+ ├── templates/
449
+ │ ├── component.svelte
450
+ │ ├── api-route.ts
451
+ │ └── sql-migration.sql
452
+ ├── images/
453
+ │ ├── logo.png
454
+ │ └── diagram.svg
455
+ ├── config/
456
+ │ └── tsconfig.json
457
+ └── data/
458
+ └── example-data.json
459
+ ```
460
+
461
+ ### Using Assets
462
+
463
+ ````markdown
464
+ ## Quick Start
465
+
466
+ Copy the component template:
467
+
468
+ ```bash
469
+ cp assets/templates/component.svelte src/lib/components/new-component.svelte
470
+ ```
471
+ ````
472
+
473
+ Modify the template for your needs.
474
+
475
+ ````
476
+
477
+ ---
478
+
479
+ ## Word Count Guidelines
480
+
481
+ ### SKILL.md Body
482
+ - **Target**: 2k-5k words
483
+ - **Maximum**: 5k words
484
+ - **If exceeding**: Move content to references/
485
+
486
+ ### Reference Files
487
+ - **Target**: 1k-10k words per file
488
+ - **Maximum**: 15k words per file
489
+ - **If exceeding**: Split into multiple focused files
490
+
491
+ ### Description
492
+ - **Minimum**: 50 characters
493
+ - **Target**: 100-300 characters
494
+ - **Maximum**: 1024 characters
495
+
496
+ ---
497
+
498
+ ## Common Mistakes
499
+
500
+ ### Mistake 1: Vague Descriptions
501
+ ```yaml
502
+ # ❌ Bad
503
+ description: Helper for database stuff
504
+
505
+ # ✅ Good
506
+ description: SQLite query patterns for contacts table using better-sqlite3. Use when writing SELECT, INSERT, UPDATE operations.
507
+ ````
508
+
509
+ ### Mistake 2: Second Person
510
+
511
+ ```markdown
512
+ # ❌ Bad
513
+
514
+ You should always validate input before saving.
515
+
516
+ # ✅ Good
517
+
518
+ Validate input before saving to database.
519
+ ```
520
+
521
+ ### Mistake 3: Conceptual Over Procedural
522
+
523
+ ````markdown
524
+ # ❌ Bad
525
+
526
+ Understanding the importance of prepared statements in the context
527
+ of SQL injection vulnerabilities is crucial for security...
528
+
529
+ # ✅ Good
530
+
531
+ Use prepared statements for all SQL queries:
532
+
533
+ ```typescript
534
+ const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
535
+ ```
536
+ ````
537
+
538
+ ````
539
+
540
+ ### Mistake 4: Duplicate Content
541
+ ```markdown
542
+ # ❌ Bad (repeated in multiple places)
543
+ SKILL.md has complete schema
544
+ references/schema.md has complete schema
545
+
546
+ # ✅ Good (single source of truth)
547
+ SKILL.md has quick reference
548
+ references/schema.md has complete schema
549
+ ````
550
+
551
+ ---
552
+
553
+ ## Checklist
554
+
555
+ Before finalizing a skill:
556
+
557
+ ### Content
558
+
559
+ - [ ] Description includes keywords and triggers
560
+ - [ ] Imperative voice throughout
561
+ - [ ] Specific, not vague
562
+ - [ ] Real examples from codebase
563
+ - [ ] No TODO placeholders
564
+
565
+ ### Structure
566
+
567
+ - [ ] Quick Start section present
568
+ - [ ] 3-5 Core Patterns documented
569
+ - [ ] Links to references working
570
+ - [ ] Scripts described
571
+ - [ ] Under 5k words (SKILL.md body)
572
+
573
+ ### Technical
574
+
575
+ - [ ] YAML frontmatter valid
576
+ - [ ] Name matches directory
577
+ - [ ] Scripts are executable
578
+ - [ ] References mentioned in SKILL.md
579
+ - [ ] Validation passes
580
+
581
+ ### Testing
582
+
583
+ - [ ] Tested in real conversations
584
+ - [ ] Claude triggers skill correctly
585
+ - [ ] Instructions are clear
586
+ - [ ] Examples work as shown
587
+
588
+ ---
589
+
590
+ ## Resources
591
+
592
+ - [SKILLS-ARCHITECTURE.md](../../../docs/SKILLS-ARCHITECTURE.md) - System overview
593
+ - [SKILL-DEVELOPMENT.md](../../../docs/SKILL-DEVELOPMENT.md) - Development workflow
594
+ - [SKILL-EXAMPLES.md](../../../docs/SKILL-EXAMPLES.md) - Real examples