slash-command-writing

Create and maintain Claude Code slash commands with required frontmatter and argument handling.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/nsheaps/ai-mktpl --skill slash-command-writing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: slash-command-writing
Source: https://github.com/nsheaps/ai-mktpl/tree/main/plugins/create-command/skills/slash-command-writing
Command: npx skills add https://github.com/nsheaps/ai-mktpl --skill slash-command-writing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill removes uncertainty and manual errors when authoring, updating, or troubleshooting Claude Code slash commands by providing clear rules for file placement, frontmatter, argument handling, bash execution permissions, and file references.

Core Features & Use Cases

  • Command authoring guidance: Explains required frontmatter fields such as description and optional fields like allowed-tools, argument-hint, and model.
  • Argument and execution patterns: Covers use of $ARGUMENTS and positional $1/$2 variables, how to include bash output safely, and allowed-tools permission patterns.
  • File reference and context: Describes how to reference files with @ paths, how directory references behave, and recommendations for testing and scoping (user vs project).
  • Use Case: Create a project-scoped smart commit command that gathers git status and diffs, then formats a semantic commit message using the repository context and argument hints.

Quick Start

Create a new .claude/commands/my-command.md file with a description frontmatter, add allowed-tools if running bash, and write instructions using $ARGUMENTS for capture.

Frequently Asked Questions about slash-command-writing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Claude Code slash command with required frontmatter?

To create a Claude Code slash command, add a markdown file in your .claude/commands/ directory and include the required description frontmatter. You can optionally add fields like allowed-tools and argument-hint to configure execution and input behavior.

How do you parse arguments in Claude Code slash commands?

Claude Code slash commands parse arguments using the $ARGUMENTS variable for raw input or positional parameters like $1 and $2. You define the expected input format by adding the argument-hint field to the command's frontmatter.

How do I run bash scripts inside a Claude Code custom command?

To run bash scripts inside a custom command, include the allowed-tools frontmatter field with the appropriate bash permission patterns. This grants the command the necessary execution rights to safely run your shell scripts.

Does Claude Code support file references in slash commands?

Claude Code supports file references in slash commands using @ path syntax. You can reference specific files or entire directories to provide context, though directory references will include all contained files within the command scope.

Should I scope my custom slash command to a project or a user?

Scoping a custom slash command to a project stores it in the local repository for team sharing, while user-scoped commands are available globally across your projects. Choose project scoping for repository-specific workflows and user scoping for personal utilities.

Why is my Claude Code slash command not working correctly?

If your Claude Code slash command is not working, verify the required frontmatter fields are present and correctly formatted. Troubleshoot by checking argument parsing variables like $ARGUMENTS, ensuring bash allowed-tools permissions match, and confirming file reference paths.