Skip to content
DevBuildKit
AgentsSkillsCommandsPacksPricingDocsBlogTools
Log inGet DevBuildKit

TypeScript

Strict, idiomatic TypeScript — tsconfig hardening, narrowing and discriminated unions, runtime validation at boundaries, generics, module settings, type-level pitfalls and fast type-check workflows.

SkillFreev1.0.0
  1. Skills
  2. TypeScript

What it does

Strict, idiomatic TypeScript — tsconfig hardening, narrowing and discriminated unions, runtime validation at boundaries, generics, module settings, type-level pitfalls and fast type-check workflows.

Category
weblanguagetyping
Platforms
webbackend
Frameworks and tools
typescript
Capabilities
code-generationreviewrefactoring

Example tasks

  • “Migrate a loosely typed module to strict mode and remove the any types.”
  • “Model API responses with discriminated unions and validate them at runtime.”
  • “Fix a confusing generic constraint error in a utility function.”

Works with

Recommended alongside

  • React· skill
  • Clean Code· skill
  • Frontend Testing· skill

Used by

  • Design System Engineer
  • Frontend Architect
  • Next.js Specialist
  • Node.js Specialist
  • React Specialist
  • TypeScript Specialist
  • /typecheck

Permissions summary

  • Files

    Reads files only

  • Shell

    No shell commands

  • Network

    No network

Permissions are declared in the component manifest and compiled into each client's tool list. Components are built for least privilege.

Supported environments

ClientSupportInstalled as
Claude CodeNative.claude/skills/<id>/SKILL.md
OpenAI CodexAdapter.codex/skills/<id>/SKILL.md
CursorAdapter.cursor/rules/<id>.mdc
VS Code (Copilot)Adapter.github/instructions/<id>.instructions.md
Generic markdownAdapterdocs/forgekit/skills/<id>.md

Claude Code is the native reference. Other clients use adapters, so behaviour is close but not identical. See the compatibility matrix.

Included in packs

  • web-saas

Full skill (free preview)

This is a free component, so its complete content is public. It is exactly what gets installed (before client-specific formatting).

TypeScript

Write types that make invalid states unrepresentable and that tell the truth at runtime boundaries. Read the repo's tsconfig*.json, lint config and existing patterns first; match them. Check the TypeScript version in package.json before using newer syntax and verify option names against the official tsconfig reference.

1. Compiler configuration

OptionRecommendation
strict: trueAlways for new code (enables strictNullChecks, noImplicitAny, strictFunctionTypes, ...)
noUncheckedIndexedAccessOn; array/record indexing returns T | undefined
exactOptionalPropertyTypesConsider on for new code; stricter about undefined vs missing
noImplicitOverride, noFallthroughCasesInSwitchOn
verbatimModuleSyntaxOn; forces explicit import type and predictable emit
isolatedModulesOn when using a bundler/transpiler per file (Vite, esbuild, SWC)
moduleResolutionbundler for bundled apps, NodeNext (with module: NodeNext) for Node ESM/CJS packages
skipLibCheckAcceptable for speed; do not use it to hide errors in your own .d.ts
noEmitOn for apps where a bundler emits; run tsc --noEmit in CI

Migrating a lax codebase: enable strict per package or use // @ts-expect-error with a reason on remaining violations, tracked by count; ratchet down. Prefer @ts-expect-error over @ts-ignore so stale suppressions fail.

2. Modeling rules

  • Avoid any. Use unknown for untrusted values and narrow; use generics when the type flows through.
  • Model variants as discriminated unions with a literal tag and exhaustive switch:
    type Result<T> = { ok: true; value: T } | { ok: false; error: string };
    function assertNever(x: never): never { throw new Error(`Unhandled: ${JSON.stringify(x)}`); }
    
  • Prefer type aliases for unions/mapped types and interface for extendable object contracts; stay consistent with the repo.
  • Use as const and satisfies to keep literal types while checking shape: const routes = { home: "/" } as const satisfies Record<string, string>.
  • Prefer string-literal unions over enum (or as const objects); enums add runtime code and quirks.
  • Use branded types for ids that must not mix: type UserId = string & { readonly __brand: "UserId" }, created in one validated constructor.
  • Make illegal states unrepresentable: replace { loading: boolean; data?: T; error?: E } with a tagged union.
  • Use readonly and ReadonlyArray for inputs you do not mutate.

