← LeaderboardThe Skill Leaderboard

react-doctor-verified-cleanup

Fix verified React Doctor findings. Reproduce effect bugs, profile expensive updates, and confirm entry points before removing dead modules.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: react-doctor-verified-cleanupdescription: Fix verified React Doctor findings. Reproduce effect bugs, profile expensive updates, and confirm entry points before removing dead modules.category: developmentrisk: criticalsource: selfsource_type: selfdate_added: "2026-12-02"author: ShianMiketags: [react, react-doctor, performance, effects, dead-code]

React Doctor Verified Cleanup

When to Use

  • A user asks to run React Doctor and fix confirmed issues in a React package.
  • An effect causes stale state, extra commits, or a lifecycle bug.
  • An unused module or export needs reachability checks before removal.

Prerequisites

  • The intended application or workspace package, its entry points, and its normal test and build commands.
  • The repository's React Doctor version and configuration. Check the installed CLI flags before using a command from a different version.
  • A reproducible interaction or failing test for behavior and performance work.

1. Capture a comparable baseline

  • Run in the intended project root. Record tool version, selected project, scope, active configuration, and diagnostics by file and rule.
  • Use a full baseline for repository cleanup. Use changed or contextual scopes during focused edits according to whether you need new findings or findings in edited code.
  • Prefer JSON for comparison. Check that React was detected, the scan completed, and the relevant source files were included. An advisory exit code can accompany findings.
  • With a locally installed CLI that supports the flags, the following command keeps scoring and supply-chain requests out of the scan.
npm exec --offline -- react-doctor . --scope full --json --no-score --no-supply-chain --blocking none

2. Repair effects and measure the interaction

  • Trace the effect's inputs and destination. Derive pure values from props and state during render. Handle work tied to a specific interaction in that event handler.
  • Keep synchronization with subscriptions, timers, network requests, or browser APIs where the lifecycle requires it. Verify complete dependencies, cleanup, and stale-response handling as applicable.
  • Reproduce the stale output or extra commit and assert the app's observable result after the change.
  • Capture the same interaction before and after a performance edit. Use React Profiler or the project's existing tooling to test a specific hypothesis. Compare commit counts, render work, or a relevant bundle metric before claiming a speedup.

3. Prove a dead-code candidate

  • React Doctor's unused-file and unused-export graph rules are opt-in and require a full scan in the documented versions. Check that the active config enables the required rule.
  • Check how the framework discovers routes and entries. Trace imports, aliases, lazy imports, globs, package exports, test and build scripts, generated entry points, and external consumers relevant to the candidate.
  • Use the repository's dead-code tool or configure explicit entries in a scratch Knip run when React Doctor's graph coverage is insufficient. Treat an empty report as evidence only within the analyzer's verified scope.
  • Remove confirmed orphan files or exports in small groups. Run the build and exercise any adjacent route, plugin, package export, or lazy entry that must still work.

4. Verify completion

  • Rerun the original scan with the same project, version, scope, and rule settings. Run affected behavior tests and applicable lint, typecheck, and build commands.
  • Finish when confirmed findings in scope are resolved and the applicable checks pass. Report remaining findings with the evidence, missing coverage, or decision that prevents a fix.
  • Keep settings and exclusions comparable across the two runs. Record what changed in the diagnostic counts and what behavior was exercised.

Example

Run Verify an effect fix and remove an orphan. It checks a stale commit, confirms an orphan with a second analyzer, and verifies a lazy entry still works after removal.

Limitations

  • Static diagnostics identify candidates. Runtime behavior, external consumers, and incomplete graph coverage need direct evidence.
  • The fixture measures development commits in a simulated DOM. Collect an appropriate profile before reporting production timings.

Safety and Side Effects

  • Run the example in an empty scratch directory. It installs pinned packages locally, writes JSON reports, and moves one disposable fixture file out of the app.
  • Real cleanup edits source and can remove files or exports. Verify reachability before removal and keep locally collected reports within the project's data-handling rules.

Related Skills and Documentation