ripgrep
ripgrep
Prefer rg over grep for text search, and prefer rg --files over find | grep when the real task is path discovery.
Verified locally against ripgrep 15.1.0 on April 10, 2026. The skill is repo-agnostic, but the examples assume a Unix-like shell and an rg binary in PATH.
Decision Tree
What kind of search do you need?
-
Search file contents for text, symbols, regexes, or literals
- Start with
rg - Read
references/commands.md
- Start with
-
Find filenames or paths without reading file contents
- Start with
rg --files [path] - Then filter that list with a second
rgif needed - Read
references/patterns.md
- Start with
-
Search only specific languages, globs, hidden files, ignored files, compressed data, or multiline blocks
- Read
references/commands.md - If results seem wrong or missing, read
references/gotchas.md
- Read
-
Make ripgrep behavior repeatable with config files, aliases, or custom file types
- Read
references/configuration.md
- Read
-
Feed results into automation, scripts, editors, or other tools
- Prefer
--json,-0,-l,--count-matches, or--sort pathas appropriate - Read
references/patterns.md
- Prefer
-
The user wants full-file reading, structured JSON queries, or filesystem metadata
- Do not force
rginto a role it is bad at - Read the file directly, or use
jq,find, orfd
- Do not force
Default Operating Rules
- Use
rgfirst for text search. Only fall back togrepwhenrgis unavailable or exact POSIX grep behavior is the real requirement. - Use
-Ffor user-provided literals unless the user clearly asked for regex semantics. - Narrow the search early with an explicit path plus
-tor-ginstead of searching the entire tree and cleaning up later. - Use
rg --filesfor path discovery, then pipe into anotherrgfor filename filtering instead of composingfind ... | grep .... - Escalate ignore overrides gradually: normal search, then
--hidden, then-uor--no-ignore, then-uuor-uuuonly if the missing-result hypothesis justifies it. - Use
--debugwhen results are missing and you need to know what ripgrep skipped. - Use
--jsonor-n --color never --no-headingfor machine consumption. Prefer--sort pathwhen deterministic output matters more than maximum speed.
Quick Reference
| Need | Command | Notes |
|---|---|---|
| Literal text search | rg -n -F 'needle' path/ |
Best default for user-provided strings with punctuation |
| Regex search | rg -n 'foo\\s+bar' path/ |
Use single quotes so the shell does not interfere |
| Filenames only | rg --files path/ |
Respects ignore files by default |
| Filter filenames | `rg --files | rg '(^ |
| Match specific languages | rg -n -t py 'pattern' src/ |
-t includes, -T excludes |
| Match specific globs | rg -n -g '*.tsx' 'pattern' src/ |
Later globs override earlier ones |
| Search hidden or ignored content | rg --hidden 'pattern' then rg -u 'pattern' |
Escalate only as needed |
| Files with matches | rg -l 'pattern' path/ |
Use before opening files |
| Count individual matches | rg --count-matches 'pattern' path/ |
-c counts matching lines, not matches |
| Machine-readable output | rg --json 'pattern' path/ |
Best for tools and scripts |
| Lookaround or backreferences | rg -P '...' path/ |
Requires PCRE2 support in the build |
| Multiline blocks | rg -U '(?s)start.*end' file |
Multiline is slower and more memory-hungry |
| Diagnose skipped files | rg --debug 'pattern' path/ |
Shows ignore and skip reasons |
Reading Guide
| Task | Read |
|---|---|
| Correct command, flag, or output mode | references/commands.md |
| Config files, aliases, custom types, and environment setup | references/configuration.md |
| Agent search workflows, filename discovery, shell pipelines, and deterministic output | references/patterns.md |
| Missing results, quoting issues, multiline surprises, JSON limits, and other traps | references/gotchas.md |
Verified Behaviors
rg --filesrespects ignore rules by default and excluded an ignoredlogs/app.login local probes..rgignoreoverrode.ignore, and--no-ignorerestored access to the same ignored file.--hiddensurfaced hidden content without turning off ignore handling.- The order of
-gflags changed the result set exactly as upstream documents: later globs overrode earlier ones. RIPGREP_CONFIG_PATHsuccessfully loaded--smart-caseand a customwebtype from a config file.--jsonemittedbegin,match,end, andsummarymessages in JSON Lines format.-U '(?s)...'matched across lines, and-Plookaround worked on this machine because the local build includes PCRE2.
Gotchas
rgis not a byte-for-byte drop-in replacement for POSIXgrep; it is the default search tool when speed, recursion, ignore handling, or Unicode-aware regex matter.- Missing results are usually an ignore, hidden-file, glob-order, or quoting problem before they are a ripgrep bug. Run
--debugbefore switching tools. --replacechanges printed output only. It never edits files.--jsonis for search results, not every output mode. It does not combine with--files,-l, or-c.-Pand-Uare powerful but costlier than the default engine and normal line-oriented search. Use them deliberately.
Helper Scripts
scripts/probe_ripgrep.pybuilds a temporary corpus and verifies realrgbehavior such as ignore precedence, JSON output, multiline matching, and PCRE2 support.scripts/validate.pychecks structure, frontmatter, references, required files, and Python syntax.scripts/test_skill.pyruns validation, checks eval coverage, verifies cross-references, and executes the ripgrep probe suite.
More from jpcaparas/skills
markdown-new
Use markdown.new when the user explicitly wants markdown.new, Cloudflare Markdown for Agents, URL-to-Markdown conversion, file-to-Markdown conversion, crawl-to-Markdown, or the hosted markdown.new editor. Trigger on: 'markdown.new', 'convert this URL to markdown', 'crawl this docs site into markdown', 'file to markdown', 'upload this PDF to markdown', 'markdown.new API', or 'markdown editor'. Do NOT trigger for generic web search/scraping when another tool is enough, or for editing local Markdown without using the markdown.new service.
31skill-creator-advanced
Advanced skill creator for mission-critical, installable skills — API wrappers, progressively-disclosed technical documentation, CLI tool integrations, and complex multi-reference skills. Use when creating or improving skills that demand rigorous progressive disclosure, verified examples, tested operations, cross-harness compatibility, smart placement into the right repo-local or global skills directory, and self-improvement feedback loops. Triggers on: 'advanced skill', 'create API skill', 'create wrapper skill', 'production skill', 'installable skill', 'improve this skill for progressive disclosure', 'rigorous skill', 'mission-critical skill', or when skill-creator's output needs to be more thorough. Also use when upgrading an existing skill to production quality.
31azure-devops-wiki-markdown
Use when writing, fixing, or reviewing Azure DevOps wiki Markdown, Mermaid diagrams, `_TOC_` and `_TOSP_`, collapsible `<details>` blocks, query-table embeds, `@` mentions, work-item links, KaTeX math, HTML video embeds, code fences, or Azure DevOps surface-specific support differences across Wiki, PR, README, Widget, and Done fields. Triggers on Azure DevOps wiki, markdown guidance, Mermaid sequence/graph/timeline/ER diagrams, proposal decision trees, table-of-subpages, query-table, code fence aliases, line-break bugs, and wiki page formatting. Do NOT use for GitHub-only Markdown, generic Mermaid authoring outside Azure DevOps, or non-Azure documentation platforms.
28synthetic-search
Use this skill when the user explicitly wants Synthetic Search, the Synthetic API, `api.synthetic.new`, `SYNTHETIC_API_KEY`, or zero-data-retention web search with raw `curl`/`jq` examples. It covers live-verified search requests, quota checks, and a zero-dependency Node helper for readable output. Triggers on: 'Synthetic Search', 'Synthetic API', 'api.synthetic.new', 'SYNTHETIC_API_KEY', 'Synthetic quotas'. Do NOT trigger for general browser automation, full-site crawling, or unrelated search providers.
28tweet-replicate
Rebuild a public X/Twitter status into a deterministic local replica with a frozen snapshot, local HTML/CSS, Playwright capture, X-like media-frame fill behavior, a high-quality MP4 master, and a companion GIF capped under 24 MB. Use when asked to replicate a tweet/X post, freeze a status into video, make a tweet look like X offline, or create rerenderable tweet assets with a saved build folder. Trigger on: 'replicate this tweet', 'turn this X post into MP4', 'make this tweet into a GIF too', 'freeze this status locally'. Do NOT use for plain tweet text extraction, raw media download only, live X browser capture, authenticated pages, DMs, or promises of a pixel-perfect private X renderer.
28nanobanana-infographic
Create sleek, low-noise infographics with Nano Banana 2 for blog posts, executive decks, reports, and editorial explainers. Use when the user wants infographic prompt variants, Nano Banana 2 image-generation guidance, or render workflows that avoid clutter, poster energy, and filler. Triggers on: 'infographic', 'Nano Banana 2', 'Gemini image', 'executive visual', 'blog diagram', 'presentation visual'. Do NOT trigger for photorealistic art, mascot illustrations, logo design, meme cards, or raw dashboard screenshots.
28