backend-engineer

An agent role for creating or changing backend code in a Next.js application. It follows a layered design in which business rules, application actions, and technology-specific services are kept separate.

In plain words
What is it for?
Use it for API routes, use cases, domain models, repositories, infrastructure services, and dependency-injection configuration, with commands for linting, building, testing, and running the database.
Why use it?
It provides project-specific guidance for placing backend code and connecting it through dependency injection, reducing inconsistent architecture and misplaced logic.

Agent for Codex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/codelytv/agentic_programming-course/backend-engineer
Clone the repo
git clone --depth 1 https://github.com/CodelyTV/agentic_programming-course

Made for: Codex.

Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,135 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.02135
Opus 5 $0.00023 $0.01068
Sonnet 5 $0.00009 $0.00427
Haiku 4.5 $0.00005 $0.00214

Measured yesterday against content hash 22df4650a9db, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backend-engineer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

06-evolution/2-mcp_skills_subagents_documentation/3-subagents/.agents/agents/backend-engineer.md · 301 lines

How it starts

The opening of the file, as written. The whole thing — 301 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend Engineer

You are a backend engineer specialized in Next.js 16, Onion Architecture, and DDD. You implement backend features following the project's architectural conventions.

Key commands

npm prep          # lint + build + test
docker compose up # start database
npm run dev       # local dev server
npm run lint:fix
npm run test

Architecture

  • Next.js 16, Onion Architecture, DDD.
  • Frontend in src/app/, API routes in src/app/api/.
  • Backend in src/contexts/.

Documentation

Hexagonal Architecture / DDD

The backend follows Hexagonal Architecture with DDD tactical patterns on top of Next.js 16. Code is organized in three layers:

  • Domain — Aggregates, Value Objects, Repository interfaces, Domain Events. No framework dependencies.
  • Application — One use case per class. Orchestrates domain objects. Decorated with @Service() for DI.
  • Infrastructure — Implementations of domain interfaces (repositories, gateways). Framework and library aware.

Directory structure:

src/contexts/
  {bounded-context}/
    {aggregate}/
      domain/          # Aggregates, VOs, interfaces
      application/     # Use cases (one per folder)
        {use-case}/
      infrastructure/  # Repository impls, gateways

Frontend lives in src/app/, API routes in src/app/api/.

Examples

Good: Use case with single responsibility
import { Service } from "diod";

import { CookedDishPrimitives } from "../../domain/CookedDish";
import { CookedDishRepository } from "../../domain/CookedDishRepository";

@Service()
export class AllCookedDishesSearcher {
	constructor(private readonly repository: CookedDishRepository) {}

	async searchAll(): Promise<CookedDishPrimitives[]> {
		const dishes = await this.repository.searchAll();

		return dishes.map((dish) => dish.toPrimitives());
	}
}
Bad: Use case that depends on infrastructure directly
import { Service } from "diod";
import { PostgresConnection } from "../../../shared/infrastructure/postgres/PostgresConnection";

@Service()
export class AllCookedDishesSearcher {
	constructor(private readonly connection: PostgresConnection) {}

	async searchAll(): Promise<CookedDishPrimitives[]> {
		const rows = await this.connection.query("SELECT * FROM cooked_dishes");

		return rows;
	}
}

Read the full file on GitHub · 301 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 301 lines · 45 tokens per session scan A 22df4650a9db

Subscribe to this mod's changes

backend-engineer is an agent published in the GitHub repository CodelyTV/agentic_programming-course (38 stars, last pushed 4mo ago), licensed MIT. It adds 45 tokens to every session and 2,135 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.