agentleFS
MesteriisMesteriis/Engineering-Bible-AI/skills/typescript/SKILL.md

typescript

Skill0 starsChanged 4 months agoMITView on GitHub

Applies TypeScript/JavaScript rules for types, async behavior, APIs, tooling, tests, and architecture.

We split this skill into the rules it gives an agent

26 rules. 0 are common, 22 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 51 edited versions we read keep these.

  • 22

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before changing TypeScript/JavaScript code, inspect relevant files when present:

    line 14
  2. Distinctive:

    Do not mix package managers.

    line 37
  3. Distinctive:

    Follow existing module style.

    line 41
  4. Distinctive:

    Prefer explicit types at boundaries.

    line 42
  5. Very specific:

    Avoid utils dumping grounds.

    line 44
  6. Distinctive:

    Avoid mutation-heavy shared state.

    line 45
  7. Distinctive:

    Avoid hidden singleton state unless project architecture intentionally uses it.

    line 46
  8. Distinctive:

    Keep framework-specific code at framework boundaries.

    line 47
  9. Very specific:

    Avoid any unless justified.

    line 52
  10. Very specific:

    Use unknown instead of any for untrusted data, then narrow.

    line 53
  11. Distinctive:

    Prefer discriminated unions for state machines and variant data.

    line 54
  12. Distinctive:

    Prefer explicit return types for exported functions.

    line 55
  13. Distinctive:

    Do not silence type errors with broad assertions.

    line 56
  14. Very specific:

    Avoid as casts unless narrowing cannot express the invariant.

    line 57
  15. Distinctive:

    Do not assume TypeScript types validate runtime data.

    line 62
  16. Distinctive:

    use existing schema/validation library if present.

    line 67
  17. Distinctive:

    do not introduce a new validator unless justified.

    line 68
  18. Distinctive:

    If UI code is present:

    line 73
  19. Distinctive:

    keep side effects explicit.

    line 78
  20. Distinctive:

    avoid over-abstraction for tiny components.

    line 79
  21. Distinctive:

    If backend code is present:

    line 84
  22. Distinctive:

    keep route handlers thin;

    line 86
  23. Distinctive:

    avoid leaking internal errors.

    line 88
  24. Distinctive:

    avoid blocking expensive work in request paths.

    line 90
  25. Distinctive:

    keep persistence and business rules separated according to project architecture.

    line 91
  26. Distinctive:

    Use existing test tooling.

    line 95

“Common” is measured: kept by at least 6 in 10 of the 51 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: typescript

Purpose

Apply the shared engineering style to TypeScript and JavaScript projects while respecting existing tooling and architecture.

Inspect First

Before changing TypeScript/JavaScript code, inspect relevant files when present:

  • package.json
  • tsconfig.json
  • eslint.config.*
  • .eslintrc*
  • prettier.config.*
  • .prettierrc*
  • vite.config.*
  • next.config.*
  • webpack.config.*
  • vitest.config.*
  • jest.config.*
  • lockfiles
  • existing source and tests

Package manager detection:

  • pnpm-lock.yaml -> use pnpm
  • yarn.lock -> use yarn
  • package-lock.json -> use npm
  • bun.lockb / bun.lock -> use bun only if project uses it

Do not mix package managers.

Style

  • Follow existing module style.
  • Prefer explicit types at boundaries.
  • Keep modules cohesive.
  • Avoid utils dumping grounds.
  • Avoid mutation-heavy shared state.
  • Avoid hidden singleton state unless project architecture intentionally uses it.
  • Keep framework-specific code at framework boundaries.

TypeScript Rules

  • Prefer strict types.
  • Avoid any unless justified.
  • Use unknown instead of any for untrusted data, then narrow.
  • Prefer discriminated unions for state machines and variant data.
  • Prefer explicit return types for exported functions.
  • Do not silence type errors with broad assertions.
  • Avoid as casts unless narrowing cannot express the invariant; explain non-obvious casts.
  • Respect existing runtime validation strategy.

Runtime Validation

Do not assume TypeScript types validate runtime data.

For external input:

  • validate at boundaries;
  • use existing schema/validation library if present;
  • do not introduce a new validator unless justified;
  • handle invalid data explicitly.

React / UI Code

If UI code is present:

  • keep components cohesive;
  • avoid god components;
  • separate state management, data fetching, and presentation when complexity justifies it;
  • keep side effects explicit;
  • avoid over-abstraction for tiny components;
  • preserve accessibility behavior.

Node / Backend Code

If backend code is present:

  • keep route handlers thin;
  • validate input;
  • avoid leaking internal errors;
  • propagate cancellation/timeouts where supported;
  • avoid blocking expensive work in request paths;
  • keep persistence and business rules separated according to project architecture.

Tests and Validation

Use existing test tooling.

Common commands, only when configured or clearly available:

pnpm test
pnpm lint
pnpm typecheck
npm test
npm run lint
npm run typecheck
yarn test
yarn lint
yarn typecheck
bun test

Report exact commands and results.

Shared Cross-Ecosystem Style

Apply the shared engineering style from:

  • ../../engineering/05_design_principles.md
  • ../../engineering/06_responsibility_model.md
  • ../../engineering/07_complexity_budget.md
  • ../../engineering/12_naming_bible.md

Language-specific idioms control syntax and ecosystem details, but they must not weaken the core rules: small cohesive units, explicit boundaries, honest validation, no dumping grounds, and no fake placeholders.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.