← Skills

Next.js / React

crucible-nextjs

Unusually strict, refactor-oriented code-quality review for Next.js / React / TypeScript projects — vertical-slice (feature-folder) architecture, outcome-oriented SOLID, structural simplification, server/client-boundary and RSC guidance. Use for PR review, "crucible", or when enforcing feature-slice structure on a Next.js repo. Install one crucible variant per repo, matched to its stack (sibling: crucible-blazor).

invocationmanual only
install leveluser — once via scripts/install-skills into ~/.claude/skills (Cursor reads the same directory; all projects); a repo can override it at .claude/skills/crucible-nextjs/
disable-model-invocationtrue
install (this skill)curl -fLo ~/.claude/skills/crucible-nextjs/SKILL.md --create-dirs https://vilya.jerrodtuck.com/skills/crucible-nextjs/SKILL.md

Body

Crucible Code Quality Review — Next.js / React

Strict, refactor-oriented review of the current branch's changes. Not a pass/fail gate — every finding names a concrete refactor. Be ambitious about structure: hunt for code-judo moves that preserve behavior while making the implementation dramatically simpler.

This is the Next.js / React instance of the crucible method. The method (below) is identical across stacks; only the two stack-specific sections — VSA for Next.js and React / RSC UI layer — differ. A sibling crucible-blazor swaps just those two.


The crucible method (identical in every stack variant)

Core prompt

Deep code-quality audit of the current branch's changes. Rethink structure to improve quality without changing behavior. Improve abstractions and modularity; reduce spaghetti; improve succinctness. Prefer deleting complexity over rearranging it. For every problem, propose the refactor.

How to report — severity, then the refactor

Do not emit a verdict. Emit findings, each tagged by severity and each carrying a concrete fix:

Each finding carries: where (file:line) · the smell · why it costs later · the refactor (the code-judo move — ideally deleting a branch/helper/mode rather than relocating it).

Close with a merge-readiness signalReady · Ready after blockers · Needs rework — and the top 1–3 refactors by leverage (biggest complexity delete first). The deliverable is the direction of the refactor, not a stamp.

SOLID — outcome-oriented (reinforces VSA, does not fight it)

Judge SOLID by outcomes, not ceremony. Do not reward wrappers or one-implementation abstractions for their own sake — that collides with the anti-wrapper rule. Real SOLID reduces reasons-to-change and isolates what varies; fake SOLID just adds indirection.

Structural non-negotiables (stack-neutral)

  1. Prefer the solution that makes the code feel inevitable — delete whole branches/helpers/modes.
  2. Don't push a file from under ~400 to over ~400 lines without a strong reason — decompose first. (React files bloat faster; the line is lower than a C# file's ~1k.)
  3. No random spaghetti growth — special cases earn their own abstraction.
  4. Bias toward cleaning the design, not accepting "it works."
  5. Prefer direct, boring code over magic.
  6. Thin wrappers / one-implementation hooks that add indirection without clarity are a smell.
  7. as any / as unknown as / silent catch-and-default papering over an unclear boundary is a smell.

VSA for Next.js — presumptive 🔴 blockers (stack-specific)

Blockers unless the author justifies clearly:

  1. Feature logic outside its slice — a feature owns its own folder (e.g. features/<slice>/ or a co-located route group) holding its UI, server actions / route handlers, and data access. Do not grow app-wide components/ / services/ / utils/ dumping grounds for feature logic.
  2. Cross-feature imports — one feature reaching into another feature's internals is forbidden. Depend on a feature's public entry (its index.ts) or lift the shared piece into shared/lib.
  3. Feature logic in the shared kernelshared/ / lib/ holds framework-agnostic primitives, contracts, and pure utilities only. No feature business rules, no data fetching for a feature there.
  4. Server/client boundary break — server-only code (secrets, DB clients, server-only modules, process.env secrets) imported into a client component. This is a 🔴 security boundary, not style.
  5. Cross-cutting concern welded into a component — auth, logging, rate-limiting, external IO belongs in middleware / a server action / a dedicated module, not inlined into JSX or a handler.
  6. Ad-hoc branching bolted onto an unrelated flow instead of a dedicated policy / handler / slice.

React / RSC UI layer — guidance, not blockers (stack-specific)

Non-blocking 🟡 review questions for the UI layer. Escalate one to 🔴 only when it breaks the server/client or data boundary (then it's a blocker on those grounds, not on React style):


Brownfield clause — repos mid-migration to feature slices

In a repo that did not start sliced (flat components/+pages/, or Pages Router being moved to App Router) and is being migrated incrementally:


Primary review questions

Output order

  1. 🔴 Server/client boundary & security breaks
  2. 🔴 Structural regressions / VSA violations (new & modified code)
  3. 🟠 Missed dramatic simplification
  4. 🟠 Spaghetti / branching growth
  5. 🔴/🟠 Type-contract problems (as any, unsafe casts)
  6. 🟠 File-size / decomposition
  7. 🟡 React / RSC UI-layer guidance
  8. 🟡 Legacy migration candidates (brownfield repos)
  9. Merge-readiness signal + top refactors by leverage

The bar (refactor lens, not a rubber stamp)

Correct behavior is not enough. Withhold Ready while any of these stand:

Good phrases:

Version history

No git history yet — commit this skill to the repo and versions appear here automatically.