claude-skills-cli 0.0.2 → 0.0.4

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.
@@ -37,8 +37,15 @@ Provide concrete instructions, not general advice.
37
37
  import { nanoid } from 'nanoid';
38
38
  const id = nanoid();
39
39
 
40
- // Store timestamps with Date.now()
41
- const created_at = Date.now();
40
+ // Store timestamps as ISO strings
41
+ const timestamp = new Date().toISOString();
42
+
43
+ // Use type-safe interfaces
44
+ interface User {
45
+ id: string;
46
+ name: string;
47
+ email: string;
48
+ }
42
49
  ```
43
50
 
44
51
  #### ❌ Bad Examples
@@ -49,6 +56,9 @@ const id = generateId();
49
56
 
50
57
  // Store timestamps in a suitable format
51
58
  const created_at = getCurrentTime();
59
+
60
+ // Use appropriate types
61
+ const user: any;
52
62
  ```
53
63
 
54
64
  ### Avoid Conceptual Explanations
@@ -58,18 +68,19 @@ Focus on procedural steps, not theory.
58
68
  #### ✅ Good (Procedural)
59
69
 
60
70
  ```markdown
61
- To query contacts:
71
+ To fetch user data:
62
72
 
63
- 1. Prepare the statement
64
- 2. Bind user_id for security
65
- 3. Execute with .get() or .all()
73
+ 1. Import the API client
74
+ 2. Call the endpoint with typed parameters
75
+ 3. Handle the response with type checking
76
+ 4. Return the typed result
66
77
  ```
67
78
 
68
79
  #### ❌ Bad (Conceptual)
69
80
 
70
81
  ```markdown
71
- When thinking about database queries, consider the relational
72
- model and how data integrity affects your design choices...
82
+ When thinking about API design, consider REST principles
83
+ and how architectural patterns affect your implementation...
73
84
  ```
74
85
 
75
86
  ---
@@ -86,30 +97,30 @@ The description determines when Claude triggers your skill. Make it count.
86
97
 
87
98
  ### Examples
88
99
 
89
- #### Database Skill
100
+ #### API Client Skill
90
101
 
91
102
  ```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.
103
+ description: REST API client for user data endpoints with TypeScript types. Use when making HTTP requests, handling authentication, or working with API responses and error handling.
93
104
  ```
94
105
 
95
106
  **Breakdown**:
96
107
 
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"
108
+ - Technology: "REST API", "TypeScript"
109
+ - Operations: "HTTP requests", "authentication", "error handling"
110
+ - Data types: "user data endpoints", "API responses"
111
+ - Trigger: "Use when making...or working with"
101
112
 
102
113
  #### Component Skill
103
114
 
104
115
  ```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.
116
+ description: Create type-safe React components with hooks and TypeScript interfaces. Use when building UI components, implementing forms, or managing component state and props.
106
117
  ```
107
118
 
108
119
  **Breakdown**:
109
120
 
110
- - Technology: "Svelte 5", "$props(), $derived"
121
+ - Technology: "React", "hooks", "TypeScript"
111
122
  - Operations: "building components", "implementing forms"
112
- - Data types: "reactive stores", "SvelteKit routing"
123
+ - Data types: "component state", "props"
113
124
  - Trigger: "Use when building...or working with"
114
125
 
115
126
  ### Description Checklist
@@ -134,10 +145,10 @@ Show the most common operation immediately.
134
145
  ## Quick Start
135
146
 
136
147
  ```typescript
137
- import { db } from '$lib/server/db';
148
+ import { apiClient } from './lib/api';
138
149
 
139
- const stmt = db.prepare('SELECT * FROM contacts WHERE user_id = ?');
140
- const contacts = stmt.all(user_id) as Contact[];
150
+ const response = await apiClient.get<User[]>('/users');
151
+ const users = response.data;
141
152
  ```
142
153
  ````
143
154
 
