Typescript hints
This skill should be used when writing, reviewing, or refactoring TypeScript or JavaScript code — any time files match `**/*.ts`, `**/*.tsx`, `**/*.js`, `**/*.jsx`, `**/*.mts`, `**/*.cts`, `**/tsconfig*.json`, or `**/package.json`, or the user mentions TypeScript/JavaScript conventions, strict mode, generics, conditional/mapped/template-literal types, utility types, discriminated unions, narrowing, async/await, Promises, `AbortController`, or `structuredClone`. Covers general TS/JS language guidance only — conventions, patterns and anti-patterns, and type safety. Specific third-party tool, framework, or library rules (linters, formatters, bundlers, test runners, validation libraries, web frameworks, ORMs, UI frameworks) belong in their own skills.From its SKILL.md
npx -y skills add trphume/daichijoubu --skill typescript-hintsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.8 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
typescript-hints
Project-wide TypeScript (and JavaScript) language guidance. Apply these rules when authoring or modifying TS/JS code in this repository.
Scope
These references cover the TypeScript language, the JavaScript features it inherits (ES2015+), and platform-neutral runtime built-ins (Promise, AbortController, structuredClone, URL). They do not cover:
- Linters or formatters (ESLint, Biome, Prettier, …)
- Bundlers / build tools (tsc-as-a-build-tool specifics, esbuild, webpack, vite, rollup, …)
- Test frameworks (Jest, Vitest, Mocha,
node:test, …) - Validation libraries (Zod, Yup, io-ts, Valibot, …)
- Runtime-specific APIs (Node-only, Deno-only, Bun-only, browser-only)
- Web frameworks, UI libraries, ORMs, state managers
Those belong in dedicated skills.
When to apply
Apply when any of the following is true:
- The task touches a file matching
**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.mts,**/*.cts,**/tsconfig*.json, or**/package.json. - The user is designing a TypeScript package, service, CLI, or library.
- The user asks about TS/JS idioms, async/await, error handling, or dependency injection.
- The user is adding type annotations, defining generics/conditional/mapped types, or modeling state with discriminated unions.
- The user is configuring TypeScript compiler options.
How to apply
- Before writing or editing TS/JS code, load the reference file(s) relevant to the task. Do not rely on memory — these rules may evolve.
- Prefer the obvious, readable solution. Do not introduce abstractions, generics, or indirection that the task does not require.
- Match the repository's existing patterns before applying a rule — if a file already follows a rule, stay consistent; if it violates one, surface the mismatch rather than silently "fixing" surrounding code.
- If a rule touches a specific third-party tool the project uses, defer to that tool's dedicated skill and do not restate its rules here.
Non-negotiables (quick reference)
strict: trueis required. AddnoUncheckedIndexedAccess,exactOptionalPropertyTypes, andnoImplicitOverride.- No
anyoutside isolated interop wrappers. Useunknownand narrow. - No
as Xon values from outside the program without a runtime type guard. - No
// @ts-ignore— use// @ts-expect-error <reason>. - Every promise must be awaited, returned, or
.catch-handled. No floating promises. - Never
awaitinsideArray.prototype.forEach— usefor...oforPromise.all(items.map(...)). - Use
??for default values on nullable types, not||. constby default;letonly when reassigning; nevervar. Preferreadonlyandas const.- Throw
Error(or a subclass). Preserve causes withnew Error("...", { cause: e }). - In
catch (e),eisunknown— narrow before use. - Use
structuredClone(x)for deep copies, notJSON.parse(JSON.stringify(x)). - Finite states are discriminated unions with an exhaustive
assertNeverdefault. - Return DTOs at API boundaries, not internal persistence types.
Reference Files
Load the specific file(s) for the task — do not load all three unnecessarily.
references/conventions.md— Compiler options, naming,const/let/var, imports/exports (named vs. default, type-only imports), function and class style, TSDoc, project layout.references/patterns.md— Design principles (KISS, SRP, composition over inheritance, Rule of Three, function size), modern JS idioms (destructuring, spread, optional chaining, nullish coalescing, array methods), async patterns (async/await,Promise.all,Promise.allSettled,AbortController, typed errors in catch), and an anti-patterns checklist with fix table.references/type-safety.md— Strict mode,unknownvs.any,interfacevs.type, discriminated unions withassertNever, generics with constraints/defaults/literal preservation, narrowing and assertion functions, utility types table, mapped/conditional/template-literal types, branded types,readonly/as const,satisfies,@ts-expect-errorhygiene.
What ships with it: 3 files
20.5 KB alongside SKILL.md
references/
- conventions.md4.3 KB
- patterns.md8.3 KB
- type-safety.md7.9 KB