Claude Skill

react

Operate React applications as a named tool: inspect and diagnose React/Vite projects, design component boundaries and state flow, implement accessible responsive UI, and verify behavior with the project's tests. Use when a task explicitly involves React, JSX/TSX, React hooks, Rea

LLM Mart · 0 points · 10 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-react-d0edebb.zip · 10 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/react
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

react — Build and diagnose React applications

Why Install This Skill

React projects accumulate framework-specific failure modes: hooks that resynchronize unnecessarily, stale requests that overwrite newer data, routes that break under a subpath, and Vite environment values accidentally shipped to browsers. This skill gives your agent a focused operating loop for those problems.

After installation, your agent can inspect a React/Vite project safely, make component and state changes that fit its existing conventions, protect accessible interaction states, and verify the result with the project's own checks. It also includes a read-only doctor for quick diagnostics without installing dependencies or exposing environment values.

What You Get

Directory Purpose
SKILL.md React-specific implementation workflow, guardrails, handoffs, and verification steps
references/component-and-state.md Component boundaries, hooks, effects, async state, and forms
references/vite-diagnostics.md Vite environment, build, asset-base, and deployment diagnostics
scripts/react-doctor.py Bounded Python diagnostic with human-readable or JSON output
scripts/test_react_doctor.py Offline tests for diagnostic behavior and safety guarantees
evals/evals.json Six substantive output-quality cases for React and Vite work

Quick Start

python3 scripts/react-doctor.py --json .
python3 scripts/react-doctor.py .

The doctor reads project files only. It does not install packages, run scripts, contact the network, or print environment values.

Triggers

Load this skill when working with React, JSX/TSX, hooks, React Router, Vite React configuration, React component/state implementation, or React build failures. Use it for a focused project diagnosis before editing.

Requirements

  • Python 3.8+ for the bundled diagnostic and tests.
  • Node.js and the project's package manager for application builds and tests.
  • Existing React/Vite project files; no API key is required.
  • Use frontend-engineering for framework-agnostic frontend architecture, playwright for browser automation, and web-accessibility for dedicated accessibility audits.

Skill manifest

React Application Engineering

Use this skill for the React-specific implementation layer. Preserve the project's existing React version, package manager, build scripts, styling conventions, and routing model unless the user asks for a migration.

Operating loop

  1. Diagnose before editing. Run scripts/react-doctor.py --json [PROJECT] and inspect package.json, source entry points, Vite config, TypeScript config, routes, and test scripts. The diagnostic is bounded and read-only.
  2. Define the component contract. Identify the page/feature boundary, inputs and outputs, owned state, server state, loading/empty/error/success states, and side effects. Keep reusable components independent of route globals and avoid passing state through unrelated layers.
  3. Implement with explicit data flow. Prefer local state for local behavior, context only for genuinely cross-cutting concerns, and the existing server state/cache solution for remote data. Keep effects for synchronization with external systems; derive values during render rather than storing duplicates.
  4. Keep UI resilient. Render a useful loading, empty, error, and success experience. Cancel or ignore stale async work, handle aborts, and avoid setting state after an obsolete request. Preserve stable keys and avoid mutating props or state.
  5. Build for the browser. Use semantic HTML, keyboard-operable controls, visible focus, responsive layout, and stable accessible names. For detailed accessibility requirements, load web-accessibility.
  6. Verify in layers. Run the narrowest existing unit/component test, then lint/typecheck, then the production build. For browser-level flows use playwright, not ad hoc browser automation. Report the exact commands and any environment-dependent checks that were skipped.

React-specific rules

  • Hooks run unconditionally and in the same order on every render; never call them in branches, loops, event handlers, or nested functions.
  • Effects synchronize with external systems. Do not use an effect to calculate a value that can be derived from props/state, or to mirror props into state without a clear user-editing requirement.
  • Use functional updates when the next state depends on the previous state. Give list items stable keys from domain identity, not array indexes when the list can reorder, insert, or delete.
  • Treat event handlers as user intent and keep them separate from render-time computation. Disable or guard duplicate submissions and expose pending state.
  • Keep API response validation and transformation at the integration boundary; components should consume a typed, predictable view model.
  • Do not add a state library or router solely because it is popular. First map ownership and use the project's existing choices.
  • In Vite, expose only intentionally public variables using the project's documented prefix (normally VITE_); never put secrets in client bundles. Read references/vite-diagnostics.md for environment, build, and deployment checks.

