chore: update skills

Signed-off-by: Dmytro Stanchiev <git@dmytros.dev>
This commit is contained in:
2026-04-07 17:06:08 -04:00
parent 7ffcb4dc43
commit 685241c92f
12 changed files with 58 additions and 532 deletions

View File

@@ -27,10 +27,10 @@ You are an advanced TypeScript expert with deep, practical knowledge of type-lev
```bash
# Core versions and configuration
npx tsc --version
node -v
bunx --bun tsc --version
bun --bun -v
# Detect tooling ecosystem (prefer parsing package.json)
node -e "const p=require('./package.json');console.log(Object.keys({...p.devDependencies,...p.dependencies}||{}).join('\n'))" 2>/dev/null | grep -E 'biome|eslint|prettier|vitest|jest|turborepo|nx' || echo "No tooling detected"
bun --bun -e "const p=require('./package.json');console.log(Object.keys({...p.devDependencies,...p.dependencies}||{}).join('\n'))" 2>/dev/null | grep -E 'biome|eslint|prettier|vitest|jest|turborepo|nx' || echo "No tooling detected"
# Check for monorepo (fixed precedence)
(test -f pnpm-workspace.yaml || test -f lerna.json || test -f nx.json || test -f turbo.json) && echo "Monorepo detected"
```
@@ -48,10 +48,10 @@ You are an advanced TypeScript expert with deep, practical knowledge of type-lev
4. Validate thoroughly:
```bash
# Fast fail approach (avoid long-lived processes)
npm run -s typecheck || npx tsc --noEmit
npm test -s || npx vitest run --reporter=basic --no-watch
bun --bun run -s typecheck || bunx --bun tsc --noEmit
bun --bun test -s || bunx --bun vitest run --reporter=basic --no-watch
# Only if needed and build affects outputs/config
npm run -s build
bun --bun run -s build
```
**Safety note:** Avoid watch/serve processes in validation. Use one-shot diagnostics only.
@@ -110,7 +110,7 @@ type Route = typeof routes[number]; // '/home' | '/about' | '/contact'
**Type Checking Performance**
```bash
# Diagnose slow type checking
npx tsc --extendedDiagnostics --incremental false | grep -E "Check time|Files:|Lines:|Nodes:"
bunx --bun tsc --extendedDiagnostics --incremental false | grep -E "Check time|Files:|Lines:|Nodes:"
# Common fixes for "Type instantiation is excessively deep"
# 1. Replace type intersections with interfaces
@@ -197,8 +197,8 @@ type NestedArray<T, D extends number = 5> =
# 4. Enable strict mode features one by one
# Automated helpers (if installed/needed)
command -v ts-migrate >/dev/null 2>&1 && npx ts-migrate migrate . --sources 'src/**/*.js'
command -v typesync >/dev/null 2>&1 && npx typesync # Install missing @types packages
command -v ts-migrate >/dev/null 2>&1 && bunx --bun ts-migrate migrate . --sources 'src/**/*.js'
command -v typesync >/dev/null 2>&1 && bunx --bun typesync # Install missing @types packages
```
**Tool Migration Decisions**
@@ -275,20 +275,20 @@ test('Avatar props are correctly typed', () => {
### CLI Debugging Tools
```bash
# Debug TypeScript files directly (if tools installed)
command -v tsx >/dev/null 2>&1 && npx tsx --inspect src/file.ts
command -v ts-node >/dev/null 2>&1 && npx ts-node --inspect-brk src/file.ts
command -v tsx >/dev/null 2>&1 && bunx --bun tsx --inspect src/file.ts
command -v ts-node >/dev/null 2>&1 && bunx --bun ts-node --inspect-brk src/file.ts
# Trace module resolution issues
npx tsc --traceResolution > resolution.log 2>&1
bunx --bun tsc --traceResolution > resolution.log 2>&1
grep "Module resolution" resolution.log
# Debug type checking performance (use --incremental false for clean trace)
npx tsc --generateTrace trace --incremental false
bunx --bun tsc --generateTrace trace --incremental false
# Analyze trace (if installed)
command -v @typescript/analyze-trace >/dev/null 2>&1 && npx @typescript/analyze-trace trace
command -v @typescript/analyze-trace >/dev/null 2>&1 && bunx --bun @typescript/analyze-trace trace
# Memory usage analysis
node --max-old-space-size=8192 node_modules/typescript/lib/tsc.js
bun --bun --max-old-space-size=8192 node_modules/typescript/lib/tsc.js
```
### Custom Error Classes

View File

@@ -23,8 +23,8 @@ def check_versions():
print("\n📦 Versions:")
print("-" * 40)
ts_version = run_cmd("npx tsc --version 2>/dev/null").strip()
node_version = run_cmd("node -v 2>/dev/null").strip()
ts_version = run_cmd("bunx --bun tsc --version 2>/dev/null").strip()
node_version = run_cmd("bun --bun -v 2>/dev/null").strip()
print(f" TypeScript: {ts_version or 'Not found'}")
print(f" Node.js: {node_version or 'Not found'}")
@@ -134,7 +134,7 @@ def check_type_errors():
print("\n🔍 Type Check:")
print("-" * 40)
result = run_cmd("npx tsc --noEmit 2>&1 | head -20")
result = run_cmd("bunx --bun tsc --noEmit 2>&1 | head -20")
if "error TS" in result:
errors = result.count("error TS")
print(f"{errors}+ type errors found")
@@ -174,7 +174,7 @@ def check_performance():
print("\n⏱️ Type Check Performance:")
print("-" * 40)
result = run_cmd("npx tsc --extendedDiagnostics --noEmit 2>&1 | grep -E 'Check time|Files:|Lines:|Nodes:'")
result = run_cmd("bunx --bun tsc --extendedDiagnostics --noEmit 2>&1 | grep -E 'Check time|Files:|Lines:|Nodes:'")
if result.strip():
for line in result.strip().split('\n'):
print(f" {line}")