Skip to main content
commandsSource-backedReview first Safety Privacy

Slash Command Generator for Claude Code

Claude Code slash command that generates a new .claude/commands/*.md file from a template, with optional arguments, frontmatter, and team-sharing support.

by JSONbored·added 2025-10-25·
HarnessClaude Code
Invocation:/slash-command-gen [command-name] [options]
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/slash-commands, https://github.com/JSONbored/awesome-claude/blob/main/content/commands/slash-command-gen.mdx
Safety notes
Creates .md files in .claude/commands/ in the current project directory; review generated content before committing.
Privacy notes
Creates .md files in your local .claude/commands/ directory; no content is sent externally.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-25

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

CLI install

Copy-ready — paste the snippet to get started.

Install command

Provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

100/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

1 safety and 1 privacy notes across 1 risk area.

1 area
  • SafetyLocal filesCreates .md files in .claude/commands/ in the current project directory; review generated content before committing.
  • PrivacyLocal filesCreates .md files in your local .claude/commands/ directory; no content is sent externally.

Safety notes

  • Creates .md files in .claude/commands/ in the current project directory; review generated content before committing.

Privacy notes

  • Creates .md files in your local .claude/commands/ directory; no content is sent externally.

Schema details

Install type
cli
Reading time
8 min
Difficulty score
100
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/slash-commands
Runtime and command metadata
Command syntax
/slash-command-gen [command-name] [options]
Full copyable content
/slash-command-gen [command-name] [options]

About this resource

The /slash-command-gen command creates custom slash commands stored as Markdown templates in .claude/commands/ for reusable, team-shared workflows.

Features

  • Template Library: Pre-built command templates for common workflows
  • Argument Support: Use $ARGUMENTS, $1, $2, $3 for dynamic parameters
  • Frontmatter Metadata: Add descriptions, tags, and configuration
  • Project Scope: Commands in .claude/commands/ (git-tracked)
  • User Scope: Commands in ~/.claude/commands/ (personal)
  • Auto-Discovery: Available via tab-completion after /
  • Team Sharing: Commit to git for team-wide workflows
  • Reduced Boilerplate: Turn repetitive prompts into single commands

Usage

/slash-command-gen [command-name] [options]

Command Types

  • --github-workflow - GitHub issue/PR workflows
  • --code-review - Code review templates
  • --documentation - Documentation generation
  • --testing - Test generation workflows
  • --refactoring - Refactoring templates
  • --debugging - Debug workflows
  • --custom - Create from scratch

Scope

  • --project - Save to .claude/commands/ (team-shared)
  • --user - Save to ~/.claude/commands/ (personal)

Options

  • --with-args - Include argument placeholders
  • --template=<name> - Use specific template
  • --description=<text> - Add command description

Examples

Basic Custom Command

Command:

/slash-command-gen fix-issue --github-workflow --project

Generated File: .claude/commands/fix-issue.md

---
description: Fix GitHub issue with TDD workflow
tags: [github, tdd, workflow]
---

Fix GitHub issue #$1 using test-driven development:

1. Fetch issue details from GitHub
2. Understand the problem and requirements
3. Write failing tests that reproduce the issue
4. Implement minimal fix to make tests pass
5. Refactor for code quality
6. Run full test suite
7. Create PR with reference to issue #$1
8. Request review

Follow TDD best practices:

- Write tests FIRST
- Commit tests before implementation
- Ensure 80%+ coverage

Usage:

/fix-issue 123

# Expands to full prompt with issue #123
# Claude fetches issue, writes tests, fixes, creates PR

Code Review Command

Command:

/slash-command-gen review-pr --code-review --with-args

Generated: .claude/commands/review-pr.md

---
description: Comprehensive PR review with security focus
tags: [review, security, quality]
---

Perform comprehensive code review of PR #$1:

## Security Review

1. Check for SQL injection vulnerabilities
2. Verify input validation on all endpoints
3. Check authentication/authorization
4. Review for XSS vulnerabilities
5. Check for sensitive data exposure

## Code Quality

1. Verify TypeScript types (no `any`)
2. Check for code duplication
3. Review error handling
4. Verify test coverage (80%+ required)
5. Check adherence to CLAUDE.md standards

## Performance

1. Identify N+1 query issues
2. Check for unnecessary re-renders
3. Review database query efficiency
4. Check for memory leaks

## Documentation

1. Verify JSDoc comments on public APIs
2. Check README updates if needed
3. Ensure CHANGELOG updated

Provide:

- ✅ Approved items
- ⚠️ Suggestions for improvement
- ❌ Required changes before merge

Usage:

/review-pr 456

# Claude performs comprehensive review of PR #456

Multi-Argument Command

Command:

/slash-command-gen create-feature --custom --with-args

Generated: .claude/commands/create-feature.md

---
description: Create new feature with full stack implementation
tags: [feature, fullstack, tdd]
---

Create feature "$1" in module "$2" with priority $3:

## Planning Phase

1. Review existing $2 module architecture
2. Design feature integration approach
3. Identify affected files and dependencies

## Implementation (TDD)

1. Write comprehensive test suite for $1
2. Implement backend:
   - Database schema changes
   - API endpoints
   - Business logic
3. Implement frontend:
   - UI components
   - API integration
   - State management

## Testing

1. Unit tests (80%+ coverage)
2. Integration tests (API + DB)
3. E2E tests (critical paths)

## Documentation

1. Update API documentation
2. Add usage examples
3. Update CHANGELOG with feature: $1

## Deployment

1. Create feature flag for gradual rollout
2. Generate migration scripts
3. Create deployment checklist

Priority: $3
Deadline: Based on priority

Usage:

/create-feature "user notifications" "messaging" "high"

# $1 = user notifications
# $2 = messaging
# $3 = high

Simple Workflow Command

Command:

/slash-command-gen optimize-bundle --custom

Generated: .claude/commands/optimize-bundle.md

---
description: Analyze and optimize bundle size
tags: [performance, optimization]
---

Optimize application bundle size:

1. Run bundle analyzer:
   ```bash
   pnpm run build:analyze
   ```
  1. Identify large dependencies:

    • Check for duplicate packages
    • Find unused dependencies
    • Identify heavy libraries
  2. Optimization strategies:

    • Implement code splitting
    • Use dynamic imports
    • Replace heavy libraries with lighter alternatives
    • Remove unused code
  3. Apply optimizations:

    • Update webpack/vite config
    • Implement lazy loading
    • Add tree-shaking hints
  4. Measure impact:

    • Compare bundle sizes before/after
    • Run Lighthouse performance audit
    • Check Core Web Vitals

Target: Reduce bundle size by 30%


**Usage:**
```bash
/optimize-bundle

# Claude analyzes bundle, suggests optimizations, implements changes

Documentation Command

Command:

/slash-command-gen doc-api --documentation --with-args

Generated: .claude/commands/doc-api.md

---
description: Generate comprehensive API documentation
tags: [documentation, api]
---

Generate comprehensive documentation for API endpoint $1:

## Endpoint Analysis

1. Read implementation: $1
2. Extract:
   - HTTP method and path
   - Request parameters
   - Request body schema
   - Response schema
   - Error responses
   - Authentication requirements

## Documentation Generation

Create markdown documentation with:

### Endpoint: $1

**Method:** [GET/POST/PUT/DELETE]
**Path:** [Full path]
**Authentication:** [Required/Optional]

#### Request

\`\`\`typescript
interface RequestBody {
// Schema
}
\`\`\`

#### Response

\`\`\`typescript
interface ResponseBody {
// Schema
}
\`\`\`

#### Example

\`\`\`bash
curl -X POST https://api.example.com$1 \
 -H "Authorization: Bearer TOKEN" \
 -d '{"example": "data"}'
\`\`\`

#### Error Codes

- 400: Bad Request - [Details]
- 401: Unauthorized - [Details]
- 500: Server Error - [Details]

Save to: docs/api/$1.md

Usage:

/doc-api /api/users/create

# Generates full API documentation for endpoint

$ARGUMENTS vs Positional

Using $ARGUMENTS (all arguments as string):

# .claude/commands/commit.md

---

## description: Create conventional commit

Create a conventional commit with message: "$ARGUMENTS"

Format: type(scope): message
Run: git add . && git commit -m "$ARGUMENTS"

Usage:

/commit feat(auth): add OAuth2 support
# $ARGUMENTS = "feat(auth): add OAuth2 support"

Using Positional ($1, $2, $3):

# .claude/commands/commit-structured.md

Create conventional commit:

- Type: $1
- Scope: $2
- Message: $3

Run: git commit -m "$1($2): $3"

Usage:

/commit-structured feat auth "add OAuth2 support"
# $1 = feat
# $2 = auth
# $3 = add OAuth2 support

Advanced Patterns

Conditional Logic

---
description: Deploy to environment
---

Deploy to $1 environment:

If $1 is "production":

1. Run full test suite
2. Require approval
3. Create backup
4. Deploy with zero-downtime strategy
5. Monitor for 30 minutes

If $1 is "staging":

1. Run release regression tests
2. Deploy immediately
3. Notify team in Slack

If $1 is "dev":

1. Skip tests
2. Fast deployment

Chained Commands

---
description: Full feature workflow
---

Complete feature workflow for "$1":

1. Create feature branch:
   Run: git checkout -b feat/$1

2. Implement with TDD:
   Use /tdd-workflow "$1" --unit

3. Create PR:
   Use /create-pr "feat: $1"

4. Deploy to staging:
   After approval, use /deploy staging

Template with Frontmatter

---
description: Security audit workflow
tags: [security, audit, compliance]
author: security-team
priority: high
requires: [sonarqube, npm-audit]
---

Run comprehensive security audit:

1. Static analysis:
   ```bash
   npx sonarqube-scanner
   ```
  1. Dependency audit:

    npm audit --audit-level=moderate
    
  2. Code review:

    • Check for hardcoded secrets
    • Verify input validation
    • Review authentication flows
  3. Generate report:

    • Findings summary
    • Severity ratings
    • Remediation steps

## Team Collaboration

### Project Commands (Shared)
```bash
# Location: .claude/commands/
# Committed to git
# Available to entire team

.claude/
  commands/
    fix-issue.md
    review-pr.md
    deploy.md
    create-feature.md

Benefits:

  • Consistent workflows across team
  • Onboard new developers faster
  • Standardize complex processes
  • Share tribal knowledge

User Commands (Personal)

# Location: ~/.claude/commands/
# Personal workflows
# Not shared with team

~/.claude/
  commands/
    my-daily-standup.md
    my-shortcuts.md

Use Cases:

  • Personal shortcuts
  • Individual preferences
  • Experimental workflows

Command Discovery

List All Commands

/help

[Available Commands]
Project Commands:
  /fix-issue [number] - Fix GitHub issue with TDD
  /review-pr [number] - Comprehensive PR review
  /deploy [env] - Deploy to environment
  /create-feature [name] [module] [priority] - Create feature

User Commands:
  /my-shortcuts - Personal workflow shortcuts

Tab Completion

# Type / and press TAB
/fix-<TAB>
  → /fix-issue

/rev<TAB>
  → /review-pr

Best Practices

Clear Descriptions

---
# ✅ Good
description: Fix GitHub issue with TDD workflow and PR creation

# ❌ Bad  
description: Fix stuff
---

Specific Instructions

# ✅ Good

Implement feature using:

1. Write tests in tests/unit/
2. Use Vitest framework
3. 80%+ coverage required
4. Follow AAA pattern

# ❌ Bad

Write some tests

Use Tags

---
tags: [github, tdd, testing, workflow]
---

# Makes commands searchable and organized

Document Arguments

---
description: Deploy to environment
---

Arguments:
$1 - Environment (dev, staging, production)
$2 - Version tag (optional)

Example: /deploy production v1.2.3

Template Library

Available Templates

GitHub Workflows:

  • fix-issue
  • create-pr
  • review-pr
  • close-stale-issues

Code Quality:

  • code-review
  • refactor-module
  • optimize-performance
  • fix-security-issue

Testing:

  • generate-tests
  • run-e2e-tests
  • update-snapshots
  • coverage-report

Documentation:

  • doc-api
  • update-readme
  • generate-changelog
  • write-tutorial

Deployment:

  • deploy-env
  • rollback
  • health-check
  • release-notes

Command Maintenance

Update Command

/slash-command-gen fix-issue --update

# Opens editor to modify existing command
# Preserves frontmatter
# Updates last-modified date

Delete Command

/slash-command-gen fix-issue --delete

⚠️  Delete command 'fix-issue'? (y/n): y
✓ Deleted .claude/commands/fix-issue.md

Validate Commands

/slash-command-gen --validate-all

[Validation Report]
✓ fix-issue.md - Valid
✓ review-pr.md - Valid
⚠ deploy.md - Missing description
✗ old-command.md - Invalid frontmatter

3 valid, 1 warning, 1 error

Source citations

Add this badge to your README

Show that Slash Command Generator for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/commands/slash-command-gen.svg)](https://heyclau.de/entry/commands/slash-command-gen)

How it compares

Slash Command Generator for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

Next steps differ across entries — use the actions in the table below to copy install commands and source links per resource.

Field

Claude Code slash command that generates a new .claude/commands/*.md file from a template, with optional arguments, frontmatter, and team-sharing support.

Open dossier

Use the built-in /init command to generate a project CLAUDE.md from your codebase, then refine it by hand. Covers /memory, file locations, @path imports, and .claude/rules/.

Open dossier

Use the built-in /hooks menu to inspect Claude Code hooks and configure them in settings.json so shell commands run deterministically at lifecycle events like PreToolUse, PostToolUse, and Stop.

Open dossier

Advanced debugging assistant with root cause analysis, step-by-step troubleshooting, and automated fix suggestions

Open dossier
Next stepsDiffers
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
Submitter
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Brand
Categorycommandscommandscommandscommands
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredJSONbored
Added2025-10-252025-10-252025-10-252025-09-16
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesCreates .md files in .claude/commands/ in the current project directory; review generated content before committing./init writes a CLAUDE.md file to your project (and, in the CLAUDE_CODE_NEW_INIT=1 flow, may also propose skills and hooks). It analyzes your codebase before writing; review the generated file before committing. CLAUDE.md, CLAUDE.local.md, and .claude/rules/ are loaded into Claude's context every session as behavioral guidance, not enforced configuration. For hard enforcement (blocking tools/commands), use a PreToolUse hook or managed settings instead. Custom commands in .claude/commands/*.md are prompt templates committed to the repo and run with your session's permissions; review any command file before invoking it.Hooks execute shell commands automatically with your user permissions whenever their event fires. A misconfigured or malicious hook can run destructive commands (file deletion, network calls, credential access) without further confirmation. PreToolUse hooks can allow or deny tool calls and PostToolUse hooks run after tools succeed; review hook commands before committing them to a shared .claude/settings.json so teammates do not inherit unexpected execution. Prefer `.claude/settings.json` for reviewed, team-shared hooks and `.claude/settings.local.json` for personal, gitignored hooks; use `disableAllHooks` to turn off user/project hooks when running untrusted code.Review generated changes and commands before applying them; slash commands can ask the agent to read, write, edit, or run tools in the current project. Limit scope to the intended files and run in a trusted checkout when the command analyzes code, tests, security findings, or generated output.
Privacy notesCreates .md files in your local .claude/commands/ directory; no content is sent externally.CLAUDE.md and .claude/rules/ are committed to source control and shared with your team, so do not put secrets, credentials, or sensitive data in them. Use CLAUDE.local.md (gitignored) for personal, machine-local notes. /init reads files across your project (and existing AGENTS.md/.cursorrules/.windsurfrules) to generate context; do not let it copy secret values into the generated CLAUDE.md. Auto memory is stored locally under ~/.claude/projects/<project>/memory/ and is machine-local; review it with /memory if you are concerned about what was recorded.Command and HTTP hooks receive event JSON on stdin including `session_id`, `transcript_path`, `cwd`, and tool input (such as file paths and Bash commands); a hook that forwards this data over the network can expose local file contents, paths, or command arguments to third parties. HTTP hooks can include headers with interpolated environment variables (restricted by `allowedEnvVars`); avoid embedding secrets in hook configuration that is committed to a repository.Prompts, source files, logs, errors, dependency metadata, and generated reports may be sent to the configured AI model during command execution. Redact secrets, customer data, private repository details, and proprietary code before sharing command output outside the workspace.
Prerequisites— none listed— none listed— none listed— none listed
Install
/slash-command-gen [command-name] [options]
/debug
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.