agentleFS
ushiboushibo/brigade/skills/node/SKILL.md

node

Skill1 starsChanged 4 months agoMITView on GitHub

Provides domain-specific best practices for Node.js development with TypeScript, covering type stripping, async patterns, error handling, streams, modules, testing, performance, caching, logging, and more. Use when setting up Node.js projects with native TypeScript support, configuring type stripping (--experimental-strip-types), writing Node 22+ TypeScript without a build step, or when the user mentions 'native TypeScript in Node', 'strip types', 'Node 22 TypeScript', '.ts files without compilation', 'ts-node alternative', or needs guidance on error handling, graceful shutdown, flaky tests, profiling, or environment configuration in Node.js. Helps configure tsconfig.json for type stripping, set up package.json scripts, handle module resolution and import extensions, and apply robust patterns across the full Node.js stack.

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use java, python and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • testdino-hqSkill

    java

    Google's official Java style guide. Covers 2-space indentation, 100-char line limit, naming conventions, braces, imports, Javadoc, exception handling, lambdas, and streams. Enforces @Override annotations and specific imports.

    Also in 3 projects that use this

  • rogue-dev-studioSkill

    python

    Python 3.13 with uv package manager via mise. Use when the project needs this capability or the user / team manifest asks for it. Use for specialized `python` work when listed in TEAM.yaml or explicitly requested.

    Also in 4 projects that use this

  • MicrosoftSkill

    rust

    Use this guide when working on Rust changes in the FAST monorepo.

    Also in 3 projects that use this

  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill whenever you are dealing with Node.js code to obtain domain-specific knowledge for building robust, performant, and …

    line 10
  2. Very specific:

    When writing TypeScript for Node.js, use type stripping (Node.js 22.6+) instead of build tools like ts-node or tsx.

    line 14
  3. Very specific:

    Use import type for type-only imports

    line 17
  4. Distinctive:

    Use const objects instead of enums

    line 18
  5. Distinctive:

    Avoid namespaces and parameter properties

    line 19
  6. Very specific:

    Use .ts extensions in imports

    line 20
  7. Distinctive:

    When the task mentions CSV, ETL, ingestion pipelines, large file processing, backpressure, repeated lookups, or deduplicating concurrent …

    line 55
  8. Very specific:

    Use await pipeline(...) from node:stream/promises (prefer this over chained .pipe() in guidance/code).

    line 57
  9. Distinctive:

    Read individual rule files for detailed explanations and code examples:

    line 78

“Common” is measured: kept by at least 6 in 10 of the 5 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

When to use

Use this skill whenever you are dealing with Node.js code to obtain domain-specific knowledge for building robust, performant, and maintainable Node.js applications.

TypeScript with Type Stripping

When writing TypeScript for Node.js, use type stripping (Node.js 22.6+) instead of build tools like ts-node or tsx. Type stripping runs TypeScript directly by removing type annotations at runtime without transpilation.

Key requirements for type stripping compatibility:

  • Use import type for type-only imports
  • Use const objects instead of enums
  • Avoid namespaces and parameter properties
  • Use .ts extensions in imports

Minimal example — a valid type-stripped TypeScript file:

// greet.ts
import type { IncomingMessage } from 'node:http';

const greet = (name: string): string => `Hello, ${name}!`;
console.log(greet('world'));

Run directly with:

node greet.ts

See rules/typescript.md for complete configuration and examples.

Common Workflows

For multi-step processes, follow these high-level sequences before consulting the relevant rule file:

Graceful shutdown: Register signal handlers (SIGTERM/SIGINT) → stop accepting new work → drain in-flight requests → close external connections (DB, cache) → exit with appropriate code. See rules/graceful-shutdown.md.

Error handling: Define a shared error base class → classify errors (operational vs programmer) → add async boundary handlers (process.on('unhandledRejection')) → propagate typed errors through the call stack → log with context before responding or crashing. See rules/error-handling.md.

Diagnosing flaky tests: Isolate the test with --test-only → check for shared state or timer dependencies → inspect async teardown order → add retry logic as a temporary diagnostic step → fix root cause. See rules/flaky-tests.md.

Diagnosing stuck processes/tests (node --test hangs, "process did not exit", CI timeout, open handles): isolate file/test → run with explicit timeout/reporter → inspect handles via why-is-node-running (SIGUSR1) → patch deterministic teardown in resource-creation scope → rerun isolated + full suite until stable. See rules/stuck-processes-and-tests.md.

Profiling a slow path: Reproduce under realistic load → capture a CPU profile with --cpu-prof → identify hot functions → check for stream backpressure or unnecessary serialisation → validate improvement with a benchmark. See rules/profiling.md and rules/performance.md.

High-priority activation checklist (streams + caching)

When the task mentions CSV, ETL, ingestion pipelines, large file processing, backpressure, repeated lookups, or deduplicating concurrent async calls, explicitly apply this checklist:

  1. Use await pipeline(...) from node:stream/promises (prefer this over chained .pipe() in guidance/code).
  2. Include at least one explicit async function* transform when data is being transformed in-stream.
  3. Choose a cache strategy when repeated work appears:
    • lru-cache for bounded in-memory reuse in a single process.
    • async-cache-dedupe for async request deduplication / stale-while-revalidate behavior.
  4. Show where backpressure is handled (implicitly via pipeline() or explicitly via drain).

Integrated example pattern (CSV/ETL)

For CSV/ETL-style prompts, prefer an answer structure like:

  • createReadStream(input)
  • async function* parser/transform
  • optional cached enrichment lookup (async-cache-dedupe or lru-cache)
  • await pipeline(...) to a writable destination

Link relevant rules directly in explanations so models can retrieve details:

  • rules/streams.md
  • rules/caching.md

How to use

Read individual rule files for detailed explanations and code examples:

  • rules/error-handling.md - Error handling patterns in Node.js
  • rules/async-patterns.md - Async/await and Promise patterns
  • rules/streams.md - Working with Node.js streams
  • rules/modules.md - ES Modules and CommonJS patterns
  • rules/testing.md - Testing strategies for Node.js applications
  • rules/flaky-tests.md - Identifying and diagnosing flaky tests with node:test
  • rules/stuck-processes-and-tests.md - Diagnosing processes that do not exit and tests that get stuck
  • rules/node-modules-exploration.md - Navigating and analyzing node_modules directories
  • rules/performance.md - Performance optimization techniques
  • rules/caching.md - Caching patterns and libraries
  • rules/profiling.md - Profiling and benchmarking tools
  • rules/logging.md - Logging and debugging patterns
  • rules/environment.md - Environment configuration and secrets management
  • rules/graceful-shutdown.md - Graceful shutdown and signal handling
  • rules/typescript.md - TypeScript configuration and type stripping in Node.js

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.