Skip to main content
command CX Codex

create-command · carlrannaberg — Claude Code command: what it does, how to install

The create-command command builds a Claude Code slash command from your requirements, then shows its file location and how to invoke it.

MIT ★ 763 updated 2026-03-31

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/create-command.md
Open on GitHub

What create-command does

First, it asks whether the new command belongs in the project’s .claude/commands/ folder or your personal ~/.claude/commands/ directory. It gathers a name, description, content template, tool needs, and choices about arguments, shell commands, or file references.

The result is a Markdown file, with YAML frontmatter when tool settings are needed. The template can use $ARGUMENTS for input, ! to run Bash commands, and @ to include file contents. Namespaced commands get nested directories. Its available tools are Write, Read, and Bash(mkdir:*), so it can create the required folders.

Install the command file at .claude/commands/create-command.md. It then prints the path and an example invocation: /create-command.

What it helps with

  • create a project slash command for team use
  • set up a personal command under ~/.claude/commands/
  • add dynamic input with $ARGUMENTS
  • restrict a command’s tools with allowed-tools
  • place a namespaced command in nested folders

Example prompts for the agent

  • Create a project command called review-pr to inspect changes and accept a PR number as an argument.
  • Make a personal check-deps command that reads package.json and reviews the dependencies.
  • Create api:create with a Bash call, then show me how to invoke it.

How to install create-command

Manually: put the files in place

.claude/commands/create-command.md

Call it with /create-command. For all projects use ~/.claude/commands/

Questions about create-command

How do I install create-command in Claude Code?

Place the command file at .claude/commands/create-command.md.

What does create-command do?

It gathers requirements for a Claude Code slash command and creates its Markdown file with the requested instructions and settings.

How can the generated command accept arguments or read a file?

Use $ARGUMENTS for supplied input and the @ prefix to include file contents.

Source text

create-command.md · MIT
---
description: Create a new Claude Code slash command with full feature support
category: claude-setup
allowed-tools: Write, Read, Bash(mkdir:*)
argument-hint: "[command-name] [description]"
---

Create a new Claude Code slash command based on the user's requirements: $ARGUMENTS

For complete slash command documentation, see: https://docs.claude.com/en/docs/claude-code/slash-commands

First, ask the user to specify the command type:
- **project** - Add to current project's `.claude/commands/` directory (shared with team)
- **personal** - Add to user's `~/.claude/commands/` directory (personal use only)

If the user doesn't specify, ask which type to create.

Then gather the following information from the user:
- Command name
- Description
- Command content/template
- Any required tools (for frontmatter)
- Whether to use arguments, bash commands, or file references

## Command Template Structure

### YAML Frontmatter
Commands use standardized frontmatter that follows Claude Code's official schema:

```yaml
---
# Required field:
description: Brief description of what the command does

# Security control (highly recommended):
allowed-tools: Read, Write, Bash(git:*)  # Specify allowed tools

# Optional fields:
argument-hint: "<feature-name>"  # Help text for expected arguments
model: sonnet  # opus, sonnet, haiku, or specific model
category: workflow  # workflow, ai-assistant, or validation
---
```

### Security with allowed-tools
The `allowed-tools` field provides granular security control:
- Basic: `allowed-tools: Read, Write, Edit`
- Restricted bash: `allowed-tools: Bash(git:*), Read`  # Only git commands
- Multiple restrictions: `allowed-tools: Read, Write, Bash(npm:*, git:*)`

## Features to Support

When creating the command, support these Claude Code features if requested:

**Arguments:** If the user wants dynamic input, use `$ARGUMENTS` placeholder
- Example: `/deploy $ARGUMENTS` where user types `/deploy production`

**Bash Execution:** If the user wants command output, use exclamation mark (!) prefix
- Example: `!pwd > /dev/null 2>&1` or `!ls -la > /dev/null 2>&1` to include command output
- **Performance tip**: Combine related commands with `&&` for faster execution
- Example: `!pwd > /dev/null 2>&1 && ls -la 2>/dev/null | head -5 > /dev/null`

**File References:** If the user wants file contents, use `@` prefix
- Example: `@package.json` to include package.json contents

**Namespacing:** If the command name contains `:`, create subdirectories
- Example: `/api:create` → `.claude/commands/api/create.md`


## Implementation Steps