@@ -157,26 +168,25 @@ Provide 3-5 essential patterns.
157
168
  ```markdown
158
169
  ## Core Patterns
159
170
 
160
- ### SELECT Operations
171
+ ### GET Requests
161
172
 
162
173
  ```typescript
163
- // Single row
164
- const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
165
- const contact = stmt.get(id) as Contact | undefined;
174
+ // Single resource
175
+ const user = await apiClient.get<User>(`/users/${id}`);
166
176
 
167
- // Multiple rows
168
- const stmt = db.prepare('SELECT * FROM contacts WHERE user_id = ?');
169
- const contacts = stmt.all(user_id) as Contact[];
177
+ // Collection
178
+ const users = await apiClient.get<User[]>('/users');
170
179
  ````
171
180
 
172
- ### INSERT Operations
181
+ ### POST Requests
173
182
 
174
183
  ```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());
184
+ const newUser = await apiClient.post<User>('/users', {
185
+ id: nanoid(),
186
+ name: 'John Doe',
187
+ email: 'john@example.com',
188
+ createdAt: new Date().toISOString(),
189
+ });
180
190
  ```
181
191
 
182
192
  ````
@@ -196,9 +206,9 @@ Link to detailed references.
196
206
  ## Advanced Usage
197
207
 
198
208
  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
209
+ - [references/api-docs.md](references/api-docs.md) - Complete API reference
210
+ - [references/authentication.md](references/authentication.md) - Auth patterns
211
+ - [references/examples.md](references/examples.md) - 20+ usage examples
202
212
  ````
203
213
 
204
214
  **Guidelines**:
@@ -219,21 +229,21 @@ Pull examples from actual codebase, not invented scenarios.
219
229
  #### ✅ Good (Real)
220
230
 
221
231
  ```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
- `);
232
+ // From src/lib/api/users.ts
233
+ const response = await fetch(`${API_BASE}/users/${userId}/stats`, {
234
+ headers: {
235
+ Authorization: `Bearer ${token}`,
236
+ 'Content-Type': 'application/json',
237
+ },
238
+ });
239
+ const stats = (await response.json()) as UserStats;
230
240
  ```
231
241
 
232
242
  #### ❌ Bad (Generic)
233
243
 
234
244
  ```typescript
235
245
  // Generic example
236
- const result = database.query('SELECT * FROM table');
246
+ const result = await api.getData();
237
247
  ```
238
248
 
239
249
  ### Include Context
@@ -242,18 +252,19 @@ Show imports, types, and surrounding context.
242
252
 
243
253
  ```typescript
244
254
  // ✅ Complete context
245
- import { db } from '$lib/server/db';
246
255
  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() };
256
+ import type { User, CreateUserRequest } from './types';
257
+ import { apiClient } from './client';
258
+
259
+ const createUser = async (request: CreateUserRequest): Promise<User> => {
260
+ const user: User = {
261
+ id: nanoid(),
262
+ ...request,
263
+ createdAt: new Date().toISOString(),
264
+ };
265
+
266
+ const response = await apiClient.post<User>('/users', user);
267
+ return response.data;
257
268
  };
258
269
  ```
259
270
 
@@ -263,18 +274,18 @@ Explain WHY, not WHAT.
263
274
 
264
275
  ```typescript
265
276
  // ✅ Good comments (explain why)
266
- // Use prepared statements to prevent SQL injection
267
- const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
277
+ // Use Authorization header to verify JWT token
278
+ const headers = { Authorization: `Bearer ${token}` };
268
279
 
269
- // Always include user_id for row-level security
270
- const stmt = db.prepare('SELECT * FROM contacts WHERE id = ? AND user_id = ?');
280
+ // Always validate input to prevent injection attacks
281
+ const sanitized = validator.escape(userInput);
271
282
 
272
283
  // ❌ Bad comments (state the obvious)
273
- // This prepares a statement
274
- const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
284
+ // This creates headers
285
+ const headers = { Authorization: `Bearer ${token}` };
275
286
 
