SkilVaultSign inStart free

Catalogue / js-ts-quality-review

js-ts-quality-review

Older skill: source not recordedSignedReviews JavaScript and TypeScript code for quality defects by combining the project's own read-only tooling with context-checked manual reading: type diagnostics and suppression comments, oversized files and functions, nesting depth, async paths that drop rejections, duplicate logic, and misleading…
---
name: js-ts-quality-review
description: >
  Reviews JavaScript and TypeScript code for quality defects by combining
  the project's own read-only tooling with context-checked manual reading:
  type diagnostics and suppression comments, oversized files and functions,
  nesting depth, async paths that drop rejections, duplicate logic, and
  misleading names. Each candidate signal is confirmed against its
  surroundings and ranked critical, high, medium, or nitpick by
  consequence, with async rejection paths traced to their callers and
  unused public exports checked for outside consumers before high severity.
  Routes Zod schema and Vitest configuration areas to dedicated skills when
  available, with fallback checks included. Use when the user asks to
  review, audit, critique, or triage JS or TS quality before a merge or
  cleanup. Not for applying fixes, effort estimates, other languages,
  builds, deployments, or output formatting.
license: MIT
---

JS/TS Quality Review

Your contract

Investigate the code, verify what you find, rank it, and hand over evidence. You never repair anything. Whoever invoked you decides how findings are presented and what happens next: if a report shape was specified, adopt it; if not, keep your output plain and invent no required format of your own.

Hard limits inside your own workflow:

  • Do not modify, create, move, or delete any file, and never invoke a linter or formatter in its autofix mode; every command you run must leave the working tree untouched.
  • Do not install, download, or fetch any tool to enable a missing check. Record the gap and cover that check by reading instead.
  • Before running a package script, skim its definition in package.json; if it builds, writes files, or talks to a network, skip it and call the underlying tool directly with read-only flags.

Settle scope and toolbox

If the user named files, directories, or a diff, that is your scope. Otherwise derive it: the entry points declared in package.json plus the main source tree, and state which you chose.

Read package.json and the config files to learn which tooling exists — linter, TypeScript, an unused-export scanner. Prefer machine output wherever it exists, because it returns exact positions you can verify later; every check without a backing tool you perform yourself during the reading pass.

Gather machine signals

Run available tools in read-only form, and for the tool-less signals run searches like these, adjusting paths to your scope:

grep -rnwE "TODO|FIXME|HACK" app lib --include="*.ts" --include="*.tsx"
grep -rnE "console\.(log|debug|info|trace)|\bdebugger\b" app lib --include="*.ts"
grep -rnE "\bawait\b|\.then\(|new Promise" app lib --include="*.ts" --include="*.tsx"
grep -rnE "@ts-ignore|@ts-expect-error|as any" app lib --include="*.ts"
find app lib -name "*.ts" -print0 | xargs -0 wc -l | sort -rn | head -15

Record the following per signal class:

| Signal | Machine source when present | Otherwise | What to note down | | --- | --- | --- | --- | | Lint | repo's linter, no fix flags | — | rule name plus file and line per hit | | Types | compiler in check-only mode | — | each diagnostic with its position | | Unused exports / deps | the repo's dead-code scanner | search the repo for each export's name | candidates only, never verdicts | | Async sites | — | the await and promise search | call sites to trace during reading | | Suppressions | — | the suppression search | each hit plus any explanatory comment | | Work markers | — | the marker search | the marker and its surrounding sentence | | Debug logging | — | the logging search | hit, line, and what it prints | | File size | — | line counts | files at 500 lines or beyond, largest first |

Every row is a lead. Nothing here is a finding yet.

Read and judge

Open the flagged files plus whatever the user pointed at, and settle five questions. Searches surface candidates; only reading answers the questions.

1 — Does the code hold together typewise? Diagnostics that stop compilation are already critical. Then weigh each suppression on its own facts, because a suppression is not automatically a defect. A cast of an external response to an unvalidated loose type sits on a trust boundary and earns medium to high. A commented expect-error covering a known library type gap inside a test fixture is a nitpick. Flag stale suppressions as well: one whose removal would change nothing is dead weight.

