Skip to main content

Claude Code Skills: Complete Guide to Slash Commands

Master Claude Code's Skills system. Learn how slash commands work, built-in skills available, and how to create custom skills for your workflow.

Skills are Claude Code’s slash command system—reusable prompts and workflows that can be triggered with /command syntax. This guide covers built-in skills, customization, and how to create your own.

What are Skills?

According to the official documentation, Skills are:

  • Reusable prompt templates triggered by slash commands
  • Workflow automations that combine multiple steps
  • Custom extensions you can create for your needs
  • Project-specific commands that understand your codebase

Think of Skills as macros that encode common workflows into single commands.

How Skills Work

User types: /commit

Claude Code:
1. Finds skill definition in .claude/skills/ or built-in
2. Loads the skill's prompt template
3. Executes the workflow defined in the skill
4. Returns results to user

Built-in Skills

Core Workflow Skills

SkillCommandPurpose
Init/initInitialize CLAUDE.md for new project
Help/helpShow available commands
Clear/clearClear conversation context
Config/configView/edit configuration
Permissions/permissionsManage tool permissions
Doctor/doctorDiagnose Claude Code issues

Development Skills

SkillCommandPurpose
Commit/commitCreate git commit with proper message
Review/reviewReview current changes
Test/testRun tests and analyze results
Build/buildBuild project and check for errors
Lint/lintRun linting and fix issues

Memory Skills

SkillCommandPurpose
Memory Save/memory-saveSave knowledge to memory MCP
Memory Search/memory-searchSearch saved knowledge
Memory List/memory-listList all saved entities
Memory Audit/memory-auditCheck memory health

Using Skills

Basic Usage

Simply type the slash command:

/commit

Claude will execute the skill’s workflow.

With Arguments

Some skills accept arguments:

/commit -m "feat: add user authentication"
/review --security
/test --coverage

Chaining Skills

Skills can be used in sequence:

User: Make the changes we discussed, then run /commit

Claude:
  → Makes the changes
  → Executes /commit skill
  → Creates proper commit message

Skill File Structure

Skills are defined in .claude/skills/ directory:

.claude/
├── skills/
│   ├── commit.md           # Git commit skill
│   ├── review.md           # Code review skill
│   ├── deploy.md           # Deployment skill
│   └── my-custom-skill.md  # Your custom skills
└── settings.json

Skill Definition Format

---
name: commit
description: Create a git commit with conventional commit message
trigger: /commit
---

# Commit Skill

## Instructions

1. Check git status for staged changes
2. Analyze the changes to understand what was modified
3. Generate a conventional commit message:
   - feat: New feature
   - fix: Bug fix
   - docs: Documentation
   - refactor: Code refactoring
   - test: Test changes
   - chore: Maintenance

4. Create the commit with the generated message
5. Show the commit result

## Format

Use this commit message format:

type(scope): description

  • Detail 1
  • Detail 2

Co-Authored-By: Claude noreply@anthropic.com


## Example Output

Created commit: abc1234

feat(auth): add JWT token refresh mechanism

  • Implement automatic token refresh before expiration
  • Add refresh token rotation for security
  • Update auth middleware to handle refresh flow

Co-Authored-By: Claude noreply@anthropic.com

Creating Custom Skills

Step 1: Create the File

Create a new .md file in .claude/skills/:

touch .claude/skills/deploy.md

Step 2: Define the Skill

---
name: deploy
description: Deploy to staging environment
trigger: /deploy
---

# Deploy to Staging

## Prerequisites Check

1. Verify all tests pass
2. Check for uncommitted changes
3. Confirm current branch

## Deployment Steps

1. Build the project:
   ```bash
   npm run build
  1. Run pre-deployment tests:

    npm run test:e2e
  2. Deploy to staging:

    npm run deploy:staging
  3. Verify deployment:

    • Check health endpoint
    • Run smoke tests

Post-Deployment

  • Report deployment status
  • Show deployed URL
  • Note any warnings

### Step 3: Use the Skill

/deploy


## Advanced Skill Patterns

### Pattern 1: Parameterized Skills

Accept arguments in your skill:

```markdown
---
name: feature
description: Start a new feature branch
trigger: /feature
args:
  - name: feature-name
    required: true
    description: Name of the feature
---

# New Feature Workflow

## Steps

1. Create branch: `feature/{{feature-name}}`
2. Set up feature structure
3. Create initial files
4. Open PR draft

Pattern 2: Conditional Skills

Different behavior based on context:

---
name: review
description: Review code changes
trigger: /review
---

# Code Review

## Determine Review Type

If reviewing a PR:
- Fetch PR changes
- Compare with base branch

If reviewing local changes:
- Check git diff
- Review staged and unstaged

## Review Checklist

- [ ] Code quality
- [ ] Security considerations
- [ ] Test coverage
- [ ] Documentation
- [ ] Performance implications

