← ClaudeAtlas

engineering-standards-javascriptlisted

Use when writing or reviewing JavaScript or TypeScript code and tests under the team engineering standards, especially when validating input or setting up mocks in a Jest or Vitest test.
pragmatic-engineer/playbook · ★ 0 · Testing & QA · score 66
Install: claude install-skill pragmatic-engineer/playbook
# Engineering Standards: JavaScript and TypeScript Language-specific engineering standards for JavaScript and TypeScript, derived from the team's base standards. RFC 2119 keywords (MUST, SHOULD) carry their standard meanings. **REQUIRED BACKGROUND:** engineering-standards owns the general rules (PR readiness, size, test types and requirements, the mocking philosophy, deployment). Read it first. This skill adds only the JS/TS specifics and never restates the base. ## Validation and parsing: use a schema validator **Prefer a schema validator (Zod, Valibot, or whatever the project already uses) for validation and parsing** over hand-written type guards, manual `if` checks, or casting with `as`. A schema is one source of truth: it validates at runtime and gives you the static type (Zod's `z.infer`, Valibot's `v.InferOutput`), so the shape and the check can't drift. **Validate at the boundaries of the application.** Parse untrusted or untyped data the moment it enters the app, then work with typed values inside. Boundaries include: - HTTP request bodies, query params, route params, and headers. - Environment variables and config files. - Responses from external APIs and third-party services. - Message-queue and event payloads. - Anything typed `any` or `unknown`: `JSON.parse` output, untyped DB rows, files read off disk. Use `schema.parse(input)` when a bad value should throw and fail fast at the edge, or `schema.safeParse(input)` when you want to handle the error path your