# Create Command: Scaffold New Slash Commands



## Create Command: Scaffold New Slash Commands

An interactive agent that guides you through creating well-structured slash commands for Claude Code. It asks the right questions and generates commands following proven patterns.

## Purpose

Creating effective slash commands requires understanding frontmatter options, context gathering patterns, and instruction structures. This agent encapsulates best practices so you can create powerful commands quickly without memorizing the format.

## Instructions

### Step 1: Gather Requirements

Ask the user these questions:

**Question 1: Command Category**
What category best describes this command?

| Category | Description | Defaults |
|----------|-------------|----------|
| `git-workflow` | Git operations (commit, branch, push, merge) | `model: haiku`, git tools |
| `github` | GitHub operations (PR, issues, CI) | `model: haiku`, gh + git tools |
| `quality` | Linting, testing, type checking | test/lint tools |
| `debugging` | Fix errors, investigate issues | full tools, decision trees |
| `code-transform` | Refactoring, code generation | full tools, file references |
| `utility` | General purpose automation | varies |

**Question 2: Arguments**
Does this command need arguments?

| Option | Syntax | Example |
|--------|--------|---------|
| None | (no arguments) | `/lint` |
| Single required | `$1` | `/review-pr 123` |
| Multiple positional | `$1`, `$2`, `$3` | `/deploy staging v1.2.3` |
| Free-form text | `$ARGUMENTS` | `/branch add dark mode toggle` |

**Question 3: File References**
Does the command operate on specific files?

- **Yes** - Use `@$1` syntax to reference file contents
- **No** - Command works on general context

**Question 4: Complexity**
How complex is the workflow?

| Level | Characteristics | Structure |
|-------|-----------------|-----------|
| `simple` | Run command, report result | Linear steps |
| `linear` | Sequential steps, no branching | Numbered instructions |
| `branching` | Pre-checks, multiple paths | Decision tree |
| `complex` | Multi-phase, verification, fallback | Full protocol with red flags |

### Step 2: Generate Command File

Based on the answers, generate the command file with:

**Frontmatter:**
```yaml
---
description: <imperative verb phrase>
argument-hint: <show expected args>
allowed-tools: <category defaults>
model: <haiku for routine, omit for complex>
---
```

**Context Blocks** using semantic XML tags:
```markdown
<current_branch>
!`git branch --show-current`
</current_branch>
```

**Structure Templates** based on complexity level.

### Step 3: Write the File

1. Write the file to `.claude/commands/<name>.md`
2. Show the user the generated command
3. Explain how to use it

## Expected Output

- **Format:** Complete markdown file with YAML frontmatter
- **Key sections:**
  - Frontmatter with description, tools, model
  - Context blocks with shell commands
  - Decision tree (if branching/complex)
  - Numbered instructions
  - Red flags section (if complex)

## Example

**Input:**
```
/create-command deploy "Deploy to staging or production environment"
```

**Output:**
A complete command file at `.claude/commands/deploy.md` with:
- Proper frontmatter for deployment category
- Context blocks for git status, current branch, latest tag
- Decision tree handling uncommitted changes
- Instructions for build and deploy steps

## Done When

- [ ] User requirements gathered via questions
- [ ] Command file generated with correct frontmatter
- [ ] Context blocks use appropriate shell commands
- [ ] Instructions match complexity level
- [ ] File written to `.claude/commands/`

---

--- title: Fix Pipeline: Systematic CI/CD Debugging description: Agent that systematically debugs CI pipeline failures using root cause analysis before implementing fixes tool: claude category: agent tags: ['ci-cd', 'debugging', 'github-actions', 'testing', 'workflow'] url: https://alexop.dev/prompts/claude/claude-fix-pipeline-command ---