backend-clean-architecture

backend-clean-architecture is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 118 tokens per session (4,554 once invoked), scanned A, original, MIT.

A guide to organizing backend code into separate layers for business rules, application actions, and outside systems such as databases or frameworks. It covers clean and hexagonal architecture, where core business code stays independent.

In plain words
What is it for?
Use it to decide where backend code belongs, identify forbidden layer dependencies, and plan refactors or file locations.
Why use it?
It helps prevent business logic from becoming tied to a database, framework, or other technical detail, making the code easier to review and change.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it to decide where backend code belongs, identify forbidden layer dependencies, and plan refactors or file locations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j4flmao/agent-skills/clean-architecture
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.

Any agent
npx skills add j4flmao/agent-skills --skill clean-architecture
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-clean-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/clean-architecture/github.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/clean-architecture)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/clean-architecture"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/clean-architecture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backend-clean-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/clean-architecture"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/clean-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,554 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00118 $0.04554
Opus 5 $0.00059 $0.02277
Sonnet 5 $0.00024 $0.00911
Haiku 4.5 $0.00012 $0.00455

Measured 7d ago against content hash 8234281741aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

backend-clean-architecture 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 7d 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.

skills/backend/universal/clean-architecture/SKILL.md · 545 lines

How it starts

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

Backend Clean Architecture

Purpose

Enforce strict layer separation in backend code. Domain layer has zero dependencies on frameworks, databases, or external libraries. Every piece of code must belong to exactly one layer.

Agent Protocol

Trigger

Exact user phrases: "where does this code go", "what layer", "clean architecture", "hexagonal", "ports and adapters", "domain layer", "application layer", "infrastructure layer", "should this be in service or repository", "layer violation", "architecture rule".

Input Context

Before activating, verify:

  • The stack is known (NestJS, Go, Rust, Python, Spring Boot).
  • The user has described a specific piece of code or asked about a specific location.
  • The project's folder structure is visible or has been described.

Output Artifact

No file output. This skill produces text guidance.

Response Format

Answer exactly:

{code piece} -> {Layer}: {one-sentence justification}
File: {suggested file path}

If there is a violation:

VIOLATION: {file}:{line}
Layer {X} imports Layer {Y} which is NOT allowed.
Fix: {specific refactor instruction}
Direction: {layer name} -> {layer name} is the correct direction.

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output.

Completion Criteria

  • The layer for the code has been identified.
  • If a violation exists, it has been identified with specific file/line.
  • The fix direction has been specified.
  • No layer rules have been explained — only applied.

Max Response Length

Layer assignment: 3 lines. Violation: 5 lines.

Architecture Decision Tree

Where Does This Code Go?

Is the code a business concept/rule?
  ├── Yes → Does it depend on a framework, DB, or external library?
  │         ├── No  → Domain Layer (Entity, Value Object, Domain Service, Repository Interface)
  │         └── Yes → INFRASTRUCTURE LAYER VIOLATION — extract pure logic to Domain
  ├── No → Does it orchestrate business operations?
  │         ├── Yes → Application Layer (Use Case, Command/Query Handler, Port Interface)
  │         └── No → Does it handle external input (HTTP, CLI, message)?
  │                  ├── Yes → Presentation Layer (Controller, Middleware, DTO, Resolver)
  │                  └── No → Does it implement external concerns?
  │                           ├── Yes → Infrastructure Layer (DB repo, API client, queue)
  │                           └── No → Reconsider the architecture — every piece fits one layer

Read the full file on GitHub · 545 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. 7d ago First seen · 545 lines · 118 tokens per session scan A 8234281741aa

Subscribe to this mod's changes

backend-clean-architecture is a skill published in the GitHub repository j4flmao/agent-skills (22 stars, last pushed 4d ago), licensed MIT. It adds 118 tokens to every session and 4,554 once invoked, about $0.0006 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-09-03.

Related

Other skills, from other repositories

microservices-architecture

Guides service boundary analysis, communication pattern selection, data consistency design, API contract strategy, and resilience checklist for microservices systems. Complements the microservices fragment. Invoked when the user asks to design a microservices system, split a monolith, or review service boundaries.

soulcodex/agentic · 61 tokens

express

Minimal-friction implementation path for well-scoped tasks. Assumes the developer has full context, knows the codebase, and does not need planning ceremony. Use when the developer says "/express", wants to move fast on a well-understood single-layer change, or explicitly opts out of the full workflow.

adonai-labs/agent-runway · 63 tokens

Event-Driven Semantics & Delivery Guarantees

Ensure event-driven designs specify delivery guarantees, ordering, idempotency, schema evolution, and replay/backfill strategy.

s977043/river-review · 33 tokens

Trust Boundaries & Authorization Architecture

Ensure designs define trust boundaries, authn/authz responsibilities, and propagation of identity/claims across services.

s977043/river-review · 28 tokens

External Dependencies & Vendor Risks

Ensure designs document third-party dependencies, SLAs, quotas, failure modes, and vendor lock-in mitigation.

s977043/river-review · 27 tokens

Cache Strategy Consistency Guard

Detect undefined or inconsistent cache strategies (layers, consistency, invalidation, TTL, failure handling) in design documents.

s977043/river-review · 29 tokens