2 — What happens when something fails? Never label a missing local catch as unhandled from the call site alone. Trace the rejection upward first: the enclosing function may return the promise to a caller that catches it, hand it to framework error middleware, or sit under a test asserting rejection. Handling is genuinely absent only when the rejection can escape into a fire-and-forget path — a floating await in an event handler, a then-chain with no rejection leg. Then weigh blast radius: an escaped rejection on a payment write is high; a prefetch whose failure merely leaves a cache cold is a nitpick.

3 — What does the next editor pay? Three triggers, each needing confirmation, plus naming:

  • Functions around 50 lines or more: count the distinct jobs inside. A 63-line reconcileLedger doing one reconciliation pass is a note; the same length mixing parsing, rounding, and persistence is a finding.
  • Nesting four levels or deeper. Get the arithmetic right for the file's indent width: at four spaces per level, the fourth level begins at sixteen spaces of indentation; at two spaces per level, eight. Worth citing concretely: in tenantMapper.ts a permission check sits inside a loop inside a try inside a conditional — sixteen spaces at four-wide formatting — and no test reaches it.
  • Duplication of five or more similar lines appearing twice is a candidate; severity follows drift risk. Two copies of a rounding rule diverge silently; two copies of a log banner do not.
  • Names: misleading outranks vague. resetTrial that actually extends the trial, usrCfgMngr, tmp2.

4 — Is the work finished? Markers and stray logging both demand context, not counting. Read the lines around each TODO, FIXME, or HACK: a HACK in front of a stubbed safety check is a raised finding; a TODO with an issue reference and a recent date gets recorded and left alone. For each logging hit, decide leftover versus intentional: a raw log of request bodies is a probable data leak and rises to medium or above, while structured logging through the project's logger is usually fine. A debugger statement reachable from production code paths is medium at minimum.

5 — Is anything actually unused? For each candidate export, search the whole repository for imports of the name, then check the export map in package.json, sibling packages in the workspace, documentation, and story files. Only then weigh severity, and weigh external consumers explicitly: an export unused internally but shipped in a published package's public API may have consumers you cannot see, so report it as a removal candidate for the owner to confirm — never as a high-severity defect on internal evidence alone. Internal-only, provably unconsumed code is a straightforward medium.

Rank by consequence

Severity is a claim about consequence, so run each verified finding through this ladder instead of matching patterns to a list:

| Rank | Test to apply | Where verified findings usually land | | --- | --- | --- | | critical | the code cannot compile or typecheck, or a defect guarantees failure on a main path | unresolved diagnostics; argument errors repeated at every call site | | high | a plausible production failure, an unsafe trust boundary, or a confirmed breaking-change decision | escaped rejection on a write path; unvalidated cast of external data; removing a published export only after consumers are verified | | medium | real cost or risk if left alone | a 512-line file mixing three domains; sixteen-space nesting on a hot path; a stale unowned marker guarding a stub; payload logging | | nitpick | polish | style-only lint; vague but harmless names; justified suppressions in fixtures |

No signal owns a fixed row. The same marker lands in different rows depending on question 4; the same 60-line function, on question 3. When signals pile onto one file, raise its place in your list and state which facts combined — for instance, the 512-line file that also holds the escaped rejection and three stale markers.

Specialized areas

Two areas have dedicated reviews; route before you improvise.

  • Zod schemas and runtime validation: if a schema-pattern review skill is installed alongside this one, hand those files to it and keep only the severity decision. Without one, check the basics yourself — schemas widening to a catch-all type at a boundary instead of describing the shape, catch-alls that accept anything, unions missing the error branch, and refinements that discard the real message.
  • Vitest configuration: if a dedicated Vitest-review skill exists, route vitest.config files to it. Otherwise compare each option against the installed version's current documentation: flag keys its release notes call deprecated, major-version mismatches between vitest and its companion packages, and options pointing at files that are absent.

Before you report

  • Read every cited line. A search hit inside a comment, fixture, or string literal is not a finding.
  • Keep the evidence: path, line, the fact that decided the severity, and a short quote or paraphrase of the code.
  • Do not estimate effort, story points, or fix duration; one guessed number weakens everything else you report.
  • Deliver findings in whatever shape the caller asked for, or plainly when nothing was specified.

What this skill leaves out

It does not apply fixes, size repairs, or run builds and deployments. Because it ships as a single file, the analysis scripts bundled with the original workflow are replaced by the inline read-only searches above.

License note

This skill rewrites an MIT-licensed community skill from the djankies/claude-configs repository; those terms carry over to this derivative.