3. Narrowing and assertions

  • Use user-defined guards (x is Foo), in, typeof, instanceof, and equality narrowing. Prefer narrowing over as.
  • as and ! are escape hatches: allow them only with an adjacent comment explaining the invariant. Never as unknown as T to silence an error.
  • satisfies checks without widening; use it instead of annotating when you want the inferred literal type.

4. Runtime boundaries

Types vanish at runtime. Validate all external data (HTTP bodies, query strings, env vars, JSON files, localStorage, message payloads) with a schema library such as Zod, Valibot or ArkType, and derive the static type from the schema (z.infer<typeof Schema>) so there is one source of truth. Parse once at the edge, pass typed values inward. JSON.parse returns any; never trust it directly. Env vars are string | undefined; parse them into a typed config object at startup.

5. Generics and utility types

  • Constrain generics (<T extends { id: string }>) and let inference work; do not pass explicit type arguments unless needed.
  • Use built-ins: Pick, Omit, Partial, Required, Record, ReturnType, Parameters, Awaited, NonNullable, Extract, Exclude.
  • Keep type-level cleverness proportional: if a conditional type needs a comment longer than the function, simplify or use overloads.
  • Overloads: order most specific first; provide an implementation signature that is not itself callable.

6. Workflow

  • Fast feedback: tsc --noEmit -p tsconfig.json (add --incremental); use tsc -b for project references in monorepos.
  • Use typed lint rules from typescript-eslint (no-floating-promises, no-misused-promises, consistent-type-imports, no-unnecessary-type-assertion).
  • Export types from modules explicitly; avoid deep imports across package boundaries.
  • Fix errors at the source type rather than adding casts at each use.

Common mistakes

  • Object.keys(obj) typed as string[]; do not cast to (keyof T)[] without justification.
  • Optional property vs T | undefined; they differ under exactOptionalPropertyTypes.
  • Async functions typed as returning T instead of Promise<T>, or unhandled floating promises.
  • Using Function, object, {} as types; use specific signatures or Record<string, unknown>.
  • Trusting API types generated once and never regenerated.

Version and changelog

Latest version 1.0.0. Requires DevBuildKit CLI 1.0.0 or newer.

Changelog — TypeScript

1.0.0

  • Initial release.

Build with this skill

Create Demo Project

Install in CLI

$ devbuild add skill typescript

Dependencies are resolved automatically.

Free. Needs a free account: run devbuild login once.

IDtypescript
Version1.0.0
TierFree
DevBuildKit

Your entire AI development team. One install.

DevBuildKit never uploads your source code. Telemetry is opt-in and anonymous.

Product

  • Agents
  • Skills
  • Commands
  • Packs
  • Features
  • Live demo
  • Pricing

Learn

  • Documentation
  • Getting started
  • CLI reference
  • Blog
  • Changelog
  • Compare

Free tools

  • All tools
  • Agent generator
  • Config converter
  • Stack detector
  • Context analyzer

Use cases

  • Android development
  • iOS development
  • SaaS development
  • Backend development
  • App Factory
  • Game development

Company

  • Terms
  • Privacy
  • Refunds
  • Log in
  • Sign up

© 2026 DevBuildKit. All rights reserved.

DevBuildKit is an independent product. Claude, Claude Code, Anthropic, OpenAI, Codex, ChatGPT, Cursor, Visual Studio Code, GitHub Copilot, Microsoft and all other product names are trademarks of their respective owners. DevBuildKit is not affiliated with, endorsed by or sponsored by any of them; names are used only to describe compatibility.