本文へ移動
cccskills
無料GitHub で公開

command-development

Create and configure slash commands for Claude Code — the legacy .claude/commands/ format. Use when asked to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or for guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices. Commands are the legacy format superseded by skills — for new development prefer /plugin-creator:skill-creator

インストール方法を見る

含まれるファイル(5)

  • SKILL.md10.1 KB
  • references/advanced-workflows.md5.0 KB
  • references/frontmatter-fields.md5.4 KB
  • references/interactive-commands.md5.6 KB
  • references/plugin-command-patterns.md6.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Command Development for Claude Code

Legacy Format Notice. The .claude/commands/ directory is a legacy format. For new development, use .claude/skills/<name>/SKILL.md instead. Both formats are loaded identically — the only difference is file layout. Use /plugin-creator:skill-creator for the preferred skills format.

Commands remain fully supported for backward compatibility and are still appropriate when maintaining existing command sets or contributing to projects that use the commands/ convention.

What Commands Are

Slash commands are Markdown files containing prompts that Claude executes when invoked via /command-name. They provide reusable, consistent, shareable workflows with quick access to complex prompts.

Commands are instructions FOR Claude, not messages TO users. When a user invokes /command-name, the command content becomes Claude's instructions. Write commands as directives to Claude about what to do.

<!-- Correct: instructions for Claude -->
Review this code for security vulnerabilities including:
- SQL injection
- XSS attacks
- Authentication issues

Provide specific line numbers and severity ratings.
<!-- Wrong: message to user — Claude receives this but has no directive -->
This command will review your code for security issues.
You'll receive a report with vulnerability details.

Command Locations

flowchart TD
    Q{"Where should the<br>command live?"}
    Q -->|"Shared with team"| Proj[".claude/commands/<br>Scope — this project only<br>Label — '(project)' in /help"]
    Q -->|"Personal use<br>across all projects"| User["~/.claude/commands/<br>Scope — all projects<br>Label — '(user)' in /help"]
    Q -->|"Bundled with a plugin"| Plugin["plugin-name/commands/<br>Scope — when plugin installed<br>Label — '(plugin-name)' in /help"]

File Format

Commands are .md files. No frontmatter is required for basic commands.

.claude/commands/
├── review.md           # /review
├── test.md             # /test
└── deploy.md           # /deploy

Add YAML frontmatter for configuration:

---
description: Review code for security issues
allowed-tools: Read, Grep, Bash(git:*)
model: sonnet
---

Review this code for security vulnerabilities...

Frontmatter Fields (Summary)

All fields are optional. Commands work without any frontmatter.

flowchart TD
    Start(["Writing command frontmatter"]) --> D{"Need a description<br>in /help?"}
    D -->|Yes| Desc["description — string, under 60 chars<br>Start with verb — Review, Deploy, Generate"]
    D -->|No| AT{"Need to restrict<br>tool access?"}
    Desc --> AT
    AT -->|Yes| Tools["allowed-tools — comma-separated or array<br>Bash(git:*) for filtered bash access"]
    AT -->|No| M{"Need a specific<br>model?"}
    Tools --> M
    M -->|Yes| Model["model — haiku, sonnet, or opus"]
    M -->|No| AH{"Command takes<br>arguments?"}
    Model --> AH
    AH -->|Yes| Hint["argument-hint — e.g. [pr-number] [priority]"]
    AH -->|No| DMI{"Should only user<br>invoke manually?"}
    Hint --> DMI
    DMI -->|Yes| Disable["disable-model-invocation — true"]
    DMI -->|No| Done(["Frontmatter complete"])
    Disable --> Done

For the complete field specification with examples, validation rules, and edge cases, see ./references/frontmatter-fields.md.

Dynamic Arguments

Positional Arguments

Capture individual arguments with $1, $2, $3:

---
description: Review PR with priority and assignee
argument-hint: [pr-number] [priority] [assignee]
---

Review pull request #$1 with priority level $2.
After review, assign to $3 for follow-up.

Running /review-pr 123 high alice expands to: Review pull request #123 with priority level high. After review, assign to alice for follow-up.

$ARGUMENTS

Capture all arguments as a single string:

---
argument-hint: [issue-number]
---

Fix issue #$ARGUMENTS following our coding standards.

File References with @

Include file contents using @ syntax:

Review @$1 for code quality and potential bugs.

Running /review-file src/api/users.ts causes Claude to read src/api/users.ts before processing the command.

Static references also work: Review @package.json and @tsconfig.json for consistency.

Bash Execution

Execute shell commands inline with !`command` syntax to gather dynamic context:

---
allowed-tools: Bash(git:*)
---

Files changed: !`git diff --name-only`

Review each file for code quality and potential bugs.

The command output replaces the placeholder before Claude processes the prompt. Ensure allowed-tools includes the appropriate Bash filter.

Command Organization

flowchart TD
    Q{"How many commands?"}
    Q -->|"5-15, no clear categories"| Flat["Flat structure<br>.claude/commands/*.md"]
    Q -->|"15+, clear categories"| NS["Namespaced structure<br>.claude/commands/ci/*.md<br>.claude/commands/git/*.md<br>.claude/commands/docs/*.md"]

Subdirectory names become namespaces shown in /help. For example, .claude/commands/ci/build.md appears as /build (project:ci).

Common Patterns

Review Pattern

