react-grab

supercent-io/skills-template · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/supercent-io/skills-template --skill react-grab
0 commentsdiscussion
summary

Keyword: react-grab · grab · element context · copy component to ai

skill.md

react-grab — Browser Element Context for AI Agents

Keyword: react-grab · grab · element context · copy component to ai

Point at any UI element in your browser, press Cmd/Ctrl+C, and instantly copy its React component name, source file path, and HTML markup to clipboard — ready for your AI coding agent.

When to use this skill

  • Set up react-grab in a React project (Next.js, Vite, Webpack) for AI-assisted development
  • Point at UI elements and copy precise component context to Claude Code / Cursor / Copilot / Gemini
  • Add react-grab MCP server so your AI agent can receive element context programmatically
  • Configure react-grab with a custom plugin for project-specific workflows (Jira, Figma, etc.)
  • Use the programmatic API (getElementContext, freeze) for automation or test tooling
  • Remove react-grab from a project or a specific agent integration

Instructions

  1. Run bash scripts/install.sh (or npx -y grab@latest init) to install react-grab in your project
  2. Start your dev server — react-grab is dev-only and never ships to production
  3. Open your app in a browser, hover over any element, and press Cmd+C (Mac) / Ctrl+C (Win)
  4. Paste the clipboard content into your AI coding agent (Claude Code / Cursor / Copilot / Gemini)
  5. Optionally run bash scripts/add-agent.sh mcp to enable MCP tool access for programmatic use

For detailed API and framework-specific setup, see references/api.md.


Examples

Copy element context to Claude Code

# 1. Start your app
npm run dev

# 2. Hover over a button in the browser
# 3. Press Cmd+C (Mac) or Ctrl+C (Win/Linux)
# Clipboard now contains:
#
# in LoginForm at components/login-form.tsx:46:19
#
# <button class="btn-primary" type="submit">
#   Log in
# </button>

# 4. Paste into Claude Code — it knows exactly where the component lives

Set up MCP integration

# Install react-grab MCP server
npx -y grab@latest add mcp

# Your AI agent can now call the get_element_context MCP tool
# to receive element context after you select it in the browser

Add custom plugin action

import { registerPlugin } from "react-grab";

registerPlugin({
  name: "open-in-figma",
  actions: [{
    id: "figma",
    label: "Find in Figma",
    shortcut: "F",
    onAction: (ctx) => {
      window.open(`figma://search?q=${ctx.componentName}`);
    },
  }],
});

Quick Start

# One command — auto-detects your framework and installs everything
npx -y grab@latest init

# Add MCP server for programmatic AI agent access
npx -y grab@latest add mcp

# Add to a specific AI agent
npx -y grab@latest add claude-code

After installation, hover over any element in your browser during development and press:

  • Mac: Cmd+C
  • Windows/Linux: Ctrl+C

Output copied to clipboard:

in LoginForm at components/login-form.tsx:46:19

<a class="ml-auto text-sm underline-offset-4 hover:underline">
  Forgot your password?
</a>

Paste directly into your AI coding agent prompt — no file searching needed.


Installation

Auto-detect (Recommended)

npx -y grab@latest init

Detects your framework (Next.js App Router / Pages Router / Vite / TanStack Start / Webpack) and package manager (npm / yarn / pnpm / bun) automatically.

Manual installation by framework

Next.js App Router (app/layout.tsx):

import Script from 'next/script'

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        {process.env.NODE_ENV === "development" && (
          <Script
            src="//unpkg.com/react-grab/dist/index.global.js"
            crossOrigin="anonymous"
            strategy="beforeInteractive"
          />
        )}
      </body>
    </html>
  )
}

Next.js Pages Router (pages/_document.tsx):

import Script from 'next/script'

// Inside _document component:
{process.env.NODE_ENV === "development" && (
  <Script
    src="//unpkg.com/react-grab/dist/index.global.js"
    crossOrigin="anonymous"
    strategy="beforeInteractive"
  />
)}

Vite (index.html):

<script type="module">
  if (import.meta.env.DEV) {
    await import('//unpkg.com/react-grab/dist/index.global.js');
  }
</script>

Webpack (entry file):

if (process.env.NODE_ENV === 'development') {
  import('react-grab');
}

Package install (for programmatic use):

npm install react-grab
# or: pnpm add react-grab | yarn add react-grab | bun add react-grab

Install react-grab via skill scripts

# Auto-detect framework and install
bash scripts/install.sh

# Install for a specific framework
bash scripts/install.sh --framework next-app

# Add to a specific AI agent
bash scripts/add-agent.sh claude-code
bash scripts/add-agent.sh cursor
bash scripts/add-agent.sh mcp

Core Usage

Keyboard shortcut

In development mode:

  1. Hover over any React element in the browser
  2. Press Cmd+C (Mac) or Ctrl+C (Windows/Linux)
  3. The context is copied to clipboard

Output format:

in <ComponentName> at <file-path>:<line>:<col>

<element-html>

Floating toolbar

A draggable toolbar appears in the corner of your browser when react-grab is active:

  • Click to toggle activation on/off
  • Drag to any screen edge
  • Collapse when not needed

Multi-element selection (drag)

Click and drag across multiple elements to capture all their contexts at once. Each element's component stack and HTML is included in the clipboard output.

Programmatic API

import { getGlobalApi } from "react-grab";

const api = getGlobalApi();

// Activate the overlay
api.activate();   // show overlay
api.deactivate(); // hide overlay
api.toggle();     // toggle

// Copy an element's context to clipboard
await api.copyElement(document.querySelector('.my-button'));

// Get source info without copying
const source = await api.getSource(element);
console.log(source.filePath);     // "src/components/Button.tsx"
console.log(source.lineNumber);   // 42
console
how to use react-grab

How to use react-grab on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add react-grab
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/supercent-io/skills-template --skill react-grab

The skills CLI fetches react-grab from GitHub repository supercent-io/skills-template and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/react-grab

Reload or restart Cursor to activate react-grab. Access the skill through slash commands (e.g., /react-grab) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.627 reviews
  • Chaitanya Patil· Dec 28, 2024

    Useful defaults in react-grab — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Ren Chen· Dec 20, 2024

    react-grab fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Amelia Verma· Dec 16, 2024

    We added react-grab from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Maya Ndlovu· Nov 23, 2024

    react-grab reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Piyush G· Nov 19, 2024

    react-grab has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Rahul Santra· Nov 15, 2024

    Registry listing for react-grab matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Sakura Sanchez· Nov 11, 2024

    react-grab is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Nia Lopez· Nov 7, 2024

    Keeps context tight: react-grab is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Daniel Johnson· Oct 26, 2024

    react-grab is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Sofia Liu· Oct 14, 2024

    Registry listing for react-grab matched our evaluation — installs cleanly and behaves as described in the markdown.

showing 1-10 of 27

1 / 3