Agent skill

Crush Shell Builtins

by charmbracelet in charmbracelet/crush

Explains how to add a new in-process builtin command to Crush's embedded POSIX shell, so it is intercepted before reaching the OS, with context polling and exit-status rules.

Custom licenceAuto-check passedDevelopment

Install Crush Shell Builtins

skills CLI
$ npx skills add charmbracelet/crush --skill shell-builtins -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install charmbracelet/crush shell-builtins --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/charmbracelet/crush.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/shell-builtins .claude/skills/shell-builtins && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
shell-builtins
GitHub stars
29k
Token cost
~790 tokens
SKILL.md length
305 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
Custom licence

At a glance

Explains how to add a new in-process builtin command to Crush's embedded POSIX shell, so it is intercepted before reaching the OS, with context polling and exit-status rules.

  • Works in 6 steps: Add the case to the switch in… → Get I/O from the handler context, not… → Implement the handler in its own file… → …
  • Adding a new builtin command to Crush's embedded shell
  • SKILL.md covers How Builtins Work, Adding a New Builtin and Existing Builtins
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Crush's shell, built on mvdan.cc/sh/v3, intercepts commands through a builtinHandler switch in internal/shell/run.go, registered before the block handler so builtins run even for otherwise-blocked commands and are shared identically between the interactive shell and the hook runner's stateless entrypoint. Adding one means adding a case to that switch, reading stdin, stdout and stderr from the handler context rather than the OS streams so pipes and redirection keep working, and implementing the handler in its own file with a context.Context as its first parameter.

A builtin that loops over input or does any work that can exceed a few milliseconds must check ctx.Err() on every iteration and return it verbatim, because hook timeouts depend on that polling; a builtin that never checks cannot be interrupted and the hook runner has to abandon its goroutine instead. Return values distinguish success, a specific exit status, and a timeout error so callers can tell a non-zero exit from the handler running out of time.

When your agent uses it

  • Adding a new builtin command to Crush's embedded shell
  • Debugging why an existing shell builtin doesn't respect a hook timeout
  • Understanding how Crush intercepts shell commands before they reach the OS

Example prompts

  • “Add a new builtin called mytool that reads from stdin and writes a summary to stdout.”
  • “Why doesn't my builtin get interrupted by the hook's timeout_sec?”
  • “Explain how builtinHandler decides which commands it intercepts.”

