code-harden-types

Remove weak TypeScript typing and add runtime validation at input boundaries.

22|3|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/webdevcody/go-mailing-list --skill code-harden-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-harden-types
Source: https://github.com/webdevcody/go-mailing-list/tree/main/.claude/skills/code-harden-types
Command: npx skills add https://github.com/webdevcody/go-mailing-list --skill code-harden-types

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces runtime bugs and type regressions by removing weak typing patterns in the parts of a codebase that most often accept untrusted input.

Core Features & Use Cases

  • Types hardening for changed files: Focuses on the current diff to tighten safety without broad refactors.
  • Boundary validation with the existing validator: Adds zod-based validation (or whichever validator the project already uses) at trust boundaries like HTTP handlers, server functions, webhook payloads, and job/queue handlers.
  • Safe, classified remediation: Automatically fixes clearly mechanical issues (e.g., redundant casts and suppressed type errors) while surfacing structural risks for human review.

Quick Start

Run the code-harden-types skill on your current changed TypeScript files to remove any unsafe typing and enforce runtime validation at input boundaries.

Frequently Asked Questions about code-harden-types

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

FAQPage Schema
How do I add runtime validation to TypeScript webhook payloads and HTTP handlers?

To add runtime validation to TypeScript webhook payloads, you parse untrusted boundary inputs using the project's existing validator, preferably zod. This enforces type safety and ensures the codebase typechecks after each file-level edit.

What is the best way to remove unsafe typing and weak TypeScript constructs in changed files?

Removing unsafe typing in changed files involves scanning TypeScript and TSX sources to classify occurrences, applying safe mechanical fixes to redundant casts and suppressed type errors, and surfacing structural risks for human review without broad refactoring.

Does this type hardening approach work with existing validators other than zod?

Yes, this type hardening approach works with existing validators other than zod. It requires using the project's existing validator to parse and validate boundary inputs, preferring zod but supporting any validator already integrated into the codebase.

How do I typecheck my codebase after fixing suppressed type errors at trust boundaries?

To typecheck your codebase after fixing suppressed type errors, you apply safe mechanical fixes to changed files and ensure the project typechecks after each file-level edit, preventing type regressions from weak typing patterns at untrusted input boundaries.

When should I not use automated type hardening for TypeScript safety?

You should not use automated type hardening for structural risks that require human review. The process applies only safe mechanical fixes to changed files and explicitly surfaces structural and legitimate cases rather than automatically refactoring them.