スキル一覧に戻る
vasilyu1983

claude-code-commands

by vasilyu1983

25🍴 6📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: claude-code-commands description: Create slash commands for Claude Code with $ARGUMENTS handling, agent invocation patterns, and template best practices. Reference for building user-triggered workflow shortcuts.

Claude Code Commands — Meta Reference

This skill provides the definitive reference for creating Claude Code slash commands. Use this when building new commands or improving existing command patterns.


When to Use This Skill

Use this skill when you need to:

  • Create a new slash command for repeated workflows
  • Add $ARGUMENTS handling to commands
  • Invoke agents from commands
  • Include file context or bash output in commands
  • Organize commands for team sharing

Quick Reference

ComponentPurposeExample
FilenameCommand namereview.md/review
ContentPrompt templateInstructions for Claude
$ARGUMENTSUser input/review auth.js$ARGUMENTS = "auth.js"
$1, $2Positional args/compare a.js b.js$1 = "a.js"
${CLAUDE_SESSION_ID}Session trackinglogs/${CLAUDE_SESSION_ID}.log
@fileInclude file@CLAUDE.md includes file contents
!commandBash output (preprocessing)!git status includes command output

Command Locations

LocationScopeSyntaxUse For
.claude/commands/Project/cmd or /project:cmdTeam-shared (version control)
~/.claude/commands/Personal/cmdCross-project (not shared)
<plugin>/commands/Plugin/plugin:cmdPlugin-bundled commands
packages/*/.claude/commands/NestedAuto-discoveredMonorepo subdirectories

Nested discovery: Claude automatically discovers .claude/commands/ in subdirectories when editing files in those paths (useful for monorepos).

Command Structure

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

Command Template

---
description: Brief description for autocomplete and invocation
argument-hint: [filename] [options]
allowed-tools: Read, Grep, Bash(git:*)
disable-model-invocation: false
model: claude-sonnet-4-20250514
---

# Command Title

[Clear instructions for what this command does]

User request: $ARGUMENTS

## Steps

1. [First action Claude should take]
2. [Second action]
3. [Third action]

## Output Format

[Specify expected output structure]

Frontmatter Fields

FieldRequiredPurpose
descriptionYesShown in autocomplete, helps Claude decide when to invoke
argument-hintNoAutocomplete hint for expected arguments
allowed-toolsNoTools command can use without permission prompts
disable-model-invocationNoIf true, only user can invoke via /command
user-invocableNoIf false, only Claude can invoke (hidden from menu)
modelNoOverride default model for this command
contextNoSet to fork for isolated subagent execution
agentNoSubagent type: Explore, Plan, general-purpose

allowed-tools Syntax

allowed-tools: Read, Grep, Bash(git:*)
PatternMeaning
ToolAllow any invocation of that tool
Tool(prefix:*)Allow with specific prefix only
Bash(git:*)Only git commands
Bash(npm test:*)Only npm test commands

$ARGUMENTS Usage

Single Argument

# Code Review

Review the following file or code for quality, security, and best practices:

$ARGUMENTS

Focus on:
- Code quality issues
- Security vulnerabilities
- Performance concerns
- Best practice violations

Usage: /review src/auth.js

Multiple Arguments

# Compare Files

Compare these two files and explain the differences:

$ARGUMENTS

Provide:
- Line-by-line diff
- Semantic changes
- Impact analysis

Usage: /compare old.js new.js

Optional Arguments

# Run Tests

Run tests for the specified scope.

Scope: $ARGUMENTS

If no scope specified, run all tests.
If scope is a file, run tests for that file.
If scope is a directory, run tests in that directory.

Usage: /test or /test auth/ or /test login.test.ts

Positional Arguments

Use $1, $2, etc. for specific arguments (like shell scripts):

# Compare Files

Compare $1 with $2.

Show:
- Line differences
- Semantic changes
- Which version is preferred

Usage: /compare old.js new.js$1 = "old.js", $2 = "new.js"


File References (@ Prefix)

Include file contents directly in the command with @:

# Review with Context

Review this code following our standards.

Project standards:
@CLAUDE.md

Code to review:
$ARGUMENTS

Usage: /review-context src/auth.js includes CLAUDE.md contents automatically.


Bash Execution (! Prefix)

Execute bash commands and include output with !:

# Smart Commit

Current status:
!git status --short

Recent commits:
!git log --oneline -5

Staged changes:
!git diff --cached

Generate a commit message for the staged changes.

Usage: /smart-commit runs git commands and includes their output.

Important: The !command syntax is preprocessing — commands execute BEFORE the content is sent to Claude. Claude only sees the final rendered output with actual data, not the command itself.

Backtick Syntax

For inline execution, use backticks:

PR diff: !`gh pr diff`
Changed files: !`gh pr diff --name-only`

Command Patterns

Agent Invocation

# Security Audit

Perform a comprehensive security audit.

Target: $ARGUMENTS

Use the **security-auditor** agent to:
1. Scan for OWASP Top 10 vulnerabilities
2. Check authentication patterns
3. Review data validation
4. Analyze dependencies

Provide a severity-rated findings report.

Multi-Agent Orchestration

# Fullstack Feature

Build a complete fullstack feature.

Feature: $ARGUMENTS

Workflow:
1. Use **prd-architect** to clarify requirements
2. Use **system-architect** to design approach
3. Use **backend-engineer** for API implementation
4. Use **frontend-engineer** for UI implementation
5. Use **test-architect** for test coverage

Coordinate between agents and ensure integration.

Validation Command

# Pre-Commit Check

Validate changes before commit.

Files: $ARGUMENTS (or all staged files if not specified)

Checklist:
- [ ] All tests pass
- [ ] No linting errors
- [ ] No type errors
- [ ] No console.log statements
- [ ] No TODO comments
- [ ] No hardcoded secrets

Return READY or BLOCKED with details.

Command Categories

Development Commands

CommandPurpose
/reviewCode review
/testRun/write tests
/debugDebug issues
/refactorImprove code

Architecture Commands

CommandPurpose
/designSystem design
/architecture-reviewReview architecture
/tech-specWrite tech spec

Security Commands

CommandPurpose
/security-scanSecurity audit
/secrets-checkFind exposed secrets
/dependency-auditCheck dependencies

Operations Commands

CommandPurpose
/deployDeployment workflow
/rollbackRollback changes
/incidentIncident response

Naming Conventions

PatternExampleUse For
{action}/reviewSimple actions
{action}-{target}/security-scanSpecific targets
{domain}-{action}/pm-strategyDomain-prefixed
{tool}-{action}/git-commitTool-specific

Command vs Agent vs Skill

FeatureCommandAgentSkill
TriggerUser types /commandClaude decidesClaude loads
PurposeQuick shortcutsComplex workKnowledge
StatefulnessStatelessMaintains contextReference only
LengthShort promptFull instructionsDetailed docs

Flow: User → Command → Agent → Skill


Invocation Control

Control who can invoke commands using frontmatter:

FrontmatterUser InvokesClaude InvokesUse Case
(default)/name✓ AutoGeneral commands
disable-model-invocation: true/name✗ NeverDeploy, commit, dangerous ops
user-invocable: false✗ Hidden✓ AutoBackground knowledge only

Example: User-Only Command

---
description: Deploy to production
disable-model-invocation: true
allowed-tools: Bash(kubectl:*), Bash(docker:*)
---

# Deploy

Deploy $ARGUMENTS to production cluster.

Claude cannot auto-invoke this — user must explicitly type /deploy.


Context Budget

Default skill/command description budget: 15,000 characters.

If many commands are excluded from context:

export SLASH_COMMAND_TOOL_CHAR_BUDGET=20000

Check with /context command for warnings about excluded skills.


Best Practices

DO

# Good Command

Clear, specific instructions.

Target: $ARGUMENTS

1. First, analyze the target
2. Then, perform action X
3. Finally, output result Y

Expected output:
- Summary of findings
- Actionable recommendations

DON'T

# Bad Command

Do stuff with $ARGUMENTS.

Make it good.

Advanced Patterns

Conditional Logic

# Smart Review

Review target: $ARGUMENTS

If target is a PR number (e.g., #123):
  - Fetch PR details with `gh pr view`
  - Review all changed files

If target is a file path:
  - Review that specific file

If target is a directory:
  - Review all files in directory

Template with Options

# Generate Tests

Generate tests for: $ARGUMENTS

Options (parsed from arguments):
- `--unit` - Unit tests only
- `--e2e` - E2E tests only
- `--coverage` - Include coverage report

Default: Generate both unit and E2E tests.

Resources

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です