跳到正文
Skillpedia
通用编程29k · #9765

crush-config

它能做什么

这项技能帮助你通过配置文件设置 Crush 这一编程工具。它涵盖提供方、模型、MCP 服务器、钩子和权限。适合希望改变 Crush 行为方式的用户。

适用场景

  • ✓当你想在 Crush 中设置提供方或模型的时候。
  • ✓当你想为 Crush 添加 MCP 服务器、语言服务器或技能的时候。
  • ✓当你想通过配置文件更改 Crush 的权限或行为的时候。

技能链接

https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/crush-config/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/crush-config/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请用我项目中的 crushrc 文件,为 Crush 设置我的 API 提供方,并添加一个 MCP 服务器。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会编写一个基于 Bash 的 crushrc 脚本,或一个 crush.json 文件。Crush 会合并你主文件夹和项目中的配置文件。该脚本通过调用 provider、model 和 mcp 等内置命令来生成设置。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Crush Configuration

Crush supports two config formats:

  • crushrc — a Bash script that builds config by calling Crush builtins. Preferred. Because it is real Bash you get includes, secrets, conditionals, and variables for free.
  • crush.json — static JSON. Fully supported; see Legacy JSON format.

Both are discovered together and deep-merged. Priority (highest to lowest):

  1. .crushrc / crushrc / .crush.json / crush.json (project-local, closer-to-cwd wins; Windows uses .\.crushrc / .\crushrc)
  2. $XDG_CONFIG_HOME/crush/crushrc or ~/.config/crush/crushrc (%XDG_CONFIG_HOME%\crush\crushrc or %USERPROFILE%\.config\crush\crushrc on Windows)

Data directories (~/.local/share/crush and %LOCALAPPDATA%\crush) contain machine-owned JSON state only; Crush does not discover or execute a crushrc from those locations.

If a directory has both crushrc and crush.json, they merge (crushrc wins on conflicts) and Crush logs a warning.

crushrc at a glance

A crushrc is a plain Bash script executed at load time with the same embedded shell the bash tool uses. It builds config by calling builtins (provider, model, mcp, lsp, hook, permissions, option). Statements run top to bottom; later statements win, and remove/reset operate on anything defined earlier or pulled in via source.

#!/usr/bin/env bash
# Includes and secrets are just Bash.
source ~/.config/crush/shared.sh

provider add anthropic --api-key "$ANTHROPIC_API_KEY"

model large anthropic/claude-sonnet-4-20250514 --max-tokens 16384
model small anthropic/claude-haiku-4-20250514

option skill-path ./skills
permissions allow view ls grep edit

Values are ordinary Bash — quote and expand normally ("$VAR", $(cmd), ${VAR:?required}). A failing $(command) aborts the load.

CRUSH_VERSION is exported into the script so you can feature-detect the running Crush (it is the literal devel for local builds):

[[ "$CRUSH_VERSION" != devel ]] && lsp add gopls --command gopls

Commands

All entity commands are verb-first. remove accepts rm as an alias. Booleans accept true/false/1/0/yes/no, case-insensitive.

providers

provider add <id> [flags]    # define/update; repeated calls merge
provider remove <id>         # alias: rm — removes the provider and its models

Flags: --name, --type (completions, responses, messages, or a local type like ollama, lmstudio, llamacpp; legacy values openai, openai-compat, anthropic are migrated automatically), --api-key, --base-url, --disable BOOL, --flat-rate BOOL, --discover-models BOOL, --system-prompt-prefix TEXT, --extra-header KEY VALUE (repeatable), --extra-body JSON, --provider-options JSON.

provider add deepseek \
  --type completions \
  --base-url "https://api.deepseek.com/v1" \
  --api-key "${DEEPSEEK_API_KEY:?set DEEPSEEK_API_KEY}"

models

model add <provider>/<id> [flags]      # register a custom model (provider must exist)
model remove <provider>/<id>           # alias: rm
model large [<provider>/<id>] [flags]  # set the large slot; no arg prints it
model small [<provider>/<id>] [flags]  # set the small slot; no arg prints it
  • <provider>/<id> is the same form crush models prints. A missing slash is an error. model add requires the provider to already exist.
  • model add flags: --name, --context-window N, --default-max-tokens N, --thinking always|never|toggleable, --supports-images BOOL, --price-input F, --price-output F, --price-cache-create F, --price-cache-hit F, --reasoning-effort low|medium|high, --max-attachments N.
  • model large/model small flags: --think, --reasoning-effort, --max-tokens N, --temperature F, --top-p F, --top-k N, --frequency-penalty F, --presence-penalty F, --provider-options JSON.
  • model large with no argument prints the current selection as provider/id, usable in $(model large).

large is the primary coding model; small is used for summarization.

mcp

mcp add <name> --type stdio|sse|http [flags]   # default type is stdio
mcp remove <name>                              # alias: rm

Flags: --command CMD, --args ARG (repeatable), --env KEY VALUE (repeatable), --url URL, --header KEY VALUE (repeatable), --timeout N, --disabled BOOL, --disabled-tools TOOL (repeatable), `--enabled-t

常见问题

什么是 crushrc?

它是一个 Bash 脚本,通过调用内置命令来生成 Crush 的配置,是首选格式。

我仍然可以使用 JSON 吗?

可以,crush.json 完全受支持,两种格式可以同时使用。

它涵盖哪些设置?

它涵盖提供方、模型、语言服务器、MCP 服务器、钩子、技能和权限。

详情

作者的原始描述

Use when the user needs help configuring Crush — writing crushrc (the Bash config format) or crush.json, setting up providers, models, LSPs, MCP servers, hooks, skills, permissions, or changing Crush behavior.

repo: charmbracelet/crush

热度

GitHub 星标
29k
排名
#9765
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能