Requirements

  • A Go development environment for the Crush codebase

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Add the case to the switch in builtinHandler() in run.go.
  2. Get I/O from the handler context, not from os.Stdin/os.Stdout.
  3. Implement the handler in its own file (e.g.,
  4. Poll ctx in every unbounded loop. Builtins that iterate over
  5. Return values: return nil for success, interp.ExitStatus(n) for
  6. No extra wiring needed — builtinHandler() is already registered

What it can do on your machine

Read from SKILL.md and the folder at commit 140e8cb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Crush Shell Builtins loads about 790 tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 305 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~790

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

Its licence (Custom licence) doesn't allow us to republish the file, so here is its outline and opening line. It has 305 words (~790 tokens).

“Crush's shell (internal/shell/) uses mvdan.cc/sh/v3 for POSIX shell emulation. Commands can be intercepted before they reach the OS by adding builtins — functions handled in-process.”

— opening of SKILL.md by charmbracelet, Custom licence
name
shell-builtins

Read the full SKILL.md on GitHub

Files

Just SKILL.md in .agents/skills/shell-builtins of charmbracelet/crush.

Open the folder on GitHubat commit 140e8cb

Compare with similar skills

Crush Shell Builtins next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Crush Shell Builtins compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Crush Shell Builtins this skillcharmbracelet/crush29k—~790Automated safety check: PassCustom licence
Mole Bug Patternstw93/Mole69k—~2kAutomated safety check: PassGPL-3.0
CLI DeveloperJeffallan/claude-skills12k1 repos~1.2kAutomated safety check: PassMIT
Shellm Architecture Referencelaude-institute/headlong1.2k—~2kAutomated safety check: NotesApache-2.0
Cppcrazyguitar/cppcheatsheet290—~1.8kAutomated safety check: PassMIT
Adding Copyright Headersflutter/devtools1.7k—~640Automated safety check: PassBSD-3-Clause

Similar skills

  • A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.

    69k GitHub stars~2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • CLI Developer

    Jeffallan/claude-skills

    Walks through designing, building and polishing a command-line tool: user workflow and command hierarchy, implementation in commander, click, typer or cobra, completions and cross-platform testing.

    12k GitHub starsUsed in 1 repo~1.2k tokens
    DevelopmentAuto-check passed
  • Shellm Architecture Reference

    laude-institute/headlong

    Explains how shellm's bash-based recursive LLM shell fits together - its core engine, identity system, memory, skills and trajectory log.

    1.2k GitHub stars~2k tokensUpdated yesterday
    DevelopmentAuto-check: notes
  • Cpp

    crazyguitar/cppcheatsheet

    Comprehensive C/C++ programming reference covering everything from C11-C23 and C++11-C++23, system programming, CUDA GPU computing, debugging tools, Rust interop, and advanced topics.

    290 GitHub stars~1.8k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • Adding Copyright Headers

    flutter/devtools

    Adds copyright headers to files based on file type. An agent skill from flutter/devtools.

    1.7k GitHub stars~640 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Rem CLI

    BRO3886/rem

    Create, list, update, complete, tag, and search macOS Reminders via the rem CLI.

    154 GitHub stars~3.1k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed

More from charmbracelet/crush

  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated yesterday
    Auto-check passed
  • Crush Hook Writer

    charmbracelet/crush

    Helps write, debug and configure Crush hooks in crush.json that block, approve or rewrite tool calls before they run.

    29k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • JSON Processing with jq

    charmbracelet/crush

    Explains the jq command built into Crush for querying, filtering and reshaping JSON, including its supported flags and where it differs from standard jq.

    29k GitHub stars~746 tokensUpdated yesterday
    Auto-check passed
  • Crush Builtin Skills

    charmbracelet/crush

    Explains how the Crush coding agent embeds builtin skills in its binary and how to add or edit one, including the discovery test and build commands.

    29k GitHub stars~466 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Crush Shell Builtins

What does Crush Shell Builtins do?

Explains how to add a new in-process builtin command to Crush's embedded POSIX shell, so it is intercepted before reaching the OS, with context polling and exit-status rules. go, registered before the block handler so builtins run even for otherwise-blocked commands and are shared identically between the interactive shell and the hook runner's stateless entrypoint.Context as its first parameter.

When should I use Crush Shell Builtins?

Crush Shell Builtins fits situations like: adding a new builtin command to Crush's embedded shell; debugging why an existing shell builtin doesn't respect a hook timeout; understanding how Crush intercepts shell commands before they reach the OS.

How do I install Crush Shell Builtins in Claude Code?

Run `npx skills add charmbracelet/crush --skill shell-builtins -a claude-code`. Or copy the skill folder (.agents/skills/shell-builtins in charmbracelet/crush) into .claude/skills/shell-builtins in your project. Claude Code loads it when a task matches its description.

How do I install Crush Shell Builtins in Codex?

Run `npx skills add charmbracelet/crush --skill shell-builtins -a codex`. Or copy the skill folder (.agents/skills/shell-builtins in charmbracelet/crush) into .agents/skills/shell-builtins in your project. Codex loads it when a task matches its description.

Can I use Crush Shell Builtins in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add charmbracelet/crush --skill shell-builtins -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/shell-builtins, .gemini/skills/shell-builtins, .github/skills/shell-builtins and .opencode/skills/shell-builtins in your project.

What does Crush Shell Builtins need to run?

SKILL.md names no scripts, command-line tools or credentials: Crush Shell Builtins is instructions for the agent only. Our summary lists: A Go development environment for the Crush codebase.

Does Crush Shell Builtins access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Crush Shell Builtins safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Crush Shell Builtins use?

Crush Shell Builtins has a licence file (the repository's licence) that doesn't match a standard licence. Read it on GitHub before reusing the skill.

How many tokens does Crush Shell Builtins use?

About 790 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Crush Shell Builtins?

Skills that share tags, products or a category with Crush Shell Builtins: Mole Bug Patterns (tw93/Mole, 69k stars), CLI Developer (Jeffallan/claude-skills, 12k stars), Shellm Architecture Reference (laude-institute/headlong, 1.2k stars) and Cpp (crazyguitar/cppcheatsheet, 290 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Crush Shell Builtins?

charmbracelet (a GitHub organization) maintains it in charmbracelet/crush, which has 28,514 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 7, 2026.

Source: charmbracelet/crush on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.