amlei-skills 1.0.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-plugin/plugin.json +22 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/agents/README.md +300 -0
- package/agents/auth-route-debugger.md +117 -0
- package/agents/auth-route-tester.md +93 -0
- package/agents/auto-error-resolver.md +96 -0
- package/agents/code-architecture-reviewer.md +83 -0
- package/agents/code-refactor-master.md +94 -0
- package/agents/documentation-architect.md +82 -0
- package/agents/frontend-error-fixer.md +76 -0
- package/agents/plan-reviewer.md +52 -0
- package/agents/refactor-planner.md +62 -0
- package/agents/web-research-specialist.md +78 -0
- package/commands/d_system_analyse.md +8 -0
- package/commands/route-research-for-testing.md +37 -0
- package/package.json +28 -0
- package/skills/git-gh/SKILL.md +145 -0
- package/skills/skill-creation/SKILL.md +196 -0
- package/skills/skill-creation/resources/advanced-patterns.md +91 -0
- package/skills/skill-creation/resources/frontmatter-examples.md +111 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# 系统分析师
|
|
2
|
+
|
|
3
|
+
## 角色设定
|
|
4
|
+
你是一名资深的系统分析师,具有超过30多年的代码设计和编写实践,这也让你拥有客观、诚恳观念。你会深入理解项目代码实现的逻辑和功能实现,并讲述地简洁、清晰。你也很乐于交流,喜欢跟对方反复确认,确保目标一直在分析和理解。关于当前系统中的所有疑问,你自己去查找了解完整
|
|
5
|
+
|
|
6
|
+
接收到用户的请求后,你会先阅读项目代码,步步深入以了解每一步做了什么,而不像灌了两三桶水的Coder去“顾名思义”。你会不断地跟用户去聊天,而不是做执行。如果用户的疑问,开始变成了功能修改/新增,你可以开始跟用户一起讨论如何实现。
|
|
7
|
+
|
|
8
|
+
你首先会跟用户一起进行业务分析,完成业务分析后再来讨论技术设计。
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Map edited routes & launch tests
|
|
3
|
+
argument-hint: "[/extra/path …]"
|
|
4
|
+
allowed-tools: Bash(cat:*), Bash(awk:*), Bash(grep:*), Bash(sort:*), Bash(xargs:*), Bash(sed:*)
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Context
|
|
9
|
+
|
|
10
|
+
Changed route files this session (auto-generated):
|
|
11
|
+
|
|
12
|
+
!cat "$CLAUDE_PROJECT_DIR/.claude/tsc-cache"/\*/edited-files.log \
|
|
13
|
+
| awk -F: '{print $2}' \
|
|
14
|
+
| grep '/routes/' \
|
|
15
|
+
| sort -u
|
|
16
|
+
|
|
17
|
+
User-specified additional routes: `$ARGUMENTS`
|
|
18
|
+
|
|
19
|
+
## Your task
|
|
20
|
+
|
|
21
|
+
Follow the numbered steps **exactly**:
|
|
22
|
+
|
|
23
|
+
1. Combine the auto list with `$ARGUMENTS`, dedupe, and resolve any prefixes
|
|
24
|
+
defined in `src/app.ts`.
|
|
25
|
+
2. For each final route, output a JSON record with the path, method, expected
|
|
26
|
+
request/response shapes, and valid + invalid payload examples.
|
|
27
|
+
3. **Now call the `Task` tool** using:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"tool": "Task",
|
|
32
|
+
"parameters": {
|
|
33
|
+
"description": "route smoke tests",
|
|
34
|
+
"prompt": "Run the auth-route-tester sub-agent on the JSON above."
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "amlei-skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Production-tested skills, agents, and commands for Claude Code — backend/frontend, testing, git workflow, and more.",
|
|
5
|
+
"main": ".claude-plugin/plugin.json",
|
|
6
|
+
"files": [
|
|
7
|
+
".claude-plugin/",
|
|
8
|
+
"skills/git-gh/",
|
|
9
|
+
"skills/skill-creation/",
|
|
10
|
+
"agents/",
|
|
11
|
+
"commands/",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"claude-code",
|
|
17
|
+
"claude-code-plugin",
|
|
18
|
+
"skills",
|
|
19
|
+
"agents",
|
|
20
|
+
"commands"
|
|
21
|
+
],
|
|
22
|
+
"author": "amlei",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/amlei/amlei-skills.git"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-gh
|
|
3
|
+
description: Guide for git commit, push, and PR using gh CLI (GitHub). Use when committing code, pushing to remote, creating pull requests, managing branches, or any git workflow. Covers commit message conventions, push strategies, and PR creation with confirmation gates.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Git & GitHub Workflow
|
|
8
|
+
|
|
9
|
+
Use `gh` CLI (GitHub) for all remote operations. Commit and push directly without confirmation. Only PR requires explicit user approval.
|
|
10
|
+
|
|
11
|
+
## 1. Commit
|
|
12
|
+
|
|
13
|
+
### Before Committing
|
|
14
|
+
|
|
15
|
+
Run in parallel to gather context:
|
|
16
|
+
- `git status` — untracked and modified files
|
|
17
|
+
- `git diff` — staged and unstaged changes
|
|
18
|
+
- `git log --oneline -10` — recent commit style
|
|
19
|
+
|
|
20
|
+
### Commit Message Rules
|
|
21
|
+
|
|
22
|
+
- Write in **Chinese or English** depending on the project's existing commit style
|
|
23
|
+
- Format: `type: short summary` — one line, concise, human-readable
|
|
24
|
+
- Types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`, `style`, `perf`
|
|
25
|
+
- Focus on **what changed and why**, not how
|
|
26
|
+
- No emojis unless user requests
|
|
27
|
+
|
|
28
|
+
### Good Examples
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
feat: add user login with email verification
|
|
32
|
+
fix: resolve race condition in batch processing
|
|
33
|
+
refactor: extract validation logic into shared module
|
|
34
|
+
docs: update API endpoint descriptions
|
|
35
|
+
chore: upgrade dependencies to latest stable
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Bad Examples
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
update files # too vague
|
|
42
|
+
feat: add feature # which feature?
|
|
43
|
+
wip # meaningless
|
|
44
|
+
fix bug # what bug?
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Steps
|
|
48
|
+
|
|
49
|
+
1. Gather context (status, diff, recent log) — run in parallel
|
|
50
|
+
2. Stage specific files by name (`git add <file>`), avoid `git add -A`
|
|
51
|
+
3. Draft commit message based on actual changes
|
|
52
|
+
4. Create commit directly
|
|
53
|
+
5. Run `git status` to verify
|
|
54
|
+
|
|
55
|
+
Never commit files that likely contain secrets (.env, credentials).
|
|
56
|
+
|
|
57
|
+
## 2. Push
|
|
58
|
+
|
|
59
|
+
### Steps
|
|
60
|
+
|
|
61
|
+
1. Check if branch tracks a remote: `git branch -vv`
|
|
62
|
+
2. If no upstream, push with: `git push -u origin <branch>`
|
|
63
|
+
3. If upstream exists: `git push`
|
|
64
|
+
4. **Never force push** unless user explicitly requests
|
|
65
|
+
|
|
66
|
+
### Current Branch Check
|
|
67
|
+
|
|
68
|
+
After commit, check if current branch is not `main`/`master`. If on a feature branch and commit + push succeeded, proceed to step 3.
|
|
69
|
+
|
|
70
|
+
## 3. Pull Request
|
|
71
|
+
|
|
72
|
+
### When to Ask
|
|
73
|
+
|
|
74
|
+
After a successful commit + push on a **non-main branch**, ask the user:
|
|
75
|
+
|
|
76
|
+
> Commit and push completed. Would you like to create a pull request?
|
|
77
|
+
|
|
78
|
+
**Never create a PR automatically.** Always wait for explicit user confirmation.
|
|
79
|
+
|
|
80
|
+
### When NOT to Ask
|
|
81
|
+
|
|
82
|
+
- Already on `main` or `master`
|
|
83
|
+
- User only asked to commit (not push)
|
|
84
|
+
- PR already exists for this branch
|
|
85
|
+
|
|
86
|
+
### PR Creation Steps
|
|
87
|
+
|
|
88
|
+
1. Run in parallel to gather full context:
|
|
89
|
+
- `git status`
|
|
90
|
+
- `git diff`
|
|
91
|
+
- `git log main..HEAD --oneline` — all commits on this branch
|
|
92
|
+
- `git diff main...HEAD` — full diff from base
|
|
93
|
+
2. Analyze all changes, draft title and body
|
|
94
|
+
3. PR title: under 70 chars, concise summary of the change
|
|
95
|
+
4. PR body format:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## Summary
|
|
99
|
+
- Bullet points of key changes (1-3 items)
|
|
100
|
+
|
|
101
|
+
## Test plan
|
|
102
|
+
- Checklist of verification steps
|
|
103
|
+
|
|
104
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
5. Present to user for approval
|
|
108
|
+
6. Push with `-u` if needed, then create via `gh pr create`
|
|
109
|
+
7. Return the PR URL
|
|
110
|
+
|
|
111
|
+
### gh pr create Template
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
gh pr create --title "the title" --body "$(cat <<'EOF'
|
|
115
|
+
## Summary
|
|
116
|
+
<bullets>
|
|
117
|
+
|
|
118
|
+
## Test plan
|
|
119
|
+
<checklist>
|
|
120
|
+
|
|
121
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
122
|
+
EOF
|
|
123
|
+
)"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Quick Reference
|
|
127
|
+
|
|
128
|
+
| Action | Command |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Check status | `git status` |
|
|
131
|
+
| Stage files | `git add <file>` |
|
|
132
|
+
| Commit | `git commit -m "msg"` |
|
|
133
|
+
| Push (new branch) | `git push -u origin <branch>` |
|
|
134
|
+
| Push (existing) | `git push` |
|
|
135
|
+
| Create PR | `gh pr create --title "..." --body "..."` |
|
|
136
|
+
| Check existing PRs | `gh pr list` |
|
|
137
|
+
| View PR | `gh pr view <number>` |
|
|
138
|
+
|
|
139
|
+
## Safety Rules
|
|
140
|
+
|
|
141
|
+
- Never force push to main/master
|
|
142
|
+
- Never auto-create PRs
|
|
143
|
+
- Never commit secret files (.env, credentials)
|
|
144
|
+
- Never use `git add -A` — stage specific files
|
|
145
|
+
- Never skip pre-commit hooks (`--no-verify`)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-creation
|
|
3
|
+
description: Guide for creating Claude Code skills following the official Agent Skills open standard. Use when creating new skills, writing SKILL.md files, configuring frontmatter, adding support files, passing arguments, injecting dynamic context, running skills in subagents, or troubleshooting skill issues. Covers skill locations, frontmatter reference, invocation control, tool restrictions, paths filtering, and advanced patterns like fork context and shell injection.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Claude Code Skills
|
|
7
|
+
|
|
8
|
+
Official guide based on the Claude Code skills documentation. Skills extend what Claude can do via a `SKILL.md` file with instructions that Claude adds to its toolkit.
|
|
9
|
+
|
|
10
|
+
## Skill Locations
|
|
11
|
+
|
|
12
|
+
| Location | Path | Scope |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Enterprise | Managed settings | All users in org |
|
|
15
|
+
| Personal | `~/.claude/skills/<name>/SKILL.md` | All your projects |
|
|
16
|
+
| Project | `.claude/skills/<name>/SKILL.md` | This project only |
|
|
17
|
+
| Plugin | `<plugin>/skills/<name>/SKILL.md` | Where plugin is enabled |
|
|
18
|
+
|
|
19
|
+
Priority: enterprise > personal > project. Plugin skills use `plugin-name:skill-name` namespace.
|
|
20
|
+
|
|
21
|
+
## Skill Directory Structure
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
my-skill/
|
|
25
|
+
├── SKILL.md # Main instructions (required)
|
|
26
|
+
├── template.md # Template for Claude to fill
|
|
27
|
+
├── examples/
|
|
28
|
+
│ └── sample.md # Example output
|
|
29
|
+
└── scripts/
|
|
30
|
+
└── validate.sh # Executable scripts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Keep SKILL.md under 500 lines. Move details to reference files. Link them from SKILL.md:
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
## Additional resources
|
|
37
|
+
- For API details, see [reference.md](reference.md)
|
|
38
|
+
- For examples, see [examples.md](examples.md)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Frontmatter Reference
|
|
42
|
+
|
|
43
|
+
All fields optional. `description` is recommended.
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
---
|
|
47
|
+
name: my-skill # Slash command name (lowercase, hyphens, max 64 chars)
|
|
48
|
+
description: What it does # Claude uses this to decide when to activate
|
|
49
|
+
argument-hint: "[issue-number]" # Autocomplete hint
|
|
50
|
+
disable-model-invocation: true # Only user can invoke (not Claude)
|
|
51
|
+
user-invocable: false # Hide from / menu (background knowledge)
|
|
52
|
+
allowed-tools: Read Grep Glob # Tools allowed without permission prompts
|
|
53
|
+
model: sonnet # Model override
|
|
54
|
+
effort: high # Effort level: low, medium, high, max
|
|
55
|
+
context: fork # Run in isolated subagent
|
|
56
|
+
agent: Explore # Subagent type for fork context
|
|
57
|
+
hooks: {} # Lifecycle hooks
|
|
58
|
+
paths: "src/**/*.ts" # Glob: only activate for matching files
|
|
59
|
+
shell: powershell # Shell for backtick commands (bash default)
|
|
60
|
+
---
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Two Skill Content Types
|
|
64
|
+
|
|
65
|
+
**Reference content** — knowledge Claude applies inline:
|
|
66
|
+
```yaml
|
|
67
|
+
---
|
|
68
|
+
name: api-conventions
|
|
69
|
+
description: API design patterns for this codebase
|
|
70
|
+
---
|
|
71
|
+
When writing API endpoints:
|
|
72
|
+
- Use RESTful naming
|
|
73
|
+
- Return consistent error formats
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Task content** — step-by-step workflow (add `disable-model-invocation: true`):
|
|
77
|
+
```yaml
|
|
78
|
+
---
|
|
79
|
+
name: deploy
|
|
80
|
+
description: Deploy to production
|
|
81
|
+
context: fork
|
|
82
|
+
disable-model-invocation: true
|
|
83
|
+
---
|
|
84
|
+
1. Run the test suite
|
|
85
|
+
2. Build the application
|
|
86
|
+
3. Push to deployment target
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Invocation Control
|
|
90
|
+
|
|
91
|
+
| Frontmatter | User invokes | Claude invokes | Context loading |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| (default) | Yes | Yes | Description always loaded, full content on invoke |
|
|
94
|
+
| `disable-model-invocation: true` | Yes | No | Description NOT loaded, full content on user invoke |
|
|
95
|
+
| `user-invocable: false` | No | Yes | Description always loaded, full content on Claude invoke |
|
|
96
|
+
|
|
97
|
+
## String Replacements
|
|
98
|
+
|
|
99
|
+
| Variable | Description |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `$ARGUMENTS` | All arguments passed to skill |
|
|
102
|
+
| `$ARGUMENTS[N]` or `$N` | Argument by 0-based index |
|
|
103
|
+
| `${CLAUDE_SESSION_ID}` | Current session ID |
|
|
104
|
+
| `${CLAUDE_SKILL_DIR}` | Directory containing SKILL.md |
|
|
105
|
+
|
|
106
|
+
## Passing Arguments
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
---
|
|
110
|
+
name: fix-issue
|
|
111
|
+
description: Fix a GitHub issue
|
|
112
|
+
disable-model-invocation: true
|
|
113
|
+
---
|
|
114
|
+
Fix GitHub issue $ARGUMENTS following our coding standards.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`/fix-issue 123` → "Fix GitHub issue 123 following our coding standards."
|
|
118
|
+
|
|
119
|
+
Positional: `/migrate-component SearchBar React Vue`
|
|
120
|
+
```
|
|
121
|
+
Migrate the $0 component from $1 to $2.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Dynamic Context Injection
|
|
125
|
+
|
|
126
|
+
`` !`command` `` runs shell commands before Claude sees the content:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
---
|
|
130
|
+
name: pr-summary
|
|
131
|
+
description: Summarize PR changes
|
|
132
|
+
context: fork
|
|
133
|
+
agent: Explore
|
|
134
|
+
allowed-tools: Bash(gh *)
|
|
135
|
+
---
|
|
136
|
+
## PR context
|
|
137
|
+
- PR diff: !`gh pr diff`
|
|
138
|
+
- PR comments: !`gh pr view --comments`
|
|
139
|
+
- Changed files: !`gh pr diff --name-only`
|
|
140
|
+
|
|
141
|
+
## Your task
|
|
142
|
+
Summarize this pull request.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Subagent Execution
|
|
146
|
+
|
|
147
|
+
Add `context: fork` to run in an isolated subagent:
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
---
|
|
151
|
+
name: deep-research
|
|
152
|
+
description: Research a topic thoroughly
|
|
153
|
+
context: fork
|
|
154
|
+
agent: Explore
|
|
155
|
+
---
|
|
156
|
+
Research $ARGUMENTS thoroughly:
|
|
157
|
+
1. Find relevant files using Glob and Grep
|
|
158
|
+
2. Read and analyze the code
|
|
159
|
+
3. Summarize findings with file references
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`agent` options: `Explore`, `Plan`, `general-purpose`, or any custom subagent from `.claude/agents/`.
|
|
163
|
+
|
|
164
|
+
## Paths Filtering
|
|
165
|
+
|
|
166
|
+
Limit activation to specific file patterns:
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
---
|
|
170
|
+
name: react-patterns
|
|
171
|
+
description: React component patterns
|
|
172
|
+
paths: "src/components/**/*.tsx,src/pages/**/*.tsx"
|
|
173
|
+
---
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Quick Creation Checklist
|
|
177
|
+
|
|
178
|
+
- [ ] Create `.claude/skills/<name>/SKILL.md`
|
|
179
|
+
- [ ] Add frontmatter with `name` and `description`
|
|
180
|
+
- [ ] Write instructions (under 500 lines)
|
|
181
|
+
- [ ] Add reference files for details, link from SKILL.md
|
|
182
|
+
- [ ] Test: ask a matching question or run `/skill-name`
|
|
183
|
+
- [ ] Verify description includes keywords users would naturally say
|
|
184
|
+
|
|
185
|
+
## Troubleshooting
|
|
186
|
+
|
|
187
|
+
**Skill not triggering**: Check description keywords, verify with "What skills are available?", try `/skill-name` directly.
|
|
188
|
+
|
|
189
|
+
**Triggering too often**: Make description more specific, add `disable-model-invocation: true`.
|
|
190
|
+
|
|
191
|
+
**Description truncated**: Each entry capped at 250 chars. Lead with key use cases. Raise limit with `SLASH_COMMAND_TOOL_CHAR_BUDGET` env var.
|
|
192
|
+
|
|
193
|
+
## Reference Files
|
|
194
|
+
|
|
195
|
+
- [frontmatter-examples.md](resources/frontmatter-examples.md) — Complete frontmatter examples for common skill types
|
|
196
|
+
- [advanced-patterns.md](resources/advanced-patterns.md) — Visual output generation, hooks integration, permission control
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Advanced Patterns
|
|
2
|
+
|
|
3
|
+
## Visual Output Generation
|
|
4
|
+
|
|
5
|
+
Skills can bundle scripts that generate interactive HTML files opened in a browser:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
name: codebase-visualizer
|
|
10
|
+
description: Generate interactive tree visualization of codebase
|
|
11
|
+
allowed-tools: Bash(python *)
|
|
12
|
+
---
|
|
13
|
+
# Codebase Visualizer
|
|
14
|
+
|
|
15
|
+
Run the visualization script:
|
|
16
|
+
```bash
|
|
17
|
+
python ${CLAUDE_SKILL_DIR}/scripts/visualize.py .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This creates `codebase-map.html` and opens it in the browser.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Pattern: skill orchestrates, bundled script does heavy lifting. Works for dependency graphs, test coverage reports, API docs, DB schema visualizations.
|
|
24
|
+
|
|
25
|
+
## Permission Control
|
|
26
|
+
|
|
27
|
+
**Deny all skills via /permissions:**
|
|
28
|
+
```
|
|
29
|
+
Skill
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Allow specific skills:**
|
|
33
|
+
```
|
|
34
|
+
Skill(commit)
|
|
35
|
+
Skill(review-pr *)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Deny specific skills:**
|
|
39
|
+
```
|
|
40
|
+
Skill(deploy *)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Syntax: `Skill(name)` for exact match, `Skill(name *)` for prefix with any args.
|
|
44
|
+
|
|
45
|
+
## Nested Directory Auto-Discovery
|
|
46
|
+
|
|
47
|
+
In monorepos, Claude discovers skills from nested `.claude/skills/`:
|
|
48
|
+
```
|
|
49
|
+
packages/frontend/.claude/skills/react-patterns/SKILL.md
|
|
50
|
+
packages/backend/.claude/skills/api-conventions/SKILL.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Skills from Added Directories
|
|
54
|
+
|
|
55
|
+
`--add-dir` flag auto-loads `.claude/skills/` from added directories with live change detection. Other `.claude/` config (subagents, commands) is NOT loaded.
|
|
56
|
+
|
|
57
|
+
## Hooks Integration
|
|
58
|
+
|
|
59
|
+
Skills can define lifecycle hooks scoped to the skill's lifetime:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
---
|
|
63
|
+
name: monitored-task
|
|
64
|
+
description: Task with pre/post hooks
|
|
65
|
+
hooks:
|
|
66
|
+
PreToolUse:
|
|
67
|
+
- command: "echo 'About to use $TOOL_NAME'"
|
|
68
|
+
PostToolUse:
|
|
69
|
+
- command: "echo 'Finished $TOOL_NAME'"
|
|
70
|
+
---
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Extended Thinking
|
|
74
|
+
|
|
75
|
+
Include the word "ultrathink" anywhere in skill content to enable extended thinking.
|
|
76
|
+
|
|
77
|
+
## Sharing Skills
|
|
78
|
+
|
|
79
|
+
- **Project skills**: Commit `.claude/skills/` to version control
|
|
80
|
+
- **Plugins**: Create `skills/` directory in plugin
|
|
81
|
+
- **Managed**: Deploy org-wide via managed settings
|
|
82
|
+
|
|
83
|
+
## Monorepo Tips
|
|
84
|
+
|
|
85
|
+
For workspace-specific skills, place them in the package's `.claude/skills/`:
|
|
86
|
+
```
|
|
87
|
+
packages/api/.claude/skills/api-conventions/SKILL.md
|
|
88
|
+
packages/web/.claude/skills/react-patterns/SKILL.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Claude auto-discovers skills from the package you're working in.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Frontmatter Examples
|
|
2
|
+
|
|
3
|
+
Complete examples for common skill types.
|
|
4
|
+
|
|
5
|
+
## User-Only Task (deploy, commit, send-message)
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
name: deploy
|
|
10
|
+
description: Deploy the application to production
|
|
11
|
+
disable-model-invocation: true
|
|
12
|
+
argument-hint: "[environment]"
|
|
13
|
+
---
|
|
14
|
+
Deploy $ARGUMENTS to production:
|
|
15
|
+
1. Run the test suite
|
|
16
|
+
2. Build the application
|
|
17
|
+
3. Push to the deployment target
|
|
18
|
+
4. Verify the deployment succeeded
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Background Knowledge (conventions, domain context)
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
---
|
|
25
|
+
name: legacy-api-context
|
|
26
|
+
description: Context about the legacy API system for backward-compatible changes
|
|
27
|
+
user-invocable: false
|
|
28
|
+
---
|
|
29
|
+
When modifying legacy API endpoints:
|
|
30
|
+
- v1 endpoints use snake_case JSON keys
|
|
31
|
+
- Auth headers use X-Legacy-Token, not Bearer
|
|
32
|
+
- Rate limits are per-IP, not per-user
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Read-Only Explorer Skill
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
---
|
|
39
|
+
name: audit-structure
|
|
40
|
+
description: Audit project structure without making changes
|
|
41
|
+
allowed-tools: Read Grep Glob
|
|
42
|
+
context: fork
|
|
43
|
+
agent: Explore
|
|
44
|
+
---
|
|
45
|
+
Analyze the project structure:
|
|
46
|
+
1. Map the directory tree
|
|
47
|
+
2. Identify architectural patterns
|
|
48
|
+
3. Flag inconsistencies
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Multi-Argument Skill
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
---
|
|
55
|
+
name: scaffold
|
|
56
|
+
description: Scaffold a new module with tests
|
|
57
|
+
argument-hint: "<module-name> <layer>"
|
|
58
|
+
---
|
|
59
|
+
Create module $0 in the $1 layer:
|
|
60
|
+
1. Create the module directory
|
|
61
|
+
2. Generate the main file
|
|
62
|
+
3. Generate the test file
|
|
63
|
+
4. Update the index exports
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Path-Filtered Skill
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
---
|
|
70
|
+
name: prisma-patterns
|
|
71
|
+
description: Prisma ORM best practices
|
|
72
|
+
paths: "src/db/**/*.ts,prisma/**/*"
|
|
73
|
+
---
|
|
74
|
+
When writing Prisma queries:
|
|
75
|
+
- Always use select to limit fields
|
|
76
|
+
- Use transactions for multi-table writes
|
|
77
|
+
- Index fields used in where clauses
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Dynamic Context with Shell Injection
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
---
|
|
84
|
+
name: branch-context
|
|
85
|
+
description: Show current branch context and recent changes
|
|
86
|
+
allowed-tools: Bash(git *)
|
|
87
|
+
---
|
|
88
|
+
## Current Branch
|
|
89
|
+
- Branch: !`git branch --show-current`
|
|
90
|
+
- Last 5 commits: !`git log --oneline -5`
|
|
91
|
+
- Changed files: !`git diff --name-only main...HEAD`
|
|
92
|
+
|
|
93
|
+
Summarize the current work-in-progress based on the above context.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Fork Skill with Custom Agent
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
---
|
|
100
|
+
name: security-audit
|
|
101
|
+
description: Security audit of code changes
|
|
102
|
+
context: fork
|
|
103
|
+
agent: general-purpose
|
|
104
|
+
allowed-tools: Read Grep Glob Bash(git *)
|
|
105
|
+
---
|
|
106
|
+
Perform a security audit on the current changes:
|
|
107
|
+
1. Get the diff: !`git diff --name-only main...HEAD`
|
|
108
|
+
2. Review each changed file for security issues
|
|
109
|
+
3. Check for: SQL injection, XSS, secrets in code, insecure defaults
|
|
110
|
+
4. Report findings with severity levels
|
|
111
|
+
```
|