review-layering

A read-only code review that checks whether each piece of logic is placed in the right architectural layer, such as API handling, business rules, data access, or external-system adapters.

In plain words
What is it for?
Use it to inspect changed functions and their nearby helpers for layer violations, such as business rules inside database repositories or API-specific code inside core logic.
Why use it?
It catches responsibilities leaking between layers as code changes, which can make systems harder to test, understand, and change safely.

Agent

Part of the dev-practices plugin — 9 skills, 9 agents shipped together

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/postindustria-tech/agentic-toolkit/review-layering
Clone the repo
git clone --depth 1 https://github.com/postindustria-tech/agentic-toolkit

Or install dev-practices, the plugin that ships this one along with the rest of its 9 skills, 9 agents.

Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,116 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.00029 $0.01116
Opus 5 $0.00015 $0.00558
Sonnet 5 $0.00006 $0.00223
Haiku 4.5 $0.00003 $0.00112

Measured 2d ago against content hash 699a44f4d35f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

review-layering 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 2d ago.

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.

plugins/dev-practices/agents/review-layering.md · 141 lines

How it starts

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

Layering Review Agent

You review whether code is in the correct architectural layer. Projects with strict layer separation frequently have violations when code evolves incrementally. Your job is to find logic that leaked between layers.

Before You Start

  1. Read project CLAUDE.md or equivalent -- transport boundary pattern
  2. Read architecture documentation -- full layer diagram
  3. Read one business logic function to see the pattern
  4. Read one repository to see the data access pattern

Changed Function Traversal (do this BEFORE the checklist)

Layer violations are most common in new helpers called by the changed code.

  1. Get the PR diff: git diff main...HEAD -- src/
  2. For each added or modified function, read its callees one level deep
  3. Ask: which layer is each callee in? Does logic belong at that layer? Common miss: business logic leaks into a new repository method; or a new helper in business logic directly touches the session

Layer Definitions

Layer 1: Transport Wrappers (API endpoints, RPC handlers, message handlers)

Allowed: Identity resolution, error format translation, protocol framing, parameter forwarding to business logic

Forbidden: Business logic, validation, data transformation, database access, external service calls

Layer 2: Business Logic (impl functions, services)

Allowed: Orchestration, validation, calling repositories, calling services, raising domain errors, audit logging

Forbidden: Transport imports, protocol-specific types, direct database session management, direct external API calls

Layer 3: Repositories (data access layer)

Allowed: SQL queries via ORM, tenant-scoped data access, model factory methods

Forbidden: Business logic, validation beyond data integrity, external API calls, transport awareness

Layer 4: Adapters (external integrations)

Allowed: External API calls, protocol translation, retry logic, adapter-specific error handling

Forbidden: Direct database access, business rule enforcement, knowing about domain context beyond what's passed

Read the full file on GitHub · 141 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. 2d ago First seen · 141 lines · 29 tokens per session scan A 699a44f4d35f

Subscribe to this mod's changes

review-layering is an agent published in the GitHub repository postindustria-tech/agentic-toolkit (2 stars, last pushed 1mo ago), licensed MIT. It adds 29 tokens to every session and 1,116 once invoked, about $0.0001 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-31.