276
- // This runs the query
277
- const result = stmt.get(id);
287
+ // This makes a request
288
+ const response = await fetch(url);
278
289
  ```
279
290
 
280
291
  ---
@@ -371,62 +382,64 @@ Create scripts for:
371
382
 
372
383
  ### Script Structure
373
384
 
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())
385
+ ```javascript
386
+ #!/usr/bin/env node
387
+ /**
388
+ * Clear description of what this script does.
389
+ *
390
+ * This script [main purpose] by [method]. Use it to [when to use].
391
+ *
392
+ * Usage:
393
+ * node script-name.js [arguments]
394
+ *
395
+ * Example:
396
+ * node validate-config.js --check-all
397
+ * node validate-config.js --file config.json
398
+ *
399
+ * Options:
400
+ * --check-all Check all config files
401
+ * --file NAME Check specific file
402
+ * --verbose Show detailed output
403
+ */
404
+
405
+ import { parseArgs } from 'node:util';
406
+
407
+ async function main() {
408
+ const { values } = parseArgs({
409
+ options: {
410
+ verbose: { type: 'boolean', default: false },
411
+ file: { type: 'string' },
412
+ 'check-all': { type: 'boolean', default: false },
413
+ },
414
+ });
415
+
416
+ try {
417
+ const result = await performOperation(values);
418
+ console.log(`✅ Success: ${result}`);
419
+ process.exit(0);
420
+ } catch (error) {
421
+ console.error(`❌ Error: ${error.message}`);
422
+ process.exit(1);
423
+ }
424
+ }
425
+
426
+ async function performOperation(options) {
427
+ // Main logic here
428
+ return 'Operation completed';
429
+ }
430
+
431
+ main();
420
432
  ```
421
433
 
422
434
  ### Script Best Practices
423
435
 
424
- - Include shebang (`#!/usr/bin/env python3`)
425
- - Detailed docstring with usage examples
426
- - Argument parsing with help text
436
+ - Include shebang (`#!/usr/bin/env node`)
437
+ - Detailed JSDoc comment with usage examples
438
+ - Argument parsing with node:util or commander
427
439
  - Error handling with meaningful messages
428
440
  - Exit codes (0 = success, 1 = error)
429
441
  - Clear output formatting (✅ ❌ ⚠️)
442
+ - Use ES modules (import/export) or CommonJS (require)
430
443
 
431
444
  ---
432
445
 
@@ -500,10 +513,10 @@ Modify the template for your needs.
500
513
  ### Mistake 1: Vague Descriptions
501
514
  ```yaml
502
515
  # ❌ Bad
503
- description: Helper for database stuff
516
+ description: Helper for API stuff
504
517
 
505
518
  # ✅ Good
506
- description: SQLite query patterns for contacts table using better-sqlite3. Use when writing SELECT, INSERT, UPDATE operations.
519
+ description: REST API client with TypeScript types for user endpoints. Use when making HTTP requests, handling auth, or managing API errors.
507
520
  ````
508
521
 
509
522
  ### Mistake 2: Second Person
@@ -523,15 +536,17 @@ Validate input before saving to database.
523
536
  ````markdown
524
537
  # ❌ Bad
525
538
 
526
- Understanding the importance of prepared statements in the context
527
- of SQL injection vulnerabilities is crucial for security...
539
+ Understanding the importance of authentication tokens in the context
540
+ of secure API communication is crucial for security...
528
541
 
529
542
  # ✅ Good
530
543
 
531
- Use prepared statements for all SQL queries:
544
+ Include authentication tokens in all API requests:
532
545
 
533
546
  ```typescript
534
- const stmt = db.prepare('SELECT * FROM contacts WHERE id = ?');
547
+ const response = await fetch(url, {
548
+ headers: { Authorization: `Bearer ${token}` },
549
+ });
535
550
  ```
536
551
  ````
537
552