How to Use @-Mentions in Claude Code

You’re asking Claude Code to update a function, but it’s reading three different files trying to figure out which one you mean. Or you want it to match the pattern in a specific component, but you’re not sure how to point it there without pasting the whole file into your prompt. @-mentions solve both of these problems in one keystroke. They’re one of the smallest features in Claude Code with one of the biggest impacts on accuracy.

This is part of our complete How Claude Code Works — A Beginner’s Deep Dive.


TL;DR

  • @-mentions** let you explicitly reference files, folders, functions, or symbols in your prompt
  • Type @ followed by a file name or path to attach it to your request
  • Claude Code reads the mentioned file as part of your prompt — no guessing required
  • You can @-mention multiple files in one prompt
  • @-mentions are more reliable than describing a file — they point to the actual code

What Are @-Mentions?

An @-mention in Claude Code is a way to explicitly tell Claude Code to look at a specific file, folder, or piece of code when processing your request. You type @ and then the name of what you want to reference — Claude Code finds it in your project and reads it as part of your prompt.

Think of it like tagging someone in an email. Instead of writing “ask Sarah about this” and hoping the right Sarah gets the message, you type @Sarah and she gets it directly. Same idea: instead of describing a file and hoping Claude Code finds the right one, you type @filename and Claude Code reads that exact file.


Step 1: @-Mention a File

The most common use of @-mentions is referencing a specific file. Here’s how:


# Basic @-mention of a file in your prompt
Look at @src/utils/pricing.js and add a calculateDiscount() function
that follows the same pattern as the existing calculateTotal() function.

When you type @ in Claude Code, it will show you an autocomplete dropdown of files in your project. You can type part of the file name and select from the list — you don’t need to type the full path manually.


# Claude Code autocomplete when typing @
@pric   →  [dropdown appears]
            src/utils/pricing.js        ← select this one
            src/utils/pricingHelpers.js
            src/types/PricingTypes.ts

Claude Code prompt field showing the @ autocomplete dropdown with a list of matching files

This is faster than typing the full path and eliminates typos.


Step 2: @-Mention Multiple Files

You can mention as many files as you need in a single prompt:


# @-mentioning multiple files in one prompt
Compare the error handling in @src/api/users.js and @src/api/products.js.
They're inconsistent — update products.js to match the pattern in users.js.

Claude Code reads both files and uses them as context. It can now see exactly what the “users.js pattern” looks like rather than guessing from your description.


# Another example with multiple @-mentions
The checkout flow spans @src/pages/checkout.tsx, @src/hooks/useCart.js,
and @src/api/orders.js. There's a bug where the order total doesn't
match the cart total. Find and fix the discrepancy.

When the bug spans multiple files, mentioning all of them tells Claude Code exactly where to look — no wasted time reading unrelated files.


Step 3: @-Mention a Folder

You can @-mention a directory to ask Claude Code to consider all files within it:


# @-mentioning a folder
Look at @src/components/auth/ and tell me which components are missing
loading states. Then add loading states to any that don't have them.

This tells Claude Code to read everything in the auth/ folder. Use folder mentions when you want Claude Code to understand a whole feature area, not just one file.

⚠️ Warning: Mentioning large folders can use a lot of tokens — the amount of information Claude Code can hold at once. If a folder has dozens of files, consider being more specific and mentioning only the files that are relevant. See What Are Tokens in Claude Code? for more on this.


Step 4: @-Mention a Specific Function or Symbol

In some environments, Claude Code supports mentioning specific functions or symbols within a file — not just the whole file:


# @-mentioning a specific function
Update the @calculateShippingCost function to handle international orders.
It currently only handles domestic US shipping.

# @-mentioning a specific component
Refactor @CheckoutSummary to use the new <PriceDisplay> component
instead of calculating and displaying prices inline.

Symbol-level @-mentions work best in IDE environments (VS Code and JetBrains) where Claude Code has deeper integration with your codebase’s symbol index. In the terminal, file-level @-mentions are the most reliable.


