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
OpenClaw
Benign
high confidencePurpose & 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 ziplatest
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
| Topic | File |
|---|---|
| Generic patterns | generics.md |
| Utility types | utility-types.md |
| Declaration files | declarations.md |
| Migration from JS | migration.md |
Stop Using any
unknownforces you to narrow before use —anysilently breaks type safety- API responses: type them or use
unknown, neverany - When you don't know the type, that's
unknown, notany
Narrowing Failures
filter(Boolean)doesn't narrow — use.filter((x): x is T => Boolean(x))Object.keys(obj)returnsstring[], notkeyof typeof obj— intentional, objects can have extra keysArray.isArray()narrows toany[]— may need assertion for element typeinoperator narrows but only if property is in exactly one branch of union
Literal Type Traps
let x = "hello"isstring— useconstoras constfor literal type- Object properties widen:
{ status: "ok" }hasstatus: string— useas constor 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
typeorkindfield 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 = valwidens to Type — loses literal infoconst x = val satisfies Typekeeps literal, checks compatibility — prefer for config objects
Strict Null Handling
- Optional chaining
?.returnsundefined, notnull— matters for APIs expectingnull ??only catchesnull/undefined—||catches all falsy including0and""- Non-null
!should be last resort — prefer narrowing or early return
Module Boundaries
import typefor type-only imports — stripped at runtime, avoids bundler issues- Re-exporting types:
export type { X }— prevents accidental runtime dependency .d.tsaugmentation: usedeclare modulewith exact module path
Files
5 totalSelect a file
Select a file to preview.
Comments
Loading comments…
