Home / Market / command creator

command creator

This skill should be used when creating a Claude Code slash command. Use when users ask to "create a command", "make a slash command", "add a command", or want to document a workflow as a reusable command. Essential for creating optimized, agent-executable slash commands with proper structure and best practices.

skill★ 347440 dlgithubMITInstall in CosmosUpstream Source

Documentation & Preview

Command Creator

A comprehensive skill for creating optimized, agent-executable slash commands in Claude Code. This skill guides you through the entire process of designing, implementing, and testing reusable workflow automation commands.

Table of Contents

---

Overview

The Command Creator skill helps you transform repetitive workflows into reusable slash commands that can be invoked with /command-name in Claude Code conversations. It provides expert guidance on command structure, agent optimization, and best practices to ensure your commands execute reliably and autonomously.

Purpose: Create high-quality, agent-executable slash commands with proper structure, clear instructions, and optimal tool usage patterns.

Target Users: Developers who want to:

---

When to Use This Skill

Invoke this skill when you need to:

Trigger Phrases:

---

What Are Slash Commands?

Slash commands are markdown files stored in .claude/commands/ (project-level) or ~/.claude/commands/ (global/user-level) that get expanded into prompts when invoked.

Structure:

---
description: Brief description shown in /help (required)
argument-hint: <placeholder> (optional, if command takes arguments)
---

# Command Title

[Detailed instructions for the agent to execute autonomously]

Invocation:

/command-name [arguments]

Storage Locations:

---

Key Features

1. Intelligent Location Detection

Automatically determines whether commands should be project-level or global based on:

2. Pattern-Based Design

Guides you through proven command patterns:

3. Agent-Optimized Instructions

Creates commands that agents can execute autonomously with:

4. Quality Assurance

Includes comprehensive best practices for:

5. Bundled Reference Documentation

Provides three comprehensive reference files:

---

How It Works

The Command Creator follows a structured 6-step workflow:

Step 1: Determine Location

Auto-detection Logic:

  1. Check if current directory is inside a git repository
  2. Default to project-level (.claude/commands/) if in git repo
  3. Default to global (~/.claude/commands/) if not in git repo
  4. Allow user override for explicit location preference

User is informed of the chosen location before proceeding.

Step 2: Show Command Patterns

Present available command patterns to help frame the conversation:

User selects the closest pattern to their needs.

Step 3: Gather Command Information

Interactive Q&A to collect:

A. Command Name and Purpose

B. Arguments

C. Workflow Steps

D. Tool Restrictions

Step 4: Generate Optimized Command

Create agent-executable instructions using:

Step 5: Create the Command File

  1. Construct full file path (project or global)
  2. Ensure directory exists (mkdir -p)
  3. Write command file using Write tool
  4. Confirm with user:

Step 6: Test and Iterate

  1. Suggest testing the command
  2. Wait for user feedback
  3. Iterate and improve based on results
  4. Update file with refinements

---

Command Patterns

1. Workflow Automation

Use Case: Multi-step processes requiring analysis, action, and reporting

Example: Submit PR stack

1. Analyze git history to identify commit stack
2. Create PRs for each commit with proper dependencies
3. Report created PRs with links and status

Key Characteristics:

2. Iterative Fixing

Use Case: Continuous improvement until success criteria met

Example: Ensure CI passes

1. Run tests and capture output
2. Parse failures and errors
3. Fix identified issues
4. Repeat until all tests pass

Key Characteristics:

3. Agent Delegation

Use Case: Complex tasks requiring specialized agent expertise

Example: Create implementation plan

1. Gather context (requirements, codebase)
2. Delegate to subagent agent
3. Iterate on plan with user feedback
4. Save final plan to .PLAN.md

Key Characteristics:

4. Simple Execution

Use Case: Direct tool/script execution with arguments

Example: Code review

1. Run codex review on specified files
2. Present results to user

Key Characteristics:

---

Location Strategy

Project-Level Commands (.claude/commands/)

When to Use:

Examples:

Advantages:

Global Commands (~/.claude/commands/)

When to Use:

Examples:

Advantages:

---

Bundled Resources

This skill includes three comprehensive reference files in the references/ directory:

references/patterns.md

Purpose: Detailed command design patterns with implementation guidance

Contents:

Load When: Designing the command workflow and choosing the right pattern

references/examples.md

Purpose: Real-world command implementations with full source code

Contents:

Load When: Need concrete examples of how to structure specific command types

references/best-practices.md

Purpose: Quality checklist and writing guidelines

Contents:

Load When: Finalizing command to ensure quality and completeness

---

Usage Examples

Example 1: Create Project-Level CI Fixer

User Request: "I keep fixing CI failures manually. Can we make a command for this?"

Skill Flow:

  1. Detects project-level (in git repo)
  2. Suggests "Iterative Fixing" pattern
  3. Gathers info:
  1. Generates command with Bash tool for pytest
  2. Creates .claude/commands/ensure-ci.md
  3. User invokes: /ensure-ci

Example 2: Create Global Code Review Command

User Request: "Create a global command to review code with Codex"

Skill Flow:

  1. Detects global (user requests "global")
  2. Suggests "Simple Execution" pattern
  3. Gathers info:
  1. Generates command with codex skill invocation
  2. Creates ~/.claude/commands/codex-review.md
  3. User invokes: /codex-review src/app.py src/utils.py

Example 3: Create PR Submission Workflow

User Request: "Make a command that analyzes my commits and creates a PR stack"

Skill Flow:

  1. Detects project-level (in git repo)
  2. Suggests "Workflow Automation" pattern
  3. Gathers info:
  1. Generates command with git analysis and gh CLI
  2. Creates .claude/commands/submit-stack.md
  3. User invokes: /submit-stack or /submit-stack develop

---

Best Pra