Skill Writing

Command Development

A Claude Code skill from the plugin-dev plugin that guides the creation of slash commands. It covers file format, YAML frontmatter, dynamic arguments, file references, bash execution, organization, plugin-specific features and validation patterns.

  • 150k GitHub stars
Command Development — illustration

What it is

Command Development is a skill in Claude Code's plugin-dev plugin. It gives comprehensive guidance on creating slash commands, which are frequently-used prompts defined as Markdown files that Claude executes during interactive sessions. Claude Code activates it when a user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", or "organize commands". It also activates for questions about command frontmatter, file references, bash execution in commands, interactive commands or AskUserQuestion, and command development best practices. The core idea is that commands are instructions FOR Claude, not messages to the user. When a user invokes /command-name, the command content becomes Claude's instructions. Commands can live in three places: - .claude/commands/ for project commands, shown as "(project)" in /help - ~/.claude/commands/ for personal commands, shown as "(user)" - plugin-name/commands/ for plugin commands, shown as "(plugin-name)" Commands are .md files with optional YAML frontmatter. The supported fields are description, allowed-tools, model (sonnet, opus, haiku), argument-hint and disable-model-invocation. Commands can use dynamic arguments ($ARGUMENTS for all arguments as one string, and $1, $2, $3 for positional ones), include file contents with @path, and execute bash inline with the !` syntax. They can be organized flat or namespaced in subdirectories. For plugins, the skill covers: - the ${CLAUDE_PLUGIN_ROOT} environment variable, which resolves to the plugin's absolute path - automatic command discovery from commands/ - configuration, template and multi-script patterns - integration with plugin agents, skills and hooks - validation patterns for arguments, file existence, plugin resources and error handling The skill uses progressive disclosure. SKILL.md (~2,470 words) holds the core concepts. Reference files hold detailed specifications, including frontmatter-reference.md and plugin-features-reference.md. Example files (simple-commands.md and plugin-commands.md) hold complete working commands. Claude loads the references and examples as needed.

Who it's for

  • Claude Code users who want to create custom slash commands
  • Teams sharing project-specific workflows via .claude/commands/
  • Plugin developers bundling commands with their Claude Code plugins
  • Developers integrating commands with plugin agents, skills, and hooks

Requirements

Requirements

  • Claude Code
  • Part of the plugin-dev plugin in the anthropics/claude-code repository
  • Plugin-specific features (${CLAUDE_PLUGIN_ROOT}, plugin command organization) apply to commands bundled in a plugin's commands/ directory

هاي سكيل لـ Claude Code بتساعدك تعمل slash commands خاصة فيك. بتشرحلك شكل الملف والـ frontmatter والـ arguments، وكيف تربط الأوامر مع ملفات وأوامر bash ومكوّنات البلَغِن.

Examples

Command using $ARGUMENTS

markdown
markdown
---
description: Fix issue by number
argument-hint: [issue-number]
---

Fix issue #$ARGUMENTS following our coding standards and best practices.

What it does: Captures all arguments as a single string. Invoking /fix-issue 123 expands to "Fix issue #123 following our coding standards...".

Invoking a command with positional arguments

Prompt
prompt
> /review-pr 123 high alice

Expected output: With a command using $1, $2, $3, this expands to "Review pull request #123 with priority level high. After review, assign to alice for follow-up."

Command with bash execution

markdown
markdown
---
description: Show Git status
allowed-tools: Bash(git:*)
---

Current status: !`git status`
Recent commits: !`git log --oneline -5`

What it does: Runs git commands inline and includes their output as context. allowed-tools restricts Bash to git commands only.

Plugin command using ${CLAUDE_PLUGIN_ROOT}

markdown
markdown
---
description: Analyze using plugin script
allowed-tools: Bash(node:*)
---

Run analysis: !`node ${CLAUDE_PLUGIN_ROOT}/scripts/analyze.js $1`

Review results and report findings.

What it does: Executes a script bundled with the plugin using a portable path. This avoids hardcoded paths across installations.