nts-architecture-patternslisted
Install: claude install-skill juncoding/nextjs-trpc-prisma-starter
# Architecture patterns for ongoing development
For projects already scaffolded with `nextjs-trpc-prisma-starter`. Explains the patterns to follow when adding features. Companion to the `nts-scaffold-internal-tool` skill which only handles initial setup.
## Use this skill when
- Adding a new business module (e.g. `customer`, `order`, `invoice`).
- Adding a new tRPC procedure or route handler.
- Deciding whether something belongs in tRPC, a route handler, a MCP tool, or a cron job.
- Wiring permissions on a new resource.
- Structuring a service that touches multiple modules.
- Handling errors at any layer.
- Reviewing whether a PR follows project conventions.
## The four-rule cheat sheet
1. **`src/app/` is a thin delivery layer.** No business logic. No DB queries. Just: validate, call a service, return.
2. **`src/server/` is the entire backend.** Every file starts with `import "server-only";`.
3. **Permissions live in services.** Every service method touching user-owned data takes `userId` first and calls `requirePermission`.
4. **Audit calls live in services**, inside the same transaction as the mutation.
If you remember nothing else, remember these four.
## Reference index
Read the file matching your task:
| Doing this... | Read this |
|---|---|
| Creating a new business module (service, schema, types) | `references/service-layer.md` |
| Writing a tRPC procedure | `references/trpc-procedures.md` |
| Wiring auth / RBAC for a new resource | `references/permissions-and