Pattern 3: Multi-Agent Skills

Skills that orchestrate multiple agents:

---
name: audit
description: Comprehensive codebase audit
trigger: /audit
---

# Codebase Audit

## Phase 1: Parallel Analysis

Launch these agents simultaneously:

1. **Explore Agent (quick)**: Map codebase structure
2. **Explore Agent (medium)**: Find code patterns
3. **security-auditor**: Security scan
4. **code-reviewer**: Quality check
5. **test-runner**: Coverage analysis

## Phase 2: Synthesize Results

Combine findings into:
- Security issues (by severity)
- Quality concerns
- Coverage gaps
- Recommended improvements

## Output Format

Audit Report

Security (X issues)

  • Critical: …
  • High: …

Quality (X concerns)

Coverage (X%)

  • Missing: …

Recommendations

Pattern 4: Interactive Skills

Skills that ask for input:

---
name: scaffold
description: Scaffold new component/feature
trigger: /scaffold
---

# Scaffold Generator

## Questions

Ask the user:
1. What type? (component/api/service/hook)
2. Name?
3. Location? (suggest based on type)

## Generate Based on Answers

For component:
- Create component file
- Create test file
- Create styles file
- Export from index

For API:
- Create route handler
- Create validation schema
- Create test file
- Update API routes index

Project-Specific Skills

Example: E-commerce Skills

# .claude/skills/add-product.md
---
name: add-product
description: Add a new product to catalog
trigger: /add-product
---

## Product Creation Workflow

1. Create product migration
2. Add product schema
3. Create API endpoints
4. Add admin UI components
5. Write tests

Example: API Development Skills

# .claude/skills/new-endpoint.md
---
name: new-endpoint
description: Create new API endpoint with full setup
trigger: /new-endpoint
---

## Endpoint Creation

1. Create route handler
2. Add input validation (Zod)
3. Implement business logic
4. Add error handling
5. Write tests
6. Update API docs
7. Run security-auditor

Skill Categories

Workflow Skills

/workflow        # Full development workflow
/focus-problem   # Problem analysis
/test-first     # TDD workflow
/smart-commit   # Intelligent git commit

Quality Skills

/self-review     # Self-review and fix loop
/code-review     # Code review
/security-check  # Security scan
/doc-audit      # Documentation check

Git Skills

/commit-push-pr  # Commit, push, and PR
/smart-commit    # Conventional commits

AI Interop Skills

/handoff-codex   # Hand off to Codex CLI
/handoff-gemini  # Hand off to Gemini CLI
/interop-broker  # Route to best CLI

Skills vs Agents vs MCP

FeatureSkillsAgentsMCP
PurposeWorkflow automationTask executionTool extension
Trigger/commandTask toolAutomatic
ScopeProject-specificBuilt-in typesExternal services
CustomizationEasy (markdown)LimitedMedium (code)
Context costLowMediumVariable

When to Use Each

Use Skills when:

  • You have repeatable workflows
  • You want slash command shortcuts
  • You need project-specific commands
  • You want to encode team patterns

Use Agents when:

  • You need parallel execution
  • You want specialized analysis
  • You need autonomous task handling
  • You want model selection flexibility

Use MCP when:

  • You need external data access
  • You want persistent storage
  • You need API integrations
  • You want database access

Skill Best Practices

1. Keep Skills Focused

# Good: Single purpose
/deploy-staging  # Deploy to staging
/deploy-prod     # Deploy to production

# Avoid: Too broad
/deploy          # Deploy to... somewhere?

2. Document Thoroughly

---
name: my-skill
description: Clear one-line description
trigger: /my-skill
---

# Skill Name

## Purpose
What this skill does and when to use it.

## Prerequisites
What needs to be in place before running.

## Steps
Detailed workflow steps.

## Examples
Example usage and expected output.

3. Include Error Handling

## Error Handling

If build fails:
- Show error details
- Suggest fixes
- Don't proceed with deployment

If tests fail:
- Report failed tests
- Ask before continuing

4. Use Agents Appropriately

## Quality Checks

After implementation:
- Run code-reviewer agent for quality
- Run test-runner agent for coverage
- Run security-auditor if touching auth/payment

Discovering Skills

List Available Skills

/help

Shows all available skills including custom ones.

Check Skill Definition

Look in .claude/skills/ to see custom skill definitions.

Built-in Skill Documentation

Built-in skills are documented in the official Claude Code docs.

Getting Started

Today:

  1. Try /commit on your next change
  2. Use /help to see available skills
  3. Review built-in skills

This week:

  1. Create one custom skill for your workflow
  2. Add team-specific skills to your project
  3. Document skills in your README

This month:

  1. Build a library of project skills
  2. Share skills across team projects
  3. Create multi-agent skills for complex workflows

Skills encode your expertise into reusable commands. Build them once, use them forever.

Sources: Claude Code Documentation, Claude Code GitHub