Step 5: Use @-Mentions to Show Examples

One of the most powerful uses of @-mentions is pointing Claude Code at an existing example and saying “do it like that.”


# Using @-mention to provide a pattern example
Add a delete endpoint to @src/api/products.js.
Follow the exact same pattern as the delete endpoint in @src/api/categories.js —
same error handling, same response format, same authorization check.

This is dramatically better than writing out the pattern in words. You’re giving Claude Code the actual code to match, not a description of it. The output will fit your codebase naturally because it’s based on real code from your codebase.

💡 Pro Tip: When you have a pattern you want repeated — a new API endpoint, a new React component, a new database model — always find an existing example in your codebase and @-mention it. “Do it like @this-existing-thing” is one of the most effective prompting techniques available.


Step 6: Combine @-Mentions With Context

@-mentions work best when combined with clear task descriptions. The @-mention tells Claude Code where to look — your prompt still needs to tell it what to do and why.

@-mention alone (incomplete):


# Not enough information even with @-mention
@src/utils/pricing.js

@-mention with full context (complete):


# @-mention combined with task description and context
In @src/utils/pricing.js, the calculateTotal() function doesn't account
for tax-exempt customers. Add a parameter `isTaxExempt` — when true,
skip the tax calculation and return the subtotal directly.
Tax-exempt logic should match what's in @src/utils/invoiceCalculations.js
where we already handle this for invoices.

This prompt has everything: what to change, where, why, what the expected behavior is, and a reference example. Claude Code will produce exactly what you need.


@-Mentions in Different Claude Code Environments

@-mentions work across all Claude Code environments, but with slight differences:

Terminal (CLI):

  • Type @ to trigger autocomplete
  • File and folder @-mentions work reliably
  • Symbol-level mentions may require the full name

VS Code Extension:

JetBrains IDEs:

Browser (claude.ai/code):


Common Mistakes and How to Fix Them

Mistake 1: Describing a File Instead of @-Mentioning It

Problem: You write “look at the pricing utility file in the utils folder” instead of @src/utils/pricing.js.

Fix: Any time you’re referring to a specific file, use an @-mention. It’s faster and eliminates ambiguity — especially when you have files with similar names.

Mistake 2: @-Mentioning Too Many Files

Problem: You @-mention 8 files in one prompt. Claude Code reads all of them, your token budget shrinks, and the response is slower and less focused.

Fix: Be selective. @-mention only the files directly relevant to the task. One to three files is usually the sweet spot.

Mistake 3: @-Mentioning Without Explaining Why

Problem: You @-mention a file but don’t explain what Claude Code should do with it — or why you’ve included it.

Fix: Always pair an @-mention with context: “Look at @this-file to understand the pattern I want you to follow” or “The bug is in @this-file, specifically in the X function.”

Mistake 4: Forgetting @-Mentions When Files Have Similar Names

Problem: You have Button.tsx, ButtonGroup.tsx, and IconButton.tsx. You say “fix the Button component” and Claude Code edits the wrong one.

Fix: Whenever there’s any ambiguity, use an @-mention with the full path: @src/components/ui/Button.tsx.

Mistake 5: Not Using @-Mentions for Examples

Problem: You describe the pattern you want in words — which is harder for both you to write and Claude Code to interpret correctly.

Fix: Find an existing example in your codebase that shows the pattern. @-mention it. “Do it like @this” is almost always clearer than “do it using X pattern where Y happens and Z is the result.”


Key Takeaways

  • @-mentions explicitly direct Claude Code to read a specific file, folder, or symbol
  • Type @ in the prompt field to trigger autocomplete — no need to type full paths
  • @-mention multiple files in one prompt when a task spans several areas
  • Using @-mentions to point at existing examples is one of the most effective prompting techniques
  • Combine @-mentions with clear task descriptions — the @-mention says where, your prompt says what and why

Next Steps

Return to How Claude Code Works — A Beginner’s Deep Dive for the full picture.