Index of every page on this site: llms.txt
All skills
mcollina avatar

/node

@c75d70d
by Matteo Collinamcollina/skills2k stars
146
Run it yourself

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.

Use this Skill: https://skilld.dev/gh/mcollina/skills/node

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rulesnode-modules-exploration.md

≈921 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Exploring node_modules

When to Explore node_modules

Explore node_modules when you need to:

  • Find specific packages and their versions
  • Analyze dependencies and dependency trees
  • Examine package contents
  • Investigate dependency conflicts
  • Understand how a package works internally

Core Techniques

Finding Package Versions

# Check actual installed version
cat node_modules/fastify/package.json | grep '"version"'

# For scoped packages
cat node_modules/@fastify/cors/package.json | grep '"version"'

# List all versions with npm
npm ls fastify

Navigating Directory Structure

# List package contents
ls node_modules/fastify/

# Find TypeScript definitions
ls node_modules/fastify/*.d.ts
ls node_modules/@types/node/

# Check main entry point
cat node_modules/fastify/package.json | grep '"main"\|"exports"'

Understanding Package Manager Differences

npm/yarn (node_modules hoisting):

node_modules/
  fastify/
  pino/          # hoisted from fastify's dependencies
  @fastify/cors/

pnpm (content-addressable storage):

node_modules/
  .pnpm/
    fastify@4.0.0/
      node_modules/
        fastify/
        pino/    # symlinked, not hoisted
  fastify -> .pnpm/fastify@4.0.0/node_modules/fastify

Finding Package READMEs

CRITICAL: Never use find, grep, or rg for locating READMEs. Follow this sequence:

  1. Direct Read attempts (try in order):

    node_modules/[package-name]/README.md
    node_modules/[package-name]/readme.md
    node_modules/[package-name]/README

    For scoped packages: node_modules/@scope/package-name/README.md

  2. If not found, list directory contents:

    ls node_modules/[package-name]/

    Look for README files in output, then read the exact filename.

  3. Alternative locations:

    node_modules/[package-name]/docs/README.md

    Or check readme field in package.json.

Analyzing Dependency Trees

# See why a package is installed
npm why lodash

# Full dependency tree
npm ls --all

# Only production dependencies
npm ls --prod

# Find duplicates
npm ls --all 2>&1 | grep -E "^\s+.*@[0-9]" | sort | uniq -d

Investigating Conflicts

Peer Dependency Issues

# Check peer dependencies
cat node_modules/some-plugin/package.json | grep -A 10 '"peerDependencies"'

# See what's actually installed vs. what's expected
npm ls react

Duplicate Packages

When the same package appears multiple times:

# Find all instances of a package
find node_modules -name "package.json" -path "*/lodash/*" 2>/dev/null

# Check for version mismatches
npm ls lodash

Examining Package Internals

Entry Points

# Check exports field (modern)
node -e "console.log(JSON.stringify(require('./node_modules/fastify/package.json').exports, null, 2))"

# Check main field (legacy)
cat node_modules/fastify/package.json | grep '"main"'

TypeScript Definitions

# Find type definitions
ls node_modules/fastify/*.d.ts
cat node_modules/fastify/package.json | grep '"types"\|"typings"'

# For DefinitelyTyped packages
ls node_modules/@types/

Source Files

# Examine source structure
ls node_modules/fastify/lib/
head -50 node_modules/fastify/lib/server.js

Debugging Module Resolution

# See how Node.js resolves a module
node -e "console.log(require.resolve('fastify'))"

# With full resolution paths
node --print "require.resolve.paths('fastify')"

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides a comprehensive set of Node.js best practices and design patterns, focusing on performance, observability, and robust architecture. No security issues were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer8mo

    2/17 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at c75d70d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated 9 months ago
Other metadata
metadata
{
  "tags": "node, nodejs, javascript, typescript, type-stripping, backend, server"
}

README badge

README badge for mcollina/skills/node