clean-architecture

clean-architecture is a skill for Claude Code, Codex from KaelSensei/MagicAIBuilder. It costs 62 tokens per session (1,713 once invoked), scanned A, original, MIT.

A set of design rules for organizing a Next.js, Prisma, and React application into layers. The layers separate the user interface, application logic, domain rules, and external services such as databases.

In plain words
What is it for?
Use it when designing features, choosing where files belong, reviewing changes across layers, or refactoring code.
Why use it?
It helps keep database and external-service details from spreading into the interface or core business rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when designing features, choosing where files belong, reviewing changes across layers, or refactoring code.

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kaelsensei/magicaibuilder/clean-architecture"><img src="https://agentmods.dev/badge/skills/kaelsensei/magicaibuilder/clean-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,713 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.00062 $0.01713
Opus 5.5 $0.00025 $0.00685
Sonnet 5.5 $0.00012 $0.00343
Haiku 4.5 $0.00006 $0.00171

Measured 2mo ago against content hash f1170eb1aa78, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 2mo 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.

.agents/skills/clean-architecture/SKILL.md · 161 lines

How it starts

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

Clean Architecture Skill

Practical layering rules for this repo. Based on Robert C. Martin's Clean Architecture and Alistair Cockburn's Hexagonal Architecture, translated to the concrete directory layout we actually use.

When to use this skill

  • Designing a new feature (commander deck feature, AI suggestion flow, pricing integration, etc.).
  • Deciding where a new file goes (lib/, components/, app/api/, server/, hooks/, ...).
  • Reviewing a PR that adds Prisma calls inside a React component or Scryfall fetches inside an API route that should delegate.
  • During a /refactor that moves code across layers.

Core principle

Dependencies point inward, toward the domain. Outer layers know about inner layers; inner layers do NOT know about outer ones. Concretely in this repo:

    UI (React components, pages)            <-- depends on hooks + lib
         |
    Hooks + server actions + route handlers <-- depends on lib + domain
         |
    Lib (pure domain + use-cases)           <-- depends on domain types only
         |
    Domain types (entities, value objects)  <-- depends on nothing
         |
    Infrastructure (Prisma, Scryfall, Auth) <-- implements ports defined by domain/lib

Layers in this repo

1. Domain (innermost)

  • Lives in src/types/, src/lib/<domain>/types.ts, src/lib/<domain>/constants.ts.
  • Pure TypeScript. No imports from next, react, @prisma/client, or @auth/*.
  • Represents the MTG / Commander business concepts: DeckCard, CommanderPairingType, CardCategory, BracketScore, etc.

2. Use cases / application logic

  • Lives in src/lib/<domain>/*.ts (e.g. src/lib/deck/validate.ts).
  • Pure functions taking domain types in and returning domain types out.
  • MUST be unit-tested (vitest) — these are the highest-value tests.
  • Must NOT import from src/app/**, src/components/**, or directly from Prisma / Scryfall clients.

3. Infrastructure adapters

  • Prisma access: src/lib/db/<domain>.ts — wraps Prisma queries behind domain-shaped return types. Components never import @prisma/client directly.
  • External APIs: src/lib/scryfall.ts, src/lib/moxfield.ts — single entry point per provider, with rate limiting and retries. Components never fetch("api.scryfall.com/...").
  • Auth: src/lib/auth.ts wraps next-auth calls; session shape is typed in domain.

Read the full file on GitHub · 161 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. 2mo ago First seen · 161 lines · 62 tokens per session scan A f1170eb1aa78

Subscribe to this mod's changes

clean-architecture is a skill published in the GitHub repository KaelSensei/MagicAIBuilder (2 stars, last pushed yesterday), licensed MIT. It adds 62 tokens to every session and 1,713 once invoked, about $0.0002 per session on Opus 5.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.

Related

clean-architecture compared with skills from other repositories

clean-architecture next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
clean-architectureKaelSensei/MagicAIBuilderSkill2yesterdayMITA62Claude Code, Codex
organization-best-practiceskrivoox/agent-stack-templateSkill301mo agoMITA61Claude Code, Codex
react-hook-formkrivoox/agent-stack-templateSkill301mo agoMITA85Claude Code, Codex
vibe-specConnorrmcd6/vibe-specSkill94mo agoMITA109Claude Code
shadcnkrivoox/agent-stack-templateSkill301mo agoMITA94Claude Code, Codex
interface-designkrivoox/agent-stack-templateSkill301mo agoMITA78Codex
vercel-react-best-practiceskrivoox/agent-stack-templateSkill301mo agoMITA67Claude Code, Codex