Intermediate10 min

Custom Slash Commands & Skills

Creating project-scoped and user-scoped slash commands, building reusable skills with SKILL.md frontmatter, using context: fork for isolation, and understanding when to use commands vs skills vs CLAUDE.md.

Quick Reference

  • Slash commands live in .claude/commands/ (project-scoped) or ~/.claude/commands/ (user-scoped)
  • Command files are plain Markdown with the prompt Claude should execute
  • Use $ARGUMENTS placeholder to pass user input into the command template
  • Skills live in .claude/skills/ and have SKILL.md frontmatter for configuration
  • context: fork runs the skill in an isolated sub-agent -- main conversation stays clean
  • allowed-tools restricts which tools the skill can use (principle of least privilege)
  • argument-hint provides a description shown to the user when they invoke the skill
  • Project commands are shared via git; user commands are personal and not version-controlled
  • Slash commands are great for repetitive workflows: /review, /test, /deploy, /migrate
  • Skills are ideal for complex, multi-step operations that benefit from isolation and tool restrictions

Commands and Skills: Reusable Workflows

Claude Code supports two mechanisms for creating reusable workflows: slash commands and skills. Both let you encode common operations so you can invoke them with a single command instead of typing the same long prompt every time. The difference is in their power and isolation.

Slash commands are simple: a Markdown file containing a prompt template. When you type /command-name, Claude reads the file and executes the prompt as if you had typed it. Skills are more powerful: they support frontmatter configuration for tool restrictions, execution isolation, and argument hints. Think of commands as macros and skills as plugins.