js-ts-dev
SKILL.md
JavaScript & TypeScript Development
Unified skill for all JS/TS work: types, backends, testing, modern patterns, build tools, and API design.
Task Router
| Domain | Reference |
|---|---|
| TypeScript types, generics, mapped/conditional types, type guards | references/advanced-types.md |
| Node.js, Express, Fastify, middleware, auth, DB, caching | references/node-backend.md |
| WebSocket, Socket.io, BullMQ, job queues, GraphQL schema, DataLoader, microservices, AbortController, RabbitMQ, Kafka | references/advanced-backend.md |
| Jest, Vitest, Playwright, mocking, integration, E2E, coverage | references/testing.md |
| Snapshot testing, test fixtures, faker, testcontainers, MSW, coverage thresholds | references/testing-advanced.md |
| ES6+, async/await, FP, destructuring, modules, generators | references/modern-js.md |
| Proxy, Reflect, Symbol, WeakMap, WeakSet, private class fields, tagged templates, async generators | references/advanced-js-patterns.md |
| Build tools, bundlers, package managers, linting | This file - Build & Tooling |
| REST, GraphQL, OpenAPI | This file - API Design |
| Debugging, profiling, TS errors | This file - Debugging |
| Vite config, vite.config.ts, esbuild, Turbopack, tsconfig strict mode, noUncheckedIndexedAccess, ESLint flat config | references/build-tools-modern.md |
| Dependency injection, DI container, tsyringe, inversify, manual DI, composition root, interface injection | references/dependency-injection.md |
| React Testing Library, userEvent, MSW, mock service worker, screen queries, renderHook, Next.js component testing | references/testing-library-react.md |
| Redis, ioredis, caching, CacheService, @Cacheable decorator, cache invalidation, pub/sub, session storage | references/caching-redis.md |
| OpenAPI, Swagger, swagger-jsdoc, API versioning, pagination, cursor pagination, DataLoader, error responses, RFC 7807 | references/api-design-patterns.md |
TypeScript Advanced Types
- Generics:
<T extends HasLength>for constraints, multiple params<T, U> - Conditional:
T extends string ? true : false,inferfor extraction - Mapped:
{ [P in keyof T]: T[P] }, key remapping withas, value filtering - Template literal:
\on${Capitalize}``, recursive path types - Utility types:
Partial,Required,Readonly,Pick,Omit,Record,ReturnType,Parameters - Patterns: Type-safe event emitter, API client, builder pattern, discriminated unions, deep readonly/partial, form validation
- Guards:
value is stringpredicates,assertsfunctions, composable guards - Best practices:
unknownoverany,interfacefor objects,typefor unions, strict mode,constassertions - See
references/advanced-types.mdfor code examples
Node.js Backend
- Frameworks: Express (middleware-based, helmet/cors/compression) or Fastify (high perf, schema validation, Pino)
- Architecture: Controllers (HTTP) -> Services (logic) -> Repositories (data). DI container for wiring
- Middleware: JWT auth + role-based authorize, Zod validation, Redis-backed rate limiting, structured logging
- Errors:
AppErrorhierarchy (400-409), global handler,asyncHandlerwrapper - Database: PostgreSQL connection pool, parameterized queries, transaction pattern, Mongoose for MongoDB
- Caching: Redis
CacheServicewith get/set/invalidate,@Cacheable(ttl)decorator - Auth: JWT access (15m) + refresh (7d) tokens, bcrypt hashing, token refresh endpoint
- Ops: Graceful shutdown (SIGTERM/SIGINT), health checks, connection pooling, API response format
- See
references/node-backend.mdfor code examples
Testing
- Frameworks: Jest (
ts-jestpreset), Vitest (Vite-native,vi.fn/mock/spyOn), Playwright (E2E) - Unit: Pure functions (happy/edge/error), classes with
beforeEach, async withrejects.toThrow() - Mocking: Module mocks, DI interface mocks, spies, partial mocks, return sequences, timer/date mocking
- Integration:
supertestwith real app, DB setup/teardown, auth flow tests - E2E: Playwright
test()withpage.goto/click/fill,expect(page).toHaveURL() - Frontend:
@testing-library/react(render/screen/fireEvent),renderHook+act,waitForasync - Patterns: AAA, test factories with faker, 80%+ coverage, describe nesting, behavior over implementation
- See
references/testing.mdfor code examples
Modern JavaScript (ES6+)
- Core: Arrow functions (lexical
this), destructuring (object/array/nested/defaults), spread/rest, template literals - Modules: Named/default exports, dynamic
import(), conditional loading, tree-shakeable - Async:
Promise.all/allSettled/race/any, async/await, retry with backoff, timeout wrapper, error tuples - FP: Array methods (map/filter/reduce/flatMap), currying, partial application, memoization, pipe/compose
- Immutability: Spread for updates,
structuredClonefor deep copy,Object.freeze, never mutate inputs - Generators:
function*withyield, async generators for pagination, lazy pipelines (map/filter/take) - Operators: Optional chaining
?., nullish coalescing??, logical assignment??=/||=/&&= - Performance:
debounce,throttle,AbortControllerfor cancellable fetch - See
references/modern-js.mdfor code examples
Build Tools & Package Management
Bundlers
- Vite: Dev server with HMR, Rollup-based production builds. Default choice for new projects
- esbuild: Extremely fast, use for libraries and CLI tools. Limited plugin ecosystem
- Webpack: Mature ecosystem, complex config. Use when Vite/esbuild insufficient
- Turbopack: Next.js integrated, Rust-based. Use only within Next.js
Package Managers
- npm: Default, widest compatibility.
package-lock.json - pnpm: Fastest, strict deps via symlinks. Preferred for monorepos.
pnpm-lock.yaml - yarn: Berry (v4) with PnP or node_modules.
yarn.lock - Always pin exact versions in production (
--save-exact). Useenginesfield
Linting & Formatting
- ESLint: Flat config (
eslint.config.js). Extend@typescript-eslintfor TS projects - Prettier:
.prettierrcwithsemi,singleQuote,trailingComma - lint-staged + husky: Pre-commit hooks for lint/format enforcement
API Design
REST
- Nouns for resources:
/users,/users/:id,/users/:id/posts - HTTP verbs: GET (read), POST (create), PUT (replace), PATCH (update), DELETE
- Status codes: 200, 201, 204, 400, 401, 403, 404, 409, 422, 429, 500
- Pagination:
?page=1&limit=20with response metadata. Versioning: URL prefix/v1/
GraphQL
- Schema-first (SDL) or code-first (
type-graphql). DataLoader for N+1 prevention - Implement depth/complexity limiting to prevent abuse queries
OpenAPI
- Generate from code with
swagger-jsdocor write spec-first withopenapi-generator - Use for client SDK generation, docs, and contract testing
Debugging
Node.js
--inspectflag + Chrome DevTools or VS Code debuggerconsole.time()/timeEnd()for quick measurement,--proffor CPU,--heap-proffor memory
Common TypeScript Errors
- "not assignable": Missing props, wrong types, missing
| undefined - "property does not exist": Use type guard, discriminated union, or optional chaining
- "cannot find module": Check
tsconfig.jsonpaths,moduleResolution,typesarray
Common Pitfalls
- Forgetting
awaiton async calls (returns Promise, not value) ==vs===(always strict equality)thisbinding in callbacks (use arrow functions)- Floating promises without
.catch()or try/catch
Weekly Installs
1
Repository
george11642/geo…-pluginsGitHub Stars
2
First Seen
9 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1