architecture-skill

architecture-skill is a cursor rule for Codex, Cursor from KaelSensei/MagicAIBuilder. It costs 739 tokens per session, scanned A, original, MIT.

A set of software-architecture rules for Next.js 15 applications based on Clean Architecture and Hexagonal Architecture. The rules organize code into domain, use-case, infrastructure, and interface layers, with dependencies directed toward the domain.

In plain words
What is it for?
Use it when deciding where to place TypeScript types, use cases, database and API integrations, server components, route handlers, and client components.
Why use it?
It helps keep business logic independent from frameworks, databases, external services, and user-interface code, making the project easier to test and change.

Cursor rule for CodexCursor

Written for Cursor: a Cursor rule (.mdc). Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when deciding where to place TypeScript types, use cases, database and API integrations, server components, route handlers, and client components.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kaelsensei/magicaibuilder/architecture-skill
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.

Clone the repo
git clone --depth 1 https://github.com/KaelSensei/MagicAIBuilder

Made for: Codex, Cursor.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/kaelsensei/magicaibuilder/architecture-skill"><img src="https://agentmods.dev/badge/rules/kaelsensei/magicaibuilder/architecture-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 739 This file is loaded in full into every session.
When invoked 739 The same file — it is already loaded in full.
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.00739 $0.00739
Opus 5.5 $0.00296 $0.00296
Sonnet 5.5 $0.00148 $0.00148
Haiku 4.5 $0.00074 $0.00074

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

Security

Grade A, and why

architecture-skill 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 1mo 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/rules/architecture-skill.mdc · 72 lines

How it starts

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

Clean Architecture Rule

Based on Robert C. Martin (Clean Architecture) and Alistair Cockburn (Hexagonal Architecture), adapted to Next.js 15 App Router. For the full reference, see the clean-architecture skill under .agents/skills/clean-architecture/SKILL.md.

Core principle

Dependencies point inward, toward the domain. Outer layers know about inner layers; inner layers do NOT know about outer ones.

Layers in this repo

  • Domain — src/types/, src/lib/<domain>/types.ts, src/lib/<domain>/constants.ts. Pure TypeScript, no framework imports.
  • Use cases — src/lib/<domain>/*.ts. Pure functions, unit-tested.
  • Infrastructure — src/lib/db/*.ts (Prisma), src/lib/scryfall.ts, src/lib/moxfield.ts, src/lib/auth.ts. Wraps external systems behind domain-shaped APIs.
  • Interface — src/app/**/page.tsx, layout.tsx, route handlers, server actions, and client components in src/components/. Thin — delegate to use cases.

Dependency rules

  • Domain types import nothing.
  • Use cases import domain types only.
  • Infrastructure may import domain + use cases to satisfy ports.
  • Server components may compose use cases + infrastructure.
  • Client components reach infrastructure only through server actions, route handlers, or a typed fetch wrapper — never direct Prisma imports.
  • API route handlers and server actions stay thin: parse with Zod → call a use case → shape the response.

Hexagonal ports and adapters

  • When the domain needs external I/O, define a port (interface) in the domain / use-case layer and implement adapters in infrastructure.
  • Use cases depend on ports, never on concrete adapters.

Decision guide — where does this code go?

  1. Compute something from domain data, no I/O → src/lib/<domain>/.
  2. Persist, read, or call an external service → src/lib/db/ or src/lib/<provider>.ts.
  3. Render UI → src/components/ (reusable) or src/app/** (route-scoped).
  4. Client-side state or effects → src/hooks/ or a Zustand store under src/stores/.
  5. HTTP → domain translation → src/app/api/**/route.ts (thin handler) that delegates to src/lib/.

Read the full file on GitHub · 72 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. 1mo ago First seen · 72 lines · 739 tokens per session scan A e001df09c8f5

Subscribe to this mod's changes

architecture-skill is a cursor rule published in the GitHub repository KaelSensei/MagicAIBuilder (2 stars, last pushed today), licensed MIT. It adds 739 tokens to every session, about $0.0030 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.