skills/typescript-best-practices/SKILL.md
Implement, review, and refactor TypeScript code with a strong bias toward type safety. Use to fix TypeScript errors, remove `any` or unsafe `as`, review type safety, tighten TypeScript or lint settings, and ship ESM-first code that passes the repository's typecheck without weakening types.
npx skillsauth add hayatosc/dotfiles typescript-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write and revise TypeScript with a bias toward precise types, safe narrowing, and passing typecheck without silencing errors. Prefer fixing the root cause over weakening types, widening signatures, or bypassing the checker.
Follow these steps in order:
tsconfig files, ESLint configuration, and package scripts before changing code.typescript-recommend-tools, prefer tsgo --noEmit as the main check and keep tsc --noEmit as the compatibility fallback. Otherwise, use the repository's current tsc --noEmit path.unknown until narrowed.any with concrete types, generics, unknown, or utility types.as with narrowing, predicates, discriminated unions, satisfies, or small refactors that make the type relationship explicit.Branded<T, Brand>) to model primitives at core domain boundaries (such as unique identifiers, units of measurement, or validated payloads) to prevent accidental mixing of structurally identical data.tsconfig and typescript-eslint config as part of the work when the change is scoped and reviewable.oxlint --type-aware with oxlint-tsgolint alongside compiler checks rather than introducing a separate ESLint migration by default.references/config-baseline.md before changing compiler or lint settings.any. If the value is unknown, model it as unknown and narrow it.as const and framework-required assertions are acceptable only when the runtime shape is already guaranteed.import and export, and do not introduce require, module.exports, or mixed-module patterns unless the repository is already CommonJS or the toolchain requires it.zod or valibot only on explicit request or when the repository already standardizes on them./** ... */) on all exported functions, classes, methods, interfaces, types, and constants. Include a summary sentence, describe each parameter with @param, and document return values with @returns. Use @throws when a function can throw. Do not duplicate type information already expressed in TypeScript signatures; focus on intent, constraints, and usage examples.references/type-safety-patterns.md for concrete replacements for any and unsafe as, plus modeling guidance for extracted types, branded types, and review heuristics.references/config-baseline.md before changing TypeScript or typescript-eslint settings.tools
Recommend a modern TypeScript toolchain. Use when choosing or updating a TypeScript stack for Node or CLI projects, libraries or packages, and web apps or APIs; selecting tsgo as the primary typechecker with tsc as compatibility fallback; recommending Hono, tsx, tsdown, Vite, Vitest, oxlint, oxlint-tsgolint, oxfmt, or deciding between bun and pnpm.
development
Self-review, improve, commit, and push code that Claude has just written. Use this skill when the user asks Claude to "self-ship", "review and ship", "review then commit and push", or wants Claude to autonomously review its own output, apply improvements, and publish the changes to the remote repository. Triggered by: "self-ship", "ship it", "review and push", "review my changes and commit", or similar requests to complete the full write → review → commit → push cycle.
development
Analyze and execute behavior-preserving refactors in small, verified steps. Use when the user asks to refactor, clean up code structure, extract functions or modules, reduce duplication, improve maintainability, or modernize code without changing external behavior.
development
Comprehensive Go best practices for writing production-ready, idiomatic, secure, and maintainable code. Use when: (1) writing or reviewing Go code, (2) designing project structure and layout, (3) handling errors and contexts, (4) implementing concurrency, (5) writing tests or benchmarks, (6) optimizing performance, (7) applying security practices, (8) modernizing Go codebases. Covers coding style, project organization, error handling, testing, concurrency, performance, security, and modernization.