TY

typescript-safety

Secures TypeScript message boundaries using Zod validation and strict type safety rules.

Install

mkdir -p .claude/skills/typescript-safety && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18445" && unzip -o skill.zip -d .claude/skills/typescript-safety && rm skill.zip

Installs to .claude/skills/typescript-safety

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when writing TypeScript at message boundaries, runtime inputs, shared contracts, or any code that crosses the content-script/SW/backend trust boundary — to enforce Zod validation, discriminated unions, no-any rules, and sender verification.
244 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Validate messages with Zod schemas at SW port boundaries
  • Verify message sender before processing port messages
  • Enforce no `any` in shared contracts
  • Use `unknown` and narrowing for I/O boundaries
  • Implement discriminated unions for message verb dispatch
  • Enable strict mode in `tsconfig.json`

How it works

The skill enforces type safety by validating all inbound messages with Zod schemas, verifying senders, and applying strict TypeScript rules at trust boundaries.

Inputs & outputs

You give it
Runtime inputs from external sources or messages at SW port boundary
You get back
Type-safe and validated data, or a warning for invalid message shapes

When to use typescript-safety

  • Validate runtime inputs from external sources
  • Secure message handlers in background scripts
  • Define type-safe contract interfaces
  • Prevent runtime crashes from malformed JSON

About typescript-safety

Ensures type safety where external data enters the system (SSE, DOM, storage). Implements Zod validation, prevents 'any' usage, and verifies message schemas in background and content scripts.

Use when writing TypeScript at message boundaries, runtime inputs, shared contracts, or any code that crosses the content-script/SW/backend trust boundary — to enforce Zod validation, discriminated unions, no-any rules, and sender verification.

When not to use it

  • For pure CSS or DOM geometry work with no runtime parsing

Limitations

  • The skill does not apply to pure CSS or DOM geometry work
  • The skill does not apply to documentation-only changes
  • The skill bans `any` in shared contracts

How it compares

This approach systematically applies type safety and validation at critical system boundaries, preventing common runtime errors that manual coding might miss.

Compared to similar skills

typescript-safety side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
typescript-safety (this skill)02moNo flagsAdvanced
tech-debt-analyzer510moReviewIntermediate
codex-code-review18moReviewIntermediate
tech-debt13moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

Search skills

Search the agent skills registry