Routing and handoffs

  • Component architecture, responsive implementation, performance budgets, and general frontend testing: frontend-engineering.
  • Browser E2E authoring, locator choice, network interception, and Playwright runs: playwright.
  • Semantic structure, keyboard/focus behavior, WCAG acceptance evidence, and accessibility audits: web-accessibility.
  • React Native, Expo, Android, or iOS implementation: mobile-development.

Reference routing

Load when Reference
Choosing component boundaries, state ownership, effects, or async UI behavior references/component-and-state.md
Diagnosing Vite env exposure, dependency versions, build output, or deployment paths references/vite-diagnostics.md

Included script

scripts/react-doctor.py is a read-only, dependency-free diagnostic. Run scripts/react-doctor.py --help for options. It accepts a project directory, checks common React/Vite signals, and emits human-readable or bounded JSON output. It does not install packages, execute project scripts, access the network, or print environment values.

Completion boundary

Stop when the requested React change is implemented, the project's relevant checks have run, and remaining failures are reported with their command and root-cause evidence. Do not broaden a component task into a framework migration or an accessibility audit without explicit scope.

Files (agent-skills)
  • evals
    • evals.json 3.1 KB
      Loading…
  • references
    • component-and-state.md 2.7 KB
      Loading…
    • vite-diagnostics.md 2.6 KB
      Loading…
  • scripts
    • react-doctor.py 3.6 KB
      Loading…
    • test_react_doctor.py 2.4 KB
      Loading…
  • README.md 2.2 KB
    # react — Build and diagnose React applications
    
    ## Why Install This Skill
    
    React projects accumulate framework-specific failure modes: hooks that resynchronize unnecessarily, stale requests that overwrite newer data, routes that break under a subpath, and Vite environment values accidentally shipped to browsers. This skill gives your agent a focused operating loop for those problems.
    
    After installation, your agent can inspect a React/Vite project safely, make component and state changes that fit its existing conventions, protect accessible interaction states, and verify the result with the project's own checks. It also includes a read-only doctor for quick diagnostics without installing dependencies or exposing environment values.
    
    ## What You Get
    
    | Directory | Purpose |
    |---|---|
    | `SKILL.md` | React-specific implementation workflow, guardrails, handoffs, and verification steps |
    | `references/component-and-state.md` | Component boundaries, hooks, effects, async state, and forms |
    | `references/vite-diagnostics.md` | Vite environment, build, asset-base, and deployment diagnostics |
    | `scripts/react-doctor.py` | Bounded Python diagnostic with human-readable or JSON output |
    | `scripts/test_react_doctor.py` | Offline tests for diagnostic behavior and safety guarantees |
    | `evals/evals.json` | Six substantive output-quality cases for React and Vite work |
    
    ## Quick Start
    
    ```bash
    python3 scripts/react-doctor.py --json .
    python3 scripts/react-doctor.py .
    ```
    
    The doctor reads project files only. It does not install packages, run scripts, contact the network, or print environment values.
    
    ## Triggers
    
    Load this skill when working with React, JSX/TSX, hooks, React Router, Vite React configuration, React component/state implementation, or React build failures. Use it for a focused project diagnosis before editing.
    
    ## Requirements
    
    - Python 3.8+ for the bundled diagnostic and tests.
    - Node.js and the project's package manager for application builds and tests.
    - Existing React/Vite project files; no API key is required.
    - Use `frontend-engineering` for framework-agnostic frontend architecture, `playwright` for browser automation, and `web-accessibility` for dedicated accessibility audits.
    
  • SKILL.md 5.5 KB
    ---
    name: react
    description: >-
      Operate React applications as a named tool: inspect and diagnose React/Vite
      projects, design component boundaries and state flow, implement accessible
      responsive UI, and verify behavior with the project's tests. Use when a task
      explicitly involves React, JSX/TSX, React hooks, React Router, Vite React
      configuration, or React build failures. Do not use for framework-agnostic
      frontend strategy (route to frontend-engineering), browser automation (route
      to playwright), accessibility policy or audits (route to web-accessibility),
      or non-React mobile apps (route to mobile-development).
    license: MIT
    compatibility: >-
      The bundled diagnostic script uses Python 3.8+ standard library only. Running
      or building an application requires its repository package manager and Node.js.
    metadata:
      tags: react, jsx, tsx, vite, hooks, components, router, frontend
      source: https://react.dev/
    ---
    
    # React Application Engineering
    
    Use this skill for the React-specific implementation layer. Preserve the
    project's existing React version, package manager, build scripts, styling
    conventions, and routing model unless the user asks for a migration.
    
    ## Operating loop
    
    1. **Diagnose before editing.** Run `scripts/react-doctor.py --json [PROJECT]` and
       inspect `package.json`, source entry points, Vite config, TypeScript config,
       routes, and test scripts. The diagnostic is bounded and read-only.
    2. **Define the component contract.** Identify the page/feature boundary,
       inputs and outputs, owned state, server state, loading/empty/error/success
       states, and side effects. Keep reusable components independent of route
       globals and avoid passing state through unrelated layers.
    3. **Implement with explicit data flow.** Prefer local state for local behavior,
       context only for genuinely cross-cutting concerns, and the existing server
       state/cache solution for remote data. Keep effects for synchronization with
       external systems; derive values during render rather than storing duplicates.
    4. **Keep UI resilient.** Render a useful loading, empty, error, and success
       experience. Cancel or ignore stale async work, handle aborts, and avoid
       setting state after an obsolete request. Preserve stable keys and avoid
       mutating props or state.
    5. **Build for the browser.** Use semantic HTML, keyboard-operable controls,
       visible focus, responsive layout, and stable accessible names. For detailed
       accessibility requirements, load [web-accessibility](../web-accessibility/SKILL.md).
    6. **Verify in layers.** Run the narrowest existing unit/component test, then
       lint/typecheck, then the production build. For browser-level flows use
       [playwright](../playwright/SKILL.md), not ad hoc browser automation. Report
       the exact commands and any environment-dependent checks that were skipped.
    
    ## React-specific rules
    
    - Hooks run unconditionally and in the same order on every render; never call
      them in branches, loops, event handlers, or nested functions.
    - Effects synchronize with external systems. Do not use an effect to calculate
      a value that can be derived from props/state, or to mirror props into state
      without a clear user-editing requirement.
    - Use functional updates when the next state depends on the previous state.
      Give list items stable keys from domain identity, not array indexes when the
      list can reorder, insert, or delete.
    - Treat event handlers as user intent and keep them separate from render-time
      computation. Disable or guard duplicate submissions and expose pending state.
    - Keep API response validation and transformation at the integration boundary;
      components should consume a typed, predictable view model.
    - Do not add a state library or router solely because it is popular. First map
      ownership and use the project's existing choices.
    - In Vite, expose only intentionally public variables using the project's
      documented prefix (normally `VITE_`); never put secrets in client bundles.
      Read [references/vite-diagnostics.md](references/vite-diagnostics.md) for
      environment, build, and deployment checks.
    
    ## Routing and handoffs
    
    - Component architecture, responsive implementation, performance budgets, and
      general frontend testing: [frontend-engineering](../frontend-engineering/SKILL.md).
    - Browser E2E authoring, locator choice, network interception, and Playwright
      runs: [playwright](../playwright/SKILL.md).
    - Semantic structure, keyboard/focus behavior, WCAG acceptance evidence, and
      accessibility audits: [web-accessibility](../web-accessibility/SKILL.md).
    - React Native, Expo, Android, or iOS implementation: [mobile-development](../mobile-development/SKILL.md).
    
    ## Reference routing
    
    | Load when | Reference |
    |---|---|
    | Choosing component boundaries, state ownership, effects, or async UI behavior | `references/component-and-state.md` |
    | Diagnosing Vite env exposure, dependency versions, build output, or deployment paths | `references/vite-diagnostics.md` |
    
    ## Included script
    
    `scripts/react-doctor.py` is a read-only, dependency-free diagnostic. Run
    `scripts/react-doctor.py --help` for options. It accepts a project directory,
    checks common React/Vite signals, and emits human-readable or bounded JSON
    output. It does not install packages, execute project scripts, access the
    network, or print environment values.
    
    ## Completion boundary
    
    Stop when the requested React change is implemented, the project's relevant
    checks have run, and remaining failures are reported with their command and
    root-cause evidence. Do not broaden a component task into a framework migration
    or an accessibility audit without explicit scope.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.