devlyn-cli 0.2.0 → 0.3.0
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/CLAUDE.md +23 -1
- package/README.md +1 -0
- package/bin/devlyn.js +1 -0
- package/optional-skills/generate-skill/CHECKLIST.md +60 -0
- package/optional-skills/generate-skill/PROMPT-PATTERNS.md +370 -0
- package/optional-skills/generate-skill/REFERENCE.md +195 -0
- package/optional-skills/generate-skill/SKILL.md +178 -0
- package/package.json +2 -2
package/CLAUDE.md
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
- Follow commit conventions in `.claude/commit-conventions.md`
|
|
7
7
|
- Follow design system in `docs/design-system.md` for UI/UX work if exist
|
|
8
8
|
|
|
9
|
+
## Error Handling Philosophy
|
|
10
|
+
|
|
11
|
+
**No silent fallbacks.** Handle errors explicitly and show the user what happened.
|
|
12
|
+
|
|
13
|
+
- **Default behavior**: When something fails, display a clear error state in the UI (error message, retry option, or actionable guidance). Do NOT silently fall back to default/placeholder data.
|
|
14
|
+
- **Fallbacks are the exception, not the rule.** Only use fallbacks when it is a widely accepted best practice (e.g., fallback fonts in CSS, CDN failover, graceful image loading with placeholder). If unsure, handle the error explicitly instead.
|
|
15
|
+
- **Never hide failures.** The user should always know when something went wrong. A visible error with a retry button is better UX than silently showing stale/default data.
|
|
16
|
+
- **Pattern**: `try { doThing() } catch (error) { showErrorUI(error) }` — NOT `try { doThing() } catch { return fallbackValue }`
|
|
17
|
+
|
|
9
18
|
## Investigation Workflow
|
|
10
19
|
|
|
11
20
|
When investigating bugs, analyzing features, or exploring code:
|
|
@@ -39,6 +48,19 @@ The full design-to-implementation pipeline:
|
|
|
39
48
|
|
|
40
49
|
For complex features, use the Plan agent to design the approach before implementation.
|
|
41
50
|
|
|
51
|
+
## Vibe Coding Workflow
|
|
52
|
+
|
|
53
|
+
The recommended sequence after writing code:
|
|
54
|
+
|
|
55
|
+
1. **Write code** (vibe coding)
|
|
56
|
+
2. `/simplify` → Quick cleanup pass (reuse, quality, efficiency)
|
|
57
|
+
3. `/devlyn.review` → Thorough solo review with security-first checklist
|
|
58
|
+
4. `/devlyn.team-review` → Multi-perspective team review (for important PRs)
|
|
59
|
+
5. `/devlyn.clean` → Periodic codebase-wide hygiene
|
|
60
|
+
6. `/devlyn.update-docs` → Keep docs in sync
|
|
61
|
+
|
|
62
|
+
Steps 4-6 are optional depending on the scope of changes. `/simplify` should always run before `/devlyn.review` to catch low-hanging fruit cheaply.
|
|
63
|
+
|
|
42
64
|
## Documentation Workflow
|
|
43
65
|
|
|
44
66
|
- **Sync docs with codebase**: Use `/devlyn.update-docs` to clean up stale content, update outdated info, and generate missing docs
|
|
@@ -56,7 +78,7 @@ For complex features, use the Plan agent to design the approach before implement
|
|
|
56
78
|
|
|
57
79
|
- **Codebase cleanup**: Use `/devlyn.clean` to detect and remove dead code, unused dependencies, complexity hotspots, and tech debt
|
|
58
80
|
- **Focused cleanup**: Use `/devlyn.clean [category]` for targeted sweeps (dead code, deps, tests, complexity, hygiene)
|
|
59
|
-
- **Periodic maintenance sequence**: `/devlyn.clean` → `/devlyn.update-docs` → `/devlyn.review`
|
|
81
|
+
- **Periodic maintenance sequence**: `/devlyn.clean` → `/simplify` → `/devlyn.update-docs` → `/devlyn.review`
|
|
60
82
|
|
|
61
83
|
## Context Window Management
|
|
62
84
|
|
package/README.md
CHANGED
|
@@ -103,6 +103,7 @@ During installation, you can choose to add optional skills and third-party skill
|
|
|
103
103
|
| Addon | Type | Description |
|
|
104
104
|
|---|---|---|
|
|
105
105
|
| `cloudflare-nextjs-setup` | skill | Cloudflare Workers + Next.js deployment with OpenNext |
|
|
106
|
+
| `generate-skill` | skill | Create well-structured Claude Code skills following Anthropic best practices |
|
|
106
107
|
| `prompt-engineering` | skill | Claude 4 prompt optimization using Anthropic best practices |
|
|
107
108
|
| `pyx-scan` | skill | Check whether an AI agent skill is safe before installing |
|
|
108
109
|
| `vercel-labs/agent-skills` | pack | React, Next.js, React Native best practices |
|
package/bin/devlyn.js
CHANGED
|
@@ -65,6 +65,7 @@ ${g} v${PKG.version} ${COLORS.dim}· ${k}🍩 by Donut Studio${r}
|
|
|
65
65
|
const OPTIONAL_ADDONS = [
|
|
66
66
|
// Local optional skills (copied to .claude/skills/)
|
|
67
67
|
{ name: 'cloudflare-nextjs-setup', desc: 'Cloudflare Workers + Next.js deployment with OpenNext', type: 'local' },
|
|
68
|
+
{ name: 'generate-skill', desc: 'Create well-structured Claude Code skills following Anthropic best practices', type: 'local' },
|
|
68
69
|
{ name: 'prompt-engineering', desc: 'Claude 4 prompt optimization using Anthropic best practices', type: 'local' },
|
|
69
70
|
{ name: 'pyx-scan', desc: 'Check whether an AI agent skill is safe before installing', type: 'local' },
|
|
70
71
|
// External skill packs (installed via npx skills add)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Skill Quality Checklist
|
|
2
|
+
|
|
3
|
+
Verify the generated skill against every item below before finalizing.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Frontmatter
|
|
8
|
+
|
|
9
|
+
- [ ] `name` is lowercase, hyphens and digits only, max 64 chars
|
|
10
|
+
- [ ] `name` does not contain "anthropic", "claude", or "official"
|
|
11
|
+
- [ ] `description` is third-person, max 1024 chars
|
|
12
|
+
- [ ] `description` includes specific trigger phrases ("Use when user says...")
|
|
13
|
+
- [ ] `description` first sentence states what the skill does
|
|
14
|
+
- [ ] `allowed-tools` uses the minimal set needed (not all tools)
|
|
15
|
+
- [ ] `argument-hint` shows expected input format if skill takes arguments
|
|
16
|
+
- [ ] No XML tags in any frontmatter field values
|
|
17
|
+
|
|
18
|
+
## Body Structure
|
|
19
|
+
|
|
20
|
+
- [ ] Starts with a title (`#`) and one-line purpose statement
|
|
21
|
+
- [ ] Lists reference files with descriptions (if multi-file)
|
|
22
|
+
- [ ] Workflow uses numbered steps with `###` headings
|
|
23
|
+
- [ ] Each step starts with an action verb (Parse, Read, Generate, Validate)
|
|
24
|
+
- [ ] Each step has clear entry and exit criteria
|
|
25
|
+
- [ ] Output format is explicitly defined
|
|
26
|
+
|
|
27
|
+
## Content Quality
|
|
28
|
+
|
|
29
|
+
- [ ] Instructions are explicit, not vague ("Review for X, Y, Z" not "Review the code")
|
|
30
|
+
- [ ] Includes WHY context for non-obvious rules
|
|
31
|
+
- [ ] Uses XML tags for complex structure (`<example>`, `<rules>`, `<output-format>`)
|
|
32
|
+
- [ ] Uses "consider"/"evaluate" instead of "think"
|
|
33
|
+
- [ ] Contains at least one concrete `<example>` block
|
|
34
|
+
- [ ] Scope is bounded (file limits, directory limits, or explicit boundaries)
|
|
35
|
+
- [ ] No conflicting instructions
|
|
36
|
+
|
|
37
|
+
## Error Handling
|
|
38
|
+
|
|
39
|
+
- [ ] Handles empty `$ARGUMENTS` (asks user or uses sensible detection)
|
|
40
|
+
- [ ] Handles missing files (clear error message, not silent fallback)
|
|
41
|
+
- [ ] Handles unexpected input (validation with actionable error)
|
|
42
|
+
- [ ] No silent fallbacks to defaults (project convention)
|
|
43
|
+
|
|
44
|
+
## Prompt Engineering
|
|
45
|
+
|
|
46
|
+
- [ ] No over-triggering (description is specific, not generic)
|
|
47
|
+
- [ ] No aggressive language ("MUST", "NEVER EVER", "ABSOLUTELY")
|
|
48
|
+
- [ ] No wall of text without headings or structure
|
|
49
|
+
- [ ] No unbounded scope ("analyze everything")
|
|
50
|
+
- [ ] Anti-hallucination patterns applied (grounded in file content)
|
|
51
|
+
- [ ] Degree of freedom matches skill type (guardrails for high, specs for low)
|
|
52
|
+
|
|
53
|
+
## Completeness
|
|
54
|
+
|
|
55
|
+
- [ ] All reference files mentioned in SKILL.md exist
|
|
56
|
+
- [ ] Reference files have table of contents if over 100 lines
|
|
57
|
+
- [ ] Reference files are one level deep (no nested references)
|
|
58
|
+
- [ ] Total SKILL.md is under 500 lines (split if over)
|
|
59
|
+
- [ ] Skill is self-contained (works without external dependencies)
|
|
60
|
+
- [ ] Installation path is correct (`.claude/skills/<skill-name>/`)
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# Prompt Patterns for Claude 4.6 Skills
|
|
2
|
+
|
|
3
|
+
Patterns and anti-patterns for writing effective skill body content that works well with Claude 4.6 models.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Core Principles](#core-principles)
|
|
8
|
+
- [Structural Patterns](#structural-patterns)
|
|
9
|
+
- [Anti-Patterns](#anti-patterns)
|
|
10
|
+
- [Anti-Hallucination Patterns](#anti-hallucination-patterns)
|
|
11
|
+
- [Degree of Freedom Guide](#degree-of-freedom-guide)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Core Principles
|
|
16
|
+
|
|
17
|
+
### 1. Be Explicit
|
|
18
|
+
|
|
19
|
+
Claude 4.6 follows instructions precisely. Vague prompts get literal interpretations.
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Bad — vague
|
|
23
|
+
Review the code and fix issues.
|
|
24
|
+
|
|
25
|
+
# Good — explicit
|
|
26
|
+
Review the code for:
|
|
27
|
+
1. Security vulnerabilities (SQL injection, XSS, command injection)
|
|
28
|
+
2. Performance anti-patterns (N+1 queries, unnecessary re-renders)
|
|
29
|
+
3. Missing error handling
|
|
30
|
+
|
|
31
|
+
For each issue found, output:
|
|
32
|
+
- File and line number
|
|
33
|
+
- Severity (critical/warning/info)
|
|
34
|
+
- Description of the issue
|
|
35
|
+
- Suggested fix with code snippet
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Provide WHY Context
|
|
39
|
+
|
|
40
|
+
Claude generalizes better when it understands the reasoning behind instructions.
|
|
41
|
+
|
|
42
|
+
```markdown
|
|
43
|
+
# Bad — no context
|
|
44
|
+
Always use `const` instead of `let`.
|
|
45
|
+
|
|
46
|
+
# Good — with WHY
|
|
47
|
+
Use `const` by default because it signals immutability to other developers
|
|
48
|
+
and prevents accidental reassignment. Only use `let` when the variable
|
|
49
|
+
must be reassigned within its scope.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Use XML Tags for Structure
|
|
53
|
+
|
|
54
|
+
XML tags create clear semantic boundaries. Use them for complex sections.
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
<rules>
|
|
58
|
+
- Never modify files outside the project directory
|
|
59
|
+
- Always create a backup before destructive operations
|
|
60
|
+
- Ask for confirmation before deleting more than 3 files
|
|
61
|
+
</rules>
|
|
62
|
+
|
|
63
|
+
<output-format>
|
|
64
|
+
## Review Report
|
|
65
|
+
- **File**: {path}
|
|
66
|
+
- **Issues**: {count}
|
|
67
|
+
- **Severity**: {critical|warning|info}
|
|
68
|
+
</output-format>
|
|
69
|
+
|
|
70
|
+
<example>
|
|
71
|
+
Input: `/review src/auth.ts`
|
|
72
|
+
Output: Review report with 3 issues found...
|
|
73
|
+
</example>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Avoid "Think"
|
|
77
|
+
|
|
78
|
+
When extended thinking is disabled, "think" can cause confusion. Use alternatives:
|
|
79
|
+
|
|
80
|
+
| Instead of | Use |
|
|
81
|
+
|---|---|
|
|
82
|
+
| "Think about..." | "Consider..." |
|
|
83
|
+
| "Think through..." | "Evaluate..." |
|
|
84
|
+
| "Think step by step" | "Work through each step" |
|
|
85
|
+
| "Let me think" | "Let me analyze" |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Structural Patterns
|
|
90
|
+
|
|
91
|
+
### Pattern 1: Workflow (Most Common)
|
|
92
|
+
|
|
93
|
+
Sequential steps with clear entry/exit criteria. Best for medium-freedom skills.
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
## Workflow
|
|
97
|
+
|
|
98
|
+
### Step 1: Parse Input
|
|
99
|
+
Extract the target from `$ARGUMENTS`.
|
|
100
|
+
If empty, ask the user for the target.
|
|
101
|
+
|
|
102
|
+
### Step 2: Analyze
|
|
103
|
+
Read the target file(s) and identify {specific things}.
|
|
104
|
+
|
|
105
|
+
### Step 3: Generate Output
|
|
106
|
+
Produce {specific output format}.
|
|
107
|
+
|
|
108
|
+
### Step 4: Validate
|
|
109
|
+
Verify the output meets {specific criteria}.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**When to use**: Most skills. Provides clear structure while allowing flexibility within steps.
|
|
113
|
+
|
|
114
|
+
### Pattern 2: Template (Fill-in-the-Blanks)
|
|
115
|
+
|
|
116
|
+
Fixed output structure with variable content. Best for low-freedom skills.
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## Output Template
|
|
120
|
+
|
|
121
|
+
Generate the following file:
|
|
122
|
+
|
|
123
|
+
\```yaml
|
|
124
|
+
name: {extracted-name}
|
|
125
|
+
version: {detected-version}
|
|
126
|
+
dependencies:
|
|
127
|
+
{for each dependency}
|
|
128
|
+
- name: {dep-name}
|
|
129
|
+
version: {dep-version}
|
|
130
|
+
{end for}
|
|
131
|
+
\```
|
|
132
|
+
|
|
133
|
+
Rules:
|
|
134
|
+
- `name` must be lowercase with hyphens
|
|
135
|
+
- `version` must follow semver (x.y.z)
|
|
136
|
+
- Dependencies sorted alphabetically
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**When to use**: Config generation, scaffolding, report generation.
|
|
140
|
+
|
|
141
|
+
### Pattern 3: Decision Tree
|
|
142
|
+
|
|
143
|
+
Branching logic based on input analysis. Best for skills that adapt behavior.
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
## Decision Logic
|
|
147
|
+
|
|
148
|
+
Analyze the input and follow the appropriate path:
|
|
149
|
+
|
|
150
|
+
### Path A: Single File
|
|
151
|
+
If `$ARGUMENTS` points to a single file:
|
|
152
|
+
1. Read the file
|
|
153
|
+
2. Analyze for {criteria}
|
|
154
|
+
3. Output inline suggestions
|
|
155
|
+
|
|
156
|
+
### Path B: Directory
|
|
157
|
+
If `$ARGUMENTS` points to a directory:
|
|
158
|
+
1. Glob for relevant files (`**/*.{ts,tsx}`)
|
|
159
|
+
2. Analyze each file
|
|
160
|
+
3. Output a summary report
|
|
161
|
+
|
|
162
|
+
### Path C: No Input
|
|
163
|
+
If `$ARGUMENTS` is empty:
|
|
164
|
+
1. Detect the project type from package.json / pyproject.toml
|
|
165
|
+
2. Find the most relevant files
|
|
166
|
+
3. Follow Path A or Path B based on results
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**When to use**: Skills that handle multiple input types or contexts.
|
|
170
|
+
|
|
171
|
+
### Pattern 4: Conditional Workflow
|
|
172
|
+
|
|
173
|
+
Workflow with conditional steps based on context. Combines workflow + decision tree.
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
## Workflow
|
|
177
|
+
|
|
178
|
+
### Step 1: Detect Context
|
|
179
|
+
Read the project structure and determine:
|
|
180
|
+
- Language (TypeScript, Python, Go, etc.)
|
|
181
|
+
- Framework (Next.js, FastAPI, etc.)
|
|
182
|
+
- Test runner (Jest, Pytest, etc.)
|
|
183
|
+
|
|
184
|
+
### Step 2: Analyze (language-specific)
|
|
185
|
+
|
|
186
|
+
**If TypeScript/JavaScript:**
|
|
187
|
+
- Check for type errors with LSP
|
|
188
|
+
- Scan for common JS anti-patterns
|
|
189
|
+
|
|
190
|
+
**If Python:**
|
|
191
|
+
- Check for type hints
|
|
192
|
+
- Scan for common Python anti-patterns
|
|
193
|
+
|
|
194
|
+
### Step 3: Report
|
|
195
|
+
Output findings in a unified format regardless of language.
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**When to use**: Skills that work across different project types.
|
|
199
|
+
|
|
200
|
+
### Pattern 5: Examples-Driven
|
|
201
|
+
|
|
202
|
+
Heavy use of examples to specify behavior. Best for high-freedom skills.
|
|
203
|
+
|
|
204
|
+
```markdown
|
|
205
|
+
## Behavior
|
|
206
|
+
|
|
207
|
+
Generate code following these examples exactly:
|
|
208
|
+
|
|
209
|
+
<example>
|
|
210
|
+
Input: "a function that fetches user data"
|
|
211
|
+
Output:
|
|
212
|
+
\```typescript
|
|
213
|
+
async function fetchUserData(userId: string): Promise<User> {
|
|
214
|
+
const response = await fetch(`/api/users/${userId}`);
|
|
215
|
+
if (!response.ok) {
|
|
216
|
+
throw new Error(`Failed to fetch user ${userId}: ${response.statusText}`);
|
|
217
|
+
}
|
|
218
|
+
return response.json();
|
|
219
|
+
}
|
|
220
|
+
\```
|
|
221
|
+
</example>
|
|
222
|
+
|
|
223
|
+
<example>
|
|
224
|
+
Input: "a React hook for local storage"
|
|
225
|
+
Output:
|
|
226
|
+
\```typescript
|
|
227
|
+
function useLocalStorage<T>(key: string, initialValue: T) {
|
|
228
|
+
const [value, setValue] = useState<T>(() => {
|
|
229
|
+
const stored = localStorage.getItem(key);
|
|
230
|
+
return stored ? JSON.parse(stored) : initialValue;
|
|
231
|
+
});
|
|
232
|
+
// ...
|
|
233
|
+
}
|
|
234
|
+
\```
|
|
235
|
+
</example>
|
|
236
|
+
|
|
237
|
+
Key patterns shown in examples:
|
|
238
|
+
- Always include error handling
|
|
239
|
+
- Use TypeScript generics where appropriate
|
|
240
|
+
- Async functions return typed Promises
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**When to use**: Code generation, formatting, transformation skills.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Anti-Patterns
|
|
248
|
+
|
|
249
|
+
Common mistakes when writing Claude 4.6 skills:
|
|
250
|
+
|
|
251
|
+
| Anti-Pattern | Problem | Fix |
|
|
252
|
+
|---|---|---|
|
|
253
|
+
| Over-triggering | Description matches too many scenarios | Add specific trigger phrases: `"Use when user says X, Y, Z"` |
|
|
254
|
+
| Aggressive language | "You MUST", "NEVER EVER", "ABSOLUTELY" | Use calm, clear directives: "Always X", "Do not Y" |
|
|
255
|
+
| Vague triggers | "Use when helpful" | Specific: "Use when reviewing TypeScript code for security" |
|
|
256
|
+
| Wall of text | No structure, no headings | Break into steps with `###` headings |
|
|
257
|
+
| Conflicting rules | "Be concise" + "Include all details" | Prioritize: "Be concise. Include details only for critical issues." |
|
|
258
|
+
| No examples | Claude guesses at desired output | Add 1-2 concrete `<example>` blocks |
|
|
259
|
+
| Unbounded scope | "Analyze everything" | Limit: "Analyze files in `src/` matching `*.ts`" |
|
|
260
|
+
| Silent failures | No error handling instructions | Add: "When X fails, display the error and suggest next steps" |
|
|
261
|
+
|
|
262
|
+
### Over-Triggering Fix
|
|
263
|
+
|
|
264
|
+
```markdown
|
|
265
|
+
# Bad — triggers on any code question
|
|
266
|
+
description: Helps with code. Use for any coding task.
|
|
267
|
+
|
|
268
|
+
# Good — specific triggers
|
|
269
|
+
description: >
|
|
270
|
+
Generate unit tests for TypeScript functions using Jest.
|
|
271
|
+
Use when user says "generate tests", "add tests", "write tests for",
|
|
272
|
+
or when reviewing untested code.
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Scope Bounding
|
|
276
|
+
|
|
277
|
+
```markdown
|
|
278
|
+
# Bad — unbounded
|
|
279
|
+
Analyze the entire codebase for issues.
|
|
280
|
+
|
|
281
|
+
# Good — bounded
|
|
282
|
+
Analyze files matching `$ARGUMENTS` (default: `src/**/*.ts`).
|
|
283
|
+
Limit to 50 files maximum. If more files match, ask the user to narrow the scope.
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Anti-Hallucination Patterns
|
|
289
|
+
|
|
290
|
+
Prevent Claude from inventing information in skills:
|
|
291
|
+
|
|
292
|
+
### 1. Ground in File Content
|
|
293
|
+
|
|
294
|
+
```markdown
|
|
295
|
+
# Bad
|
|
296
|
+
Describe the project architecture.
|
|
297
|
+
|
|
298
|
+
# Good
|
|
299
|
+
Read `README.md`, `package.json`, and the `src/` directory structure.
|
|
300
|
+
Describe the architecture based ONLY on what these files contain.
|
|
301
|
+
Do not infer or assume features not present in the code.
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 2. Explicit Unknowns
|
|
305
|
+
|
|
306
|
+
```markdown
|
|
307
|
+
If you cannot determine {X} from the available files:
|
|
308
|
+
- State "Unable to determine {X} from the codebase"
|
|
309
|
+
- List what files you checked
|
|
310
|
+
- Suggest what the user could provide to resolve this
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 3. Verify Before Acting
|
|
314
|
+
|
|
315
|
+
```markdown
|
|
316
|
+
Before generating code:
|
|
317
|
+
1. Read the existing implementation in `$1`
|
|
318
|
+
2. Identify the patterns already used (naming, error handling, imports)
|
|
319
|
+
3. Generate code that matches these existing patterns
|
|
320
|
+
Do not introduce new patterns or dependencies without explicit instruction.
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Degree of Freedom Guide
|
|
326
|
+
|
|
327
|
+
How much latitude to give Claude based on skill type:
|
|
328
|
+
|
|
329
|
+
### High Freedom
|
|
330
|
+
The skill makes autonomous decisions. Requires strong guardrails.
|
|
331
|
+
|
|
332
|
+
```markdown
|
|
333
|
+
## Guardrails
|
|
334
|
+
- Do NOT modify files outside `$ARGUMENTS` path
|
|
335
|
+
- Do NOT add new dependencies without asking
|
|
336
|
+
- Do NOT delete existing code without replacement
|
|
337
|
+
- Maximum 200 lines of generated code per invocation
|
|
338
|
+
- Always show a diff preview before applying changes
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Examples**: code generation, refactoring, migration skills
|
|
342
|
+
|
|
343
|
+
### Medium Freedom
|
|
344
|
+
The skill follows a workflow but adapts to context. Requires clear decision criteria.
|
|
345
|
+
|
|
346
|
+
```markdown
|
|
347
|
+
## Decision Criteria
|
|
348
|
+
- If the file has fewer than 50 lines: inline review
|
|
349
|
+
- If the file has 50-500 lines: section-by-section review
|
|
350
|
+
- If the file has more than 500 lines: focus on public API and entry points only
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Examples**: review, analysis, documentation skills
|
|
354
|
+
|
|
355
|
+
### Low Freedom
|
|
356
|
+
The skill executes a fixed procedure. Requires exact input/output specs.
|
|
357
|
+
|
|
358
|
+
```markdown
|
|
359
|
+
## Input
|
|
360
|
+
- `$1`: PR number (required, integer)
|
|
361
|
+
- `$2`: Template name (optional, default: "standard")
|
|
362
|
+
|
|
363
|
+
## Output
|
|
364
|
+
A markdown report with exactly these sections:
|
|
365
|
+
1. Summary (1-2 sentences)
|
|
366
|
+
2. Checklist (pass/fail for each template requirement)
|
|
367
|
+
3. Missing Items (list of unfulfilled requirements)
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Examples**: validation, scanning, formatting skills
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Frontmatter Field Reference
|
|
2
|
+
|
|
3
|
+
Complete catalog of YAML frontmatter fields for Claude Code skill files (`SKILL.md`).
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Required Fields](#required-fields)
|
|
8
|
+
- [Optional Fields](#optional-fields)
|
|
9
|
+
- [String Substitutions](#string-substitutions)
|
|
10
|
+
- [Tool Presets](#tool-presets)
|
|
11
|
+
- [Naming Rules](#naming-rules)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Required Fields
|
|
16
|
+
|
|
17
|
+
| Field | Type | Max Length | Description |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `name` | string | 64 chars | Unique skill identifier. Lowercase, hyphens, digits only. |
|
|
20
|
+
| `description` | string | 1024 chars | What the skill does and when to trigger it. Third-person voice. |
|
|
21
|
+
|
|
22
|
+
### `name` Validation
|
|
23
|
+
|
|
24
|
+
- Lowercase letters, hyphens, and digits only: `[a-z0-9-]+`
|
|
25
|
+
- Max 64 characters
|
|
26
|
+
- Must NOT contain: `anthropic`, `claude`, `official`
|
|
27
|
+
- Must NOT start or end with a hyphen
|
|
28
|
+
- Must be unique within the project's skill directory
|
|
29
|
+
|
|
30
|
+
### `description` Best Practices
|
|
31
|
+
|
|
32
|
+
- Write in **third-person**: "Validates PR descriptions..." not "I validate..."
|
|
33
|
+
- Include **trigger phrases** so Claude knows when to activate:
|
|
34
|
+
- Good: `Use when user says "check PR", "validate PR", "review description".`
|
|
35
|
+
- Bad: `A helpful skill for PRs.`
|
|
36
|
+
- No XML tags in the description (they break YAML parsing)
|
|
37
|
+
- First sentence = what it does. Second sentence = when to use it.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Optional Fields
|
|
42
|
+
|
|
43
|
+
| Field | Type | Default | Description |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| `allowed-tools` | string (CSV) | all tools | Comma-separated list of tools the skill can use |
|
|
46
|
+
| `argument-hint` | string | none | Placeholder shown to user (e.g., `"[file path]"`) |
|
|
47
|
+
| `user-invocable` | boolean | `true` | Whether users can trigger via `/skill-name` |
|
|
48
|
+
| `disable-model-invocation` | boolean | `false` | If `true`, Claude cannot proactively trigger the skill |
|
|
49
|
+
| `context` | list | none | Files to inject into context when skill activates |
|
|
50
|
+
| `agent` | object | none | Run skill as a subagent with its own context |
|
|
51
|
+
| `model` | string | inherited | Override model (`opus`, `sonnet`, `haiku`) |
|
|
52
|
+
| `hooks` | object | none | Shell commands to run on skill lifecycle events |
|
|
53
|
+
|
|
54
|
+
### `allowed-tools` Details
|
|
55
|
+
|
|
56
|
+
Specify the minimal set of tools needed. Format: comma-separated tool names.
|
|
57
|
+
|
|
58
|
+
For Bash, use glob patterns to restrict commands:
|
|
59
|
+
```yaml
|
|
60
|
+
allowed-tools: Read, Bash(npm test *), Bash(npx *)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Wildcard `*` matches any arguments. Without a glob, Bash runs any command.
|
|
64
|
+
|
|
65
|
+
### `context` Field
|
|
66
|
+
|
|
67
|
+
Inject files into the skill's context automatically:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
context:
|
|
71
|
+
- type: file
|
|
72
|
+
path: ${CLAUDE_SKILL_DIR}/PATTERNS.md
|
|
73
|
+
- type: file
|
|
74
|
+
path: ./CLAUDE.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use `${CLAUDE_SKILL_DIR}` for paths relative to the skill directory.
|
|
78
|
+
|
|
79
|
+
### `agent` Field
|
|
80
|
+
|
|
81
|
+
Run the skill as an isolated subagent:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
agent:
|
|
85
|
+
type: general-purpose
|
|
86
|
+
model: sonnet
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Agent types: `general-purpose`, `Explore`, `Plan`, `haiku`.
|
|
90
|
+
|
|
91
|
+
### `hooks` Field
|
|
92
|
+
|
|
93
|
+
Run shell commands on skill events:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
hooks:
|
|
97
|
+
pre-invoke: "echo 'Starting skill...'"
|
|
98
|
+
post-invoke: "echo 'Skill complete.'"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## String Substitutions
|
|
104
|
+
|
|
105
|
+
These placeholders are replaced at runtime:
|
|
106
|
+
|
|
107
|
+
| Placeholder | Replaced With |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `$ARGUMENTS` | Full argument string passed to the skill |
|
|
110
|
+
| `$1`, `$2`, ... `$N` | Positional arguments (space-separated) |
|
|
111
|
+
| `${CLAUDE_SESSION_ID}` | Current session identifier |
|
|
112
|
+
| `${CLAUDE_SKILL_DIR}` | Absolute path to the skill's directory |
|
|
113
|
+
|
|
114
|
+
### Usage Examples
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
Parse `$ARGUMENTS` for the file path.
|
|
118
|
+
If `$1` is empty, ask the user for a target file.
|
|
119
|
+
Read the config from `${CLAUDE_SKILL_DIR}/config.yaml`.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Tool Presets
|
|
125
|
+
|
|
126
|
+
Common tool combinations by skill type:
|
|
127
|
+
|
|
128
|
+
### Read-Only (analysis, scanning, review)
|
|
129
|
+
```yaml
|
|
130
|
+
allowed-tools: Read, Grep, Glob
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Read-Only + LSP (code intelligence)
|
|
134
|
+
```yaml
|
|
135
|
+
allowed-tools: Read, Grep, Glob, LSP
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Code Modification (generation, refactoring)
|
|
139
|
+
```yaml
|
|
140
|
+
allowed-tools: Read, Grep, Glob, Edit, Write
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Full Access (build, test, deploy)
|
|
144
|
+
```yaml
|
|
145
|
+
allowed-tools: Read, Grep, Glob, Edit, Write, Bash
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Web Access (API calls, fetching docs)
|
|
149
|
+
```yaml
|
|
150
|
+
allowed-tools: Read, Grep, Glob, WebFetch, WebSearch
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Restricted Bash (specific commands only)
|
|
154
|
+
```yaml
|
|
155
|
+
allowed-tools: Read, Grep, Glob, Bash(npm test *), Bash(npx prettier *)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Agent-Spawning (team coordination)
|
|
159
|
+
```yaml
|
|
160
|
+
allowed-tools: Read, Grep, Glob, Edit, Write, Bash, Agent
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Naming Rules
|
|
166
|
+
|
|
167
|
+
### Skill Name (`name` field)
|
|
168
|
+
|
|
169
|
+
| Rule | Good | Bad |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| Lowercase + hyphens | `validate-pr` | `ValidatePR`, `validate_pr` |
|
|
172
|
+
| Descriptive action | `generate-tests` | `tests`, `t` |
|
|
173
|
+
| No reserved words | `code-review` | `claude-review`, `anthropic-scan` |
|
|
174
|
+
| Max 64 chars | `validate-pr-description` | (anything over 64 chars) |
|
|
175
|
+
|
|
176
|
+
### File Naming
|
|
177
|
+
|
|
178
|
+
| File | Convention |
|
|
179
|
+
|---|---|
|
|
180
|
+
| Main skill file | Always `SKILL.md` |
|
|
181
|
+
| Reference files | `UPPERCASE-WORDS.md` (e.g., `PATTERNS.md`, `REFERENCE.md`) |
|
|
182
|
+
| Skill directory | Same as `name` field (e.g., `validate-pr/`) |
|
|
183
|
+
|
|
184
|
+
### Description Formatting
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
# Good — third person, trigger phrases, clear purpose
|
|
188
|
+
description: >
|
|
189
|
+
Validate pull request descriptions against a project template.
|
|
190
|
+
Checks for required sections and formatting completeness.
|
|
191
|
+
Use when reviewing PRs or when user says "check PR", "validate PR".
|
|
192
|
+
|
|
193
|
+
# Bad — first person, no triggers, vague
|
|
194
|
+
description: "I help with PRs"
|
|
195
|
+
```
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-skill
|
|
3
|
+
description: >
|
|
4
|
+
Create well-structured Claude Code skills following Anthropic best practices.
|
|
5
|
+
Generates SKILL.md files with proper frontmatter, workflow structure, and
|
|
6
|
+
prompt engineering patterns for Claude 4.6. Use when building new skills,
|
|
7
|
+
refactoring existing ones, or when user says "create a skill", "new skill",
|
|
8
|
+
"generate skill", "make a command".
|
|
9
|
+
allowed-tools: Read, Grep, Glob, Edit, Write, Bash
|
|
10
|
+
argument-hint: "[skill description or name]"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Generate Skill — Claude Code Skill Authoring
|
|
14
|
+
|
|
15
|
+
Create production-quality Claude Code skills with correct frontmatter, structured workflows, and Claude 4.6 prompt patterns.
|
|
16
|
+
|
|
17
|
+
Reference files in this skill directory:
|
|
18
|
+
- `REFERENCE.md` — Complete frontmatter field catalog and validation rules
|
|
19
|
+
- `PROMPT-PATTERNS.md` — Claude 4.6 prompt engineering patterns for skill bodies
|
|
20
|
+
- `CHECKLIST.md` — Quality verification checklist
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
### Step 1: Gather Requirements
|
|
25
|
+
|
|
26
|
+
Parse `$ARGUMENTS` for the skill description or name.
|
|
27
|
+
|
|
28
|
+
If `$ARGUMENTS` is empty or vague, ask the user:
|
|
29
|
+
|
|
30
|
+
> What skill do you want to create? Describe:
|
|
31
|
+
> 1. **What problem** does it solve?
|
|
32
|
+
> 2. **When** should it trigger? (user command, proactive, or both)
|
|
33
|
+
> 3. **What tools** does it need? (read-only, code modification, web access, etc.)
|
|
34
|
+
|
|
35
|
+
Determine the **degree of freedom**:
|
|
36
|
+
- **High** — Skill makes decisions autonomously (e.g., code generation, refactoring)
|
|
37
|
+
- **Medium** — Skill follows a workflow but adapts to context (e.g., review, analysis)
|
|
38
|
+
- **Low** — Skill executes a fixed procedure (e.g., scan, validate, format)
|
|
39
|
+
|
|
40
|
+
### Step 2: Choose Structure
|
|
41
|
+
|
|
42
|
+
Estimate the total line count for the skill content:
|
|
43
|
+
|
|
44
|
+
| Estimated Lines | Structure |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Under 200 | Single `SKILL.md` file |
|
|
47
|
+
| 200–500 | `SKILL.md` + reference files (e.g., `REFERENCE.md`, `PATTERNS.md`) |
|
|
48
|
+
| Over 500 | Split into multiple separate skills |
|
|
49
|
+
|
|
50
|
+
Rules for reference files:
|
|
51
|
+
- One level deep only (no nested references)
|
|
52
|
+
- Add a table of contents if a reference file exceeds 100 lines
|
|
53
|
+
- Reference files use `${CLAUDE_SKILL_DIR}/FILENAME.md` for paths
|
|
54
|
+
|
|
55
|
+
### Step 3: Write Frontmatter
|
|
56
|
+
|
|
57
|
+
Read `${CLAUDE_SKILL_DIR}/REFERENCE.md` for the complete field catalog.
|
|
58
|
+
|
|
59
|
+
Apply these rules:
|
|
60
|
+
- `name`: lowercase, hyphens only, max 64 chars, no "anthropic" or "claude"
|
|
61
|
+
- `description`: third-person, max 1024 chars, include trigger phrases, no XML tags
|
|
62
|
+
- `allowed-tools`: minimal set needed — see tool presets in REFERENCE.md
|
|
63
|
+
- `argument-hint`: brief placeholder showing expected input format
|
|
64
|
+
|
|
65
|
+
### Step 4: Write Skill Body
|
|
66
|
+
|
|
67
|
+
Read `${CLAUDE_SKILL_DIR}/PROMPT-PATTERNS.md` for Claude 4.6 patterns.
|
|
68
|
+
|
|
69
|
+
Structure the body in this order:
|
|
70
|
+
1. **Title and purpose** — One-line summary of what the skill does and why
|
|
71
|
+
2. **Reference file links** — If multi-file, list reference files with descriptions
|
|
72
|
+
3. **Workflow** — Numbered steps with clear entry/exit criteria per step
|
|
73
|
+
4. **Output format** — What the skill produces (files, messages, reports)
|
|
74
|
+
|
|
75
|
+
Writing rules:
|
|
76
|
+
- Lead each step with an **action verb** (Parse, Read, Generate, Validate)
|
|
77
|
+
- Use `$ARGUMENTS` and `$N` for user input substitution
|
|
78
|
+
- Use XML tags (`<example>`, `<rules>`, `<output-format>`) for complex structure
|
|
79
|
+
- Include concrete examples — Claude treats examples as specifications
|
|
80
|
+
- Write "consider" or "evaluate" instead of "think" (for when thinking is disabled)
|
|
81
|
+
|
|
82
|
+
### Step 5: Add Behavioral Rules
|
|
83
|
+
|
|
84
|
+
Every skill needs explicit behavioral boundaries:
|
|
85
|
+
|
|
86
|
+
**Error handling** (mandatory — project convention):
|
|
87
|
+
```
|
|
88
|
+
When an error occurs, display the error clearly to the user with actionable guidance.
|
|
89
|
+
Do NOT silently fall back to defaults or placeholder data.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Guardrails** based on degree of freedom:
|
|
93
|
+
- **High freedom**: Add constraints on what the skill should NOT do. Be specific.
|
|
94
|
+
- **Medium freedom**: Define decision criteria for branching logic.
|
|
95
|
+
- **Low freedom**: Specify exact expected inputs/outputs and validation.
|
|
96
|
+
|
|
97
|
+
**Common rules to consider**:
|
|
98
|
+
- What happens when `$ARGUMENTS` is empty?
|
|
99
|
+
- What happens when required files don't exist?
|
|
100
|
+
- What are the skill's boundaries? (what it explicitly does NOT do)
|
|
101
|
+
- Should it ask for confirmation before destructive actions?
|
|
102
|
+
|
|
103
|
+
### Step 6: Write Reference Files (if needed)
|
|
104
|
+
|
|
105
|
+
For multi-file skills, create reference files:
|
|
106
|
+
|
|
107
|
+
- Each file covers one topic (patterns, field catalog, examples, etc.)
|
|
108
|
+
- Start with a heading and brief description of the file's purpose
|
|
109
|
+
- Add a table of contents if the file exceeds 100 lines
|
|
110
|
+
- Use consistent formatting (tables for catalogs, code blocks for examples)
|
|
111
|
+
|
|
112
|
+
### Step 7: Validate
|
|
113
|
+
|
|
114
|
+
Read `${CLAUDE_SKILL_DIR}/CHECKLIST.md` and verify the generated skill against every item.
|
|
115
|
+
|
|
116
|
+
Fix any issues before presenting the final output.
|
|
117
|
+
|
|
118
|
+
## Output
|
|
119
|
+
|
|
120
|
+
After generating the skill, present:
|
|
121
|
+
|
|
122
|
+
1. **File listing** — All files created with line counts
|
|
123
|
+
2. **Installation path** — `.claude/skills/<skill-name>/`
|
|
124
|
+
3. **Test invocation** — Example command to test the skill
|
|
125
|
+
|
|
126
|
+
Offer to:
|
|
127
|
+
- Run `/devlyn.review` on the generated skill for quality assurance
|
|
128
|
+
- Run `pyx-scan` if the skill will be published
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Examples
|
|
133
|
+
|
|
134
|
+
<example>
|
|
135
|
+
**Input**: `/generate-skill A skill that validates PR descriptions against a template`
|
|
136
|
+
|
|
137
|
+
**Output structure** (single file):
|
|
138
|
+
```
|
|
139
|
+
.claude/skills/validate-pr/
|
|
140
|
+
└── SKILL.md (~120 lines)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Frontmatter:
|
|
144
|
+
```yaml
|
|
145
|
+
name: validate-pr
|
|
146
|
+
description: >
|
|
147
|
+
Validate pull request descriptions against a project template.
|
|
148
|
+
Checks for required sections, formatting, and completeness.
|
|
149
|
+
Use when reviewing PRs or when user says "check PR", "validate PR description".
|
|
150
|
+
allowed-tools: Read, Grep, Glob, Bash(gh pr view *)
|
|
151
|
+
argument-hint: "[PR number or URL]"
|
|
152
|
+
```
|
|
153
|
+
</example>
|
|
154
|
+
|
|
155
|
+
<example>
|
|
156
|
+
**Input**: `/generate-skill A comprehensive code review skill with security, performance, and accessibility checks`
|
|
157
|
+
|
|
158
|
+
**Output structure** (multi-file):
|
|
159
|
+
```
|
|
160
|
+
.claude/skills/code-review/
|
|
161
|
+
├── SKILL.md (~200 lines) Main workflow
|
|
162
|
+
├── SECURITY.md (~150 lines) Security check patterns
|
|
163
|
+
├── PERFORMANCE.md (~120 lines) Performance anti-patterns
|
|
164
|
+
└── ACCESSIBILITY.md (~100 lines) A11y checklist
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Frontmatter:
|
|
168
|
+
```yaml
|
|
169
|
+
name: code-review
|
|
170
|
+
description: >
|
|
171
|
+
Comprehensive code review covering security vulnerabilities, performance
|
|
172
|
+
anti-patterns, and accessibility compliance. Produces a structured report
|
|
173
|
+
with severity ratings. Use when reviewing code, PRs, or when user says
|
|
174
|
+
"review code", "security check", "audit this".
|
|
175
|
+
allowed-tools: Read, Grep, Glob, LSP
|
|
176
|
+
argument-hint: "[file path, directory, or PR number]"
|
|
177
|
+
```
|
|
178
|
+
</example>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devlyn-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Claude Code configuration toolkit for teams",
|
|
5
5
|
"bin": {
|
|
6
6
|
"devlyn": "bin/devlyn.js"
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git+https://github.com/fysoul17/devlyn-cli.git"
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|