Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rules Typescript?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-typescript)
---
name: rules-typescript
description: "ANVIL coding rules for typescript code (**/*.ts, **/*.js, **/*.mjs, **/*.tsx): Node.js, TypeScript Security, TypeScript, TypeScript Testing."
---
<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->
# ANVIL rules: typescript
Follow these rules for typescript code (**/*.ts, **/*.js, **/*.mjs, **/*.tsx).
## Node.js
# Node.js
- Use `node:` prefixed built-ins; `fs/promises` over sync I/O on hot paths.
- Spawn processes with argument arrays (`execFile`/`spawn`), never shell strings with user input.
- Validate environment variables at startup; fail fast with clear messages.
- Handle `unhandledRejection` and stream errors.
## TypeScript Security
# TypeScript Security
- Never use `eval`, `new Function`, `child_process` with `shell: true` on user input, or `dangerouslySetInnerHTML` with unsanitized strings.
- Guard dynamic object lookups against prototype pollution (`Object.hasOwn`, `Map`, or schema-validated keys instead of `obj[userKey] = val`).
- Validate URLs (scheme allow-list + private/metadata IP blocking) before server-side `fetch` calls to prevent SSRF.
- Canonicalize file paths with `path.resolve` + realpath checks inside base directories before disk reads/writes, and never commit hardcoded tokens.
## TypeScript
# TypeScript
- `strict` mode; no `any` without a comment explaining why. Use `unknown` and narrow.
- Validate external data at boundaries (schema validation) before trusting its type.
- Await every promise or handle it explicitly; no floating promises.
- Prefer `const`, readonly types and discriminated unions for state.
- Use `node:` prefixed built-ins in Node code.
## TypeScript Testing
# TypeScript Testing
- Use the project's runner (Vitest/Jest). Co-locate or mirror source layout consistently.
- Use fake timers and dependency injection instead of sleeps and real network.
- Type-check tests too.