harden-types

Replace unsafe TypeScript casts with schema parsing at trust boundaries.

121|2|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/AgentSystemLabs/core --skill harden-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: harden-types
Source: https://github.com/AgentSystemLabs/core/tree/main/plugins/agentsystem-core/skills/harden-types
Command: npx skills add https://github.com/AgentSystemLabs/core --skill harden-types

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces fragile TypeScript typing by removing unsafe any, dangerous casts, and suppressed compiler errors while adding runtime validation at the trust boundary so production input is actually verified.

Core Features & Use Cases

  • Type safety tightening in changed TypeScript: Scans only the relevant .ts/.tsx files from your diff and focuses on any, unsafe as casts, and @ts-ignore/@ts-expect-error usage.
  • Boundary-focused validation with your existing validator: Detects whether the project uses zod, valibot, or typebox and applies schema-based parsing at entry points (HTTP bodies, IPC, queue messages, webhook payloads, env parsing).
  • Safe classification-driven edits: Classifies each finding as MECHANICAL (auto-fix), STRUCTURAL (needs domain judgment), or LEGITIMATE (left with a hardening reason).

Quick Start

Ask an AI agent to run harden types on your last changes so it reports which type-safety issues were auto-fixed and which require your domain review.

Frequently Asked Questions about harden-types

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

FAQPage Schema
How do I remove unsafe TypeScript casts and @ts-ignore in my codebase?

TypeScript runtime validation replaces unsafe casts and @ts-ignore directives by parsing untrusted inputs against schemas at trust boundaries. It uses your existing validator, like zod or valibot, to verify HTTP bodies, IPC payloads, and env variables during execution.

How do I add runtime validation to Next.js server handlers and webhooks?

Adding runtime validation to Next.js server handlers and webhooks requires parsing incoming payloads through schema validators at trust boundaries. This process detects the project's existing validator, such as zod or typebox, and applies schema parsing to verify HTTP bodies before processing.

Can I automatically fix TypeScript type safety issues without breaking existing logic?

You can safely fix TypeScript type safety issues without breaking logic when the tool classifies findings as mechanical, structural, or legitimate. Mechanical issues are auto-fixed, while structural issues requiring domain judgment and legitimate suppressed errors are left for manual review.

Does this type hardening approach work with valibot or typebox instead of zod?

Type hardening works with valibot or typebox instead of zod by detecting the project's existing validator. It applies schema-based parsing at entry points like HTTP bodies, IPC handlers, and queue messages regardless of the specific validation library configured.

What is the best way to tighten type safety on changed TypeScript files?

The best way to tighten type safety on changed TypeScript files is to scan only the relevant .ts/.tsx files from your diff. This focuses the audit on any types, unsafe casts, and ts-expect-error usage, replacing them with runtime validation at trust boundaries.