Create Custom Skills and Commands for Claude Code
Skills turn repetitive prompts into reusable commands. Write a SKILL.md once, invoke it with /skill-name, and Claude Code executes the full workflow every time.
Skills are markdown files that define reusable workflows for Claude Code. Instead of typing the same complex prompt every time you want to deploy, run a code review, or generate documentation, you write a SKILL.md once and invoke it with a slash command.
What is a Claude Code Skill?
A Skill is a markdown file (SKILL.md) that contains instructions Claude Code follows when you invoke it. It can include a description, tool restrictions, context settings, and step-by-step instructions. Think of it as a saved prompt with superpowers.
How do you create a Skill?
Create a SKILL.md file in your project's .claude/skills/ directory (shared with team) or in ~/.claude/skills/ (personal):
# .claude/skills/deploy.md
---
name: deploy
description: Deploy the current branch to staging
allowed-tools: Bash, Read
---
## Steps
1. Run the test suite: `npm run test`
2. If tests pass, build the project: `npm run build`
3. Deploy to staging: `npm run deploy:staging`
4. Verify the deployment by checking the health endpoint
5. Post a summary of what was deployedNow you can invoke it:
# In Claude Code
> /deployWhat frontmatter options are available?
| Option | What it does | Example |
|---|---|---|
| name | Slash command name | deploy |
| description | Shows in skill list | Deploy to staging |
| allowed-tools | Restrict which tools the skill can use | Bash, Read, Edit |
| disable-model-invocation | Prevent nested AI calls | true |
| context | Session handling | fork (runs in isolated context) |
What are good use cases for Skills?
- +Deployment workflows (test → build → deploy → verify)
- +Code review checklists (security, performance, style)
- +Documentation generation (API docs, changelogs, READMEs)
- +Database operations (migration, seeding, backup)
- +Onboarding new team members (project tour, setup verification)
- +Release management (version bump, changelog, tag, publish)
How do you use variables in Skills?
Skills support arguments through $ARGUMENTS (full text) and positional variables ($0, $1, etc.):
# .claude/skills/create-component.md
---
name: create-component
description: Create a new React component
---
Create a new React component named $0 in the components directory.
Requirements:
- TypeScript with proper props interface
- Tailwind CSS for styling
- Export as default
- Include basic unit test in __tests__/
Usage: /create-component UserProfileInvoking with arguments
# Single argument
> /create-component UserProfile
# Multiple arguments
> /create-component UserProfile --with-tests --with-storyHow do you share Skills with your team?
Put Skills in your project's .claude/skills/ directory and commit them to git. Every developer who clones the repo gets the same skills. Personal skills go in ~/.claude/skills/ and don't get shared.
Skills compose well with Hooks. For example, a "deploy" skill can trigger a PostToolUse hook that sends a Slack notification after deployment. Build your automation in layers.