More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Typelock: type safety that stays switched on

    1

    Replaces `as any` with type guards, schema parses, satisfies and unknown. Audits a folder for unsafe casts and fixes them in order of risk until tsc passes.

    Free

    Security scanned
    Typelock: type safety that stays switched on

    Typelock: type safety that stays switched on

    Example session with this skill installed

    Audit the src/api folder for unsafe types and fix the high risk findings.

    • Read your context and instructions
    • Compiled the typelock

    I have audited the src/api folder for type-safety violations. I found 3 high-risk findings related to boundary data and 1 medium-risk finding in a utility function.

    TypeScript Audit Results

    RiskLocationFindingRecommended Fix
    Highsrc/api/client.ts:22res.json() as anyUse UserSchema.parse()
    Highsrc/api/config.ts:5process.env.API_URL!Add explicit null check and throw
    Highsrc/api/transform.ts:12data: any parameterChange to unknown and narrow
    Mediumsrc/api/utils.ts:45// @ts-ignoreReplace with @ts-expect-error

    I have applied fixes for the high-risk items. The any cast in the client has been replaced with a Zod schema parse, and the environment variable access now includes a runtime validation check.

    // src/api/client.ts refactored
    import { UserSchema } from "./schemas";
    
    export async function fetchUser(id: string) {
      const response = await fetch(`/api/users/${id}`);
      const json = await response.json();
      // Fixed: Replaced 'as any' with schema validation
      return UserSchema.parse(json);
    }
    
    // src/api/config.ts refactored
    const rawUrl = process.env.API_URL;
    if (!rawUrl) {
      throw new Error("Missing required environment variable: API_URL");
    }
    export const API_URL = rawUrl;
    

    Next steps

    1. Review the generated Zod schema in src/api/schemas.ts to ensure it matches the latest API spec.
    2. Run npm run typecheck to verify the medium-risk fixes don't conflict with global types.
    3. Decide if noUncheckedIndexedAccess should be enabled in tsconfig.json.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A single as any cast can silence errors across an entire call chain, hiding bugs that only appear at runtime. This skill enforces TypeScript type safety by replacing unsafe casts and non-null assertions with verifiable compiler checks.

    What it does

    • Eliminates any casts by swapping them for type guards, satisfies operators, or exhaustive never checks.
    • Validates data boundaries using the project's existing schema libraries like Zod or Valibot to parse external inputs.
    • Audits codebases to find and rank type-safety risks in files or folders, prioritizing API boundaries and shared utilities.
    • Refactors unsafe patterns such as non-null assertions and @ts-ignore comments into safer alternatives like narrowing or @ts-expect-error.
    • Recommends strict configurations one flag at a time, such as like noUncheckedIndexedAccess and exactOptionalPropertyTypes.

    How it works

    1. Context discovery: The skill analyzes the project's stack, package.json, and tsconfig.json to identify existing validation libraries and strictness levels.
    2. Audit execution: Run audit <path> to generate a prioritized list of type-safety violations ranked by risk level.
    3. Refactor and verify: The skill applies fixes in batches, running tsc --noEmit after each change to ensure no new errors are introduced.

    Frameworks & tools

    Works with any TypeScript project. It integrates with validation libraries like Zod and Valibot, and utilizes standard TypeScript features like satisfies, unknown, and type predicates.

    Why this beats prompting it yourself

    Generic prompts often replace as any with as unknown as T, which just moves the problem. This skill follows a specific hierarchy of safety, forcing runtime validation at boundaries and narrowing within local logic to ensure types actually match reality.

    Use cases

    • Refactoring a legacy TypeScript codebase to enable strict mode.
    • Sanitizing API responses and environment variables to prevent runtime crashes.
    • Removing non-null assertions from complex logic chains to handle edge cases safely.
    • Implementing exhaustive switch-case checks to prevent bugs when adding new union members.

    Known limitations

    Does not add new heavy dependencies for validation. Casts that are truly unavoidable in third-party glue code are wrapped rather than fully eliminated.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 1 day ago

    • Free to download with an account

    Listed1 day ago

    What's inside

    Frequently Asked Questions