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.
- package/README.md +169 -354
- package/dist/commands/init.js +28 -19
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/package.js +2 -5
- package/dist/commands/package.js.map +1 -1
- package/dist/commands/stats.js +154 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/core/templates.js +82 -59
- package/dist/core/templates.js.map +1 -1
- package/dist/core/validator.js +117 -16
- package/dist/core/validator.js.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/output.js +46 -16
- package/dist/utils/output.js.map +1 -1
- package/docs/SKILL-DEVELOPMENT.md +28 -30
- package/docs/SKILL-EXAMPLES.md +27 -23
- package/docs/SKILLS-ARCHITECTURE.md +14 -14
- package/package.json +1 -1
- package/skills/skill-creator/SKILL.md +62 -301
- package/skills/skill-creator/references/anthropic-resources.md +458 -0
- package/skills/skill-creator/references/cli-feedback.md +431 -0
- package/skills/skill-creator/references/cli-reference.md +499 -0
- package/skills/skill-creator/references/skill-examples.md +77 -69
- package/skills/skill-creator/references/writing-guide.md +134 -119
|
@@ -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
|
|
41
|
-
const
|
|
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
|
|
71
|
+
To fetch user data:
|
|
62
72
|
|
|
63
|
-
1.
|
|
64
|
-
2.
|
|
65
|
-
3.
|
|
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
|
|
72
|
-
|
|
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
|
-
####
|
|
100
|
+
#### API Client Skill
|
|
90
101
|
|
|
91
102
|
```yaml
|
|
92
|
-
description:
|
|
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: "
|
|
98
|
-
- Operations: "
|
|
99
|
-
- Data types: "
|
|
100
|
-
- Trigger: "Use when
|
|
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
|
|
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: "
|
|
121
|
+
- Technology: "React", "hooks", "TypeScript"
|
|
111
122
|
- Operations: "building components", "implementing forms"
|
|
112
|
-
- Data types: "
|
|
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 {
|
|
148
|
+
import { apiClient } from './lib/api';
|
|
138
149
|
|
|
139
|
-
const
|
|
140
|
-
const
|
|
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
|
-
###
|
|
171
|
+
### GET Requests
|
|
161
172
|
|
|
162
173
|
```typescript
|
|
163
|
-
// Single
|
|
164
|
-
const
|
|
165
|
-
const contact = stmt.get(id) as Contact | undefined;
|
|
174
|
+
// Single resource
|
|
175
|
+
const user = await apiClient.get<User>(`/users/${id}`);
|
|
166
176
|
|
|
167
|
-
//
|
|
168
|
-
const
|
|
169
|
-
const contacts = stmt.all(user_id) as Contact[];
|
|
177
|
+
// Collection
|
|
178
|
+
const users = await apiClient.get<User[]>('/users');
|
|
170
179
|
````
|
|
171
180
|
|
|
172
|
-
###
|
|
181
|
+
### POST Requests
|
|
173
182
|
|
|
174
183
|
```typescript
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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/
|
|
200
|
-
- [references/
|
|
201
|
-
- [references/
|
|
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/
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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 =
|
|
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 {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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
|
|
267
|
-
const
|
|
277
|
+
// Use Authorization header to verify JWT token
|
|
278
|
+
const headers = { Authorization: `Bearer ${token}` };
|
|
268
279
|
|
|
269
|
-
// Always
|
|
270
|
-
const
|
|
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
|
|
274
|
-
const
|
|
284
|
+
// This creates headers
|
|
285
|
+
const headers = { Authorization: `Bearer ${token}` };
|
|
275
286
|
|
|
276
|
-
// This
|
|
277
|
-
const
|
|
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
|
-
```
|
|
375
|
-
#!/usr/bin/env
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
Example:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
Options:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
import
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
|
425
|
-
- Detailed
|
|
426
|
-
- Argument parsing with
|
|
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
|
|
516
|
+
description: Helper for API stuff
|
|
504
517
|
|
|
505
518
|
# ✅ Good
|
|
506
|
-
description:
|
|
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
|
|
527
|
-
of
|
|
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
|
-
|
|
544
|
+
Include authentication tokens in all API requests:
|
|
532
545
|
|
|
533
546
|
```typescript
|
|
534
|
-
const
|
|
547
|
+
const response = await fetch(url, {
|
|
548
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
549
|
+
});
|
|
535
550
|
```
|
|
536
551
|
````
|
|
537
552
|
|