principle-clean-architecture

principle-clean-architecture is a skill for Claude Code from lugassawan/swe-workbench. It costs 43 tokens per session (1,027 once invoked), scanned A, original, MIT.

Architecture guidance for organizing software into layers, with business rules kept separate from web frameworks, databases, and other outside tools.

In plain words
What is it for?
Use it when planning application layers, defining interfaces between them, connecting databases or other tools, and writing unit tests for business rules.
Why use it?
It prevents framework details from spreading through the core of an application, making business logic easier to change and test.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the swe-workbench plugin — 60 skills, 25 commands, 22 agents, 4 hooks shipped together

Good fit Use it when planning application layers, defining interfaces between them, connecting databases or other tools, and writing unit tests for business rules.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lugassawan/swe-workbench/principle-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 lugassawan/swe-workbench --skill principle-clean-architecture
Clone the repo
git clone --depth 1 https://github.com/lugassawan/swe-workbench

Made for: Claude Code.

Or install swe-workbench, the plugin that ships this one along with the rest of its 60 skills, 25 commands, 22 agents, 4 hooks.

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 principle-clean-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/lugassawan/swe-workbench/principle-clean-architecture/github.svg)](https://agentmods.dev/skills/lugassawan/swe-workbench/principle-clean-architecture)
Your own site
<a href="https://agentmods.dev/skills/lugassawan/swe-workbench/principle-clean-architecture"><img src="https://agentmods.dev/badge/skills/lugassawan/swe-workbench/principle-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 principle-clean-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/lugassawan/swe-workbench/principle-clean-architecture"><img src="https://agentmods.dev/badge/skills/lugassawan/swe-workbench/principle-clean-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,027 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.
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.00043 $0.01027
Opus 5 $0.00022 $0.00513
Sonnet 5 $0.00009 $0.00205
Haiku 4.5 $0.00004 $0.00103

Measured 6d ago against content hash 446653a13815, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

principle-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 6d 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/principle-clean-architecture/SKILL.md · 94 lines

How it starts

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

Clean Architecture

The one rule

Source-code dependencies point inward. Inner circles know nothing about outer ones.

[ Frameworks & Drivers ]   ← HTTP, DB, UI, CLI
  [ Interface Adapters ]   ← controllers, presenters, gateways
    [ Use Cases ]          ← application-specific business rules
      [ Entities ]         ← enterprise-wide business rules

If a use case imports the ORM, the rule is broken.

Ports and adapters

  • Port — interface owned by the domain describing what it needs (UserRepository.find(id)).
  • Adapter — implementation in the outer layer (PostgresUserRepository).
  • Domain depends on ports. Composition root wires adapters to ports at startup.

Keeping the domain pure

  • No imports of HTTP, SQL, ORM types, JSON libraries, or wall-clock time from the domain.
  • Pass side-effects in as interfaces (Clock, IdGenerator, Repository).
  • Domain types are plain data + behavior — no framework annotations.

Boundary crossings

  • Cross layers only via data structures the inner layer defines.
  • Outer layers translate to/from these structures. Never leak an ORM entity into a use case.

Testing payoff

  • Use cases are unit-testable with fake adapters.
  • Integration tests live at the adapter boundary.
  • Framework tests (HTTP, DB) stay narrow because business rules are elsewhere.

When NOT to apply

  • Throwaway scripts and prototypes — flat is fine.
  • Obvious CRUD with no domain logic — a single service file is clearer than four layers.
  • Tiny internal tools where ceremony cost exceeds change cost.

Drift smells

  • Repositories returning ORM objects instead of domain types.
  • Use cases importing HTTP request/response types.
  • Presenters holding business rules.
  • utils packages imported by the domain.

Layer import rules

Layer Can import Must NOT import
Domain Standard library only Application, Infrastructure, Framework
Application Domain Infrastructure, Framework
Infrastructure Domain, Application Framework (except its own SDK)
Framework/UI All layers

Read the full file on GitHub · 94 lines

Files

What ships with it

10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 94 lines · 43 tokens per session scan A 446653a13815

Subscribe to this mod's changes

principle-clean-architecture is a skill published in the GitHub repository lugassawan/swe-workbench (2 stars, last pushed 4d ago), licensed MIT. It adds 43 tokens to every session and 1,027 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-09-03.

Related

Other skills, from other repositories

brooks-test

Test quality review drawing on twelve classic engineering books — with primary focus on xUnit Test Patterns, The Art of Unit Testing, How Google Tests Software, and Working Effectively with Legacy Code — that diagnoses structural problems in an existing test suite: brittleness, mock abuse, coverage illusions, slow…

hyhmrright/brooks-lint · 161 tokens

architecture-patterns

Architecture validation and patterns for clean architecture, backend structure enforcement, project structure validation, test standards, and context-aware sizing. Use when designing system boundaries, enforcing layered architecture, validating project structure, defining test standards, or choosing the right…

yonatangross/orchestkit · 56 tokens

functions-development

Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs foundry functions create, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when…

CrowdStrike/foundry-skills · 195 tokens

go-testing-quality

Use when writing or reviewing Go tests, adding coverage, benchmarking, or profiling a Go program. Not for CI/lint wiring (go-tooling-security) or non-Go tests.

fusengine/agents · 40 tokens

testing-dotnet

.NET testing patterns — xUnit conventions, integration tests with WebApplicationFactory, mocking strategies, and test organization.

zdanovichnick/dotnet-pilot · 26 tokens

golang-test-review

Use when reviewing Go test code (new or changed test.go files, test harnesses, fixtures, or test tooling) for a Go-test-expert pass — behavior-over-surface, determinism, parallel-safety, build-tag correctness, and harness reuse. Complements the general code-reviewer with test-specific rigor.

mickeyyaya/evolve-loop · 70 tokens