TypeScript

Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.

MIT-0 · Free to use, modify, and redistribute. No attribution required.
6 · 2.6k · 27 current installs · 27 all-time installs
byIván@ivangdavila
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description (TypeScript best practices) align with the provided content (guides on narrowing, generics, utility types, .d.ts, migration). There are no unrelated requirements (no binaries, env vars, or installs).
Instruction Scope
SKILL.md provides guidance and points to topical documents; it does not instruct the agent to read arbitrary files, access environment variables, or transmit data to external endpoints. The guidance is confined to TypeScript patterns and migration advice.
Install Mechanism
No install spec and no code files that would be written/executed. Being instruction-only means nothing is downloaded or installed by the skill itself.
Credentials
The skill declares no required environment variables, credentials, or config paths. The content does not reference secrets or external APIs, so requested access is proportional (none).
Persistence & Privilege
always is false and the skill is user-invocable; autonomous model invocation is allowed (platform default) but the skill does not request elevated or persistent privileges or modify other skills/config.
Assessment
This appears to be a pure reference/authoring guide for TypeScript and is internally consistent. Before installing, confirm you trust the skill publisher (source unknown) and avoid granting it extra runtime permissions (file system or credentials) when you enable it — the skill itself doesn’t request any, but an agent running it could still be given broader access by your platform. If you need provenance, prefer skills with a known homepage or verified owner.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.2
Download zip
latestvk97ehff61bz2j18zcg8vv5q5j5814t4b

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

When to Use

User needs TypeScript expertise — from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.

Quick Reference

TopicFile
Generic patternsgenerics.md
Utility typesutility-types.md
Declaration filesdeclarations.md
Migration from JSmigration.md

Stop Using any

  • unknown forces you to narrow before use — any silently breaks type safety
  • API responses: type them or use unknown, never any
  • When you don't know the type, that's unknown, not any

Narrowing Failures

  • filter(Boolean) doesn't narrow — use .filter((x): x is T => Boolean(x))
  • Object.keys(obj) returns string[], not keyof typeof obj — intentional, objects can have extra keys
  • Array.isArray() narrows to any[] — may need assertion for element type
  • in operator narrows but only if property is in exactly one branch of union

Literal Type Traps

  • let x = "hello" is string — use const or as const for literal type
  • Object properties widen: { status: "ok" } has status: string — use as const or type annotation
  • Function return types widen — annotate explicitly for literal returns

Inference Limits

  • Callbacks lose inference in some array methods — annotate parameter when TS guesses wrong
  • Generic functions need usage to infer — fn<T>() can't infer, pass a value or annotate
  • Nested generics often fail — break into steps with explicit types

Discriminated Unions

  • Add a literal type or kind field to each variant — enables exhaustive switch
  • Exhaustive check: default: const _never: never = x — compile error if case missed
  • Don't mix discriminated with optional properties — breaks narrowing

satisfies vs Type Annotation

  • const x: Type = val widens to Type — loses literal info
  • const x = val satisfies Type keeps literal, checks compatibility — prefer for config objects

Strict Null Handling

  • Optional chaining ?. returns undefined, not null — matters for APIs expecting null
  • ?? only catches null/undefined|| catches all falsy including 0 and ""
  • Non-null ! should be last resort — prefer narrowing or early return

Module Boundaries

  • import type for type-only imports — stripped at runtime, avoids bundler issues
  • Re-exporting types: export type { X } — prevents accidental runtime dependency
  • .d.ts augmentation: use declare module with exact module path

Files

5 total
Select a file
Select a file to preview.

Comments

Loading comments…