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 Phaedra-Solutions/cursor-rules --skill migrate-class-to-hooksgit clone --depth 1 https://github.com/Phaedra-Solutions/cursor-rulesWrote 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/phaedra-solutions/cursor-rules/migrate-class-to-hooks)<a href="https://agentmods.dev/skills/phaedra-solutions/cursor-rules/migrate-class-to-hooks"><img src="https://agentmods.dev/badge/skills/phaedra-solutions/cursor-rules/migrate-class-to-hooks/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/phaedra-solutions/cursor-rules/migrate-class-to-hooks"><img src="https://agentmods.dev/badge/skills/phaedra-solutions/cursor-rules/migrate-class-to-hooks.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.00111 | $0.01027 |
| Opus 5.5 | $0.00044 | $0.00411 |
| Sonnet 5.5 | $0.00022 | $0.00205 |
| Haiku 4.5 | $0.00011 | $0.00103 |
Grade A, and why
migrate-class-to-hooks 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 3d 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 — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Migrate class components → hooks
When to use
- The user asks to convert class components, or a class component needs substantial changes anyway.
- React is 16.8 or newer (hooks exist). Error boundaries stay classes (there's no hook equivalent).
Before you start
- Pick the scope with the user: one component (default), a feature folder, or leaf components first across the app. Never the whole app in one change.
- Read the component, its parents and tests. Note lifecycle methods,
setStatecallbacks, instance fields, refs, context (contextType,Consumer), HOCs (connect,withRouter) andgetDerivedStateFromProps. - Working tree clean; new branch.
Steps
- Characterization tests: if the component lacks tests, add Testing Library tests for its visible behavior (render output, user interactions, calls to props and APIs) and make them pass on the class version first.
- Convert the shell:
class X extends Component→function X(props)(or a typed arrow function per house style); destructure props; movedefaultPropsto default parameter values. - State: each independent
this.statefield →useState; related fields or complex transitions →useReducer. Replacethis.setState(prev => …)with functional updates.setState(…, callback)→ do the follow-up in the event handler or an effect keyed on that state. - Lifecycle:
- work that responds to a user action → the event handler, not an effect;
- derived data → compute during render (
useMemoonly if measured slow, or let React Compiler handle it); - subscriptions, timers, DOM integrations:
componentDidMount+componentWillUnmount→ oneuseEffectwith cleanup; componentDidUpdate(prevProps)comparisons →useEffectwith those values as dependencies;getDerivedStateFromProps→ derive during render, or reset state with akeyon the component;shouldComponentUpdate/PureComponent→memo()only if needed. Include every value the effect uses in its dependency array; don't silencereact-hooks/exhaustive-deps.
- Instance fields and refs: mutable instance fields (
this.timer) →useRef;createRef→useRef; callback refs stay callback refs;forwardRefonly on React < 19 (19 passesrefas a prop). - Context and HOCs:
static contextType/Consumer→useContext;connect(mapState, mapDispatch)→useSelector/useDispatch(keep selectors memoized);withRouter→ the router's hooks (useNavigate,useParams). - Run the tests, fix differences, and check effects don't run twice incorrectly under
StrictMode(cleanup must undo setup). - Verify (next section); show the diff and results; commit only when asked (
git-commitskill).
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.
- 3d ago First seen · 59 lines · 111 tokens per session scan A 46a030bade58
migrate-class-to-hooks is a skill published in the GitHub repository Phaedra-Solutions/cursor-rules (4 stars, last pushed 2d ago), licensed MIT. It adds 111 tokens to every session and 1,027 once invoked, about $0.0004 per session on Opus 5.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-11-01.
Other skills, from other repositories
react-web
React web development with hooks, React Query, Zustand.
property-testing
Write and review property-based tests for pure logic with Hegel (Rust, Go, C++, TypeScript, Java, OCaml) or Hypothesis (Python). Covers when a property test is required, the property catalog, verified package pins, seed replay, the failing-example database, CI behaviour, and pinning a shrunk failure as a regression…
browser-qa
Test live web interfaces with browser automation for smoke failures, interactions, visual regressions, responsive behavior, and accessibility. Use after frontend changes or deployments, during UI review, and before shipping critical user journeys.
bun-runtime
Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.
frontend-ux-engineer
Use for frontend features, Next.js/React/Vue/Svelte UI, accessibility, responsive layout, design polish, state handling, forms, visual QA, or product workflow improvements.
nextjs-fullstack
Use for Next.js App Router, React Server Components, server actions, API routes, auth, database integration, caching, deployment, or full-stack product features.