Skip to main content

Claude Skills - Custom Commands

Create reusable commands, project-specific automations, and powerful custom workflows

60 minutes
3 min read
Updated January 15, 2026

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.

How Skills Work

Quick Start

Create Your First Skill

1. Create the command file:

Bash
mkdir -p .claude/commands

2. Write the skill:

Create .claude/commands/fix-issue.md:

Markdown
# Fix GitHub Issue
Fix issue #$ARGUMENTS from GitHub:
1. Read the issue description and comments
2. Locate the relevant code
3. Implement a fix with tests
4. Create commit: "fix: Description (closes #$ARGUMENTS)"

3. Use it:

Bash
/fix-issue 1234

Claude fixes issue #1234 end-to-end.


Types of Skills

Skill Hierarchy

Built-in Commands

Always available, highest priority:

CommandWhat It DoesWhen to Use
/helpShow all commandsDiscovering features
/clearReset conversationSwitching tasks
/initGenerate CLAUDE.mdNew projects
/compactCompress contextLong sessions
/reviewAI code reviewBefore commits
/memoryEdit CLAUDE.mdUpdating context
/permissionsManage toolsSecurity config

Project Skills

Live in your repository, shared with team:

Bash
your-project/
└── .claude/
└── commands/
├── deploy.md → /deploy
├── fix-issue.md → /fix-issue
└── git/
└── squash.md → /git/squash

User Skills

Personal commands, global across all projects:

Bash
~/.claude/
└── commands/
├── standup.md → /standup
├── eod.md → /eod
└── review-pr.md → /review-pr

Skill Anatomy

Every skill follows this structure:

Markdown
# Skill Title
Brief description of what this skill does.
## Instructions
1. First step Claude should take
2. Second step
3. 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

Markdown
# Create React Component
Create a new component named $ARGUMENTS.
1. Create src/components/$ARGUMENTS/$ARGUMENTS.tsx
2. Create src/components/$ARGUMENTS/$ARGUMENTS.test.tsx
3. Create src/components/$ARGUMENTS/index.ts
4. Export from src/components/index.ts

Usage:

Bash
/create-component UserProfile

Claude creates UserProfile component with tests.


Real-World Examples

Development Workflow Skills

.claude/commands/review.md — Code Review

Markdown
# Code Review
Review the current changes:
1. Run `git diff` to see changes
2. Analyze for:
- Logic errors
- Security vulnerabilities
- Performance issues
- Missing tests
3. 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

Markdown
# Deploy to Production
Safe deployment workflow:
## Pre-flight Checks
1. 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.
## Deploy
1. Run `npm run deploy:prod`
2. Wait for completion
3. Run health checks
## Verify
1. Check production URL
2. Verify key features work
3. Report success/failure
IMPORTANT: Get confirmation before deploying.
NEVER: Deploy if tests are failing.

Git Workflow Skills

.claude/commands/git/squash.md — Squash Commits

Markdown
# Squash Commits
Squash the last $ARGUMENTS commits:
1. Show `git log --oneline -10`
2. Confirm the commits to squash
3. Run `git rebase -i HEAD~$ARGUMENTS`
4. Use 'squash' for all but first
5. Edit commit message
6. 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

Markdown
# 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

Markdown
# 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

Markdown
# End of Day
Wrap up the day:
1. Check for uncommitted changes
2. 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

Markdown
# Investigate Bug
Investigate: $ARGUMENTS
## Understand
1. Parse the bug description
2. Identify expected vs actual behavior
3. List affected components
## Reproduce
1. Find reproduction steps
2. Locate relevant test files
3. Add logging if needed
## Analyze
1. Search codebase for related code
2. Check git history for recent changes
3. 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

Markdown
# 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
## Steps
1. Create src/app/api/$ARGUMENTS/route.ts
2. Create request/response schemas
3. Add authentication check
4. Implement business logic
5. Add error handling
6. Create tests in __tests__/
## Template
```typescript
import { 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/

Bash
---
## 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

Bash
**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 Does
Creates a timestamped migration file...
## Prerequisites
- Database connection configured
- Prisma schema updated
## Steps
1. Generate migration
2. Review SQL
3. Apply migration

2. Include Safety Rails

Markdown
## 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

Markdown
## Output Format

Migration: [filename] Tables affected: [list] Status: Created / Failed Next steps: [action]

Bash

4. Handle Errors

Markdown
## Error Handling
If migration fails:
1. Do NOT retry automatically
2. Report exact error
3. Suggest causes:
- Schema syntax error
- Conflicting migration
- Connection issue
4. Provide recovery steps

Testing Skills

Create a test skill to verify your setup:

.claude/commands/test-skill.md

Markdown
# Test Skill
This skill verifies custom commands work.
Arguments received: $ARGUMENTS
If you see this, skills are working!
Respond with:
1. Confirmation you read this
2. The arguments received
3. Current directory

Test it:

Bash
/test-skill hello world

Sharing with Your Team

Commit Skills to Git

Bash
git add .claude/commands/
git commit -m "feat: add team workflow skills"
git push

Document in README

Markdown
## Custom Commands
This project includes Claude Code skills. See `.claude/commands/` for details.
CommandDescription
/deployDeploy to production
/fix-issue [n]Fix GitHub issue
/create-component [name]Create React component

Troubleshooting

Skill Not Found

Bash
Error: Unknown command /my-skill

Check:

  • File exists in .claude/commands/ or ~/.claude/commands/
  • File has .md extension
  • Filename matches command (kebab-case)

Arguments Not Working

Ensure you use $ARGUMENTS:

Markdown
# Wrong
Process the input: [user input here]
# Correct
Process the input: $ARGUMENTS

Skill Fails Mid-Execution

Add more specific instructions:

Markdown
# Before (vague)
Fix the issue.
# After (specific)
1. Read the issue description
2. Locate the problematic code
3. Propose a fix and wait for approval
4. Implement only after approval

Quick Reference

Locations

LocationCommandScope
.claude/commands/skill.md/skillProject
.claude/commands/dir/skill.md/dir/skillProject
~/.claude/commands/skill.md/skillGlobal

Template

Markdown
# Skill Name
Brief description.
## Instructions
1. Step one
2. Step two
3. Step three
## Output Format
Expected output format.
IMPORTANT: Critical rule.
YOU MUST: Required behavior.
NEVER: Prohibited action.

Keywords

KeywordEffect
IMPORTANT:High priority
YOU MUST:Required
NEVER:Prohibited
CRITICAL:Absolute

Next Steps

  1. Start simple — Create 2-3 skills for daily tasks
  2. Iterate — Refine based on results
  3. Share — Commit for team benefit
  4. Expand — Add more as patterns emerge

Related Topics:


Share this article