nestjs-typeorm-transactional
Installation
SKILL.md
NestJS TypeORM Transactional
Build transaction boundaries that propagate TypeORM's transactional EntityManager through asynchronous calls without passing it through every service and repository method.
Required workflow
- Inspect the target project's NestJS, TypeORM, RxJS, TypeScript, module, bootstrap, repository, test, and multi-data-source setup.
- Read architecture-and-audit.md to identify required components and known failure modes.
- Decide the transaction entry point:
- Use interceptor mode only for controller handler or controller class boundaries.
- Use
TxRunner.run()for service-to-service calls, jobs, consumers, schedulers, CLI flows, and other non-controller entry points. - Do not claim that a metadata-only service method decorator is active through a Nest controller interceptor.
- Read implementation-example.md and adapt paths, module ownership, logging, isolation defaults, and data-source selection to the target project.
- Replace transaction-sensitive repository access with
OrmHelperlookups performed at method call time. - Keep the transaction scope around database work only. Move slow filesystem, network, subprocess, and streaming work outside it unless atomic coupling is explicitly required and supported.
- Read testing-example.md, add proportional tests, and verify commit, rollback, context cleanup, nesting, and non-transactional fallback.
- Report changed files, selected boundary mode, participating repositories, unsupported paths, tests run, and remaining risks.