Slash Commands

Custom slash commands let you save frequently-used prompts as markdown files. Define a command once, then run it anytime with dynamic arguments. Commands can be project-level or user-level (shared across all projects).


/<command-name> [arguments]
ParameterDescription
<command-name>Name derived from the markdown filename (without .md extension)
[arguments]Optional arguments passed to the command

​There are two types of Commands:

Project-Level Commands

Commands saved directly in your project. When shown in /help, they appear with “(project)” after their description.

Location: .commandcode/commands/

# Create a project-level command mkdir -p .commandcode/commands echo "Generate unit tests for this code following our testing conventions" > .commandcode/commands/test.md

This makes /test command available only within this project.

User-Level Commands

Commands that are available across all your projects. In the command menu, they appear with “(user)” after their description.

Location: ~/.commandcode/commands/

# Create a user-level command mkdir -p ~/.commandcode/commands echo "I am currently being onboarded on this project, help me understand it." > ~/.commandcode/commands/understand.md

This makes /understand command available in all your projects.


Organize commands in subdirectories. The subdirectories appear in the command description but do not affect the command name.

File LocationCommandDescription Shows
.commandcode/commands/frontend/component.md/component(project: frontend)
~/.commandcode/commands/git/commit.md/commit(user: git)
.commandcode/commands/simple.md/simple(project)

Unlimited Nesting Depth

You can organize commands as deeply as needed:

.commandcode/commands/ ├── frontend/ │ ├── react/ │ │ ├── hooks/ │ │ │ └── use-auth.md/use-auth (project: frontend/react/hooks) │ │ └── components/ │ │ └── button.md/button (project: frontend/react/components) │ └── vue/ │ └── composable.md/composable (project: frontend/vue) ├── backend/ │ └── api/ │ └── endpoint.md/endpoint (project: backend/api) └── simple.md/simple (project)
Warning

The command name comes from the filename only, not the folder path. So frontend/button.md and backend/button.md both create /button, they will conflict. Use unique filenames like frontend-button.md and backend-button.md instead.


Pass dynamic values to commands using argument placeholders.

All Arguments with $ARGUMENTS

The $ARGUMENTS placeholder captures all arguments as a single string:

Command definition (.commandcode/commands/explain.md):

Explain the following concept in simple terms: $ARGUMENTS

Usage:

/explain how async await works in JavaScript

Result: $ARGUMENTS becomes "how async await works in JavaScript"

Positional Arguments with $1, $2, etc.

Access specific arguments using positional parameters. Arguments start at $1 (there is no $0):

Command definition (.commandcode/commands/create-component.md):

Create a $1 component named $2 with the following features: $3

Usage:

/create-component React Button "onClick and disabled props"

Result:

  • $1"React"
  • $2"Button"
  • $3"onClick and disabled props"

Quoted Strings

Arguments containing spaces can be wrapped in quotes:

/create-component React "Login Form" "email validation and submit handler"

Result:

  • $1"React"
  • $2"Login Form"
  • $3"email validation and submit handler"

ScenarioBehavior
Missing argument (e.g., $3 with only 2 args)Replaced with empty string
Extra argumentsCaptured in $ARGUMENTS, ignored by unused $N
No arguments provided$ARGUMENTS = "", all $N = ""
Command without placeholdersTemplate passed through unchanged

Test Generator Command

File: .commandcode/commands/test.md

Write $1 tests for the following code using $2. Requirements: - Cover edge cases and error scenarios - Add descriptive test names - Follow testing best practices

Usage:

/test unit Jest

Documentation Command

File: ~/.commandcode/commands/docs.md

Generate documentation for this $1. Include: - Description and purpose - Parameters/props with types - Usage examples - Return values if applicable

Usage:

/docs function

  1. Type / to open the command menu
  2. Select a command from the dropdown (e.g., /test)
  3. Command is inserted into the input field with a trailing space
  4. Type your arguments (e.g., unit Jest)
  5. Press Enter to execute
  6. Placeholders are replaced with your arguments
  7. Processed prompt is sent to the AI

Info

Custom commands cannot override built-in commands. If you create a command with the same name as a built-in, the built-in takes precedence.


Placeholders

PlaceholderDescriptionExample InputResult
$ARGUMENTSAll arguments as stringunit Jest asyncunit Jest async
$1First argumentunit Jestunit
$2Second argumentunit JestJest
$NNth argument

Command Locations

TypeLocationDescription Label
Project.commandcode/commands/(project)
Project (nested).commandcode/commands/subdir/(project: subdir)
User~/.commandcode/commands/(user)
User (nested)~/.commandcode/commands/subdir/(user: subdir)

Command not appearing in menu

  1. Ensure the file has .md extension
  2. Check file is in correct directory (.commandcode/commands/ or ~/.commandcode/commands/)
  3. Verify file permissions allow reading

Arguments not being replaced

  1. Use $1, $2, etc. for positional args (not $0)
  2. Use $ARGUMENTS for all args as a string
  3. Check for typos in placeholder names (case-sensitive)

  • Create your first custom command and try it out
  • Join our Discord community for feedback, requests, and support.