Claude Code Plugins

Community-maintained marketplace

Feedback

command-creator

@sjnims/plugin-forge
1
0

Create custom slash commands for Claude Code plugins with markdown format, arguments, frontmatter, and features. Use when creating commands, slash commands, or custom prompts for plugins.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name command-creator
description Create custom slash commands for Claude Code plugins with markdown format, arguments, frontmatter, and features. Use when creating commands, slash commands, or custom prompts for plugins.

Command Creator

Create custom slash commands for Claude Code plugins that users can invoke explicitly.

When to Use This Skill

Use when:

  • Creating custom slash commands for plugins
  • User requests "create a command" or "add a slash command"
  • Building frequently-used prompt shortcuts
  • Need user-invoked commands (vs autonomous skills)

Command vs Skill

Slash Commands (User-Invoked):

  • Explicitly called by user: /command-name
  • Good for frequently-used prompts
  • Simple, single-file structure
  • Manual invocation

Skills (Model-Invoked):

  • Automatically used by Claude when relevant
  • Good for complex capabilities
  • Multi-file structure with resources
  • Autonomous activation

Command File Structure

Commands are markdown files with optional frontmatter:

```yaml
---
description: Brief description of what the command does
argument-hint: [arg1] [arg2]
allowed-tools: Tool1, Tool2
model: sonnet
disable-model-invocation: false
---
```

# Command prompt content

$ARGUMENTS or $1, $2, $3 for argument access

Instructions

Step 1: Determine Command Purpose

Define what the command should do:

  • What prompt/instruction does it provide?
  • Does it need arguments?
  • Should it reference files?
  • Does it need to execute bash commands?
  • Which tools are required?

Step 2: Create Command File

Filename: <command-name>.md (kebab-case)

Location:

  • Plugin commands: <plugin>/commands/
  • Project commands: .claude/commands/
  • User commands: ~/.claude/commands/

Invocation: /command-name [arguments]

Step 3: Write Frontmatter (Optional)

---
description: Brief description of command
argument-hint: [arg1] [arg2]  # Shown in autocomplete
allowed-tools: Tool1, Tool2  # Restrict tools
model: sonnet  # Specific model
disable-model-invocation: false  # Allow SlashCommand tool
---

All frontmatter fields are optional.

Step 4: Write Command Content

After frontmatter, write the command prompt:

# Task Description

Your command instructions here.

## Arguments

- $ARGUMENTS: All arguments as single string
- $1: First argument
- $2: Second argument
- $3: Third argument, etc.

## File References

Use @file/path to reference files:
Review @src/main.js for errors

## Bash Execution

Use !`command` for bash execution (requires allowed-tools: Bash):
Current status: !`git status`

Step 5: Configure Arguments

All arguments (simple):

Fix issue #$ARGUMENTS

Usage: /fix-issue 123 high-priority Result: "Fix issue #123 high-priority"

Individual arguments (structured):

Review PR #$1 with priority $2 and assign to $3

Usage: /review-pr 456 high alice Result: "Review PR #456 with priority high and assign to alice"

Step 6: Add Bash Commands (Optional)

Include bash output in context:

Frontmatter:

allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)

Command content:

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

Based on the above, create a commit message.

Bash commands execute before prompt is sent to Claude.

Step 7: Enable File References (Optional)

Reference files directly in command:

Compare @src/old-version.js with @src/new-version.js

Identify differences and suggest improvements.

User can then use command and file references are loaded.

Frontmatter Reference

description (optional)

Purpose: Shown in /help and autocomplete

Example:

description: Create git commit with conventional format

argument-hint (optional)

Purpose: Shown in autocomplete to guide users

Example:

argument-hint: [pr-number] [priority] [assignee]

Shown when user types /review-pr to indicate expected arguments.

allowed-tools (optional)

Purpose: Restrict which tools command can use

Example:

