code-quality-audit

Audits TypeScript and TSX code for any usage, dead exports, oversized files, long functions, and circular dependencies.

5|9|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/ajenchen/design-system --skill code-quality-audit-ajenchen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-quality-audit
Source: https://github.com/ajenchen/design-system/tree/main/.agents/skills/code-quality-audit
Command: npx skills add https://github.com/ajenchen/design-system --skill code-quality-audit-ajenchen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript and TSX codebases accumulate clean-code violations—any type abuse, dead exports, oversized files, overly long functions, and circular dependencies—that no design-system audit dimension covers. This Skill quantifies those hygiene issues with severity-ranked findings so teams can enforce code quality at every stage of component development. ## Core Features & Use Cases - Six Quantified Checks: Detects any usage (with // any-allow: escape hatch), file size over 500/800-line budgets, functions over 80 lines, dead exports, and circular dependencies via DFS import-graph analysis, each mapped to P0/P1 severity. - Flexible Scoping: Run against the full repo (scope=all), only changed files (scope=changed), or a single component (scope=component:<Name>) for daily, release, or focused audits. - CI and Workflow Integration: Chains automatically from design-system audits, component quality gates, and new-component workflows, and runs as a CI gate where P0 violations exit with code 1. - Use Case: Before shipping a new React component, run the audit scoped to that component to catch a 900-line file and an untyped as any cast, then remediate before the ship phase completes. ## Quick Start Ask the AI to run a code quality audit with scope=changed on the current git diff and triage the findings by severity.

Frequently Asked Questions about code-quality-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit TypeScript code for any-type usage?

Run the audit script, which greps for patterns like `: any`, `as any`, `<any>`, `any[]`, and `Record<X, any>` across your source files. Legitimate cases can be exempted by adding a `// any-allow: {rationale}` comment on the same or previous line.

How to detect circular dependencies in a TypeScript project?

The audit builds an import graph of your source files and runs depth-first search to find cycles, reporting them as P0 violations. Circular dependency remediation is treated as an engineering decision handled during the triage workflow.

What file size limits should React TSX components follow?

This audit flags TSX files over 500 lines as P1 and over 800 lines as P0, based on the budget defined in the audit script. Files exceeding the P0 threshold typically require architectural splitting of the component.

Can I run a code quality audit only on changed files?

Yes, use the scope=changed option to audit only files in the current git diff, which is the recommended daily workflow. Other scopes include scope=all for release audits and scope=component:<Name> for focused reviews.

Does the audit fail CI builds on violations?

Yes, running the audit script with the --check flag makes it exit with code 1 when any P0 violation is found, so it can gate CI pipelines. P1 findings are reported for triage without blocking the build.

Why are magic numbers not checked by this code audit?

Magic number enforcement is delegated to a separate token hygiene layer that handles primitive colors, shadows, and Tailwind v4 arbitrary values. This audit intentionally avoids duplicating that orthogonal token-discipline coverage.