writing-typescript

Guides writing and reviewing TypeScript under src/ with strict compiler flags and zone boundaries.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/tomada1114/quick-reply-drill --skill writing-typescript-tomada1114
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: writing-typescript
Source: https://github.com/tomada1114/quick-reply-drill/tree/main/.agents/skills/writing-typescript
Command: npx skills add https://github.com/tomada1114/quick-reply-drill --skill writing-typescript-tomada1114

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing TypeScript under strict compiler settings like noUncheckedIndexedAccess, exactOptionalPropertyTypes, and verbatimModuleSyntax produces recurring judgment calls — unknown vs any, satisfies vs as, interface vs type, where constants live — that this Skill resolves with concrete, repository-grounded rules. ## Core Features & Use Cases - Type-system judgment: Narrow unknown at boundaries, prefer satisfies over as, use type guards for runtime narrowing, and compose object types with interface extends instead of intersections. - Strict-flag guidance: Handle indexed access returning T | undefined, distinguish absent properties from explicit undefined, and resolve noPropertyAccessFromIndexSignature conflicts without weakening compiler options. - Module and zone discipline: Keep constants next to their readers, publish zone surfaces through a single named re-export file, respect import boundaries between src/core, src/app, src/server, and src/ai, and never use enum or export *. - Use Case: When adding a new exported generic function under src/, apply the rule to annotate the return type only if it is provably no wider than inference, keep the generic narrow, and cover the signature with a compile-time assertion. ## Quick Start Ask the assistant to review or write a TypeScript module under src/ applying the writing-typescript rules for strict flags, imports, and zone boundaries.

Frequently Asked Questions about writing-typescript

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

FAQPage Schema
How do I handle unknown vs any at TypeScript boundaries?▼

Take unknown at untyped boundaries such as parsed request bodies or caught errors, then narrow with a type guard before use. Using any disables type checking for everything downstream of the boundary, not just at it.

When should I use satisfies instead of as in TypeScript?▼

Prefer satisfies on typed literals because it keeps excess-property and missing-property checking, while as silences both. The pattern as const satisfies Record<K, V> also preserves literal keys, making lookup tables exhaustive against a union.

Why does exactOptionalPropertyTypes reject passing undefined to optional props?▼

The flag makes an absent property and an explicit undefined distinct types, so prop={undefined} does not satisfy readonly prop?: string. Widen that one prop to prop?: string | undefined when a caller genuinely forwards undefined, rather than changing the compiler option.

Should I use interface or type for object types in TypeScript?▼

Prefer interface X extends Y over type X = Y & Z when composing object types, because the intersection operator is markedly slower to type-check. The consistent-type-definitions lint rule already prefers interface for object shapes.

Why is enum banned and what replaces it?▼

The eslint config blocks TSEnumDeclaration through no-restricted-syntax. Replace enums with a union of string literals or an as const object, which provide the same exhaustiveness checking without enum's runtime and typing quirks.

How do I make a switch over a union exhaustive without a default case?▼

Give each union member its own case and omit default. The switch-exhaustiveness-check rule treats default as a deliberate answer to new members, so adding one to silence the compiler disables the protection the check provides.