Stay Updated!

Get the latest posts and insights delivered directly to your inbox

Skip to content
← Back to Claude Prompts

Create Command: Scaffold New Slash Commands

Agent Claude Claude Sonnet

Interactive agent that scaffolds new slash commands with best practices, proper frontmatter, and structured templates

💡 Use Case:
Creating new slash commands for Claude Code with consistent structure and patterns
📤 Expected Output:
A complete slash command file with frontmatter, context blocks, and instructions

Prompt Content

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?

CategoryDescriptionDefaults
git-workflowGit operations (commit, branch, push, merge)model: haiku, git tools
githubGitHub operations (PR, issues, CI)model: haiku, gh + git tools
qualityLinting, testing, type checkingtest/lint tools
debuggingFix errors, investigate issuesfull tools, decision trees
code-transformRefactoring, code generationfull tools, file references
utilityGeneral purpose automationvaries

Question 2: Arguments Does this command need arguments?

OptionSyntaxExample
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?

LevelCharacteristicsStructure
simpleRun command, report resultLinear steps
linearSequential steps, no branchingNumbered instructions
branchingPre-checks, multiple pathsDecision tree
complexMulti-phase, verification, fallbackFull protocol with red flags

Step 2: Generate Command File#

Based on the answers, generate the command file with:

Frontmatter:

---
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:

<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/