Skill

Enforce Backend Development Standards

A layered backend architecture doctrine (routes-controllers-services-repositories) with a BFRI risk-scoring gate and hard anti-patterns.

Works with expresstypescriptprismazodsentry

82
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Ensure your backend services are predictable, observable, and maintainable by enforcing strict architectural guidelines, error handling, and testing discipline.

Outcomes

What it gets done

01

Apply a layered architecture (Routes → Controllers → Services → Repositories).

02

Implement explicit error boundaries and ensure all errors are captured by Sentry.

03

Validate all external input using Zod schemas.

04

Enforce mandatory unit and integration testing for all backend code.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-backend-dev-guidelines | bash

Overview

Backend Development Guidelines

A backend architecture doctrine defining a BFRI risk-scoring formula and a mandatory routes-controllers-services-repositories layering with seven hard anti-patterns. Use in codebases following this specific layered architecture doctrine; score changes with BFRI before building and reject any of the seven hard anti-patterns.

What it does

This skill defines a non-negotiable backend architecture doctrine plus a risk-scoring gate for evaluating whether a change is safe to build. The Backend Feasibility & Risk Index (BFRI) scores a proposed change across five dimensions (1-5 each): Architectural Fit (does it follow routes -> controllers -> services -> repositories?), Business Logic Complexity, Data Risk (does it touch critical data paths or transactions?), Operational Risk (does it affect auth, billing, messaging, or infra?), and Testability. The formula BFRI = (Architectural Fit + Testability) - (Complexity + Data Risk + Operational Risk) produces a score from -10 to +10: 6-10 is Safe (proceed), 3-5 is Moderate (add tests and monitoring), 0-2 is Risky (refactor or isolate first), and below 0 is Dangerous (redesign before writing any code).

The core architecture doctrine is treated as non-negotiable: layered architecture is mandatory (routes only route, controllers coordinate while services decide business logic), all controllers extend a shared BaseController, all errors go to Sentry, unifiedConfig is the only allowed configuration source, and all external input must be validated with Zod. It also prescribes a canonical directory structure, strict naming conventions, dependency injection rules, Prisma and repository patterns, mandatory asyncErrorWrapper for async error handling, required observability/monitoring instrumentation, and required test coverage.

Seven anti-patterns trigger immediate rejection: business logic in routes, skipping the service layer, direct Prisma calls in controllers, missing validation, using process.env directly instead of unifiedConfig, console.log instead of Sentry, and untested business logic.

When to use - and when NOT to

Use this when writing or reviewing backend code in a codebase that follows this layered routes-controllers-services-repositories doctrine, scoring new features or changes with BFRI before building, and rejecting code that hits one of the seven hard anti-patterns.

Not the right skill for codebases using a fundamentally different architecture pattern (this doctrine is specific and opinionated, not a general backend guide), or for frontend-only changes with no backend logic involved.

Inputs and outputs

Inputs: a proposed backend feature or change, scored across the five BFRI dimensions.

Outputs: a BFRI score with a clear proceed/add-tests/refactor/redesign verdict, code following the mandatory layered architecture (BaseController, Sentry error reporting, unifiedConfig, Zod validation, asyncErrorWrapper), and rejection of any code matching the seven hard anti-patterns.

Integrations

Sentry (error reporting), Zod (input validation), Prisma (repository layer), a unifiedConfig module, asyncErrorWrapper utility, BaseController base class.

Who it's for

Backend developers and reviewers working in a codebase enforcing this specific layered architecture doctrine who need a risk-scoring gate (BFRI) and a hard anti-pattern checklist before shipping changes.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.