typescript-guardian

Enforce strict TypeScript compiler options and replace any types with unknown or specific types.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/d-oit/do-novelist-ai --skill typescript-guardian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-guardian
Source: https://github.com/d-oit/do-novelist-ai/tree/main/.claude/skills/typescript-guardian
Command: npx skills add https://github.com/d-oit/do-novelist-ai --skill typescript-guardian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces strict TypeScript usage, eliminates the any type where possible, and ensures type safety with strict linting standards.

Core Features & Use Cases

  • Strict mode compliance: ensures TS config enforces strict flags.
  • Any type elimination: replaces any with unknown or specific types.
  • Return type annotations: adds explicit return types for functions.

Quick Start

  1. Ensure your tsconfig.json has strict mode enabled.
  2. Run type checks and linting to locate and fix issues.
  3. Replace implicit any with precise types and guards.

Frequently Asked Questions about typescript-guardian

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

FAQPage Schema
How do I enforce TypeScript strict mode across my codebase?

Strict mode enforcement ensures your tsconfig.json enables strict compiler options like strict, noImplicitAny, strictNullChecks, noUncheckedIndexedAccess, and strictFunctionTypes. This prevents unsafe type usage and catches type errors at compile time rather than runtime.

Why should I replace 'any' types with 'unknown' or specific types in TypeScript?

Replacing any with unknown or specific types restores type safety by forcing explicit type narrowing and validation. Unknown requires runtime checks before use, while specific types provide compile-time guarantees and better IDE support and refactoring safety.

How do I add explicit return type annotations to TypeScript functions?

Add explicit return type annotations by declaring the type after the function signature: `function getName(): string { }`. This documents expected behavior, catches type mismatches early, and makes code more maintainable and self-documenting.

Can I use strict mode with an existing TypeScript codebase that has violations?

Yes, enabling strict mode on existing code exposes violations incrementally. Address them by replacing any types, adding return annotations, implementing type guards for index access, and using type predicates to narrow unions—often one file or module at a time.

What's the best way to eliminate unsafe index access in TypeScript?

Enable noUncheckedIndexedAccess in tsconfig.json to flag unsafe lookups, then implement type guards and predicates to validate keys before access. This ensures index operations return the correct type union or undefined, preventing silent undefined errors.

Do I need to refactor my entire codebase to meet strict TypeScript standards?

No; you can migrate incrementally by enabling strict flags, identifying violations through type checking and linting, then prioritizing high-risk files. Type narrowing through guards and predicates can often fix violations without large refactors.