Master Claude Code in a Week (Part 6): Skills
This is the sixth part of the "Master Claude Code in a Week" series. In this article, we'll explore Skills — reusable capabilities that are automatically triggered.
What are Skills?
Skills are reusable capabilities — collections of instructions, scripts, and templates that are automatically triggered when Claude detects a matching context. Unlike Slash Commands (manual trigger), Skills are invoked based on conversation content.
┌────────────────────────────────────────────────────────────────┐
│ SKILLS │
├────────────────────────────────────────────────────────────────┤
│ │
│ User: "Review this code for security issues" │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────┐ │
│ │ Claude detects: "code review" + "security" │
│ └────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────┐ │
│ │ Auto-invokes: security-review skill │ │
│ │ │ │
│ │ ~/.claude/skills/security-review/ │ │
│ │ ├── SKILL.md (instructions) │ │
│ │ ├── scripts/scan.sh │ │
│ │ └── templates/report.md │ │
│ └────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Comprehensive security review executed │
│ │
└────────────────────────────────────────────────────────────────┘
Skills vs Slash Commands
| Aspect | Skills | Slash Commands |
|---|---|---|
| Trigger | Auto-invoked | Manual (/cmd) |
| Persistence | Filesystem | Session |
| Complexity | Can include scripts, templates | Markdown only |
| Scope | Automated workflows | Quick shortcuts |
| Structure | Folder with SKILL.md | Single .md file |
Skill Structure
skill-name/
├── SKILL.md # Main instructions (required)
├── scripts/ # Helper scripts (optional)
│ ├── analyze.sh
│ └── report.py
├── templates/ # Output templates (optional)
│ ├── summary.md
│ └── report.json
└── examples/ # Example files (optional)
└── sample-output.md
SKILL.md Structure
---
name: skill-name
description: Brief description for Claude to match
triggers:
- "trigger phrase 1"
- "trigger phrase 2"
---
# Skill Name
## Purpose
What this skill does.
## When to Use
Conditions that should trigger this skill.
## Instructions
Step-by-step instructions for Claude.
## Scripts Available
- `scripts/analyze.sh`: Description
- `scripts/report.py`: Description
## Templates
- `templates/summary.md`: For final summary
- `templates/report.json`: For structured output
## Output Format
Expected output structure.
Installing Skills
Storage Locations
Personal (global):
~/.claude/skills/
Project-specific:
.claude/skills/
From claude-howto
# Copy all skills
cp -r claude-howto/03-skills/* ~/.claude/skills/
# Or copy specific skill
cp -r claude-howto/03-skills/code-review ~/.claude/skills/
Example Skills
1. Code Review Skill
Location: ~/.claude/skills/code-review/
SKILL.md:
---
name: code-review
description: Comprehensive code review with best practices
triggers:
- "review this code"
- "code review"
- "check this code"
- "review PR"
---
# Code Review Skill
## Purpose
Perform comprehensive code review covering quality, security,
performance, and maintainability.
## When to Use
- When user asks for code review
- When reviewing pull requests
- When checking code quality
## Instructions
### 1. Initial Analysis
- Identify the programming language
- Understand the code's purpose
- Note the architecture/patterns used
### 2. Quality Check
Run through checklist:
- [ ] Clean code principles followed
- [ ] Proper naming conventions
- [ ] Single responsibility principle
- [ ] DRY (Don't Repeat Yourself)
- [ ] Error handling present
### 3. Security Review
Check for:
- SQL injection vulnerabilities
- XSS vulnerabilities
- Authentication/Authorization issues
- Sensitive data exposure
- Input validation
### 4. Performance Analysis
Look for:
- N+1 query problems
- Unnecessary loops
- Memory leaks
- Caching opportunities
- Algorithm efficiency
### 5. Generate Report
Use template: `templates/review-report.md`
## Output Format
## Code Review Summary
### Overall Score: X/10
### Critical Issues (Must Fix)
- [Issue with file:line reference]
### Major Issues (Should Fix)
- [Issue with file:line reference]
### Minor Issues (Nice to Have)
- [Issue with file:line reference]
### Positive Aspects
- [Good practice noted]
### Recommendations
1. [Actionable suggestion]
2. [Actionable suggestion]
2. Documentation Generator Skill
Location: ~/.claude/skills/doc-generator/
SKILL.md:
---
name: doc-generator
description: Generate technical documentation automatically
triggers:
- "generate docs"
- "document this"
- "create documentation"
- "write docs"
---
# Documentation Generator Skill
## Purpose
Automatically generate comprehensive technical documentation.
## When to Use
- When user asks for documentation
- When documenting APIs
- When creating README files
## Instructions
### 1. Analyze Code
- Identify public interfaces
- Extract function signatures
- Find existing comments/docstrings
### 2. Determine Doc Type
- API Documentation
- README
- Architecture Doc
- User Guide
- Code Comments
### 3. Generate Documentation
#### For API Documentation:
- Endpoint path and method
- Parameters (path, query, body)
- Request/Response examples
- Error codes
#### For README:
- Project description
- Installation steps
- Usage examples
- Configuration options
- Contributing guidelines
### 4. Format Output
Use appropriate template from `templates/`
3. Brand Voice Skill
Location: ~/.claude/skills/brand-voice/
SKILL.md:
---
name: brand-voice
description: Ensure content matches brand voice guidelines
triggers:
- "write in brand voice"
- "brand guidelines"
- "marketing copy"
- "content review for brand"
---
# Brand Voice Skill
## Purpose
Review and generate content that matches brand voice guidelines.
## When to Use
- Writing marketing copy
- Creating user-facing messages
- Reviewing content for brand consistency
## Instructions
### 1. Load Brand Guidelines
Check for brand guidelines in:
1. `CLAUDE.md` (Brand Voice section)
2. `.claude/brand-voice.md`
3. `docs/brand-guidelines.md`
### 2. Analyze Content
- Tone: Formal vs Casual
- Voice: Active vs Passive
- Vocabulary: Technical level
- Personality: Brand attributes
### 3. Review/Generate
#### For Review:
- Highlight inconsistencies
- Suggest alternatives
- Score brand alignment
#### For Generation:
- Apply brand voice rules
- Use approved vocabulary
- Match tone guidelines
Create Your Own Skill
Step 1: Create folder structure
mkdir -p ~/.claude/skills/my-skill/{scripts,templates,examples}
touch ~/.claude/skills/my-skill/SKILL.md
Step 2: Define SKILL.md
---
name: my-skill
description: What this skill does
triggers:
- "trigger phrase"
---
# My Skill
## Purpose
What this skill accomplishes.
## When to Use
Conditions for triggering.
## Instructions
Step-by-step guide.
## Output Format
Expected output structure.
Step 3: Add scripts (optional)
# scripts/helper.sh
#!/bin/bash
# Helper script
echo "Running helper..."
Step 4: Add templates (optional)
# templates/output.md
# {{title}}
## Summary
{{summary}}
## Details
{{details}}
Step 5: Test
Ask Claude something that should trigger your skill:
User: "Please generate docs" # Should trigger doc-generator
User: "Review this code" # Should trigger code-review
Skills from Community
Claude-howto provides a skills collection at luongnv89/skills:
Available Skills
| Skill | Description |
|---|---|
code-review |
Comprehensive code review |
doc-generator |
Documentation generation |
brand-voice |
Brand voice consistency |
test-generator |
Generate test cases |
refactor-helper |
Refactoring assistance |
security-scan |
Security vulnerability check |
Install from collection
# Clone skills repository
git clone https://github.com/luongnv89/skills.git
# Install specific skill
cp -r skills/code-review ~/.claude/skills/
# Install all skills
cp -r skills/* ~/.claude/skills/
Best Practices
1. Clear Triggers
# ❌ Bad - Too generic
triggers:
- "help"
- "do something"
# ✅ Good - Specific
triggers:
- "review code for security"
- "security audit"
- "check vulnerabilities"
2. Detailed Instructions
# ❌ Bad - Vague
## Instructions
Review the code.
# ✅ Good - Detailed
## Instructions
### 1. Initial Analysis
- Identify programming language
- Note architecture patterns
- List dependencies
### 2. Security Check
For each category:
- [ ] SQL Injection: Check for parameterized queries
- [ ] XSS: Check for output encoding
- [ ] Auth: Check for proper authentication
3. Useful Scripts
Keep scripts focused and reusable:
#!/bin/bash
# ✅ Good - Single purpose, reusable
# scripts/count-lines.sh
FILE=$1
if [ -z "$FILE" ]; then
echo "Usage: count-lines.sh <file>"
exit 1
fi
wc -l < "$FILE"
Debugging Skills
Skill not triggering
- Check triggers: Ensure trigger phrases match user input
- Check location: Skill must be in
~/.claude/skills/or.claude/skills/ - Check SKILL.md: Has proper YAML frontmatter format
Script not running
- Check permissions:
chmod +x scripts/*.sh - Check shebang:
#!/bin/bashat top of file - Check path: Reference correct relative path
Test skill manually
User: "I want to trigger my code-review skill.
Please review this code for security issues."
Summary
Skills are powerful automation tools:
- ✅ Auto-invoked based on context
- ✅ Include scripts and templates
- ✅ Reusable across projects
- ✅ Shareable with team
Next Up
In the next part, we'll explore Hooks — event-driven automation for Claude Code.
References
This series is translated and expanded from claude-howto — MIT License.