lang-js-ts
Skill5 starsChanged 47 days agoMITView on GitHub
use this when writing, reviewing, or testing JavaScript or TypeScript — *.ts, *.tsx, *.js, *.mjs, *.cjs, tsconfig, package.json. TypeScript-strict wins when tsconfig exists. do not use for HTML/CSS-only (lang-web-markup) or Python.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-safetySkill
- golang-securitySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-cppSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-sqlSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
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
- Very specific: line 21
Use the lockfile's package manager (pnpm / npm / yarn).
- Distinctive: line 30
Do not add a second test runner or a second linter.
- Very specific: line 46
Do not empty-catch. Log or wrap with context, then rethrow or return a typed error the caller expects.
- Distinctive: line 53
No shared mutable state across requests without a documented store.
- Very specific: line 55
Avoid Promise.all on untrusted-length lists without a bound.
- Distinctive: line 60
Test through the public API.
- Distinctive: line 63
Use the runner already in the repo (node:test, vitest, jest).
- Distinctive: line 78
No string-built SQL, HTML, or shell.
- Very specific: line 84
Do not store tokens in localStorage.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
JavaScript / TypeScript
One skill for both. TS-strict is the default when tsconfig.json exists;
JS is the same rules minus the type checker. No scripts/. Not a
React/Next/Vue skill.
Process skills that may load with this one: load-with list.
Whether .tsx loads this skill or lang-web-markup: map.
Iron law
any is a bug. Untrusted data is parsed at the boundary. Promises are
not fire-and-forget.
Tooling / verify
Use the lockfile's package manager (pnpm / npm / yarn). Typical:
# names vary — run what package.json scripts already define
npm test
npx tsc --noEmit # when tsconfig exists
npx eslint . # when eslint is already in the treeDo not add a second test runner or a second linter. Read the full output.
Idioms a linter misses
constdefault,letwhen reassigned. Novar. No implicit globals.===.??for nullish; do not use||when0or''is valid.- Named exports. Default exports only if the file already does.
- ESM if the package is ESM. Do not mix
requireandimportwithout an existing pattern. - Functions that return a Promise are
asyncor clearly chained. Callersawaitor return the promise. No floating promises. - Narrow with predicates / discriminated unions, not
as T. unknownat untrusted boundaries, then narrow. Neveras any.
Errors
- Do not empty-
catch. Log or wrap with context, then rethrow or return a typed error the caller expects. - Node: do not
process.exitfrom a library. - Map HTTP / network failures to a small error union, not a raw
any.
Concurrency
- No shared mutable state across requests without a documented store.
AbortSignalfor cancellable I/O when the caller can cancel.- Avoid
Promise.allon untrusted-length lists without a bound. - Worker threads / child processes: structured messages, no string
eval.
Testing
- Test through the public API. Mock only at process boundaries (network, clock, RNG, fs).
- One behavior per test. Names say the expected outcome.
- Use the runner already in the repo (node:test, vitest, jest). Do not add another.
PR review
- New
as/any/@ts-ignore: reject unless the comment names the invariant and the escape is local. - New dependency: why not std or an existing dep?
- Async path: every rejection handled.
- Bundle / Node surface: no secrets in client code.
Security
- Validate untrusted input at the boundary. Use the schema library the repo already has; do not invent a second one.
- No string-built SQL, HTML, or shell. Parameterize / use APIs.
- Browser: no
innerHTML/dangerouslySetInnerHTML/postMessageof untrusted data. Same sink class.target=_blankneedsrel="noopener noreferrer". - Node: no
eval,new Function, orchild_processwith a concatenated string.pathjoins stay inside an allowlisted root. - Do not store tokens in
localStorage.
Always
strictstays on. New files match existingtsconfig.- Quote-free equality and nullish rules above.
- Tests for the new branch.
Ask first
- Disabling a
strictflag. - Adding a runtime schema library the repo does not use.
- Introducing a new test runner or bundler.
anyin a public.d.ts.
Never
any,as unknown as T, emptycatch {}.eval/new Function/document.write.- String-building SQL, HTML, or shell.
- Pinning a future TS / Node version the repo is not on.
Red flags
- "I'll type this as any and fix later"
- "The frontend already validated it"
- "JSON.parse is fine, we control the server"
- "It's just a quick child_process.exec"
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.

