Hatch3r cli ripgrep

From hatch3r/hatch3r · View interactive version

Hatch3r cli ripgrep is an AI agent skill from the GitHub repository hatch3r/hatch3r. Fast recursive grep with sane defaults and gitignore awareness. Use when regex content searches across large source trees with gitignore filtering; invoke `rg`. Outputs newline-separated hit records; bound results with `-c` or `--max-count`.

How to use this skill

Skill file

<!-- HATCH3R-CLI-SKILL-GENERATED v1 -->

ripgrep

Fast recursive grep with sane defaults and gitignore awareness

§0 — Ambiguity & Safety Gate (P8 B1)

Before invoking rg, resolve these via agents/shared/user-question-protocol.md (default behavior, not exception-driven):

Fan-out Discipline (P8 B2)

Tier 1 reference card — no fan-out. This skill is a single-tool usage reference an agent consults inline; it spawns no sub-agents. Fan-out is owned by the calling workflow per its own Fan-out Discipline block. Source: rules/hatch3r-fan-out-discipline.md (P8 B2).

When to Use

Reach for rg when the task is in the search category and the agent would otherwise call an MCP tool or read large outputs into context.

Token Cost

CLI tools return structured stdout that fits in <1KB for typical queries; equivalent MCP calls regularly exceed 10KB.

Reference: Anthropic engineering (Nov 4 2025) — code-execution-over-MCP yields 98.7% token reduction.

Recipes

rg --json -tts 'createServer\(' src/

Structured JSON output scoped to TypeScript — parse hits with jq instead of re-reading files.

rg -c 'TODO' --type ts

Per-file match counts for .ts files; cheap stand-in for issue-debt triage.

rg -B 2 -A 4 'BREAKING' --max-count 50 CHANGELOG.md

Context windows around BREAKING entries, capped at 50 hits to bound output size.

rg --hidden --no-ignore 'API_KEY' .

Pierces both dotfiles and .gitignore rules — use when scanning for accidentally-committed secrets.

rg --files-with-matches 'deprecated' src/ | xargs -I{} rg -n 'deprecated' {}

Two-phase: file list first, then ranged scan — keeps stdout small when match density is uneven.

Wrong Choice When

Alternatives

| Tool | When to prefer |

|------|----------------|

| ast-grep (toolbox section) | Structural code patterns: matchers like console.log($MSG) that survive whitespace and identifier renames. |

| git grep | Search at a specific revision, tag, or stash — rg only reads the working tree. |

| fd (hatch3r-cli-fd) piped into rg | Filename pre-filter when scoping by extension/age is faster than rg --type. |

| grep -RIn | POSIX-only environment where ripgrep is not on PATH and install is blocked. |

Detection / Install

Verify with:

command -v rg

Install (macOS):

# brew
brew install ripgrep

Install (Linux):

# apt
sudo apt install ripgrep

Install (Windows):

# scoop
scoop install ripgrep

Homepage: https://github.com/BurntSushi/ripgrep

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.