Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add pproenca/dot-skills --skill react-refactorgit clone --depth 1 https://github.com/pproenca/dot-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/pproenca/dot-skills/react-refactor)<a href="https://agentmods.dev/skills/pproenca/dot-skills/react-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/react-refactor/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/pproenca/dot-skills/react-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/react-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Socket pass
- Snyk pass
- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00086 | $0.02265 |
| Opus 5 | $0.00043 | $0.01132 |
| Sonnet 5 | $0.00017 | $0.00453 |
| Haiku 4.5 | $0.00009 | $0.00227 |
Grade A, and why
react-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 108 lines — stays where its author put it; the contents beside it link to each section on GitHub.
React Refactor Best Practices
Architectural refactoring guide for React applications. Contains 40 rules across 7 categories, prioritized by impact from critical (component and state architecture) to incremental (refactoring safety).
When to Apply
- Refactoring existing React codebases or planning large-scale restructuring
- Reviewing PRs for architectural issues and code smells
- Decomposing oversized components into focused units
- Extracting reusable hooks from component logic
- Improving testability of React code
- Reducing coupling between feature modules
Rule Categories
| Category | Impact | Rules | Key Topics |
|---|---|---|---|
| Component Architecture | CRITICAL | 8 | Compound components, headless pattern, composition over props, client boundaries |
| State Architecture | CRITICAL | 7 | Colocation, state machines, URL state, derived values |
| Hook Patterns | HIGH | 6 | Single responsibility, naming, dependency stability, composition |
| Component Decomposition | HIGH | 6 | Scroll test, extraction by change reason, view/logic separation |
| Coupling & Cohesion | MEDIUM | 4 | Dependency injection, circular deps, stable imports, barrel-free |
| Data & Side Effects | MEDIUM | 4 | Server-first fetch, TanStack Query, error boundaries |
| Refactoring Safety | LOW-MEDIUM | 5 | Characterization tests, behavior testing, integration tests |
Quick Reference
Critical patterns — get these right first:
- Use compound components instead of props explosion
- Colocate state with the components that use it
- Use state machines for complex UI workflows
- Separate container logic from presentational components
Common mistakes — avoid these anti-patterns:
- Lifting state to App when only one component reads it
- Using context for rapidly-changing values
- Monolithic hooks that fetch + transform + cache
- Testing implementation details instead of behavior
Table of Contents
- Component Architecture — CRITICAL
- 1.1 Apply Interface Segregation to Component Props — CRITICAL (prevents 30-50% of unnecessary re-renders)
- 1.2 Colocate Files by Feature Instead of Type — CRITICAL (reduces cross-directory navigation by 70%)
- 1.3 Convert Render Props to Custom Hooks — CRITICAL (eliminates 2-4 levels of nesting)
- 1.4 Extract Headless Components for Logic Reuse — CRITICAL (5x more reuse scenarios)
- 1.5 Prefer Composition Over Props Explosion — CRITICAL (reduces prop count by 50-70%)
- 1.6 Separate Container Logic from Presentational Components — CRITICAL (enables independent testing)
- 1.7 Use Compound Components for Implicit State Sharing — CRITICAL (reduces API surface by 60%)
- 1.8 Push Client Boundaries to Leaf Components — HIGH (keeps 60-80% server-rendered)
- State Architecture — CRITICAL
- 2.1 Colocate State with Components That Use It — CRITICAL (reduces prop passing by 60%)
- 2.2 Derive Values Instead of Syncing State — CRITICAL (eliminates double-render cycle)
- 2.3 Lift State Only When Multiple Components Read It — CRITICAL (eliminates unnecessary parent re-renders)
- 2.4 Use Context for Rarely-Changing Values Only — CRITICAL (5-50x fewer re-renders)
- 2.5 Use State Machines for Complex UI Workflows — CRITICAL (reduces valid states from 2^n to N)
- 2.6 Use URL Parameters as State for Shareable Views — CRITICAL (enables deep linking and sharing)
- 2.7 Use useReducer for Multi-Field State Transitions — CRITICAL (eliminates impossible states)
- Hook Patterns — HIGH
- 3.1 Avoid Object and Array Dependencies in Custom Hooks — HIGH (prevents effect re-execution every render)
- 3.2 Compose Hooks Instead of Nesting Them — HIGH (flattens dependency graph)
- 3.3 Extract Logic into Custom Hooks When Behavior Is Nameable — HIGH (40-60% shorter components)
- 3.4 Follow Hook Naming Conventions for Discoverability — HIGH (reduces navigation time by 40%)
- 3.5 Keep Custom Hooks to a Single Responsibility — HIGH (3x easier to test)
- 3.6 Stabilize Hook Dependencies with Refs and Callbacks — HIGH (prevents infinite loops)
- Component Decomposition — HIGH
- 4.1 Apply the Scroll Test to Identify Oversized Components — HIGH (3x faster code review)
- 4.2 Complete Component Extraction Without Half-Measures — HIGH (enables independent testing and reuse)
- 4.3 Extract Components by Independent Change Reasons — HIGH (70% fewer files touched per change)
- 4.4 Extract Pure Functions from Component Bodies — HIGH (10x faster unit tests)
- 4.5 Inline Premature Abstractions Before Re-Extracting — HIGH (40-60% simpler code)
- 4.6 Separate View Layer from Business Logic — HIGH (5x faster test suite)
- Coupling & Cohesion — MEDIUM
- 5.1 Break Circular Dependencies with Intermediate Modules — MEDIUM (eliminates undefined-at-import-time bugs)
- 5.2 Import from Stable Public API Surfaces Only — MEDIUM (enables internal refactoring)
- 5.3 Use Barrel-Free Feature Modules for Clean Dependencies — MEDIUM (200-800ms build reduction)
- 5.4 Use Dependency Injection for External Services — MEDIUM (3x faster test setup)
- Data & Side Effects — MEDIUM
- 6.1 Fetch Data on the Server by Default — MEDIUM (reduces client JS by 30-60%)
- 6.2 Place Error Boundaries at Data Fetch Granularity — MEDIUM (errors isolated to affected section)
- 6.3 Use Context Module Pattern for Action Colocation — MEDIUM (centralizes data mutations)
- 6.4 Use TanStack Query for Client-Side Server State — MEDIUM (eliminates 80% of fetch boilerplate)
- Refactoring Safety — LOW-MEDIUM
- 7.1 Avoid Snapshot Tests for Refactored Components — LOW-MEDIUM (eliminates false test failures)
- 7.2 Extract Pure Functions to Increase Testability — LOW-MEDIUM (10x faster test execution)
- 7.3 Prefer Integration Tests for Component Verification — LOW-MEDIUM (catches 40% more bugs)
- 7.4 Test Component Behavior Not Implementation Details — LOW-MEDIUM (5x fewer test updates)
- 7.5 Write Characterization Tests Before Refactoring — LOW-MEDIUM (catches 90% of unintended changes)
What ships with it
45 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- AGENTS.md 8.6 KB
- assets/templates/_template.md 631 B
- metadata.json 777 B
- README.md 4.3 KB
- references/_sections.md 1.9 KB
- references/arch-composition-over-props.md 2.8 KB
- references/arch-compound-components.md 3.1 KB
- references/arch-container-presentational.md 3.0 KB
- references/arch-feature-colocation.md 2.0 KB
- references/arch-headless-pattern.md 3.5 KB
- references/arch-interface-segregation.md 2.9 KB
- references/arch-push-client-low.md 3.2 KB
- references/arch-render-props-to-hooks.md 1.9 KB
- references/couple-barrel-free-features.md 2.6 KB
- references/couple-break-circular-deps.md 2.4 KB
- references/couple-dependency-injection.md 2.3 KB
- references/couple-stable-imports.md 2.5 KB
- references/data-context-module-pattern.md 3.2 KB
- references/data-granular-error-boundaries.md 2.6 KB
- references/data-server-first-fetch.md 2.9 KB
- references/data-tanstack-query-client.md 2.7 KB
- references/decomp-complete-extraction.md 2.8 KB
- references/decomp-extract-by-change-reason.md 3.5 KB
- references/decomp-extract-pure-functions.md 3.3 KB
- references/decomp-inline-premature.md 3.1 KB
- references/decomp-scroll-test.md 3.9 KB
- references/decomp-separate-view-logic.md 3.7 KB
- references/hook-avoid-object-deps.md 2.3 KB
- references/hook-composition-over-nesting.md 2.6 KB
- references/hook-dependency-stability.md 2.7 KB
- references/hook-extract-when-nameable.md 2.7 KB
- references/hook-naming-conventions.md 2.5 KB
- references/hook-single-responsibility.md 3.3 KB
- references/safety-characterization-tests.md 2.5 KB
- references/safety-extract-pure-testability.md 3.0 KB
- references/safety-integration-over-unit.md 3.1 KB
- references/safety-snapshot-free.md 2.4 KB
- references/safety-test-behavior.md 2.4 KB
- references/state-colocate-with-consumers.md 2.1 KB
- references/state-context-for-static.md 2.9 KB
- references/state-derive-dont-sync.md 2.2 KB
- references/state-lift-only-when-shared.md 2.0 KB
- references/state-machines-for-workflows.md 3.6 KB
- references/state-reducer-for-complex.md 3.1 KB
- references/state-url-as-state.md 3.6 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 108 lines · 86 tokens per session scan A 803468df4e6f
react-refactor is a skill published in the GitHub repository pproenca/dot-skills (205 stars, last pushed 24d ago), licensed MIT. It adds 86 tokens to every session and 2,265 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
chakra-ui-builder
Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable themes using tokens, semantic tokens, recipes, and slot recipes. Use this skill whenever a user asks to build, create, or generate any UI component, page, form…
material-ui-tailwind
Integrates Material UI with Tailwind CSS v4 using cascade layers (enableCssLayer, @layer order) and documents Tailwind v3 interoperability (preflight, important, injectFirst, portals). Use when combining MUI with Tailwind utilities, slotProps className, or theme token bridges.
r3f-best-practices
React Three Fiber (R3F) and Poimandres ecosystem best practices. Use when writing, reviewing, or optimizing R3F code. Triggers on tasks involving @react-three/fiber, @react-three/drei, zustand, @react-three/postprocessing, @react-three/rapier, or leva.
dashboard-widgets
Author a dashboard widget — a small React component backed by named LangWatchQL queries — from a plain question. Discovers the analytics schema, writes the queries, writes the widget file, saves it, then proves it renders. Use when asked to build, prototype, or iterate on a custom chart widget, or to add a widget…
assistant-ui-primitives
Guide for assistant-ui UI primitives - ThreadPrimitive, ComposerPrimitive, MessagePrimitive. Use when customizing chat UI components.
create-site
Creates a new Power Pages code site (SPA) using React, Angular, Vue, or Astro. Guides through the full process from initial concept to deployed site: requirements discovery, scaffolding, component planning, design, implementation, validation, and deployment. Use when the user wants to create, build, or scaffold a new…