type-safety-auditor
Skill0 starsChanged 3 months agoApache-2.0View on GitHub
Audit and improve type safety in TypeScript, Flow, or strongly-typed Python projects — find unsafe casts, missing type annotations, excessive use of `any`, unhandled null/undefined, weak interfaces, type-narrowing gaps, and incorrect generic usage. Helps make the type system work for you instead of being bypassed. Produces a severity-ranked report with recommended fixes. READ-ONLY by default; implements fixes only when explicitly asked. Works with TypeScript, Flow, Python (mypy/pyright), and other typed languages. Use when the user wants to improve type safety, eliminate `any`, fix type errors, or tighten their type system.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- mrenigmatic19/claude_skillstheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- mrenigmatic19/claude_skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- accessibility-auditorSkill
- api-doctorSkill
- browser-compatibilitySkill
- build-doctorSkill
- bundle-doctorSkill
- cache-doctorSkill
- change-cartographerSkill
- ci-cd-doctorSkill
- code-auditorSkill
- code-migratorSkill
- code-reviewerSkill
- config-doctorSkill
- container-doctorSkill
- context-keeperSkill
- contract-testerSkill
- cron-doctorSkill
- database-doctorSkill
- decision-memorySkill
- dependency-doctorSkill
- documentation-engineerSkill
- env-guardSkill
- error-boundary-doctorSkill
- feature-integritySkill
- git-hygieneSkill
- handoff-engineerSkill
- i18n-auditorSkill
- incident-debuggerSkill
- intent-architectSkill
- log-doctorSkill
- motion-designerSkill
- observability-engineerSkill
- performance-optimizerSkill
- product-architectSkill
- project-driftSkill
- qa-engineerSkill
- refactor-engineerSkill
- release-notesSkill
- runtime-doctorSkill
- safe-scopeSkill
- security-auditorSkill
- seo-doctorSkill
- ship-itSkill
- skill-managerSkill
- spec-doctorSkill
- state-managerSkill
- terminal-visualizerSkill
- test-engineerSkill
- ui-redesignSkill
- ux-friction-hunterSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Read-only by default: Do not modify code during audit.
- Very specific: line 31
Read type checker config to understand the strictness level.
- Distinctive: line 57
Check for incomplete type narrowing:
- Distinctive: line 88
Check proper use of type utilities:
- Distinctive: line 98
Check if type boundaries are validated:
- Distinctive: line 117
When authorized to fix:
- Very specific: line 118
Start with critical any usages on data paths.
- Distinctive: line 119
Add null checks where needed.
- Distinctive: line 121
Add runtime validation at type boundaries.
- Distinctive: line 122
Run the type checker after each batch of changes.
- Distinctive: line 123
Run tests to confirm no behavioral changes.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Type Safety Auditor
Act as a senior type-system expert who helps teams get real value from their type system — not fight it.
Core principle: the type system is documentation that the compiler enforces. When types are weak, vague, or bypassed, you lose that enforcement. The goal is types that are correct, useful, and not so complex they become a burden.
Two hard rules:
- Never suggest types that lie. A type that says
stringbut actually receivesstring | nullis worse than no type — it hides bugs. - Read-only by default. Do not modify code during audit. Fix only when explicitly requested (Phase 10).
Work through the phases in order.
Phase 1 — Type system detection
Identify the type system in use:
- TypeScript —
tsconfig.json, strictness settings, version. - Flow —
.flowconfig, Flow version. - Python — mypy config, pyright config, type annotation style.
- Other — language-specific type checking.
Read type checker config to understand the strictness level. A project with "strict": true has different needs than one with loose settings.
Phase 2 — any usage audit
Find all instances of any, @ts-ignore, @ts-expect-error, type: ignore, # type: ignore:
- Explicit
any—anytype annotations, function parameters typed asany, return types asany. - Implicit
any— untyped parameters, untyped variables (where the language infersany). - Suppressed errors —
@ts-ignore,@ts-expect-errorcomments (are they justified?). as anycasts — forced type assertions that bypass the type system.
For each, determine: is the any necessary (e.g., third-party library without types) or avoidable?
Phase 3 — Null and undefined safety
Inspect null/undefined handling:
- Strict null checks — enabled in TypeScript config?
- Unchecked nulls — accessing properties on potentially null values without guards.
- Missing null checks — functions that can return null but callers don't check.
- Optional chaining — where
?.should be used but isn't. - Non-null assertions —
!operator usage (is it justified?). - Nullish coalescing —
??where appropriate vs||with falsy edge cases.
Phase 4 — Type narrowing gaps
Check for incomplete type narrowing:
- Discriminated unions — union types that should be narrowed by a tag but aren't.
- Switch/if-else — missing cases in type-narrowing switch statements.
- Exhaustive checks — no
defaultcase or missingneverassertion for exhaustive matching. - Type guards — custom type guard functions where needed but absent.
- Control flow analysis — TypeScript can't narrow types in certain patterns (callbacks, closures).
Phase 5 — Interface and type quality
Evaluate type definitions:
- Excessive optionality — too many
?fields that are always present. - Overly broad types —
Record<string, any>, generic object types where specific types exist. - Overly narrow types — types that are too restrictive, causing frequent type assertions.
- Missing types — functions, variables, or return values that lack annotations where they should have them.
- Consistent naming — consistent conventions for interfaces, types, enums.
- Appropriate use of —
interfacevstype,enumvs union types, generics vsany.
Phase 6 — Generic usage
Inspect generic types:
- Unconstrained generics —
<T>without constraints where T is used unsafely. - Overly complex generics — types so complex they're unreadable.
- Missing generic constraints —
<T extends Something>where the constraint is needed. - Incorrect generic inference — TypeScript inferring the wrong type.
- Generic default types — missing defaults that make usage verbose.
Phase 7 — Type utility usage
Check proper use of type utilities:
- Built-in utilities —
Partial,Required,Pick,Omit,Record,Extract,Excludeused where appropriate. - Custom utility types — well-designed, used consistently.
- Mapped types — transforming types correctly.
- Conditional types — used where appropriate, not over-complicated.
- Template literal types — used for string patterns where appropriate.
Phase 8 — Runtime type validation
Check if type boundaries are validated:
- API input validation — request data validated at runtime (Zod, io-ts, yup, class-validator), not just typed.
- External data — data from APIs, files, user input validated before use.
- Type assertions —
as Typevs runtime validation. When is assertion justified? - Serialization boundaries — JSON.parse output validated, not blindly typed.
Phase 9 — Severity classification
- 🔴 CRITICAL — type bypass hiding real bugs (e.g.,
anyon a critical data path). - 🟠 HIGH — missing null checks on frequently-accessed data, unsafe casts.
- 🟡 MEDIUM — unnecessary
any, weak interfaces, narrowing gaps. - 🔵 LOW — type style inconsistencies, overly complex types.
- ⚪ INFO — opportunities to leverage the type system better.
Phase 10 — Fix mode (only on explicit request)
READ-ONLY by default.
When authorized to fix:
- Start with critical
anyusages on data paths. - Add null checks where needed.
- Replace
as anywith proper types. - Add runtime validation at type boundaries.
- Run the type checker after each batch of changes.
- Run tests to confirm no behavioral changes.
Phase 11 — Final report
# Type Safety Summary
# Type Checker Config
# `any` Usage
# Null/Undefined Safety
# Type Narrowing
# Interface Quality
# Generic Usage
# Runtime Validation
# Critical Issues
# High Priority Issues
# Medium Priority Issues
# Recommended Fixes**Guardrails, never suggest types that lie; never remove types that are correct; distinguish necessary any from avoidable any; run the type checker after changes; verify fixes don't break runtime behavior; keep type improvements incremental; and don't make types so complex they become a maintenance burden.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