---
description: Review code changes
allowed-tools: Read, Bash(git:*)
---

Files changed: !`git diff --name-only`

Review each file for:
1. Code quality and style
2. Potential bugs or issues
3. Test coverage
4. Documentation needs

Testing Pattern

---
description: Run tests for specific file
argument-hint: [test-file]
allowed-tools: Bash(npm:*)
---

Run tests: !`npm test $1`

Analyze results and suggest fixes for failures.

Workflow Pattern

---
description: Complete PR workflow
argument-hint: [pr-number]
allowed-tools: Bash(gh:*), Read
---

PR #$1 Workflow:

1. Fetch PR: !`gh pr view $1`
2. Review changes
3. Run checks
4. Approve or request changes

Best Practices

  1. Single responsibility — one command, one task
  2. Clear descriptions — self-explanatory in /help, under 60 chars
  3. Document arguments — always provide argument-hint
  4. Restrict tools — use most restrictive allowed-tools that works; prefer Bash(git:*) over Bash(*)
  5. Consistent naming — use verb-noun pattern (review-pr, fix-issue)
  6. Validate inputs — check for required arguments early in the prompt
  7. Handle errors — consider missing or invalid arguments

Interactive Commands (AskUserQuestion)

For commands that need complex user input beyond simple arguments, use the AskUserQuestion tool. This enables multi-choice decisions, multi-select scenarios, and conditional workflows.

flowchart TD
    Q{"What kind of<br>user input?"}
    Q -->|"Simple values —<br>file paths, numbers"| Args["Use command arguments<br>argument-hint + positional vars"]
    Q -->|"Complex choices —<br>multiple options with trade-offs"| AUQ["Use AskUserQuestion<br>Include in allowed-tools"]
    Q -->|"Both"| Both["Arguments for known values<br>AskUserQuestion for decisions"]

For complete AskUserQuestion patterns including multi-stage workflows, conditional flows, multi-select, and validation loops, see ./references/interactive-commands.md.

Advanced Workflows

Commands can implement multi-step sequences, maintain state across invocations using .local.md files, coordinate with other commands, and compose into pipeline workflows.

For state management, command composition, workflow recovery, and error handling patterns, see ./references/advanced-workflows.md.

Plugin Command Features

Plugin commands have access to ${CLAUDE_PLUGIN_ROOT} for portable paths to plugin resources, auto-discovery from the commands/ directory, and can integrate with plugin agents, skills, and hooks.

For CLAUDE_PLUGIN_ROOT patterns, plugin component integration, validation patterns, and marketplace distribution guidance, see ./references/plugin-command-patterns.md.

Troubleshooting

flowchart TD
    P{"What is the problem?"}
    P -->|"Command not appearing<br>in /help"| NotAppearing["Check file is in correct directory<br>Verify .md extension<br>Ensure valid Markdown format<br>Restart Claude Code"]
    P -->|"Arguments not<br>substituting"| ArgsNotWorking["Verify dollar-sign N syntax<br>Check argument-hint matches usage<br>Ensure no extra spaces"]
    P -->|"Bash execution<br>failing"| BashFail["Check allowed-tools includes Bash<br>Verify command syntax in backticks<br>Test command in terminal first<br>Check required permissions"]
    P -->|"File references<br>not loading"| FileFail["Verify @ syntax correct<br>Check file path is valid<br>Ensure Read tool allowed<br>Use project-relative paths"]

Related Skills

  • For the preferred skills format: /plugin-creator:skill-creator
  • For hook development: /plugin-creator:hooks-guide
  • For agent creation: /plugin-creator:agent-creator
  • For plugin lifecycle: /plugin-creator:plugin-lifecycle
  • For plugin structure and component selection: /plugin-creator:component-patterns
  • For command documentation and testing strategies: see ./references/frontmatter-fields.md validation section

Source: Adapted from Anthropic's plugin-dev:command-development skill (../claude-plugins-official/plugins/plugin-dev/skills/command-development/, 11 files).

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Add automated documentation updater to any Claude skill. Creates a Python sync script that downloads upstream docs, processes markdown for AI consumption, and maintains local cache with configurable refresh. Collects template variables, then delegates implementation through 5-phase workflow. Use when adding auto-updating reference documentation to plugins or skills.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

SAM-style feature initiation workflow — discovery through codebase analysis, architecture spec, task decomposition, validation, and context manifest. Use when a user asks to add a feature, plan a feature, or convert an idea into an executable SAM plan.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

Browser automation for AI agents using the agent-browser CLI and Playwright. Use when navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, logging into sites, or automating any browser task. Triggers on "open a website", "fill out a form", "click a button", "scrape data", "test this web app", "automate browser actions", or any programmatic web interaction request.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

Runs the description-drift experiment — spawns all Claude Code agents simultaneously to collect self-reported capabilities, then compares them against static frontmatter descriptions to reveal how reliable orchestrator routing based on descriptions actually is. Use when measuring description drift across the agent fleet, re-running the capability collection experiment, analyzing a specific agent's self-reported capabilities, or auditing whether frontmatter descriptions accurately reflect agent behavior.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

Create or adapt Claude Code agent definitions. Use when creating an agent, changing subagent configuration, selecting agent scope, or designing a specialized delegation role.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月9日 更新

Jamie-BitFlight のスキルをすべて見る

このスキルの問題を報告する