lang-typescript
Skill0 starsChanged 7 days agoMITView on GitHub
Use when writing, reviewing, testing or setting up TypeScript or JavaScript (Node, Bun) backend code in a loops run (the typescript language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
- Reads credentials
- Installs packages
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/work/platforms/claude.mdCLAUDE.md
- llms.txtllms.txt
- clarifySkill
- consistencySkill
- debuggingSkill
- documentationSkill
- featureSkill
- hexagonalSkill
- initSkill
- jobs-and-state-machinesSkill
- lang-clojureSkill
- lang-cppSkill
- lang-csharpSkill
- lang-elixirSkill
- lang-erlangSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-phpSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-scalaSkill
- lang-swiftSkill
- memorySkill
- parallel-workSkill
- performanceSkill
- qualitySkill
- reportSkill
- review-integrationSkill
- statusSkill
- testingSkill
- workSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Check-then-act across await: DB unique constraint or per-key lock.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript / JavaScript backend (Node 26 LTS, as of 2026-11)
Rule book: specs/languages/typescript/RULES.md (IDs TS-<SEC>-NN). Pack data: specs/languages/typescript/pack.json. Universal rules: specs/ARCHITECTURE.md, specs/SOLID.md; do not restate them.
1. When it applies
loops lang detect reports typescript (a package.json or tsconfig.json at the root). The pack picks a variant from the lockfile: package-lock.json is npm (the base), pnpm-lock.yaml, yarn.lock (Yarn Berry), bun.lock. Deno has no variant: deno.json projects use the commands in testing.md as project overrides.
2. Project rules first
Follow the repo's own configs over this pack: ESLint flat config or Biome, Prettier, tsconfig, the package manager, the test runner, the framework's layout. Log every deviation: loops run override --rule "<loops rule>" --project "<project rule, file:line>" --note "<what you did>" (ROLES.md, Project rules first). Never add a second formatter or linter next to the project's.
3. The toolchain the gate runs
loops gate runs the checks below in order (WORKFLOW §6). While iterating, run one check's command, never the whole repo by hand. A check with when_file runs only if that config is committed, and then it is required.
| Check | Command (npm) | Runs when |
deps | npm ci --ignore-scripts (pnpm install --frozen-lockfile, yarn install --immutable, bun install --frozen-lockfile) | a lockfile is committed |
typecheck | npx --no-install tsc --noEmit | tsconfig.json |
prettier | npx --no-install prettier --check . | a Prettier config |
eslint | npx --no-install eslint --max-warnings=0 . | eslint.config.* |
biome | npx --no-install biome ci . | biome.json[c]; replaces Prettier and ESLint |
build | npm run build --if-present | always |
arch, depcruise | loops arch; depcruise src --config .dependency-cruiser.cjs | depcruise needs its config |
test, test-repeat | vitest (jest when no vitest or vite config; bun test in the bun variant), see §4 | always |
coverage | new-code lcov coverage at least 70% (WORKFLOW §6) | after test |
npm-audit, osv-scanner | npm audit --audit-level=high --omit=dev; osv-scanner scan source -r . | --vuln only |
Tools run through npx --no-install (or the manager's own exec), so versions come from the lockfile; never npm install -g (TS-OPS-07). Installs always use --ignore-scripts (TS-SEC-06); a dependency that needs a build step is allowed explicitly (pnpm allowBuilds), by the architect. post_edit formats the one edited file with prettier --write. Biome projects override that in project config. Yarn Classic: use --frozen-lockfile and yarn run build as an override.
4. Race policy
JavaScript has no race detector, so the policy is race.mode = none (WORKFLOW §6, GENERIC §5.2). Two required checks carry it, and a skipped one fails the full gate:
test: the whole suite,--sequence.shuffle.files --sequence.shuffle.tests --sequence.concurrent. vitest prints "Running tests with seed ..."; paste that seed in a failure report and replay with--sequence.seed=N.test-repeat:vitest run --repeats=2with the same shuffle and concurrency, over the whole suite (--changedhas no git base in the gate, so it would repeat nothing once changes are committed).
Retries stay off: never --retry.count above 0, retry: in config, or jest.retryTimes; never --no-randomize, --sequence.shuffle=false or --sequence.concurrent=false. A flaky test is a shared-state bug: find the module state, the un-awaited promise, or the check-then-act across await (concurrency.md). Node's node:test needs --test-randomize --test-concurrency (Node 26.1+); jest 30 needs --randomize.
5. Coverage recipe
vitest run --coverage --coverage.provider=v8 --coverage.reporter=lcov --coverage.reportsDirectory={coverage_dir} writes {coverage_dir}/lcov.info; loops reads DA: lines of changed non-test source files. Wave 0 prerequisites (architect or typescript-engineer, each logged as an override when it deviates from the repo):
@vitest/coverage-v8in devDependencies (jest: built in; bun: built in).vitest.config.tswithtest.coverage.include: ['src/**/*.ts']so untested files count, andcoverage.excludefor*.d.ts, generated code, migrations,main.ts. Without a vitest or vite config the gate falls back to jest, so commit this file.testTimeoutandhookTimeoutset,isolate: trueand theforkspool (the defaults),restoreMocks: true.
6. Layer map
src/domain/ pure: entities, value objects, errors; no node:*, no framework, no clock
src/application/ use cases + consumer-owned port interfaces (Clock, IdGen, repos)
src/adapters/inbound/{http,queue,cli} routes, schema validation (zod), handlers
src/adapters/outbound/{postgres,http-client,kafka}
src/compose/ composition root: new X(deps)
src/main.ts the only file reading process.env, starting the server, handling signalsTests sit next to code as *.test.ts; integration and e2e under test/. loops arch reads import statements (ES, import type, export from, import(), require) with the relative-path resolver, so tsconfig paths aliases need ./-relative imports or a dependency-cruiser config. NestJS: domain/ and application/ stay decorator-free (frameworks.md).
7. Footguns
- Floating promise:
await, orvoid p.catch(log). forEach(async ...)does not await:Promise.allwith a cap, orfor...of.- Blocking the event loop: no
*Sync, bigJSON.parse, or backtracking regex on request paths. req.body as Tis not validation:Schema.parse(zod or valibot) at the edge.strictwithoutnoUncheckedIndexedAccess:arr[i]is typed as present.npm installor install scripts in CI:npm ci --ignore-scripts.- Prototype pollution: no recursive merge or
Object.assignof input; useMap. - Check-then-act across
await: DB unique constraint or per-key lock. CMD npm startloses SIGTERM: exec-formnode dist/main.js, gracefulserver.close().- Type stripping is not type checking and
enumbreaks it: keeptsc --noEmitin the gate.
8. Load on demand
repo.md: layout, lockfile, toolchain pins,.npmrc, CI order, supply chain.architecture.md: layer mapping, imports, dependency-cruiser, DI, size limits.idioms.md: errors, null handling, unions, ESM, dates and money.testing.md: vitest, fakes, Testcontainers, coverage, Bun and Deno recipes.concurrency.md: event loop,awaitinterleaving, AbortSignal, shutdown, the race substitute.security.md: validation, injection, supply chain, secrets, headers.data-api.md: persistence, APIs, observability, config and packaging.frameworks.md: NestJS, Fastify, Hono and Express fit.
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
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.

