Install
openclaw skills install openclaw-traecliTRAE CLI installation, configuration and usage guide. TRAE CLI is an AI-powered CLI programming assistant supporting natural language driven development.
openclaw skills install openclaw-traecliTRAE CLI is your dedicated Code Agent. You can send natural language instructions to TRAE CLI to complete a series of complex development tasks from code writing, testing to Git operations, allowing you to focus on higher-value creative work.
Execute the following script in your local terminal to install TRAE CLI:
sh -c "$(curl -L https://lf-cdn.trae.com.cn/obj/trae-com-cn/trae-cli/install.sh)" && export PATH=~/.local/bin:$PATH
Execute the following script in PowerShell to install TRAE CLI:
irm https://lf-cdn.trae.com.cn/obj/trae-com-cn/trae-cli/install.ps1 | iex
Note: If the built-in Ripgrep in TRAE CLI is unavailable, you also need to install Visual C++ Redistributable (VC runtime library).
cd command to enter your target projecttraecli
TRAE CLI supports both automatic and manual upgrades:
traecli update command to manually upgradeWhen working with a new project, use TRAE CLI to quickly establish an overall understanding of the codebase.
Examples:
TRAE CLI can help you develop new features, fix bugs, write documentation, etc.
Examples:
TRAE CLI can help you run unit tests, locate problems, and provide fix suggestions.
Examples:
Let TRAE CLI handle Git commands for you.
Examples:
TRAE CLI supports running in non-interactive mode. You can conveniently integrate TRAE CLI into CI/CD pipelines or other automation scripts to achieve development process automation.
Examples:
Update README automatically in CI script based on recent Git commits:
traecli --allowed-tool Bash,Edit,MultiEdit,Write -p "update README with latest changes"
Automatically run a pre-written Prompt template in CI script:
traecli -p /command arg1 arg2
You can use the following command line arguments to pass additional information:
| Argument | Description |
|---|---|
--allowed-tool | Specify automatically allowed tools, such as "Bash", "Edit", "Replace", etc. Multiple tools are separated by commas. Can be specified multiple times. |
--bash-tool-timeout | Set the maximum running time for commands executed through the Bash tool. After timeout, execution will be automatically terminated, e.g., 30s, 5m, 1h. |
-c / --config | Override settings in "k=v" format. |
--disallowed-tools | Specify automatically disabled tools. Multiple tools are separated by commas. Can be specified multiple times. |
-h / --help | Get usage help for TRAE CLI. |
--json | Output complete information in JSON format, including System Prompt, tool calls, execution process, and final results. Only used with --print. |
-p / --print | Print response content and exit immediately, suitable for pipe scenarios. |
--query-timeout | Set the maximum execution duration for a single query. Timeout will terminate the query, e.g., 30s, 5m, 1h. |
-v / --version | View the current version of TRAE CLI. |
In a session, use slash commands to execute quick operations, manage session state, and customize common workflows.
| Command | Purpose |
|---|---|
/agent-new | Create a new custom agent. |
/clear or /reset | Clear conversation history and release context. |
/feedback | Submit feedback or report issues. |
/init | Initialize a new AGENTS.md file for the current directory. |
/login | Log in to TRAE CLI. |
/logout | Log out of TRAE CLI. |
/mcp | Manage MCP Server and tools. |
/model | Switch the AI model being used. |
/plugin or /plugins | Manage plugins. |
/status | Display TRAE CLI status information. |
/terminal-setup | Install the Shift+Enter shortcut for line breaks. |
You can define commonly used prompts as Markdown files, and TRAE CLI will execute them as custom slash commands.
/<command-name> [arguments]
Parameter Description:
<command-name>: Name derived from the Markdown file name (without the .md extension)[arguments]: Optional arguments passed to the commandmkdir -p .traecli/commands to create the .traecli/commands directory in the project rootcd .traecli/commands to enter the .traecli/commands directory.traecli/commands directoryFrontmatter Field Description:
| Frontmatter | Description | Example |
|---|---|---|
description | Brief description of this custom slash command. | Review code changes with context |
argument-hint | Arguments required by the slash command (/). This hint will be displayed to the user when performing slash command auto-completion. | argument-hint: add [tagId] | remove [tagId] | list |
tools | Specify available tools. Multiple tools are separated by commas. | Read,Write,mcp__{$mcp_server_name}__{$tool_name} |
model | Specify the model to use. | kimi-k2 |
Example:
---
description: Review code changes with context
argument-hint: <file-pattern>
model: kimi-k2
tools: Read
---
## Code Review Request
Files to review: $1
Current git diff: !`git diff HEAD -- $1`
File structure: !`find . -name "$1" -type f | head -10`
## Your task
Please perform a thorough code review of specified files focusing on:
1. **Code Quality**: Check for best practices, readability, and maintainability
2. **Security**: Look for potential security vulnerabilities
3. **Performance**: Identify potential performance issues
4. **Testing**: Suggest areas that need test coverage
5. **Documentation**: Check if code is properly documented
Provide specific suggestions for improvement with line numbers where applicable.
TRAE CLI provides a series of special syntaxes for dynamically referencing parameters, setting default values, and inserting system command execution results in command definitions, greatly enhancing the flexibility and reusability of custom commands.
$ARGUMENTS
The $ARGUMENTS placeholder captures all arguments passed to the command, separated by spaces between multiple arguments.
Example:
# Command definition
echo 'Deploying service: $ARGUMENTS to staging environment' > .traecli/commands/deploy-service.md
# Usage
> /deploy-service auth-api v2.3.1
# $ARGUMENTS becomes: "auth-api v2.3.1"
$N
You can access specific parameters individually by positional parameters $N, just like in shell scripts.
Example:
# Command definition
echo 'Deploy service $1 to environment $2 with version $3' > .traecli/commands/deploy-service.md
# Usage
> /deploy-service auth staging v1.4.2
# $1 becomes "auth", $2 becomes "staging", $3 becomes "v1.4.2"
!command
!command is used to execute the specified command and insert its standard output result directly into the current position as text content.
For example, in the following command definition, !cat VERSION will be executed when TRAE CLI processes the file. TRAE CLI will run `cat VERSION`, then get its standard output (e.g., 1.4.0), and finally replace the `!`cat VERSION segment with the output content.
# Command definition
echo "Project version: !`cat VERSION`" > traecli/commands/show-version.md
# After replacement
Project version: 1.4.0
${N:-DefaultValue}
${N:-DefaultValue} is used to provide default values for variables.
Example:
# Command definition
echo 'Deploying to environment: ${1:-staging}' > .traecli/commands/deploy.md
# Usage
# Case 1: User provided parameter and defined $1="production"
> /deploy production
# ${1:-staging} becomes "production"
# Case 2: User did not provide parameter, $1 is undefined
> /deploy
# ${1:-staging} becomes "staging"
Problem: Installation script fails to execute
Solution:
lf-cdn.trae.com.cncurl is installed on your systemProblem: TRAE CLI command not found after installation
Solution:
~/.local/bin to your PATHexport PATH=~/.local/bin:$PATHProblem: Ripgrep not working
Solution:
Problem: Login issues
Solution:
/login command to re-authenticateProblem: Command timeout
Solution:
--bash-tool-timeout to increase timeout for long-running commands--query-timeout to increase query timeouttraecli --bash-tool-timeout 10m --query-timeout 5mProblem: High usage consumption
Solution:
/model command