resilient-nestjs-patterns
Skill34 starsChanged 10 days agoMITView on GitHub
NestJS service decomposition and resilience. Use when splitting an orchestrator service into layers, adding retries or fallbacks, wiring EventEmitter events or SSE, or designing forRoot/forTesting dynamic modules. Persistence, auth, RBAC and repositories are nestjs-backend-patterns. Webhook plumbing is webhook-architecture. A task that both persists and retries may load both skills.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Hive-Academy/ptah-extensionword for word, first seen Nov 3, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Hive-Academy/ptah-extension★ 34100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-lanesSkill
- angular-3d-scene-crafterSkill
- angular-frontend-patternsSkill
- angular-gsap-animation-crafterSkill
- ddd-architectureSkill
- execute-phase-gated-taskSkill
- frontend-designSkill
- humanize-librarySkill
- nestjs-backend-patternsSkill
- nestjs-deploymentSkill
- nx-workspace-architectSkill
- orchestrationSkill
- ptah-surface-authoringSkill
- saas-platform-patternsSkill
- saas-workspace-initializerSkill
- session-handoffSkill
- skill-creatorSkill
- technical-content-writerSkill
- tribunalSkill
- ui-ux-designerSkill
- webhook-architectureSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use during a Stage B module task when the module needs orchestration, reliability, events, or configurable wiring.
- Distinctive: line 11
Keep controllers at the HTTP boundary, domain services responsible for business rules, and database services responsible for persistence …
≈ “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
Resilient NestJS Patterns
Apply
- Use during a Stage B module task when the module needs orchestration, reliability, events, or configurable wiring.
- Keep controllers at the HTTP boundary, domain services responsible for business rules, and database services responsible for persistence and transactions.
- Retry only transient external failures with a bounded policy; make fallback behavior explicit. Keep side effects behind events when they should not block the core transaction.
- Expose configuration through a dynamic module when provider choices vary by environment or tests.
- When patterns compose, a thin controller calls a business orchestrator; it delegates persistence to a DbService, external calls to a resilient adapter, and emits a domain event only after the transaction succeeds. Event listeners handle email or SSE; the module exports the orchestrator and supplies production and test providers through
forRootandforTesting.
Selection and adoption
| Current problem | Route |
| Controller calls Prisma, owns transactions, or mixes HTTP mapping with business rules | Domain service layering first |
| Service has unrelated method clusters or too many collaborators to test | Service orchestration after layering |
| Transient provider errors, a local fallback, or provider downtime | Retry and fallback; this can be adopted independently |
| Email, cache invalidation, audit work, or SSE coupled to the core method | Event-driven architecture after service boundaries are clear |
| Repeated provider setup, environment choices, or test substitutes | Dynamic modules once the module structure is stable |
Adopt only patterns justified by a current problem; do not decompose a small cohesive service just to fit this sequence.
Failure patterns
| Symptom | Correct route |
| Fat controller with business logic | Domain service layering |
| God service spanning unrelated concerns | Service orchestration |
| Silent failure from an empty catch around an external call | Retry and fallback with explicit failure handling |
| Synchronous email or other side effect blocking the response | Event-driven architecture |
| Copy-pasted provider arrays across modules | Dynamic modules |
| Premature decomposition of a small service | Keep it cohesive (YAGNI) |
Load by task
- For a domain service coordinating several collaborators, load service orchestration.
- For controller, business, and database boundaries, load domain service layering.
- For external provider failures, load retry and fallback.
- For decoupled side effects or SSE, load event-driven architecture.
- For configurable provider wiring and test substitutes, load dynamic modules.
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
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.

