Command Development

Create custom Claude Code slash commands with YAML frontmatter and dynamic arguments.

3|4|Updated Apr 2, 2025
One-click install
npx skills add https://github.com/akiojin/playfab-mcp-server --skill command-development-akiojin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Command Development
Source: https://github.com/akiojin/playfab-mcp-server/tree/main/.claude/skills/command-development
Command: npx skills add https://github.com/akiojin/playfab-mcp-server --skill command-development-akiojin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance for creating custom, reusable slash commands in Claude Code, enabling you to automate repetitive tasks, standardize workflows, and enhance your AI assistant's capabilities. It simplifies the process of defining command structure, arguments, and execution logic.

Core Features & Use Cases

  • Custom Command Definition: Learn to structure commands using Markdown and YAML frontmatter, defining descriptions, allowed tools, and model preferences.
  • Dynamic Argument Handling: Utilize $1, $2, and $ARGUMENTS to create flexible commands that adapt to user input, making them highly versatile.
  • Contextual Execution: Embed file contents with @ syntax and execute bash commands with ! syntax to gather dynamic context directly within your commands.
  • Plugin Integration: Understand how to organize commands with namespacing and integrate them seamlessly with other plugin components like agents, skills, and hooks for complex workflows.
  • Use Case: Create a /review-pr command that takes a pull request number, fetches its details using the gh cli, and then instructs Claude to perform a detailed code review based on the retrieved information.

Quick Start

Help me create a new slash command called /my-task that takes one argument, a file path, and then reads that file's content.

Frequently Asked Questions about Command Development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom slash commands in Claude Code?

Slash commands in Claude Code are defined using Markdown with YAML frontmatter that specifies description, allowed tools, and model preferences. Structure your command file with frontmatter metadata followed by the command logic, then place it in your project, personal, or plugin command directory for Claude Code to recognize and execute it.

Can I use dynamic arguments in slash commands?

Yes, slash commands support dynamic arguments through `$1`, `$2`, and `$ARGUMENTS` variables. These tokens let you pass user input into your command logic, making commands flexible enough to adapt to different contexts and parameters without rewriting the command structure.

How do I read file contents and execute bash within a slash command?

Use `@` syntax to embed file contents directly in your command and `!` syntax to execute bash commands. These features allow you to gather dynamic context—like fetching pull request details with `gh cli`—and pass that information to Claude for processing within a single command execution.

What's the difference between project, personal, and plugin command contexts?

Project commands are scoped to a specific project, personal commands are available across all Claude Code sessions, and plugin commands integrate with agent, skill, and hook components for complex workflows. Use namespacing to organize commands and avoid conflicts across these three contexts.

Do slash commands support integration with Claude Code plugins?

Yes, slash commands integrate with agents, skills, and hooks through plugin namespacing and `${CLAUDE_PLUGIN_ROOT}` references. This enables you to build complex, multi-component workflows where commands orchestrate logic across different plugin elements.

What validation and error handling do slash commands provide?

Slash commands include built-in validation for frontmatter parsing, argument handling, and bash execution. Error handling covers malformed YAML, missing file references, and failed bash commands, ensuring commands fail gracefully with meaningful feedback rather than silent errors.