03-tool-usage

A guide to choosing tools for finding and editing files in a repository. It distinguishes semantic search, exact text search, file-name search, and direct file reading.

In plain words
What is it for?
Use it when navigating a code repository, locating rules, searching for exact patterns, listing files, or opening a known path.
Why use it?
It reduces wasted searches and helps avoid using a tool that is poorly suited to the question. The examples clarify when to search by meaning, text, path, or known file.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/renvia-code/best-cursor-rules/03-tool-usage
Clone the repo
git clone --depth 1 https://github.com/Renvia-code/best-cursor-rules

Made for: Cursor.

Per session 905 This file is loaded in full into every session.
When invoked 905 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00905 $0.00905
Opus 5 $0.00452 $0.00452
Sonnet 5 $0.00181 $0.00181
Haiku 4.5 $0.00090 $0.00090

Measured yesterday against content hash ab815338f47a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

03-tool-usage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/03-tool-usage.mdc · 167 lines

How it starts

The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tool Usage for This Repository

Tool Selection Strategy

codebase_search (Semantic Search)

When to use:

  • Finding rules by topic or concept
  • Understanding how similar rules are structured
  • Discovering patterns across multiple rules

Examples:

✅ "How do other rules handle React patterns?"
✅ "What's the structure for backend rules?"
✅ "Find rules related to testing"

Don't use for:

❌ Finding specific file names (use glob_file_search)
❌ Exact text matches (use grep)
❌ Known file paths (use read_file)

grep (Exact Text Search)

When to use:

  • Finding specific patterns in rules
  • Locating frontmatter fields
  • Finding all rules with certain globs

Examples:

✅ grep("alwaysApply: true")      # Find always-on rules
✅ grep("globs:.*\\.tsx")         # Find TypeScript rules
✅ grep("## Common Mistakes")     # Find rules with this section

glob_file_search (Find Files)

When to use:

  • Listing all rules in a category
  • Finding rules by name pattern
  • Getting file counts

Examples:

✅ glob_file_search("rules/frameworks/*.mdc")
✅ glob_file_search("**/*react*.mdc")
✅ glob_file_search("rules/**/*.mdc")

read_file (Direct Access)

When to use:

  • Reading a specific rule file
  • Checking rule format/structure
  • Reviewing before editing

Examples:

✅ read_file("rules/frameworks/nextjs-15.mdc")
✅ read_file(".cursor/rules/01-rule-format.mdc")

Parallel Operations

✅ DO: Read multiple rules at once

// When comparing or reviewing multiple rules
read_file('rules/frameworks/nextjs-15.mdc')
read_file('rules/frameworks/react-19.mdc')
read_file('rules/backends/supabase.mdc')
// All execute in parallel

❌ DON'T: Read sequentially when independent

// Slow - waits between each
read_file('rules/frameworks/nextjs-15.mdc')
// wait...
read_file('rules/frameworks/react-19.mdc')
// wait...

Common Tasks

Adding a new rule

1. glob_file_search("rules/{category}/*.mdc")  # See existing
2. read_file(".cursor/rules/01-rule-format.mdc")  # Check format
3. read_file("rules/{category}/similar-rule.mdc")  # Reference
4. write("rules/{category}/new-rule.mdc", content)

Read the full file on GitHub · 167 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 167 lines · 905 tokens per session scan A ab815338f47a

Subscribe to this mod's changes

03-tool-usage is a cursor rule published in the GitHub repository Renvia-code/best-cursor-rules (12 stars, last pushed 9mo ago), licensed CC0-1.0. It adds 905 tokens to every session, about $0.0045 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.