Agent skill
write-skill
Use when the user wants to create a new Claude Code skill. Guides skill creation with playbook patterns.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/write-skill
SKILL.md
Skill Creation Playbook
CRITICAL: Before deploying any skill, spawn a reviewer agent with REVIEW.md to audit allowed-tools. Overly permissive tool access (e.g., Bash(git:*)) can cause data loss or leak secrets.
Create skills as flexible playbooks, not rigid scripts.
Arguments
$ARGUMENTS
Process
0. Determine Scope
Check if arguments specify global or local:
globalorin ~/.claude/skills/→ Skill goes in dotfiles via chezmoi, available everywherelocalorin .claude/skills/→ Skill goes in current project's.claude/skills/, scoped to this repo
If scope is unclear, ask:
"Should this skill be global (available in all projects via dotfiles) or local (scoped to this project only)?"
1. No Arguments? Extract from Conversation
If arguments are empty, the user wants to codify the task just performed:
- Analyze the conversation for the repeatable pattern
- Identify: trigger conditions, tools used, decision points, inputs/outputs
- Propose a skill name and description based on what was done
- Ask about scope (global vs local)
- Draft the skill capturing the workflow as a playbook
- Ask user to confirm or refine before writing
2. Gather Context (when args provided)
If unclear, ask:
- Trigger? (user/auto/always)
- Tools needed?
- Fork context? (noisy output)
- Side effects? (commits/deploys/APIs)
3. Draft Skill
For global skills: Create $(chezmoi source-path)/dot_claude/skills/<name>/SKILL.md
For local skills: Create .claude/skills/<name>/SKILL.md in the current working directory
---
name: <kebab-case>
description: <When to use + what it does>
argument-hint: <flexible, use brackets>
model: <haiku|sonnet|opus> # see MODEL-SELECTION.md
disable-model-invocation: <true if user-only>
context: <fork if output not needed>
allowed-tools: <minimal safe subset>
---
# <Title>
## Arguments
\`\`\`
\$ARGUMENTS
\`\`\`
## Instructions
<Decision-tree playbook>
## Examples
<Varied inputs and outcomes>
For global skills: After writing, run:
chezmoi diffto previewchezmoi apply ~/.claude/skills/<name>to deploychezmoi statusto verify
For local skills: No deployment needed - the skill is immediately available in the project.
4. Principles
Frontmatter:
description: "Use when..." for auto-invokecontext: fork: noisy output that won't inform follow-updisable-model-invocation: true: side-effect skillsallowed-tools: tools that run WITHOUT user approval (omitted tools still work but prompt user)
Arguments:
- Free-form:
[package | url...]not<package> - Show varied inputs in examples
- Parse flexibly, not strictly
Content:
- Decision trees, not linear scripts
- <60 lines; externalize reference material
- Refer to "arguments" after the Arguments section
\${CLAUDE_SESSION_ID}for session-specific context
5. Review (REQUIRED)
Spawn a reviewer agent with this skill's REVIEW.md file to audit:
allowed-toolsagainst red flags (rejectBash(git:*),Bash(npm:*), etc.)- Narrowing principle: most specific pattern used?
- Publication risks: commands that send data externally?
- Deletion risks: commands that remove data?
Also check verbosity, edge cases, and invocation clarity.
Quick Reference
| Goal | Frontmatter |
|---|---|
| User-only trigger | disable-model-invocation: true |
| Auto-invoke | description with "Use when..." |
Hidden from / menu |
user-invocable: false |
| Isolate context | context: fork |
| Specific agent | context: fork + agent: Explore |
| Right-size capability | model: haiku|sonnet|opus |
Supplementary Docs
- REVIEW.md - REQUIRED checklist for auditing
allowed-toolsbefore deployment - MODEL-SELECTION.md - When to use haiku vs sonnet vs opus
- SHIM-PATTERN.md - Wrapper scripts for enforcing constraints (advanced)
| Safe | Unsafe |
|---|---|
Bash(git status:*) |
Bash(git:*) |
Bash(npm test:*) |
Bash(npm:*) |
Read, Grep, Glob |
Bash(rm:*) |
Examples
/write-skill → extract skill from current conversation (will ask about scope)
/write-skill global deploy → global skill for deployments (via chezmoi)
/write-skill local lint-fix → project-local skill for this repo only
/write-skill in ~/.claude/skills/ search → global skill (explicit path)
/write-skill in .claude/skills/ format → local skill (explicit path)
Scope Decision Guide
| Choose global when... | Choose local when... |
|---|---|
| Skill is useful across many projects | Skill is specific to this codebase |
| General-purpose workflow (git, testing) | Project-specific conventions |
| You want it in your dotfiles | Collaborators should have it too |
| Personal preference/style | Team or repo-specific process |
Anti-patterns
- Strict positional arguments
- Broad tool access
- Verbose prose over terse bullets
- Missing
context: forkfor noisy ops - Hardcoded paths vs arguments
- Global skill for project-specific logic
- Local skill for personal workflows you'd want everywhere
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?