Knowledge card L3 · Workflows informational

Mention Only What Matters With @-Context

What it is

A precision habit: use Cursor's @-mentions (@file, @folder, @codebase, @docs) to hand the model exactly the context a task needs — no more, no less.

Everything20 tabs open· Signal buried· Wrong file edited· Slow, noisyOnly what matters@-mention the few→ High signal→ Right target→ Trustworthy edit
Scoped context beats a wall of open files.

Why it works

More context is not better context. Padding a prompt with irrelevant files dilutes the signal and can push the real target out of the model's attention. Naming the two or three files that actually matter gives the model a clean problem and produces sharper edits.

When to use it

Every non-trivial edit. Whenever a change touches known files (the model, its test, the caller), mention them explicitly rather than hoping retrieval finds them.

When not to use it

Genuine 'where is this?' exploration — there, @codebase search is the right tool precisely because you don't yet know the files.

Prompt

Be explicit about scope:
"Update @src/auth/session.ts to expire sessions after 30 days. Match the style in @src/auth/token.ts and update @src/auth/session.test.ts. Don't touch anything else."
For discovery, switch modes:
"@codebase where are sessions created?"

Example

A change that kept breaking unrelated files got clean once the prompt named only session.ts and its test with '@' and added 'don't touch anything else' — the model stopped helpfully editing callers you didn't want changed.

Advanced version

Layer context deliberately: @docs for an external library's API, @file for the exact code to change, and a rule for conventions. Each source answers a different question, so the model isn't guessing at any of them. Keep the total tight.

Common mistakes

  • Dumping whole folders as context 'to be safe', burying the relevant file.
  • Relying on retrieval to guess the target when you already know the file — just @-mention it.
  • Omitting the test file, so the model changes behaviour without updating its checks.

Related