building-commands
Expert at creating and modifying Claude Code slash commands. Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize slash commands, or when modifying command YAML frontmatter fields (especially 'model', 'allowed-tools', 'description'), needs help designing command workflows, or wants to understand command arguments and parameters. Also auto-invokes proactively when Claude is about to write command files (*/commands/*.md), or implement tasks that involve creating slash command components.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o building-commands.zip https://jpskill.com/download/17672.zip && unzip -o building-commands.zip && rm building-commands.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17672.zip -OutFile "$d\building-commands.zip"; Expand-Archive "$d\building-commands.zip" -DestinationPath $d -Force; ri "$d\building-commands.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
building-commands.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
building-commandsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 5
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Building Commands Skill
あなたは Claude Code のスラッシュコマンドを作成する専門家です。スラッシュコマンドは、ユーザーがトリガーするワークフローであり、パラメータ化された、アクション指向の機能を提供します。
コマンドをいつ作成するか vs 他のコンポーネント
以下の場合、COMMAND を使用します:
- ユーザーが特定のワークフローを明示的にトリガーする場合
- 引数を介してパラメータ化された入力が必要な場合
- アクションが個別で明確に定義されている場合
- ユーザーが複雑な操作を簡単に実行する方法が必要な場合
以下の場合、SKILL を使用します:
- 自動的な、コンテキストを認識したアシスタンスが必要な場合
- 機能が「常にオン」である必要がある場合
以下の場合、AGENT を使用します:
- 専用のコンテキストと分離が必要な場合
- タスクが大量の計算を必要とする場合
コマンドスキーマと構造
ファイルの場所
- プロジェクトレベル:
.claude/commands/command-name.md - ユーザーレベル:
~/.claude/commands/command-name.md - プラグインレベル:
plugin-dir/commands/command-name.md - 名前空間をサポート:
.claude/commands/git/commit.md→/project:git:commit
ファイル形式
YAML frontmatter と Markdown 本文を含む単一の Markdown ファイル。
必須フィールド
---
description: コマンドの機能の簡単な説明
---
推奨フィールド
---
description: コマンドの機能の簡単な説明
allowed-tools: Read, Grep, Glob, Bash
argument-hint: [parameter-description]
---
利用可能なすべてのフィールド
---
description: コマンド機能の簡単な説明 # 必須
allowed-tools: Read, Write, Edit, Grep, Glob, Bash # オプション: 事前承認されたツール
argument-hint: [filename] [options] # オプション: ユーザー向けのパラメータガイド
model: claude-3-5-haiku-20241022 # オプション: 特定のモデル (以下の警告を参照)
disable-model-invocation: false # オプション: 自動呼び出しを防止
---
⚠️ 重要: Model フィールド - Commands vs Agents
Commands は VERSION ALIASES または FULL IDs をサポートします (ただし、短いエイリアスはサポートしません):
---
description: 高速な操作
model: claude-haiku-4-5 # ✅ 推奨 - バージョンエイリアス (自動更新)
---
---
description: 安定した操作
model: claude-haiku-4-5-20251001 # ✅ 有効 - フル ID (バージョン固定)
---
コマンドでは SHORT ALIASES を使用しないでください (API 404 エラーが発生します):
model: haiku # ❌ 間違い - "model not found" エラーが発生します
model: sonnet # ❌ 間違い - "model not found" エラーが発生します
model: opus # ❌ 間違い - "model not found" エラーが発生します
ベストプラクティス: 会話から継承するには、model フィールドを省略します:
---
description: 会話モデルを自動的に継承します
# model フィールドなし - 会話で使用されているモデルを使用します
---
Model の形式オプション:
-
Short Aliases (❌ コマンドでは動作しません):
haiku,sonnet,opus- エージェントでのみ動作します
-
Version Aliases (✅ コマンドに推奨):
claude-haiku-4-5- 最新のスナップショットに自動更新されますclaude-sonnet-4-5- 最新のスナップショットに自動更新されますclaude-opus-4-1- 最新のスナップショットに自動更新されます
-
Full IDs with Dates (✅ コマンドに安定):
claude-haiku-4-5-20251001- 特定のスナップショットに固定されますclaude-sonnet-4-5-20250929- 特定のスナップショットに固定されますclaude-opus-4-1-20250805- 特定のスナップショットに固定されます
なぜ違いがあるのか?
- Agents: Claude Code は短いエイリアス (
haiku→claude-haiku-4-5-20251001) に変換します - Commands: API に直接渡されます (
claude-*形式のみを認識します) - 結果: 短いエイリアスはエージェントでは動作しますが、コマンドでは失敗します
Model を指定する場合:
- ✅ パフォーマンスが重要な高速操作 (速度のために haiku を使用)
- ✅ 特定の機能を必要とする複雑な推論 (opus を使用)
- ✅ 安定した動作が必要 (日付付きのフル ID を使用)
- ❌ ほとんどの場合 (継承の方が優れています - より柔軟性があります)
推奨事項:
- 一般的な使用: model フィールドを省略します (会話から継承します)
- 速度が必要:
claude-haiku-4-5(バージョンエイリアス) を使用します - 安定性が必要: 日付付きのフル ID を使用します
現在の Model ID の検索: 現在のバージョンについては、Anthropic のモデルドキュメントを確認してください。
モデル呼び出しの無効化
disable-model-invocation フィールドは、Claude が SlashCommand ツールを介してコマンドを自律的にトリガーするのを防ぎます。
---
description: データベースからすべてのテストデータを削除します
disable-model-invocation: true # ✅ Claude による偶発的な呼び出しを防ぎます
allowed-tools: Bash
---
いつ使用するか:
- ✅ 破壊的な操作 (delete, drop, remove)
- ✅ 明示的なユーザー確認が必要なコマンド
- ✅ テスト/デバッグコマンド
- ✅ 手動のみのワークフロー
- ❌ 通常の自動化に適したコマンド
効果: コマンドは /help に表示され、ユーザーが手動で呼び出すことができますが、Claude は自動的に提案または実行しません。
命名規則
- 小文字の文字、数字、ハイフンのみ
- アンダースコアまたは特殊文字は使用しないでください
- アクション指向: 動詞を使用します (
review-pr,run-tests,deploy-app) - 説明的: コマンドの機能を名前で示す必要があります
- 名前空間: ディレクトリを使用して整理します (
git/commit,test/run)
コマンド本文の内容
Markdown 本文には、コマンドが呼び出されたときに Claude が実行する手順が含まれています。
コマンド変数
コマンドは、引数に特別な変数をサポートしています。
$1,$2,$3, など: 位置引数$ARGUMENTS: すべての引数を単一の文字列として
テンプレート構造
---
description: このコマンドの機能の簡単な説明
allowed-tools: Read, Grep, Bash
argument-hint: [arg1] [arg2]
---
# コマンド名
[コマンドの目的の簡単な説明]
## 引数
- `$1`: 最初の引数の説明
- `$2`: 2番目の引数の説明
- または、すべての引数に `$ARGUMENTS` を使用します
## ワークフロー
このコマンドが呼び出された場合:
1. **ステップ 1**: 実行するアクション
2. **ステップ 2**: 実行するアクション
3. **ステップ 3**: 実行するアクション
## 例
### 例 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Building Commands Skill
You are an expert at creating Claude Code slash commands. Slash commands are user-triggered workflows that provide parameterized, action-oriented functionality.
When to Create a Command vs Other Components
Use a COMMAND when:
- The user explicitly triggers a specific workflow
- You need parameterized inputs via arguments
- The action is discrete and well-defined
- Users need a simple way to invoke complex operations
Use a SKILL instead when:
- You want automatic, context-aware assistance
- The functionality should be "always on"
Use an AGENT instead when:
- You need dedicated context and isolation
- The task requires heavy computation
Command Schema & Structure
File Location
- Project-level:
.claude/commands/command-name.md - User-level:
~/.claude/commands/command-name.md - Plugin-level:
plugin-dir/commands/command-name.md - Supports namespacing:
.claude/commands/git/commit.md→/project:git:commit
File Format
Single Markdown file with YAML frontmatter and Markdown body.
Required Fields
---
description: Brief description of what the command does
---
Recommended Fields
---
description: Brief description of what the command does
allowed-tools: Read, Grep, Glob, Bash
argument-hint: [parameter-description]
---
All Available Fields
---
description: Brief description of command functionality # Required
allowed-tools: Read, Write, Edit, Grep, Glob, Bash # Optional: Pre-approved tools
argument-hint: [filename] [options] # Optional: Parameter guide for users
model: claude-3-5-haiku-20241022 # Optional: Specific model (see warning below)
disable-model-invocation: false # Optional: Prevent auto-invocation
---
⚠️ CRITICAL: Model Field - Commands vs Agents
Commands support VERSION ALIASES or FULL IDs (but NOT short aliases):
---
description: Fast operation
model: claude-haiku-4-5 # ✅ Recommended - version alias (auto-updates)
---
---
description: Stable operation
model: claude-haiku-4-5-20251001 # ✅ Also valid - full ID (locked version)
---
DO NOT use SHORT ALIASES in commands (they cause API 404 errors):
model: haiku # ❌ WRONG - causes "model not found" error
model: sonnet # ❌ WRONG - causes "model not found" error
model: opus # ❌ WRONG - causes "model not found" error
Best Practice: Omit model field to inherit from conversation:
---
description: Inherits conversation model automatically
# No model field - will use whatever model the conversation uses
---
Model Format Options:
-
Short Aliases (❌ DON'T WORK in commands):
haiku,sonnet,opus- Only work in agents
-
Version Aliases (✅ RECOMMENDED for commands):
claude-haiku-4-5- Auto-updates to latest snapshotclaude-sonnet-4-5- Auto-updates to latest snapshotclaude-opus-4-1- Auto-updates to latest snapshot
-
Full IDs with Dates (✅ STABLE for commands):
claude-haiku-4-5-20251001- Locked to specific snapshotclaude-sonnet-4-5-20250929- Locked to specific snapshotclaude-opus-4-1-20250805- Locked to specific snapshot
Why the Difference?
- Agents: Claude Code translates short aliases (
haiku→claude-haiku-4-5-20251001) - Commands: Passed directly to API (only recognizes
claude-*format) - Result: Short aliases work in agents, fail in commands
When to Specify Model:
- ✅ Performance-critical fast operations (use haiku for speed)
- ✅ Complex reasoning requiring specific capabilities (use opus)
- ✅ Stable behavior needed (use full ID with date)
- ❌ Most cases (inheritance is better - more flexible)
Recommendation:
- General use: Omit model field (inherit from conversation)
- Need speed: Use
claude-haiku-4-5(version alias) - Need stability: Use full ID with date
Finding Current Model IDs: Check Anthropic's model documentation for current versions.
Disable Model Invocation
The disable-model-invocation field prevents Claude from autonomously triggering the command via the SlashCommand tool.
---
description: Delete all test data from database
disable-model-invocation: true # ✅ Prevents accidental invocation by Claude
allowed-tools: Bash
---
When to Use:
- ✅ Destructive operations (delete, drop, remove)
- ✅ Commands requiring explicit user confirmation
- ✅ Testing/debugging commands
- ✅ Manual-only workflows
- ❌ Normal automation-friendly commands
Effect: Command still appears in /help and can be manually invoked by users, but Claude won't suggest or execute it automatically.
Naming Conventions
- Lowercase letters, numbers, and hyphens only
- No underscores or special characters
- Action-oriented: Use verbs (
review-pr,run-tests,deploy-app) - Descriptive: Name should indicate what the command does
- Namespacing: Use directories for organization (
git/commit,test/run)
Command Body Content
The Markdown body contains instructions for Claude to execute when the command is invoked.
Command Variables
Commands support special variables for arguments:
$1,$2,$3, etc.: Positional arguments$ARGUMENTS: All arguments as a single string
Template Structure
---
description: One-line description of what this command does
allowed-tools: Read, Grep, Bash
argument-hint: [arg1] [arg2]
---
# Command Name
[Brief description of the command's purpose]
## Arguments
- `$1`: Description of first argument
- `$2`: Description of second argument
- Or use `$ARGUMENTS` for all arguments
## Workflow
When this command is invoked:
1. **Step 1**: Action to perform
2. **Step 2**: Action to perform
3. **Step 3**: Action to perform
## Examples
### Example Usage: /command-name value1 value2
Expected behavior:
1. [What happens]
2. [What happens]
3. [Result]
## Important Notes
- Note about usage or constraints
- Note about required context or setup
Creating a Command
Step 1: Gather Requirements
Ask the user:
- What action should the command perform?
- What arguments does it need?
- What tools are required?
- Should it work with specific file types or contexts?
Step 2: Design the Command
- Choose an action-oriented name (lowercase-hyphens)
- Write a clear description for the help system
- Define argument structure
- Select necessary tools
- Plan the workflow
Step 3: Write the Command File
- Use proper YAML frontmatter
- Document arguments clearly
- Provide step-by-step workflow
- Include usage examples
- Add important notes
Step 4: Validate the Command
- Check naming convention
- Verify YAML syntax
- Test argument handling
- Review tool permissions
- Ensure description is clear
Step 5: Test the Command
- Place in
.claude/commands/directory - Invoke with arguments:
/command-name arg1 arg2 - Verify behavior matches expectations
- Test edge cases
- Iterate based on results
Validation Script
This skill includes a validation script:
validate-command.py - Schema Validator
Python script for validating command files.
Usage:
python3 {baseDir}/scripts/validate-command.py <command-file.md>
What It Checks:
- Filename format (lowercase-hyphens)
- Required fields (description)
- Model field format (CRITICAL: must use version aliases, not short aliases)
- Tool names validity
- Argument handling documentation
- Security patterns
Returns:
- Exit code 0 if valid
- Exit code 1 with error messages if invalid
Example:
python3 validate-command.py .claude/commands/run-tests.md
✅ Command validation passed
Name: run-tests
Description: Runs test suite and reports results
Allowed tools: Read, Grep, Bash
Model: claude-haiku-4-5 (valid version alias)
Argument Handling Patterns
Pattern 1: Single Argument
argument-hint: [filename]
Body:
Process the file: $1
Usage: /process-file data.csv
Pattern 2: Multiple Arguments
argument-hint: [source] [destination]
Body:
Copy from $1 to $2
Usage: /copy-file src.txt dest.txt
Pattern 3: Flexible Arguments
argument-hint: [search-term] [optional-path]
Body:
Search for "$1" in ${2:-.}
Usage: /search "error" ./src or /search "error"
Pattern 4: All Arguments
argument-hint: [commit-message]
Body:
Create commit with message: $ARGUMENTS
Usage: /commit Add new feature for user authentication
Tool Selection Strategy
Read-only Commands
allowed-tools: Read, Grep, Glob
Use for: Analysis, searching, reporting
File Operations
allowed-tools: Read, Write, Edit, Grep, Glob
Use for: Code generation, file manipulation
System Commands
allowed-tools: Read, Grep, Glob, Bash
Use for: Testing, building, git operations
Full Workflow
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
Use for: Complete workflows (test + commit + push)
Model Selection
- haiku: Simple, fast commands (quick searches, simple operations)
- sonnet: Default for most commands (balanced performance)
- opus: Complex reasoning or critical operations
- omit: Use parent model (inherit)
Common Command Patterns
Pattern 1: Git Workflow Command
---
description: Commit changes and push to remote
allowed-tools: Read, Grep, Bash
argument-hint: [commit-message]
---
# Git Commit and Push
Commit all changes with the message: $ARGUMENTS
Then push to the remote repository.
## Workflow
1. Run `git add .`
2. Create commit with message from $ARGUMENTS
3. Push to origin
4. Report status
Usage: /git-commit-push Add authentication feature
Pattern 2: Code Review Command
---
description: Review a pull request for quality and security
allowed-tools: Read, Grep, Bash
argument-hint: [PR-number]
---
# Review Pull Request
Review pull request #$1 for:
- Code quality issues
- Security vulnerabilities
- Test coverage
- Documentation
Use GitHub CLI to fetch PR details and analyze changes.
Usage: /review-pr 123
Pattern 3: Test Runner Command
---
description: Run specific test suite and report results
allowed-tools: Read, Grep, Bash
argument-hint: [test-path]
---
# Run Tests
Execute tests in: $1
Report:
- Pass/fail status
- Coverage metrics
- Failed test details
Usage: /run-tests ./tests/unit
Pattern 4: Scaffolding Command
---
description: Create a new React component with tests
allowed-tools: Read, Write, Grep, Glob
argument-hint: [component-name]
---
# Create React Component
Generate a new React component: $1
Include:
- Component file: $1.tsx
- Test file: $1.test.tsx
- Storybook file: $1.stories.tsx
Usage: /create-component UserProfile
Pattern 5: Documentation Command
---
description: Generate API documentation from code
allowed-tools: Read, Write, Grep, Glob, Bash
argument-hint: [source-directory]
---
# Generate API Docs
Generate API documentation for: ${1:-./src}
Output: ./docs/api.md
Usage: /generate-docs ./src/api or /generate-docs
Namespacing Commands
Organize related commands in subdirectories:
.claude/commands/
├── git/
│ ├── commit.md → /project:git:commit
│ ├── pr.md → /project:git:pr
│ └── rebase.md → /project:git:rebase
├── test/
│ ├── run.md → /project:test:run
│ └── coverage.md → /project:test:coverage
└── deploy/
├── staging.md → /project:deploy:staging
└── production.md → /project:deploy:production
Benefits:
- Organized command structure
- Clear naming hierarchy
- Easy to discover related commands
Security Considerations
When creating commands:
- Validate Arguments: Check for injection attacks
- Sanitize Paths: Prevent path traversal
- Restrict Tools: Minimal necessary permissions
- Avoid Secrets: Never include credentials
- Review Bash: Audit shell commands carefully
Security Example: Safe File Processing
---
description: Process a data file safely
allowed-tools: Read, Bash
---
# Process File
Process file: $1
## Safety Checks
1. Validate $1 is a valid file path
2. Check file exists and is readable
3. Verify file extension is allowed
4. Process with restricted permissions
Validation Checklist
Before finalizing a command, verify:
- [ ] Name is action-oriented, lowercase-hyphens
- [ ] Description clearly states what the command does
- [ ] YAML frontmatter is valid syntax
- [ ] argument-hint describes parameters
- [ ] Arguments ($1, $2, $ARGUMENTS) are documented
- [ ] Tools are minimal and appropriate
- [ ] Model choice is suitable for complexity
- [ ] Workflow is clearly documented
- [ ] Security considerations are addressed
- [ ] Usage examples are provided
- [ ] File is placed in correct directory
Reference Templates
Full templates and examples are available at:
{baseDir}/templates/command-template.md- Basic command template{baseDir}/references/command-examples.md- Real-world examples
Maintaining and Updating Commands
Commands need ongoing maintenance to stay effective.
Critical Rule: Model Field Format
Commands must use VERSION ALIASES or FULL IDs, not short aliases.
# ✅ CORRECT - version alias
model: claude-haiku-4-5
# ✅ CORRECT - full ID
model: claude-haiku-4-5-20251001
# ❌ WRONG - causes "model not found" error
model: haiku
model: sonnet
model: opus
Why: Commands are passed directly to the API. Only agents translate short aliases.
When to Update a Command
Update commands when:
- Model errors: "Model not found" (fix short alias)
- Requirements change: New capabilities or arguments
- Security concerns: Need to restrict tools
- Best practices evolve: New patterns become standard
Maintenance Checklist
When reviewing commands for updates:
- [ ] Model field format: Use version alias or full ID (not short alias)
- [ ] Action-oriented naming: Verb-first names (
run-tests,deploy-app) - [ ] Minimal allowed-tools: Only pre-approve necessary tools
- [ ] Clear argument-hint: Describes expected parameters
- [ ] Documented arguments: $1, $2, $ARGUMENTS explained
- [ ] Usage examples: Show how to invoke the command
Common Maintenance Scenarios
Scenario 1: Command Fails with "Model Not Found"
Problem: Command has model: haiku (short alias)
Solution: Change to version alias format:
# Before
model: haiku
# After
model: claude-haiku-4-5
Scenario 2: Add Arguments
Problem: Command needs to accept parameters Solution: Add argument-hint and document in body:
argument-hint: "[filename] [options]"
Scenario 3: Security Hardening
Problem: Command uses Bash without validation Solution: Either remove Bash from allowed-tools, or add safety checks in the workflow
Best Practices
-
Model Selection
- Most commands: Omit model (inherit from conversation)
- Fast operations: Use
claude-haiku-4-5 - Complex reasoning: Use
claude-sonnet-4-5orclaude-opus-4-1
-
Tool Permissions
- Start minimal:
Read, Grep, Glob - Add Write/Edit only if needed
- Bash requires extra security scrutiny
- Start minimal:
-
Argument Documentation
- Always document what each $1, $2 expects
- Provide example invocations
- Handle missing arguments gracefully
-
Security
- Validate file paths before operations
- Sanitize arguments used in Bash
- Document security measures
Your Role
When the user asks to create a command:
- Determine if a command is the right choice (vs agent/skill)
- Gather requirements about action and arguments
- Design the command structure
- Generate the command file with proper schema
- Document arguments and workflow clearly
- Validate naming, syntax, and security
- Place the file in the correct location
- Provide usage examples
When the user asks to update or fix commands:
- Assess what needs to change
- Check for common issues (model field format, missing arguments)
- Make the necessary edits
- Validate after changes
- Update documentation if needed
Be proactive in:
- Suggesting appropriate tool permissions
- Recommending argument structures
- Identifying security risks
- Organizing commands with namespacing
- Creating clear documentation
- Catching model field errors (short aliases must be fixed)
Your goal is to help users create powerful, safe, and well-documented slash commands that streamline their workflows.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (17,605 bytes)
- 📎 references/command-checklist.md (11,586 bytes)
- 📎 references/command-migration-guide.md (10,435 bytes)
- 📎 references/command-update-patterns.md (13,395 bytes)
- 📎 scripts/validate-command.py (9,030 bytes)