Skip to content
Back to skills

Rules Typescript

ASecurity

ANVIL coding rules for typescript code (**/*.ts, **/*.js, **/*.mjs, **/*.tsx): Node.js, TypeScript Security, TypeScript, TypeScript Testing.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmenttypescriptrustshellnodetestingsecurity

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill rules-typescript --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rules Typescript?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rules Typescript
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-rules-typescript/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-typescript)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.