How to Create Your Own Skills
There are two ways to create Skills: directly ask Claude to create one for you, or use the dedicated skill-creator tool.
Method 1: Directly ask Claude to help you create one
This is the simplest approach. Just tell Claude your requirement in natural language.
Example:
Please help me create a skill named "format-code" to automatically format code.
Requirements:
1. Automatically detect the programming language
2. Apply the corresponding formatting rules
3. Return the diff before and after formatting
Claude will automatically:
- create the directory structure
- generate the
SKILL.mdfile - fill in the YAML frontmatter
- write the skill content
Suitable scenarios:
- quickly creating simple skills
- you know what you want but are not familiar with the
SKILL.mdformat - you want to iterate and modify quickly
Method 2: Use skill-creator
skill-creator is a dedicated tool for creating Skills. It guides you step by step through the process.
Install:
npx skills add anthropics/skills@skill-creator -g
Or install the entire official skills repository:
npx skills add anthropics/skills -g
Use:
/skill-creator
Then fill in the prompts:
- skill name
- feature description
- usage scenarios
- execution steps
skill-creator will:
- guide you to clarify the purpose of the skill
- generate a draft
SKILL.md - create test cases
- run evaluation and optimize it
Suitable scenarios:
- creating complex skills
- needing a more standard creation process
- wanting to test and verify the skill
Comparison of the two methods
| Method 1: Direct creation | Method 2: skill-creator |
|---|---|
| Fast and simple | Guided steps |
| Suitable for simple skills | Suitable for complex skills |
| Completed directly in conversation | Standardized process |
| Flexible modification | Includes testing and verification |
Tip: how to write a good requirement
A good requirement description:
Create a "git-commit" skill that automatically commits code.
Execution steps:
1. Check which files were modified
2. Generate a commit message that follows Conventional Commits
3. Run git commit
4. Ask whether to push
Notes:
- Check for sensitive information before committing
- Do not commit directories like dist/ or node_modules/
A bad requirement description:
Help me write a skill for committing code
That is too vague. Claude will not know exactly what it needs to do.
Common Skill Examples
Example 1: Code Review Skill
Create the directory and file:
mkdir -p ~/.claude/skills/review-pr
cat > ~/.claude/skills/review-pr/SKILL.md << 'EOF'
---
name: review-pr
description: Review Pull Requests for code quality, security, and test coverage
---
You are a senior code reviewer.
## Review workflow
1. **Code style check**
- Does the code follow team conventions?
- Are names clear?
- Are comments sufficient?
2. **Security check**
- Are there security vulnerabilities?
- Is sensitive information exposed?
- Is input validation complete?
3. **Testing check**
- Are there enough tests?
- Do test cases cover edge conditions?
- Are the tests runnable?
4. **Overall evaluation**
- What are the strengths?
- What needs improvement?
- Do you recommend approving the merge?
## Output format
Please output the review results in a clear structure using a list format.
EOF
How to use it:
/review-pr
Please review the PR for the current branch
Example 2: Git Auto-Commit Skill
mkdir -p ~/.claude/skills/git-commit
cat > ~/.claude/skills/git-commit/SKILL.md << 'EOF'
---
name: git-commit
description: Automatically detect changes, generate a commit message, and commit the code
---
You are a skilled Git user.
## Execution workflow
1. **Check changes**
Run `git status` to view modified files
Run `git diff` to view detailed changes
2. **Generate commit message**
Analyze the nature of the changes
Generate a commit message that follows Conventional Commits
Format: `type(scope): description`
3. **Security check**
Check whether there is sensitive information such as keys, passwords, or tokens
Check whether directories that should not be committed are included
4. **Execute after confirmation**
Show the commit message for confirmation
Run `git add` and `git commit`
Ask whether a push is needed
## Notes
- Do not commit directories such as node_modules/, dist/, or .next/
- Run tests before committing to ensure the code works
- The commit message should clearly explain the change
EOF
How to use it:
/git-commit
Example 3: Test Generation Skill
mkdir -p ~/.claude/skills/gen-test
cat > ~/.claude/skills/gen-test/SKILL.md << 'EOF'
---
name: gen-test
description: Automatically generate unit tests for code to ensure correctness
---
You are a test engineer.
## Workflow
1. **Analyze the code**
- Understand the function or class
- Identify inputs and outputs
- Find edge cases
2. **Generate tests**
- Use an appropriate test framework
- Cover normal cases
- Cover edge cases
- Cover exceptional cases
3. **Validate the tests**
- Make sure the tests can run
- Make sure the tests can catch problems
- Do not over-mock the implementation
## Test frameworks
- JavaScript/TypeScript: Jest or Vitest
- Python: pytest
- Go: testing package
## Output format
Output the test code first, then explain how to run the tests.
EOF
How to use it:
/gen-test
Generate unit tests for src/utils.ts
Example 4: Documentation Generation Skill
mkdir -p ~/.claude/skills/gen-readme
cat > ~/.claude/skills/gen-readme/SKILL.md << 'EOF'
---
name: gen-readme
description: Automatically generate a README document for a project
---
You are a technical documentation expert.
## Workflow
1. **Analyze the project**
- Scan the project directory structure
- Check package.json or other configuration files
- Read the existing code
2. **Generate content**
- Project introduction
- Installation steps
- Usage instructions
- API documentation
- Development guide
3. **Formatting**
- Use a clear section structure
- Add code examples
- Add appropriate badges
- Add license information
## Standard README structure
- Project title and introduction
- Features
- Installation
- Quick start
- Usage instructions
- API documentation
- Development guide
- Contribution guide
- License
EOF
How to use it:
/gen-readme
Generate a README document for the current project
Advanced Tips
Combine Skills with Hooks
Hooks can automatically perform actions on specific events. Combined with Skills, they enable more powerful automation.
For example, automatically format code after saving:
// .claude/hooks.json
{
"hooks": {
"PostToolUse": [{
"matcher": {
"tool_name": "Edit"
},
"hook": {
"type": "command",
"command": "/format-code" // Call the format-code skill
}
}]
}
}
Combine Skills with Commands
Commands are simple shortcut commands. Skills are complex workflows. They can be used together.
Team collaboration
Share project Skills:
- put the Skills under
.claude/skills/ - commit them to Git
- team members can use them after cloning the project
Version control:
- Skills can be version-controlled just like code
- each commit can record changes to Skills
- you can roll back to older versions
Frequently Asked Questions
Q1: Why was the Skill not triggered?
Possible reasons:
- YAML frontmatter format is wrong
- the description is not specific enough
- Claude Code was not restarted
How to solve it:
- check whether the YAML format is correct
- improve the description and include specific usage scenarios
- restart Claude Code
Q2: How do I write an accurate description?
A good description includes:
- the specific function of the skill
- the usage scenario, such as "when the user mentions..."
- trigger keywords
Bad example:
description: Review code
Good example:
description: Review Pull Request code. Trigger when the user mentions PR, review, or code review.
Q3: What is the difference between Skills and Commands?
| Commands | Skills |
|---|---|
| Simple shortcut commands | Complete workflows |
A single .md file | A directory structure (SKILL.md + optional files) |
| Manually triggered | Can be automatically triggered |
| Suitable for simple operations | Suitable for complex processes |
Q4: How do I debug a Skill?
- Use
/skillsto check whether the skill was recognized - Directly enter the skill name to trigger it manually
- Check whether the
SKILL.mdcontent is correct - Review the Claude Code logs
References
Official resources
- Claude Code official docs - Skills
- Agent Skills standard
- Anthropic engineering article (practical ideas behind Agent Skills)
- Anthropic official Skills GitHub repository
- VS Code Copilot Agent Skills documentation
Resource directories
- skills.sh - Vercel's Agent Skills app store with a 48,000+ skill library
- find-skills - intelligent skill search tool with 60K+ subscriptions
- Skills marketplace (Chinese interface) - discover and install community Skills
GitHub community projects
- vercel-labs/agent-skills - Vercel Labs official Agent Skills collection, including find-skills
- claude-code-best-practice - community-maintained best-practices collection
- everything-claude-code - comprehensive toolkit including preconfigured Skills
- awesome-claude-skills - curated list of selected Skills resources
- superpowers - collection of Skills for software development automation workflows
- jeffallan/claude-skills - 66 professional skills and 300+ reference documents
- awesome-agent-skills - curated resource list
Official Skill examples
- skill-creator - a skill for creating new skills
- mcp-builder - a skill for building MCP servers
- slack-gif-creator - a skill for creating Slack GIFs