typescript-audit

Audits TypeScript projects for compiler strictness, type quality, and boundary validation.

3|5|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/BenSheridanEdwards/ArchitectPlaybook --skill typescript-audit-bensheridanedwards
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript-audit
Source: https://github.com/BenSheridanEdwards/ArchitectPlaybook/tree/main/typescript-audit
Command: npx skills add https://github.com/BenSheridanEdwards/ArchitectPlaybook --skill typescript-audit-bensheridanedwards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript codebases often accumulate unsafe patterns like any annotations, unchecked index access, and unvalidated network data that silently undermine type safety. This Skill audits a TypeScript project against an opinionated four-layer baseline and produces a structured findings report plus an optional implementation plan. ## Core Features & Use Cases - Four-layer audit: Grades compiler configuration (strict flags, module resolution), type quality in source (any, as, @ts-ignore, non-null assertions), type system usage (discriminated unions, branded types, utility types), and type safety at IO boundaries (network, JSON.parse, forms, storage, environment variables). - Static-first with optional enrichment: Runs read-only static analysis by default, with an opt-in --with-run mode that parses tsc --noEmit diagnostics for real error counts and locations. - Structured outputs: Writes findings.md, findings.json (schema 2.0.0), snapshot.md, and metadata.json to .architect-audits/typescript-audit/, then offers to generate a descriptive implementation plan. - Use Case: Run the audit on a legacy React/TypeScript app to discover that noUncheckedIndexedAccess is disabled and three files exceed the any threshold, then generate a plan listing the exact tsconfig flags to flip and files to clean up. ## Quick Start Ask the assistant to run /typescript-audit on this repository and summarize the top type-safety gaps.

Frequently Asked Questions about typescript-audit

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

FAQPage Schema
How do I audit TypeScript strictness in my project?▼

Run /typescript-audit from the project root. It resolves your tsconfig.json including any extends chain, checks strict-family flags like noUncheckedIndexedAccess and exactOptionalPropertyTypes, and reports each check as present, partial, missing, or violation.

How do I find all any types and type assertions in a TypeScript codebase?▼

The audit walks every .ts and .tsx file counting any annotations, as assertions (excluding as const), non-null assertions, @ts-ignore, and @ts-nocheck. Files exceeding per-file thresholds are flagged, and the top 10 offenders per pattern appear in the diagnostic snapshot.

Does the TypeScript audit modify my code or config?▼

No, the audit is fully read-only. It never edits tsconfig.json, installs packages, or refactors source. The optional implementation plan is descriptive Markdown only, and --with-run invokes tsc --noEmit which emits nothing.

What happens if typescript is not installed when using --with-run?▼

The audit records the failure, prints a notice suggesting /preflight --audit=typescript --install, and continues with static analysis. Run-dependent checks degrade to partial status with a recoveryHint recorded in findings.json.

Can I adjust the thresholds for any or as assertion counts?▼

Yes, use flags like --threshold-any-per-file=5, --threshold-as-per-file=10, --threshold-non-null-assertion-per-file=5, or --threshold-conditional-type-depth=4. Applied overrides are recorded in metadata.json so runs are reproducible.

Does the audit check runtime validation of API responses?▼

Yes, layer 4 checks whether network responses, JSON.parse results, form data, URL parameters, storage reads, and environment variables pass through a validator such as zod, valibot, arktype, io-ts, yup, joi, superstruct, or runtypes, or a type-safe layer like tRPC.