allowed-tools: Bash(git add:*), Bash(git status:*), Read, Write

model (optional)

Purpose: Use specific model for command execution

Options: Model string like claude-3-5-haiku-20241022 or alias like sonnet

Example:

model: claude-3-5-haiku-20241022

disable-model-invocation (optional)

Purpose: Prevent SlashCommand tool from invoking this command

Default: false (command can be invoked by SlashCommand tool)

Example:

disable-model-invocation: true

Use when command should only be manually invoked.

Example Commands

Simple Command (No Arguments)

File: commands/review.md

```yaml
---
description: Review code for security, performance, and style
---
```

Review this code for:
- Security vulnerabilities
- Performance issues
- Code style violations

Provide specific, actionable feedback.

Usage: /review

Command with Arguments

File: commands/fix-issue.md

```yaml
---
description: Fix GitHub issue by number
argument-hint: [issue-number]
---
```

Fix issue #$ARGUMENTS following our coding standards:

1. Read the issue description
2. Implement the fix
3. Add tests
4. Update documentation

Usage: /fix-issue 123

Command with Bash Execution

File: commands/commit.md

```yaml
---
description: Create git commit with conventional format
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
---
```

Current git status:
!`git status`

Current git diff:
!`git diff HEAD`

Recent commits:
!`git log --oneline -10`

Based on the above changes, create a conventional commit message and commit the changes.

Usage: /commit

Command with File References and Multiple Arguments

File: commands/compare-files.md

```yaml
---
description: Compare two files and analyze differences
argument-hint: [file1] [file2]
---
```

Compare @$1 with @$2

Analyze:
1. Key differences
2. Which approach is better
3. Recommended improvements

Usage: /compare-files src/old.js src/new.js

Command with Thinking Mode

File: commands/deep-analysis.md

```yaml
---
description: Perform deep analysis with extended thinking
---
```

Perform a comprehensive analysis of this codebase.

Think carefully about architecture, patterns, and potential improvements.

[Use extended thinking to reason through complex architectural decisions]

Extended thinking keywords trigger thinking mode automatically.

Namespacing

Organize commands in subdirectories:

commands/
├── git/
│   ├── commit.md        → /commit (git)
│   └── review-pr.md     → /review-pr (git)
└── deploy/
    ├── staging.md       → /staging (deploy)
    └── production.md    → /production (deploy)

Subdirectories appear in description but don't affect command name.

Plugin Commands

Plugin commands automatically namespace:

Without conflicts:

/command-name

With conflicts (disambiguation):

/plugin-name:command-name

SlashCommand Tool

Commands can be invoked by Claude via SlashCommand tool if:

  • Command has description in frontmatter
  • disable-model-invocation is not true
  • Command appears in SlashCommand tool's character budget

To prevent autonomous invocation:

disable-model-invocation: true

Best Practices

  1. Use clear descriptions: Help users discover commands
  2. Provide argument hints: Guide users on expected input
  3. Limit bash commands: Only necessary operations
  4. Restrict tools: Grant only required permissions
  5. Keep prompts focused: One clear purpose per command
  6. Test with arguments: Verify $1, $2, etc. work correctly
  7. Document usage: Include examples in description

Troubleshooting

Command not found:

  • Check filename is correct
  • Verify location (commands/ directory)
  • Confirm no typos in command name
  • Run /help to see available commands

Arguments not working:

  • Use $ARGUMENTS for all args as string
  • Use $1, $2, $3 for individual args
  • Test with actual invocation
  • Check argument-hint matches usage

Bash commands fail:

  • Add allowed-tools with Bash
  • Specify allowed commands: Bash(git status:*)
  • Verify syntax: !command
  • Check command is valid

SlashCommand tool not invoking:

  • Add description in frontmatter
  • Ensure disable-model-invocation is false or omitted
  • Check character budget limit
  • Reference command name with / in instructions

Reference

For complete command documentation, see references/command-format.md.