Skip to content
Back to skills

Collection

ASecurity

Create custom slash commands for Claude Code. Use when the user wants to create, generate, or build a slash command (.md file) for Claude Code, or when they ask about slash command syntax, frontmatter options, argument handling, or want help organizing their commands. Triggers on phrases like "make a slash command", "create a command for Claude Code", "write a /command", or questions about $ARGUMENTS, allowed-tools, or command frontmatter.

  • 24 stars
  • 0 votes
  • 0 copies
  • 10 views
  • Added September 8, 2026
developmenttypescriptbashreactgitapifrontendbackendsecurityperformance

Works with

  • claude code
  • api

Security analysis

A100/100

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

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

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

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-b76fc74a/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-b76fc74a)

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: claude-code-slash-commands
description: Create custom slash commands for Claude Code. Use when the user wants to create, generate, or build a slash command (.md file) for Claude Code, or when they ask about slash command syntax, frontmatter options, argument handling, or want help organizing their commands. Triggers on phrases like "make a slash command", "create a command for Claude Code", "write a /command", or questions about $ARGUMENTS, allowed-tools, or command frontmatter.
---

# Claude Code Slash Commands

Create custom slash commands for Claude Code as Markdown files with optional YAML frontmatter.

## Quick Reference

| Location | Scope | Description Label |
|----------|-------|-------------------|
| `.claude/commands/` | Project (shared via git) | (project) |
| `~/.claude/commands/` | Personal (all projects) | (user) |

## Command Structure

```markdown
---
allowed-tools: Tool1, Tool2(pattern:*)
argument-hint: [arg1] [arg2]
description: Brief description shown in /help
model: claude-sonnet-4-20250514
disable-model-invocation: false
---

Your prompt instructions here.
Use $ARGUMENTS for all args, or $1, $2, etc. for positional.
Reference files with @path/to/file.
Execute bash inline with !`command`.
```

## Creating Commands

### Workflow

1. Determine scope (project vs personal)
2. Choose command name (filename without .md)
3. Write frontmatter (optional but recommended)
4. Write prompt body with argument placeholders
5. Save to appropriate location

### Frontmatter Options

| Field | Purpose | Default |
|-------|---------|---------|
| `allowed-tools` | Tools the command can use | Inherits from conversation |
| `argument-hint` | Shows in autocomplete (e.g., `[file] [options]`) | None |
| `description` | Brief description for /help | First line of prompt |
| `model` | Specific model to use | Inherits from conversation |
| `disable-model-invocation` | Prevent SlashCommand tool from calling this | false |

### Arguments

**All arguments** - `$ARGUMENTS` captures everything:
```markdown
Fix issue #$ARGUMENTS following our standards
# /fix-issue 123 high-priority → "123 high-priority"
```

**Positional** - `$1`, `$2`, etc. for specific args:
```markdown
Review PR #$1 with priority $2 and assign to $3
# /review-pr 456 high alice → $1="456", $2="high", $3="alice"
```

### Bash Execution

Use `!` prefix to execute bash and include output in context:

```markdown
---
allowed-tools: Bash(git:*)
description: Create commit from staged changes
---

## Context
- Status: !`git status --short`
- Diff: !`git diff --cached`
- Branch: !`git branch --show-current`

## Task
Create a commit message for these changes.
```

**Important**: Must include `allowed-tools` with Bash permissions when using `!` commands.

### File References

Use `@` prefix to include file contents:
```markdown
Review @src/utils/helpers.js for security issues
Compare @old.js with @new.js
```

### Namespacing

Subdirectories organize commands (shown in description, not command name):
- `.claude/commands/frontend/component.md` → `/component` (project:frontend)
- `~/.claude/commands/backend/api.md` → `/api` (user:backend)

## Examples

### Simple Command
```markdown
# .claude/commands/review.md
Review this code for bugs, security issues, and style violations.
```

### With Arguments
```markdown
---
argument-hint: [issue-number]
description: Fix GitHub issue
---
# .claude/commands/fix-issue.md
Fix issue #$ARGUMENTS following our coding standards and create a PR.
```

### Git Commit Helper
```markdown
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Stage and commit changes
---
# .claude/commands/commit.md

## Current State
- Status: !`git status`
- Staged diff: !`git diff --cached`
- Branch: !`git branch --show-current`

## Instructions
Create a commit. If $ARGUMENTS provided, use as message. Otherwise generate from diff.
```

### Code Generation
```markdown
---
argument-hint: [component-name]
description: Generate React component
allowed-tools: Write
---
# .claude/commands/component.md

Create a React component named $1 with:
- TypeScript
- Tailwind styling
- Unit tests
- Storybook story

Reference our patterns: @src/components/Button.tsx
```

### Multi-file Analysis
```markdown
---
description: Compare implementations
argument-hint: [file1] [file2]
---
# .claude/commands/compare.md

Compare @$1 with @$2 and identify:
1. Architectural differences
2. Performance implications
3. Suggested improvements
```

## Tips

- Keep descriptions concise (shown in /help)
- Use `argument-hint` for discoverability
- Prefer `$1`, `$2` when args have distinct roles
- Use `$ARGUMENTS` for free-form input
- Test commands with various argument patterns
- Use extended thinking keywords for complex analysis

## See Also

For complex multi-step workflows with scripts, templates, and reference docs, consider using Agent Skills instead. See references/skills-vs-commands.md.

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 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.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.