Skip to content

Slash Commands

CodeBuddy Code supports slash commands, allowing you to perform special operations, manage sessions, and customize common workflows directly in the chat. Built-in Slash Commands


These commands are used to manage your CodeBuddy Code session. Below is the current list of supported commands:

CommandCodeBuddy SupportDescription
/help✅ SupportedDisplays help information and provides guidance for feedback channels.
/clear✅ SupportedClears the current session's context history and starts a new conversation.
/login✅ SupportedLog in to your cloud development environment.
/logout✅ SupportedLog out of the current cloud development environment.
/doctor✅ SupportedChecks the status and environment of CodeBuddy Code.
/status✅ SupportedDisplays the current repository and session status.
/add-dir✅ SupportedPrompts to add directory content.
/agents✅ SupportedManages experimental AI agents.
/compact✅ SupportedCompresses the context.
/config✅ SupportedView or modify local configurations.
/cost✅ SupportedDisplays session cost and token usage.
/init✅ SupportedInitializes a new CodeBuddy repository.
/mcp✅ SupportedManages MCP connections.
/memory✅ SupportedManages long-term memory.
/model✅ SupportedSwitches or views the currently used AI model.
/permissions✅ SupportedManages tool permissions and workspace directory access.
/upgrade✅ SupportedOpens the upgrade page in the browser, displaying premium features and subscription options.

Custom Slash Commands

This is one of CodeBuddy Code's most powerful features. You can package common prompts, scripts, and workflows into reusable custom commands to greatly improve efficiency.

Creating Custom Commands

Custom commands are defined by creating .md (Markdown) files in specific directories.

  1. Project-level commands: Create the .codebuddy/commands/ folder in the root directory of your project. These commands will be available to all collaborators in the project.

  2. Global personal commands: Create the ~/.codebuddy/commands/ folder in your user home directory. These commands will be available across all your projects.

To create a command, simply add a .md file in either of the above directories. For example, the test.md file will automatically be registered as the /test command.

Frontmatter and Metadata

You can define metadata for the command using YAML Frontmatter at the top of the Markdown file.

markdown
---
description: "Run unit tests for my project and report the results."
argument-hint: "[test-file]"
---

Please run the command `npm run test -- [test-file]` and summarize the test results. If no test file is provided, run all tests.

Supported metadata fields:

  • description: A brief description of the command that will appear in the autocomplete prompt.

  • argument-hint: Describes the command's required parameters, providing input hints for the user.

Using Parameters

Your custom command can accept parameters, just like a shell script.

  • $1, $2, $3, ...: Access individual parameters by position.

Example: greet.md

markdown
---
description: "Send a customizable greeting."
argument-hint: "[name]"
---

Greet **$1** with "Hello!" If $1 is empty, greet "World".
  • When calling /greet "CodeBuddy", the value of $1 will be "CodeBuddy".

Executing Shell Commands

To execute shell commands, prefix the line with ! and enclose the command in backticks. The output (stdout) of that line will be captured and injected into the context for subsequent AI analysis.

Example: status.md

markdown
---
description: "Display the current git repository status and analyze it."
---

!`git status`

Based on the `git status` output above, please summarize the current status of the branch.