Custom Skills

Skills are reusable prompt templates that you invoke with a slash command. Instead of typing the same complex instructions repeatedly, you define a skill once and call it by name — like /skill-name — whenever you need it.

What Is a Skill?

A skill is a YAML file stored in your project's .claude/skills/ directory. Each file defines a name, description, and the prompt template that Claude executes when you invoke it. Skills can accept parameters, making them flexible enough to handle varied inputs.

Creating a Skill

Create a YAML file inside .claude/skills/:

# .claude/skills/component.yaml
name: component
description: Generate a React component with tests
prompt: |
  Create a new React component called {{name}} in the components directory.
  Include:
  - A TypeScript component file with props interface
  - A unit test file using Vitest
  - Tailwind CSS styling
  Follow the project's existing component patterns.

Skill Parameters

Use double-brace syntax {{param}} to define dynamic values. When you invoke the skill, Claude prompts you for each parameter or you can supply them inline.

SyntaxPurpose
{{name}}Required parameter
{{style|"default"}}Parameter with a default value
{{...files}}Variadic parameter (accepts multiple values)

Invoking a Skill

# In the Claude Code chat
/component name=Button

# Or just type the slash command and Claude will ask for parameters
/component

When to Use Skills vs CLAUDE.md

Use Skills WhenUse CLAUDE.md When
The task is a repeatable actionThe instruction applies globally
You need parameterized inputThe guidance is context or style rules
Different team members trigger itEvery conversation should follow it
The workflow has distinct stepsThe information is background knowledge

Best Practices

  • Keep skills focused. One skill should do one thing well.
  • Name skills clearly. Use verb-noun patterns like gen-migration or add-endpoint.
  • Version control your skills. Commit .claude/skills/ so your team shares them.
  • Document parameters. Use the description field to explain what each skill does.
  • Test incrementally. Start with a simple prompt, then add parameters as needed.

Example: Database Migration Skill

# .claude/skills/migration.yaml
name: migration
description: Create a new database migration file
prompt: |
  Generate a new database migration for {{description}}.
  Use the project's migration format and naming conventions.
  Include both up and down migration steps.
  Place the file in the migrations directory with a timestamp prefix.

Skills turn your most common workflows into one-command operations, reducing errors and keeping your team aligned on best practices.