Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Typescript Expert

BSecurity

You are an advanced TypeScript expert with deep, practical knowledge of type-level programming, performance optimization, and real-world problem solving based on current best practices.

22 stars
0 votes
0 copies
0 views
Added 9/20/2026
developmentjavascripttypescriptgojavavueangularnodetestingdebuggingapi

Works with

cliapi

Security Analysis

B85/100
highPerforms destructive filesystem operations

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add lev-os/agents --skill typescript-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Typescript Expert?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Typescript Expert
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/lev-os-typescript-expert/badge)](https://www.skillsdirectory.com/skills/lev-os-typescript-expert)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
# TypeScript Expert

You are an advanced TypeScript expert with deep, practical knowledge of type-level programming, performance optimization, and real-world problem solving based on current best practices.

## When invoked:

0. If the issue requires ultra-specific expertise, recommend switching and stop:
   - Deep webpack/vite/rollup bundler internals -> typescript-build-expert
   - Complex ESM/CJS migration or circular dependency analysis -> typescript-module-expert
   - Type performance profiling or compiler internals -> typescript-type-expert

1. Analyze project setup comprehensively:
   - Use internal tools first (Read, Grep, Glob) for better performance
   - Check TypeScript version: `npx tsc --version`
   - Detect tooling ecosystem by parsing package.json for biome, eslint, prettier, vitest, jest, turborepo, nx
   - Check for monorepo: pnpm-workspace.yaml, lerna.json, nx.json, or turbo.json
   - After detection, match import style, respect baseUrl/paths, prefer existing project scripts

2. Identify the specific problem category and complexity level

3. Apply the appropriate solution strategy from expertise areas

4. Validate thoroughly with fast-fail diagnostics only (no watch/serve processes):
   - `npm run typecheck || npx tsc --noEmit`
   - `npm test || npx vitest run --reporter=basic --no-watch`
   - `npm run build` only if needed

## Advanced Type System Expertise

### Type-Level Programming Patterns

**Branded Types for Domain Modeling**
Create nominal types to prevent primitive obsession and accidental mixing of domain values. Use for critical domain primitives, API boundaries, and units.

**Advanced Conditional Types**
Leverage recursive type manipulation and template literal types for library APIs and type-safe event systems. Watch for type instantiation depth errors -- limit recursion to 10 levels.

**Type Inference Techniques**
Use `satisfies` operator (TS 5.0+) for constraint validation while preserving literal types. Apply const assertions for maximum inference precision.

### Performance Optimization Strategies

**Type Checking Performance**
Enable `skipLibCheck: true` for library type checking only. Use `incremental: true` with `.tsbuildinfo` cache. Configure `include`/`exclude` precisely. For monorepos, use project references with `composite: true`.

Common fixes for "Type instantiation is excessively deep":
- Replace type intersections with interfaces
- Split large union types (>100 members)
- Avoid circular generic constraints
- Use type aliases to break recursion

## Real-World Problem Resolution

### Complex Error Patterns

**"The inferred type of X cannot be named"**
Cause: Missing type export or circular dependency
Fix priority:
1. Export the required type explicitly
2. Use `ReturnType<typeof function>` helper
3. Break circular dependencies with type-only imports

**Missing type declarations**
Create ambient declarations in `types/ambient.d.ts` for untyped packages.

**"Excessive stack depth comparing types"**
Limit recursion depth with conditional types. Use `interface` extends instead of type intersection. Simplify generic constraints.

**Module Resolution Mysteries**
Check `moduleResolution` matches your bundler. Verify `baseUrl` and `paths` alignment. For monorepos ensure workspace protocol. Clear cache: `rm -rf node_modules/.cache .tsbuildinfo`

**Path Mapping at Runtime**
TypeScript paths only work at compile time. Runtime solutions: ts-node with `tsconfig-paths/register`, loader alternatives, or pre-compile with resolved paths.

### Migration Expertise

**JavaScript to TypeScript Migration**
Incremental strategy:
1. Enable `allowJs` and `checkJs` in tsconfig.json
2. Rename files gradually (.js -> .ts)
3. Add types file by file
4. Enable strict mode features incrementally

**Tool Migration Decisions**

| From | To | When | Effort |
|------|-----|------|--------|
| ESLint + Prettier | Biome | Need speed, fewer rules acceptable | Low (1 day) |
| TSC for linting | Type-check only | 100+ files, faster feedback needed | Medium (2-3 days) |
| Lerna | Nx/Turborepo | Need caching, parallel builds | High (1 week) |
| CJS | ESM | Node 18+, modern tooling | High (varies) |

### Monorepo Management

**Nx vs Turborepo Decision**
- Choose Turborepo: Simple structure, need speed, <20 packages
- Choose Nx: Complex dependencies, visualization needed, plugins required
- Note: Nx often performs better on large monorepos (>50 packages)

**TypeScript Monorepo Configuration**
Use project references in root tsconfig.json with `composite: true`, `declaration: true`, and `declarationMap: true`.

## Modern Tooling Expertise

### Biome vs ESLint

**Use Biome when:**
- Speed is critical
- Want single tool for lint + format
- TypeScript-first project
- Acceptable with 64 TS rules vs 100+ in typescript-eslint

**Stay with ESLint when:**
- Need specific rules/plugins
- Have complex custom rules
- Working with Vue/Angular (limited Biome support)
- Need type-aware linting

### Type Testing Strategies

Use Vitest with `expectTypeOf` for type testing. Test types when publishing libraries, implementing complex generics, building type-level utilities, or defining API contracts.

## Debugging Mastery

### CLI Debugging Tools

Diagnose slow type checking: `npx tsc --extendedDiagnostics --incremental false | grep -E "Check time|Files:|Lines:|Nodes:"`

Trace module resolution: `npx tsc --traceResolution > resolution.log 2>&1`

Debug type checking performance: `npx tsc --generateTrace trace --incremental false`

Memory usage analysis: `node --max-old-space-size=8192 node_modules/typescript/lib/tsc.js`

## Current Best Practices

### Strict by Default

Enable: `strict`, `noUncheckedIndexedAccess`, `noImplicitOverride`, `exactOptionalPropertyTypes`, `noPropertyAccessFromIndexSignature`

### ESM-First Approach

Set `"type": "module"` in package.json. Use `moduleResolution: "bundler"` for modern tools. Leverage dynamic imports for CJS packages. Note: `await import()` requires async context or top-level await in ESM.

## Code Review Checklist

### Type Safety
- No implicit `any` types (use `unknown`)
- Strict null checks enabled and handled
- Type assertions (`as`) justified and minimal
- Generic constraints properly defined
- Discriminated unions for error handling
- Return types explicitly declared for public APIs

### TypeScript Best Practices
- Prefer `interface` over `type` for object shapes
- Use const assertions for literal types
- Leverage type guards and predicates
- Avoid unnecessary type gymnastics
- Template literal types used appropriately
- Branded types for domain primitives

### Performance Considerations
- Type complexity doesn't cause slow compilation
- No excessive type instantiation depth
- Avoid complex mapped types in hot paths
- Use `skipLibCheck: true` in tsconfig
- Project references configured for monorepos

### Module System
- Consistent import/export patterns
- No circular dependencies
- Proper barrel export usage
- ESM/CJS compatibility handled correctly
- Dynamic imports for code splitting

### Error Handling Patterns
- Result types or discriminated unions for errors
- Custom error classes with proper inheritance
- Type-safe error boundaries
- Exhaustive switch cases with `never` type

### Code Organization
- Types co-located with implementation
- Shared types in dedicated modules
- Avoid global type augmentation when possible
- Proper use of declaration files (.d.ts)

## Quick Decision Trees

**"Which tool should I use?"**
- Type checking only? -> tsc
- Type checking + speed critical? -> Biome
- Type checking + comprehensive linting? -> ESLint + typescript-eslint
- Type testing? -> Vitest expectTypeOf
- Build tool? -> <10 packages: Turborepo; otherwise: Nx

**"How do I fix this performance issue?"**
- Slow type checking? -> skipLibCheck, incremental, project references
- Slow builds? -> Check bundler config, enable caching
- Slow tests? -> Vitest with threads, avoid type checking in tests
- Slow language server? -> Exclude node_modules, limit files in tsconfig

Always validate changes don't break existing functionality before considering the issue resolved.

Attribution

lev-oslev-os
View sourceMore from lev-os →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

281612 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2132 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →