Skip to content
Back to skills

Creating Commands

ASecurity

Creates new Claude Code slash commands following best practices. Guides through command structure, naming, arguments, and frontmatter. Use when user wants to create a command, build a slash command, or asks about command best practices.

  • 416 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 9, 2026
ai-agentsbashgit

Works with

  • claude code

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add aiskillstore/marketplace --skill creating-commands --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Creating Commands?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Creating Commands
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-creating-commands/badge)](https://www.skillsdirectory.com/skills/aiskillstore-creating-commands)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: creating-commands
description: |
  Creates new Claude Code slash commands following best practices. Guides through command
  structure, naming, arguments, and frontmatter. Use when user wants to create a command,
  build a slash command, or asks about command best practices.
---

# Creating Commands

Guides creation of Claude Code slash commands using documented best practices.

## Quick Start

For a new command:
1. Ask user for command purpose and arguments needed
2. Generate using appropriate template
3. Validate against checklist

For reviewing existing command:
1. Read command file
2. Check against anti-patterns in [reference.md](reference.md)
3. Report issues with fixes

## Workflow: Create New Command

```
Progress:
- [ ] Gather requirements (purpose, arguments, scope)
- [ ] Choose template (basic, with-args, workflow)
- [ ] Generate command file
- [ ] Validate against checklist
```

### Step 1: Gather Requirements

Ask user with AskUserQuestion:
- What should this command do? (purpose)
- Does it need arguments? (none, single, multiple)
- Project or personal? (scope)

### Step 2: Choose Template

| Type | Template | When to Use |
|------|----------|-------------|
| Basic | [templates/basic.md](templates/basic.md) | No arguments, simple prompt |
| With Args | [templates/with-args.md](templates/with-args.md) | Single or multiple arguments |
| Workflow | [templates/workflow.md](templates/workflow.md) | Integrates with skills/agents |

### Step 3: Generate Command

Create in appropriate location:
- `.claude/commands/` - Project commands (git-tracked)
- `~/.claude/commands/` - Personal commands (your machine only)

### Step 4: Validate

Run through checklist before finishing:

```
Validation Checklist:
- [ ] Name: lowercase with hyphens only
- [ ] Name: descriptive, verb-noun format preferred
- [ ] Description: explains what command does
- [ ] Arguments: documented with argument-hint if used
- [ ] Prompt: clear, actionable instructions
- [ ] Tools: allowed-tools declared if needed
```

## Naming Rules

**Format**: `verb-noun` or `action` (lowercase, hyphens)
- `fix-issue`
- `review-pr`
- `run-tests`
- `optimize`

**Constraints**:
- Lowercase letters, numbers, hyphens only
- No spaces or underscores
- Keep concise (1-3 words)

## Command File Format

```markdown
---
description: Brief explanation shown in help
allowed-tools:
  - Bash(bash:*)
  - WebSearch
argument-hint: "param_name"
---

Your command prompt here.
Use $ARGUMENTS for all args or $1, $2 for positional.
```

## Argument Syntax

| Syntax | Usage | Example |
|--------|-------|---------|
| `$ARGUMENTS` | All arguments as one string | `/cmd foo bar` → `foo bar` |
| `$1`, `$2` | Positional arguments | `/cmd foo bar` → `$1=foo`, `$2=bar` |
| `@file` | Include file contents | `Review @src/main.ts` |

## Frontmatter Options

| Field | Purpose | Required |
|-------|---------|----------|
| `description` | Shown in help, enables auto-invoke | Recommended |
| `allowed-tools` | Tools the command can use | If using tools |
| `argument-hint` | Documents expected args | If has args |
| `model` | Specific model to use | Optional |

## Example: Basic Command

```markdown
---
description: Run all tests and report failures
allowed-tools:
  - Bash(npm:*)
---

Run the test suite and summarize results:

1. Execute `npm test`
2. If failures, show failing tests with context
3. Suggest fixes for common issues
```

See [reference.md](reference.md) for detailed best practices and anti-patterns.

Files in this skill

  • SKILL.md3.4 KB
  • reference.md5 KB
  • skill-report.json21.9 KB
  • templates/basic.md769 B
  • templates/with-args.md1.5 KB
  • templates/workflow.md2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…