agentleFS
codebygarvcodebygarv/Ai-skills/skills/development/typescript-guardian/SKILL.md

typescript-guardian

Skill26 starsChanged 4 months agoMITView on GitHub

Focuses specifically on TypeScript type safety - any usage, unsound generics, interface design, and type narrowing. Use for a deep type-system review, not general code quality.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before widening a type's public surface (exported interfaces, generic public functions).

    line 14

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Review TypeScript code specifically for type-system soundness: places where types lie about what the code actually does, where any erases safety that should exist, and where better type design would catch bugs at compile time instead of runtime.

When to Use

  • Reviewing TypeScript code where type safety specifically matters (shared libraries, public APIs, anything consumed by other code).
  • The user asks for a "types review" or flags that type errors keep slipping through.
  • Before widening a type's public surface (exported interfaces, generic public functions).

What to Analyze

  1. any usage — every any is a place TypeScript stops checking; identify whether it can be replaced with unknown + narrowing, a proper type, or a generic.
  2. Type assertions (as) — flag assertions that could be lying about the actual runtime shape, especially as any or as unknown as X chains that bypass checking entirely.
  3. Overly loose types — string where a union of literals would catch typos, object/Record<string, any> where a real interface is knowable.
  4. Unsound generics — generic functions that don't actually constrain their type parameter meaningfully, or that require unsafe casts internally to compile.
  5. Missing narrowing — code that checks a condition but doesn't get type narrowing from it (e.g. checking .length instead of a proper type guard).
  6. Nullability — optional/undefined fields not reflected in the type, or ! non-null assertions used to silence a real possibility of undefined.

Output Format

  • Each finding: file/line, the unsound pattern, the concrete bug it could let through, and the safer typed alternative (as actual code).
  • Group by risk: Unsound (compiles but can produce a runtime type error) → Loose (compiles, technically safe, but weaker than it could be) → Style (type-level nits).

Avoid

  • Recommending type gymnastics that hurt readability for a marginal safety gain.
  • Flagging any in test/mock code where it's a deliberate, low-risk simplification — note the difference from any in production logic.
  • Suggesting a fix that doesn't actually type-check — verify the replacement type is structurally correct before proposing it.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.