1. **Determine Location**
   - If command type not specified, ask the user (project vs personal)
   - For project commands: create `.claude/commands/` directory if needed
   - For personal commands: create `~/.claude/commands/` directory if needed
   - Create subdirectories for namespaced commands (e.g., `api/` for `/api:create`)

2. **Create Command File**
   - Generate `{{COMMAND_NAME}}.md` file in the appropriate directory
   - Include YAML frontmatter if the command needs specific tools
   - Add the command content with any placeholders, bash commands, or file references
   - Ensure proper markdown formatting

3. **Show the User**
   - Display the created command file path
   - Show how to invoke it with `/{{COMMAND_NAME}}`
   - Explain any argument usage if `$ARGUMENTS` is included
   - Provide a brief example of using the command

## Command Content Guidelines

Key principle: Write instructions TO the AI agent, not as the AI agent. Use imperative, instructional language rather than first-person descriptions of what the agent will do.

### Example Command Templates

**Simple Command:**
```markdown
---
description: Create a React component
allowed-tools: Write
---

Create a new React component named $ARGUMENTS

Component template:
\```tsx
import React from 'react';

export const $ARGUMENTS: React.FC = () => {
  return <div>$ARGUMENTS Component</div>;
};
\```
```

**Command with Bash and File Analysis:**
```markdown
---
description: Analyze dependencies
allowed-tools: Read, Bash(npm:*, yarn:*, pnpm:*)
---

Current dependencies:
@package.json

Outdated packages:
!npm outdated 2>/dev/null || echo "No outdated packages"

Suggest which packages to update based on the above information.
```

© carlrannaberg · MIT · carlrannaberg/claudekit

Similar slash commands

Slash commands catalog →

create-command by other authors comes first.

create-command Eugeniu Ghelbur create-command scaffolds a new slash command for Obsidian through an interactive interview, removing the need to write Markdown or frontmatter by hand. CX Codex +1 ★ 5,412repo stars remotion-create remotion-dev remotion-create — a skill for Claude Code and Codex that scaffolds a fresh Remotion video workspace. It runs create-video CLI and organizes React video compositions. CX Codex +1 375,000installs create-architecture-documentation davila7 create-architecture-documentation — a Claude slash command that turns your repo into architecture documentation: diagrams, ADRs and component descriptions. CX Codex +1 6,136installs convex-create-component convex convex-create-component is a Claude Code skill for building reusable Convex components with isolated tables and clear APIs, including extracting backend logic into a self-contained module. CX Codex +1 138,900installs create-prd davila7 create-prd — a slash command that turns a feature idea into a requirements document: problem, scope, success metrics and acceptance criteria. CX Codex +1 2,431installs recipe-create-presentation official googleworkspace recipe-create-presentation is a Claude Code skill that creates a Google Slides deck from the terminal and shares it with your team, without a browser. CX Codex +1 33,500installs recipe-create-gmail-filter official googleworkspace recipe-create-gmail-filter — a skill that builds Gmail filters to apply labels, stars, and folder rules automatically. Runs via gws commands and requires the gws-gmail skill loaded first. CX Codex +1 32,400installs

From the same set54

The whole set →
status status evaluates repository state via Git, categorizes modified files by type, and suggests actions before commits or rebases. CX Codex +1 ★ 763repo stars cli This command checks whether a CLI tool is available, captures its help output, and adds it to CLAUDE.md for future reference. CX Codex +1 ★ 763repo stars checkout The checkout command creates and switches git branches using prefixes such as feature/, hotfix/ and release/, following a repo's branch-naming convention. CX Codex +1 ★ 763repo stars bash-timeout bash-timeout configures bash command timeout values in Claude Code settings.json. Useful when long test runs, builds, or deployments fail due to the default 2-minute cap. CX Codex +1 ★ 763repo stars commit Builds a git commit that matches your project's conventions: scans the diff, updates docs, writes the message. CX Codex +1 ★ 763repo stars code-search code-search searches the codebase for matching files, functions, and patterns, returning a clean list of paths. Handy for locating relevant code quickly without full explanations. CX Codex ★ 763repo stars validate-and-fix validate-and-fix is a Claude Code command that runs project checks and assigns independent fixes to parallel agents. It discovers build, test, and lint commands in project instructions and package.json. CX Codex +1 ★ 763repo stars migration migration moves CLAUDE.md, .cursorrules and the rest of your AI config files into one AGENTS.md, then links each tool's expected filename to it. CX Codex +1 ★ 763repo stars

Project sponsors

Companies that keep this analytics open