More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 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

    1 useSecurity 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.

    Requires a working TypeScript environment to run compiler checks. Fixes for third-party library type mismatches may require manual intervention for local declarations or patches.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 29 days ago

    • Free with an Agensi account

    Permissions

    Environment Variables
    Listed29 days ago

    What's inside

    Frequently Asked Questions

    This skill identifies and replaces unsafe patterns like 'as any', non-null assertions, and '@ts-ignore' with safer alternatives like type guards and Zod schemas, ensuring your TypeScript types actually reflect runtime reality.

    The skill is compatible with any AI agent that has file-system access and a TypeScript environment, allowing it to run audits and verify fixes using your project's local 'tsc' installation.

    No, the skill is designed to work with your project's existing stack; if you use Zod or Valibot, it will leverage them, otherwise it utilizes native TypeScript features like 'satisfies' and type predicates to avoid adding overhead.

    The skill follows a 'verify-after-fix' protocol, where it runs 'tsc --noEmit' after every refactor batch to ensure that the changes haven't introduced new type errors or broken the build.

    One SKILL.md: the replacement order for `as any`, the audit steps and report format, and the rules. It is free.

    The 'audit' command scans your requested path and generates a risk-ranked report, highlighting API boundaries and shared utilities where unsafe types pose the greatest threat to your application's stability.

    New in Code Quality & Review