- Home
- Skills
- Frontend & Web Apps
- Find the Source Line of Any React Element
More screenshots
Works with the AI Agents you already use
Find the Source Line of Any React Element
It works with the free, open-source react-source-string build plugins.
Free
Find the Source Line of Any React Element
Example session with this skill installed
The Pay button on the checkout page at localhost:5173/checkout should say "Pay now", but only there. Fix it.
- Read your context and instructions
- Compiled the find the source
Changed the label on the checkout page only. The shared Button component stays as it was.
How I found it
I opened localhost:5173/checkout and looked the button up in the page instead of searching the repository for "Pay":
__REACT_SOURCE__.find("Pay");
// [{ source: "src/components/Button.tsx:4", tag: "button", text: "Pay" }]
__REACT_SOURCE__.stack('button[data-source="src/components/Button.tsx:4"]');
// ["src/components/Button.tsx:4", "src/pages/Checkout.tsx:42", "src/pages/Checkout.tsx:30", "src/App.tsx:12"]
| Location | What it is | Edited |
|---|---|---|
src/components/Button.tsx:4 | the shared <button> that every page uses | no |
src/pages/Checkout.tsx:42 | <Button> on the checkout page, the call site | yes |
src/pages/Checkout.tsx:30 | the order summary card around it | no |
A text search for "Pay" finds 3 places in this repository: the checkout page, PaymentMethods.tsx and a test. The source location points to one of them.
The change
// src/pages/Checkout.tsx
- <Button onClick={submit}>Pay</Button>
+ <Button onClick={submit}>Pay now</Button>
After the HMR reload, __REACT_SOURCE__.find("Pay now") returns the same element, and the other two "Pay" labels are unchanged.
Next steps
- This project renders many shared wrappers. Turn on
preferCallSite: truein the plugin options, and references will point to the call site (Checkout.tsx:42) right away. - Alt + click any element on the page to copy its reference, then paste it into the chat.
Connects securely to your tools. The creator never sees your data.
About this skill
Your agent sees a "Pay" button on the page and searches the repository for "Pay". If the codebase has three of them, it edits the wrong one. This skill gives the agent the exact file and line instead.
It works with the free, open-source react-source-string build plugins. In development they add data-source="src/pages/Checkout.tsx:42" to every JSX element. With the overlay on, you can Alt + click an element to copy that reference, and the page gets a window.__REACT_SOURCE__ lookup that an agent calls from its browser tool.
What the skill teaches your agent
- Read a pasted reference. You Alt + click an element and paste
src/pages/Checkout.tsx:42 <button> "Pay". The agent opens that line and skips the search. Theinside:line tells it which parent to edit when the change is about layout or the surrounding list. - Look up an element in the browser. Accessibility snapshots from Playwright MCP, Claude in Chrome and other agent browsers drop
data-*attributes. The skill has the agent run__REACT_SOURCE__.find("Pay")in the page and getsrc/pages/Checkout.tsx:42back. - Pick the right line. When a shared
<Button>renders the element,__REACT_SOURCE__.stack()lists the component and its call site. The agent changes the checkout page when you mean one button, and the shared component only when you want every button to change. - Set up the plugin. If the project has no plugin, the agent tells you and offers to install it. With your OK it adds the dev dependency and the config for Vite, Next.js or Babel, adds a rule to
AGENTS.md, and checks that the attributes show up.
Requirements
- A React project running in development mode.
- One of the plugins:
vite-plugin-react-source-string(Vite),swc-plugin-react-source-string(Next.js 16.1.7 and later) orbabel-plugin-react-source-string(webpack, Rspack, Next.js with a Babel config, Metro). The skill installs it for you if you agree.
Limitations
- Production builds have no
data-sourceattributes and no overlay. - Elements rendered inside
node_modulesare not tagged. The agent gets the nearest tagged element from your own code, which is the place that renders the library component. - Without a plugin the agent falls back to a text search and tells you the result is a guess.
The skill and the plugins are open source under the MIT license.
Only works in development builds. Elements inside node_modules are not tagged. Requires build-time plugin integration (Vite, Next.js, or Babel).
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 9 days ago
- Free with an Agensi account
- Software
- React project in development modeVite, Next.js 16.1.7+orBabel
Node.jsnpm
pnpmorYarn
Permissions
What's inside
Creator
Jaroslav Barov
Frequently Asked Questions
New in Frontend & Web Apps
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Frontend & Web Apps.