Claude Skills - Custom Commands
Create reusable commands, project-specific automations, and powerful custom workflows
Claude Skills - Custom Commands
Skills turn repetitive multi-step tasks into single commands. Instead of explaining the same process every time, create a skill once and invoke it with /your-skill-name. This is the power user's secret weapon.
Why Skills Matter
Every time you find yourself typing the same multi-step instructions, that's a skill waiting to be created. One well-crafted skill saves hours over weeks.
Quick Start
Create Your First Skill
1. Create the command file:
mkdir -p .claude/commands2. Write the skill:
Create .claude/commands/fix-issue.md:
# Fix GitHub Issue Fix issue #$ARGUMENTS from GitHub:1. Read the issue description and comments2. Locate the relevant code3. Implement a fix with tests4. Create commit: "fix: Description (closes #$ARGUMENTS)"3. Use it:
/fix-issue 1234Claude fixes issue #1234 end-to-end.
Types of Skills
Built-in Commands
Always available, highest priority:
| Command | What It Does | When to Use |
|---|---|---|
| /help | Show all commands | Discovering features |
| /clear | Reset conversation | Switching tasks |
| /init | Generate CLAUDE.md | New projects |
| /compact | Compress context | Long sessions |
| /review | AI code review | Before commits |
| /memory | Edit CLAUDE.md | Updating context |
| /permissions | Manage tools | Security config |
Project Skills
Live in your repository, shared with team:
your-project/└── .claude/ └── commands/ ├── deploy.md → /deploy ├── fix-issue.md → /fix-issue └── git/ └── squash.md → /git/squashUser Skills
Personal commands, global across all projects:
~/.claude/└── commands/ ├── standup.md → /standup ├── eod.md → /eod └── review-pr.md → /review-prSkill Anatomy
Every skill follows this structure:
# Skill Title Brief description of what this skill does. ## Instructions 1. First step Claude should take2. Second step3. Third step ## Output Format Describe expected output format here. IMPORTANT: Critical instructions here.YOU MUST: Required behaviors.NEVER: Prohibited actions.Using Arguments
Use $ARGUMENTS to accept input:
.claude/commands/create-component.md
# Create React Component Create a new component named $ARGUMENTS. 1. Create src/components/$ARGUMENTS/$ARGUMENTS.tsx2. Create src/components/$ARGUMENTS/$ARGUMENTS.test.tsx3. Create src/components/$ARGUMENTS/index.ts4. Export from src/components/index.tsUsage:
/create-component UserProfileClaude creates UserProfile component with tests.
Real-World Examples
Development Workflow Skills
.claude/commands/review.md — Code Review
# Code Review Review the current changes: 1. Run `git diff` to see changes2. Analyze for: - Logic errors - Security vulnerabilities - Performance issues - Missing tests3. Provide feedback as: ## Review Summary**Status:** Approved / Needs Changes ### Issues Found- [severity] Issue description (file:line) ### Suggestions- Improvement suggestion IMPORTANT: Be specific with line numbers.YOU MUST: Explain why something is an issue..claude/commands/deploy.md — Safe Deployment
# Deploy to Production Safe deployment workflow: ## Pre-flight Checks1. Run `git status` - working directory clean?2. Run `npm test` - all tests passing?3. Run `npm run build` - build successful? If any check fails, STOP and report. ## Deploy1. Run `npm run deploy:prod`2. Wait for completion3. Run health checks ## Verify1. Check production URL2. Verify key features work3. Report success/failure IMPORTANT: Get confirmation before deploying.NEVER: Deploy if tests are failing.Git Workflow Skills
.claude/commands/git/squash.md — Squash Commits
# Squash Commits Squash the last $ARGUMENTS commits: 1. Show `git log --oneline -10`2. Confirm the commits to squash3. Run `git rebase -i HEAD~$ARGUMENTS`4. Use 'squash' for all but first5. Edit commit message6. Show result with `git log --oneline -5` IMPORTANT: Confirm before rebasing.NEVER: Squash commits already pushed..claude/commands/git/branch-cleanup.md — Clean Old Branches
# Branch Cleanup Clean up merged branches: 1. List merged branches: `git branch --merged main` 2. For each branch (except main, develop): - Ask for confirmation - Delete with `git branch -d` 3. Prune remote tracking: `git remote prune origin` 4. Report branches deleted IMPORTANT: Never delete main or develop.Daily Workflow Skills
~/.claude/commands/standup.md — Morning Summary
# Standup Summary Generate standup summary: 1. Check git log for yesterday's commits: `git log --since="yesterday" --author="$(git config user.name)"` 2. Check current branch status 3. Look for any failing tests 4. Generate summary: ## Standup - [Today's Date] ### Yesterday- [List from commits] ### Today- [Current branch/task] ### Blockers- [Any issues]~/.claude/commands/eod.md — End of Day
# End of Day Wrap up the day: 1. Check for uncommitted changes2. If changes exist, create WIP commit: `wip: [description of work in progress]` 3. Generate summary: ## EOD - [Date] ### Completed- [Today's commits] ### In Progress- [WIP items] ### Tomorrow- [Next priorities]Investigation Skills
.claude/commands/investigate.md — Bug Investigation
# Investigate Bug Investigate: $ARGUMENTS ## Understand1. Parse the bug description2. Identify expected vs actual behavior3. List affected components ## Reproduce1. Find reproduction steps2. Locate relevant test files3. Add logging if needed ## Analyze1. Search codebase for related code2. Check git history for recent changes3. Identify root cause ## Report ### Bug Analysis: [Title] **Behavior:** What happens**Expected:** What should happen**Root Cause:** Technical explanation**Files Affected:** List**Proposed Fix:** Approach**Risk:** Low/Medium/High DO NOT fix yet - wait for approval.Code Generation Skills
.claude/commands/api-endpoint.md — Generate API Endpoint
# Create API Endpoint Create endpoint for: $ARGUMENTS ## Our Patterns- All inputs validated with Zod- All responses use ApiResponse<T>- Authentication via middleware- Proper error handling ## Steps1. Create src/app/api/$ARGUMENTS/route.ts2. Create request/response schemas3. Add authentication check4. Implement business logic5. Add error handling6. Create tests in __tests__/ ## Template```typescriptimport { NextRequest } from 'next/server'import { z } from 'zod'import { auth, ApiResponse } from '@/lib' const schema = z.object({ // Define schema}) export async function GET(req: NextRequest) { const session = await auth() if (!session) return ApiResponse.unauthorized() // Implementation return ApiResponse.success(data)}IMPORTANT: Follow existing patterns in src/app/api/
--- ## Nested Commands Organize related commands in folders:.claude/commands/ ├── deploy/ │ ├── staging.md → /deploy/staging │ ├── production.md → /deploy/production │ └── rollback.md → /deploy/rollback ├── db/ │ ├── migrate.md → /db/migrate │ ├── seed.md → /db/seed │ └── reset.md → /db/reset └── test/ ├── unit.md → /test/unit └── e2e.md → /test/e2e
**Benefits:**- Logical grouping- Avoid naming conflicts- Easier discovery- Team-friendly organization --- ## Command Resolution When you type `/my-command`, Claude searches: <Diagram title="Resolution Order" type="flowchart">{`flowchart TB A["/my-command"] --> B{Built-in?} B -->|Yes| C[Execute built-in] B -->|No| D{Project skill?} D -->|Yes| E[.claude/commands/my-command.md] D -->|No| F{User skill?} F -->|Yes| G[~/.claude/commands/my-command.md] F -->|No| H[Command not found]`}</Diagram> **Priority:**1. Built-in commands (highest)2. Project commands (`.claude/commands/`)3. User commands (`~/.claude/commands/`) <Callout type="warning" title="Name Conflicts">Don't name custom commands the same as built-ins. Built-ins always win.</Callout> --- ## Best Practices ### 1. Use Descriptive Sections ```markdown# Create Database Migration ## What This DoesCreates a timestamped migration file... ## Prerequisites- Database connection configured- Prisma schema updated ## Steps1. Generate migration2. Review SQL3. Apply migration2. Include Safety Rails
## Safety Checks Before proceeding:- Verify not on production database- Confirm backup exists- Check no active transactions IMPORTANT: If any check fails, STOP.3. Define Expected Output
## Output FormatMigration: [filename] Tables affected: [list] Status: Created / Failed Next steps: [action]
4. Handle Errors
## Error Handling If migration fails:1. Do NOT retry automatically2. Report exact error3. Suggest causes: - Schema syntax error - Conflicting migration - Connection issue4. Provide recovery stepsTesting Skills
Create a test skill to verify your setup:
.claude/commands/test-skill.md
# Test Skill This skill verifies custom commands work. Arguments received: $ARGUMENTS If you see this, skills are working! Respond with:1. Confirmation you read this2. The arguments received3. Current directoryTest it:
/test-skill hello worldSharing with Your Team
Commit Skills to Git
git add .claude/commands/git commit -m "feat: add team workflow skills"git pushDocument in README
## Custom Commands This project includes Claude Code skills. See `.claude/commands/` for details.| Command | Description |
|---|---|
| /deploy | Deploy to production |
| /fix-issue [n] | Fix GitHub issue |
| /create-component [name] | Create React component |
Troubleshooting
Skill Not Found
Error: Unknown command /my-skillCheck:
- File exists in
.claude/commands/or~/.claude/commands/ - File has
.mdextension - Filename matches command (kebab-case)
Arguments Not Working
Ensure you use $ARGUMENTS:
# WrongProcess the input: [user input here] # CorrectProcess the input: $ARGUMENTSSkill Fails Mid-Execution
Add more specific instructions:
# Before (vague)Fix the issue. # After (specific)1. Read the issue description2. Locate the problematic code3. Propose a fix and wait for approval4. Implement only after approvalQuick Reference
Locations
| Location | Command | Scope |
|---|---|---|
| .claude/commands/skill.md | /skill | Project |
| .claude/commands/dir/skill.md | /dir/skill | Project |
| ~/.claude/commands/skill.md | /skill | Global |
Template
# Skill Name Brief description. ## Instructions 1. Step one2. Step two3. Step three ## Output Format Expected output format. IMPORTANT: Critical rule.YOU MUST: Required behavior.NEVER: Prohibited action.Keywords
| Keyword | Effect |
|---|---|
| IMPORTANT: | High priority |
| YOU MUST: | Required |
| NEVER: | Prohibited |
| CRITICAL: | Absolute |
Next Steps
- Start simple — Create 2-3 skills for daily tasks
- Iterate — Refine based on results
- Share — Commit for team benefit
- Expand — Add more as patterns emerge
Related Topics:
- Best Practices — Optimize workflows
- MCP and Cursor — Extend capabilities
- Automation Track — Automate tasks
Your Skill Library Awaits!
Start with one skill that automates something you do weekly. Refine it until it works perfectly. Then add another. Within a month, you'll have a personal toolkit that saves hours. That's the power of skills.