type-system-audit
Type-System Audit
Audit a repository for type-system weaknesses using bug-fix commits as hard evidence—not speculation. Identify which types allowed invalid states that caused real bugs, and recommend stricter types that would prevent entire defect classes. All findings are tied to specific commits for credibility.
Workflow
Phase 1: Identify Language and Type System
Determine the primary language(s) and type system in use. Use the table below to adapt the audit approach:
| Language | Nullability patterns | Sum types | Boundary validation | File extensions |
|---|---|---|---|---|
| TypeScript | T | null | undefined, optional chaining |
Discriminated unions, literal types | zod, io-ts, yup |
.ts, .tsx |
| Swift | Optional<T> / ?, force-unwrap ! |
enum with associated values |
Codable, custom init |
.swift |
| Kotlin | T?, !!, null-safe operators |
sealed class / when |
@Serializable, require() |
.kt |
| Python | Optional[T], None checks |
Union, Literal, TypedDict |
pydantic, attrs |
.py, .pyi |
Phase 2: Commit Selection
More from ravnhq/ai-toolkit
core-coding-standards
Universal code quality rules — KISS, DRY, clean code, code review. Base
81promptify
Transform user requests into detailed, precise prompts for AI models.
66lang-typescript
TypeScript language patterns and type safety rules — strict mode, no
53tech-react
React 19 patterns for components, hooks, Server Components, and data
52design-frontend
Visual design system patterns for web UIs. Tailwind CSS v4 design tokens
43platform-backend
Server-side architecture and security — API design, error handling, validation,
39