typescript-coding-rules

Applies canonical TypeScript rules for types, functions, tests, and coverage.

Updated Oct 15, 2019
One-click install
npx skills add https://github.com/kkkaoru/dotfiles --skill typescript-coding-rules-kkkaoru
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-coding-rules
Source: https://github.com/kkkaoru/dotfiles/tree/main/.agents/skills/typescript-coding-rules
Command: npx skills add https://github.com/kkkaoru/dotfiles --skill typescript-coding-rules-kkkaoru

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TypeScript projects often accumulate inconsistent style, unsafe type casts, and weak tests because rules are scattered or undocumented. This Skill provides a single normative rule set covering type safety, control flow, testing, and coverage so every .ts, .tsx, .mts, and .cts change follows the same standard. ## Core Features & Use Cases - Normative rule set: 75 numbered rules covering types (no any, no as, satisfies over as const), functions (DRY, guards, minimal nesting), and modules (no barrel files, no import * as). - Test and coverage enforcement: Mandates colocated *.test.ts files, 80-90% coverage targets, strict assertions (toStrictEqual, no toContain), and mocked I/O for fast tests. - Verification workflow: Requires bun run tsc, lint, and bun run test to pass after every change, with Oxlint/Oxfmt or Biome as the linting toolchain. - Use Case: When asked to add a feature to a Bun-based TypeScript service, the agent loads these rules and produces interface-first, enum-free code with colocated tests that pass type checking and lint cleanly. ## Quick Start Apply the TypeScript coding rules while implementing and testing the new feature in this Bun project.

Frequently Asked Questions about typescript-coding-rules

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

FAQPage Schema
How do I enforce TypeScript coding standards in an AI coding workflow?

Load a single normative rule file that the agent must follow for every TypeScript change. This Skill points the agent to references/typescript.md as the only authoritative rule set, covering types, control flow, tests, and verification commands.

What TypeScript rules replace any and as type casts?

The rules ban any and as casts entirely, ban as const in favor of satisfies, and require interface definitions for objects with three or more properties. Union types are preferred and new enums are prohibited.

Does this rule set work with Biome or Oxlint?

Yes, the description explicitly supports either Oxlint plus Oxfmt or Biome as the linting and formatting toolchain. All lint warnings and errors must be resolved so lint stays clean at all times.

What test coverage is required for TypeScript files?

Each source file gets a colocated *.test.ts file with 80-90% coverage requirements. Tests must use toStrictEqual, avoid toContain and for loops, and mock all file I/O and web requests for speed.

Why does the rule set ban barrel files and import * as?

The rules prohibit index.ts barrel files and import * as to keep module dependencies explicit and tree-shakeable. Constants, types, and interfaces must be consolidated at the top of each file instead.