avoid-anecdotal-types

Base type definitions on official specifications instead of single examples.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill avoid-anecdotal-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: avoid-anecdotal-types
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/avoid-anecdotal-types
Command: npx skills add https://github.com/luyi985/lyi-bash --skill avoid-anecdotal-types

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Avoid inferring types from a single example; align type definitions with official specifications to catch edge cases and ensure long-term correctness.

Core Features & Use Cases

  • Spec-based typing that relies on official docs, schemas, and specs rather than anecdotes.
  • Handles optional fields, nullability, and variant shapes across APIs, databases, and services.
  • Encourages runtime validation and defensive typing to prevent surprising runtime failures.

Quick Start

Provide a robust, spec-aligned type definition by combining official API specs with multiple examples to cover edge cases.

Frequently Asked Questions about avoid-anecdotal-types

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

FAQPage Schema
How do I prevent TypeScript type drift when defining API data models?

Spec-based TypeScript typing prevents runtime failures by basing type definitions on official API specifications and schemas. This approach enforces runtime validation and defensive typing to ensure fields, nullability, and optionality reflect real behavior.

Why does inferring TypeScript types from a single API example cause edge case failures?

Spec-based typing in TypeScript handles optional fields, nullability, and variant shapes by relying on official docs, schemas, and specs. It encourages runtime validation and defensive typing to prevent surprising runtime failures across APIs and services.

What is the best way to align TypeScript API typings with official specifications?

Yes, you need runtime validation for spec-aligned TypeScript types to ensure fields, nullability, and optionality reflect real behavior. Defensive typing and runtime validation prevent surprising runtime failures when dealing with API data models.

Does spec-based typing work for schema evolution across multiple services?

Spec-based typing works for schema evolution across services by enforcing type definitions based on official specifications and generated types. This prevents type drift and ensures long-term correctness during API and data model changes.