node-patterns
Skill8 starsChanged 2 months agoMITView on GitHub
Use when writing Node.js/TypeScript backend code — Express, Fastify, or NestJS services, APIs, workers. Builder playbook: project layout, async discipline, typed config, error taxonomy, DI boundaries, testing shape. Complements typescript-reviewer (this prevents, the reviewer catches).
- Reads credentials
In this repository51 other files it gives its agents.
- adrSkill
- agency-tier-uiSkill
- api-designSkill
- banner-designSkill
- brainstormingSkill
- brandSkill
- cavemanSkill
- coding-standardsSkill
- db-optimizationSkill
- designSkill
- design-systemSkill
- design-to-codeSkill
- dispatching-parallel-agentsSkill
- django-securitySkill
- dotnet-patternsSkill
- e2e-testingSkill
- executing-plansSkill
- explainmeSkill
- finishing-a-development-branchSkill
- golang-patternsSkill
- greenfield-architectSkill
- hydraiaSkill
- karpathy-guidelinesSkill
- microservices-architectSkill
- mobile-design-framesSkill
- performance-tuningSkill
- production-auditSkill
- python-patternsSkill
- react-patternsSkill
- receiving-code-reviewSkill
- redesign-upliftSkill
- repo-scanSkill
- requesting-code-reviewSkill
- security-bounty-hunterSkill
- security-reviewSkill
- security-scanSkill
- slidesSkill
- springboot-patternsSkill
- springboot-securitySkill
- story-analysisSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- ui-stylingSkill
- ui-ux-pro-maxSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- web-design-framesSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
No floating promises: every promise is awaited, returned, or explicitly void-ed with a comment.
- Very specific: line 17
No sync I/O (readFileSync, execSync) on request paths — boot time only.
- Very specific: line 28
Never catch (e) {} — swallow nothing.
- Distinctive: line 43
Test files co-located with the feature.
≈ “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
Node/TypeScript Backend Patterns
Project layout
- Feature folders over layer folders:
src/orders/{orders.router,orders.service,orders.repo,orders.test}.tsbeatssrc/{routes,services,repos}/orders.tsscattered three places. - One composition root (
src/app.ts) wires everything; entry (src/main.ts) only boots. Handlers stay thin — parse/validate → service call → shape response.
Async discipline
- No floating promises: every promise is awaited, returned, or explicitly
void-ed with a comment. Unhandled rejection = crash in modern Node. - Propagate
AbortSignalthrough request-scoped work (fetch, DB timeouts); cancel on client disconnect for expensive handlers. - No sync I/O (
readFileSync,execSync) on request paths — boot time only. - Concurrency with intent:
Promise.allfor independent work,for…of awaitwhen order matters, a limiter (p-limit) when fan-out is unbounded.
Config
- Typed and validated at boot (zod or equivalent): missing/invalid env kills the process at startup with a clear message — never
process.env.X!scattered through the codebase. - One
config.tsexports the parsed object; nothing else readsprocess.env.
Errors
- Central error taxonomy:
AppErrorsubtypes with status + code (NotFound,Validation,Conflict,Upstream). Handlers throw domain errors; ONE error middleware maps them to responses (problem+json shape). - Never
catch (e) {}— swallow nothing; wrap-and-rethrow with context or let it propagate.
DI boundaries
- NestJS: providers with explicit scopes; beware request-scoped bleeding into singletons.
- Express/Fastify: manual factories — services take dependencies as constructor/args, never import singletons directly. Makes the testing shape below possible.
ESM/CJS pitfalls
- Pick ONE module system per package and align
"type",tsconfigmodule, and tooling. Mixed default/named interop errors are config bugs, not code bugs. __dirnamedoes not exist in ESM —import.meta.url+fileURLToPath.
Testing shape
- vitest/jest for units (services with faked repos), supertest against the composed app for HTTP behavior (status, body, headers — not internals).
- Test files co-located with the feature. Integration tests own their fixtures.
Logging
- Structured (pino), request-correlated (request-id middleware); never
console.login request paths. Log the error object, noterr.messagealone (stack + cause matter).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

