LatentCodeCustomize

Custom commands

Turn a prompt you type often into a slash command, with arguments, file contents and live shell output filled in.

Create a command

Add a Markdown file to .latentcode/commands/ in your project, or to ~/.config/latentcode/commands/ for every project. The file name is the command name.

.latentcode/commands/test-fix.md
---
description: Run the tests for a package and fix what fails
agent: build
---
Run the test suite for the $1 package.

Recent changes on this branch:
!`git log --oneline main..HEAD`

Fix every failing test. Don't change a test's assertions unless the test is wrong,
and explain why if you do. Focus on: $2

Type /test-fix and it appears in the command list with its description. Run it with arguments:

/test-fix billing the proration edge cases

Commands in subfolders get the path as their name: commands/db/reset.md is /db/reset. From the shell, run one with latentcode run --command test-fix billing.

What you can put in a template

WriteBecomes
$ARGUMENTSEverything typed after the command name, as typed.
$1, $2, …Individual arguments, split on spaces. Quote an argument to keep spaces in it: /cmd "two words" next. The highest-numbered placeholder takes all the remaining arguments.
!`command`The output of the shell command, run in your project directory when you use the slash command.
@path/to/fileThe file, attached to the message, as if you'd typed it in the prompt.

If the template has no placeholders and you type arguments anyway, they're added at the end.

Shell commands in a template run as soon as you use the command, without a permission prompt. Only use commands you trust, and review command files you get from others.

Options

descriptionstringoptional
Shown next to the command in the list.
agentstringoptional
Agent that runs the command. If it's a subagent, the command runs as a subtask in its own child session.
modelstringoptional
Model for this command, as provider/model.
subtaskbooleanoptional
true always runs the command in a child session, keeping your main conversation's context clean. false never does.

Define commands in config

You can also define commands under command in latentcode.json. The template is required; use {file:…} to keep long templates in their own file.

JSONC
{
  "command": {
    "changelog": {
      "description": "Draft a changelog entry for the current branch",
      "template": "Write a changelog entry for these changes:\n!`git diff main...HEAD --stat`",
      "model": "latentrouter/bedrock-anthropic/anthropic/claude-haiku-4-5"
    }
  }
}

Name clashes

A command you define with the same name as a built-in one replaces it. See Slash commands for the names already taken.

Other things in the command list

  • Prompts offered by MCP servers, shown as /server:prompt with :mcp after them.
  • Skills can be run by name too; /skills lists them.