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.
npx agentmods add skills/mktoronto/python-clean-architecture/clean-architecturenpx skills add MKToronto/python-clean-architecture --skill clean-architecturegit clone --depth 1 https://github.com/MKToronto/python-clean-architectureWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00112 | $0.04213 |
| Opus 5 | $0.00056 | $0.02107 |
| Sonnet 5 | $0.00022 | $0.00843 |
| Haiku 4.5 | $0.00011 | $0.00421 |
Grade A, and why
Python 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 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.
How it starts
The opening of the file, as written. The whole thing — 270 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python Clean Architecture
Provide Clean Architecture guidance for Python projects, specifically FastAPI APIs. Based on seven core design principles, Pythonic implementations of classic patterns, and a three-layer architecture (Routers → Operations → Database).
Attribution: The principles, patterns, and architectural approach in this skill are inspired by and synthesized from Arjan Codes' courses: The Software Designer Mindset, Pythonic Patterns, and Complete Extension. The specific Pythonic framing (Protocol-based DI, functional pattern progression, three-layer FastAPI architecture) originates from his teaching. This plugin distills those principles into actionable guidance for Claude Code — it is not a reproduction of course content. See also: github.com/arjancodes | youtube.com/arjancodes.
When to Apply
- Scaffolding new FastAPI projects with clean separation of concerns
- Refactoring existing Python code to reduce coupling and increase cohesion
- Adding new components (endpoints, operations, repositories, models)
- Reviewing code for design quality and Pythonic idiom adherence
- Making code testable through dependency injection and Protocol-based abstractions
Core Architecture: Three Layers
Every FastAPI project follows a strict three-layer dependency flow:
Routers (API layer) → Operations (business logic) → Database (persistence)
Each layer depends ONLY on the layer below it. Never skip layers.
Layer Responsibilities
Routers — HTTP interface. Accept requests, call operations, return responses. No business logic. Act as the composition root where concrete implementations are injected.
Operations — Business logic. Accept a DataInterface (Protocol) parameter for data access. Compute derived values, enforce rules, orchestrate workflows. Never import database modules directly.
Database — Persistence. Implement the DataInterface Protocol using SQLAlchemy, file storage, or any backend. Expose read_by_id, read_all, create, update, delete methods. Return DataObject = dict[str, Any] to decouple from ORM models.
What ships with it
60 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.
- examples/fastapi-hotel-api/db/__init__.py 0 B runs code
- examples/fastapi-hotel-api/db/database.py 593 B runs code
- examples/fastapi-hotel-api/db/db_interface.py 2.0 KB runs code
- examples/fastapi-hotel-api/db/models.py 1.3 KB runs code
- examples/fastapi-hotel-api/main.py 657 B runs code
- examples/fastapi-hotel-api/models/__init__.py 0 B runs code
- examples/fastapi-hotel-api/models/booking.py 638 B runs code
- examples/fastapi-hotel-api/models/customer.py 393 B runs code
- examples/fastapi-hotel-api/models/room.py 694 B runs code
- examples/fastapi-hotel-api/operations/__init__.py 0 B runs code
- examples/fastapi-hotel-api/operations/booking.py 1.5 KB runs code
- examples/fastapi-hotel-api/operations/customer.py 1.2 KB runs code
- examples/fastapi-hotel-api/operations/interface.py 1.6 KB runs code
- examples/fastapi-hotel-api/operations/room.py 1.3 KB runs code
- examples/fastapi-hotel-api/routers/__init__.py 0 B runs code
- examples/fastapi-hotel-api/routers/bookings.py 1.9 KB runs code
- examples/fastapi-hotel-api/routers/customers.py 1.7 KB runs code
- examples/fastapi-hotel-api/routers/rooms.py 2.3 KB runs code
- examples/fastapi-hotel-api/tests/__init__.py 0 B runs code
- examples/fastapi-hotel-api/tests/test_bookings.py 2.8 KB runs code
- examples/fastapi-hotel-api/tests/test_rooms.py 1.6 KB runs code
- references/async-patterns.md 12 KB
- references/classes-and-dataclasses.md 18 KB
- references/code-quality.md 9.9 KB
- references/code-smells.md 13 KB
- references/context-managers.md 6.6 KB
- references/data-structures.md 14 KB
- references/decorators.md 8.0 KB
- references/dependency-injection.md 7.5 KB
- references/design-principles.md 17 KB
- references/domain-driven-design.md 4.8 KB
- references/domain-modeling.md 863 B
- references/error-handling.md 11 KB
- references/function-design.md 20 KB
- references/grasp-principles.md 9.6 KB
- references/layered-architecture.md 16 KB
- references/monadic-error-handling.md 7.0 KB
- references/pattern-matching.md 7.4 KB
- references/patterns/abstract-factory.md 18 KB
- references/patterns/adapter.md 5.2 KB
- references/patterns/bridge.md 17 KB
- references/patterns/builder.md 6.5 KB
- references/patterns/command.md 13 KB
- references/patterns/cqrs.md 7.9 KB
- references/patterns/event-sourcing.md 5.8 KB
- references/patterns/facade.md 6.3 KB
- references/patterns/fluent-interface.md 4.8 KB
- references/patterns/functional.md 10 KB
- references/patterns/lazy-loading.md 6.0 KB
- references/patterns/notification.md 17 KB
- references/patterns/pipeline.md 8.6 KB
- references/patterns/plugin-architecture.md 6.9 KB
- references/patterns/registry.md 12 KB
- references/patterns/repository.md 6.7 KB
- references/patterns/retry.md 9.3 KB
- references/patterns/singleton.md 7.3 KB
- references/patterns/state.md 5.6 KB
- references/patterns/strategy.md 16 KB
- references/patterns/template-method.md 11 KB
- references/patterns/unit-of-work.md 5.4 KB
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.
- 2d ago First seen · 270 lines · 112 tokens per session scan A 03fa5fe8f5ed
Python Clean Architecture is a skill published in the GitHub repository MKToronto/python-clean-architecture (8 stars, last pushed 2mo ago), licensed MIT. It adds 112 tokens to every session and 4,213 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-08-31.
Other skills, from other repositories
neo4j-driver-python-skill
Neo4j Python Driver v6 — driver lifecycle, executequery, managed and explicit transactions, async (AsyncGraphDatabase), result handling, data type mapping, error handling, UNWIND batching, connection pool tuning, and causal consistency. Use when writing Python code that connects to Neo4j via GraphDatabase.driver…
specx-component-architecture
Design or review specx core scope boundaries in Python services. Use when deciding where code belongs across packaged scoped foundation bases, optional local foundation extensions, core/, capabilities, delivery, infrastructure, shared/, and ioc; when adding guardrails or splitting use cases, services, DTOs, schemas…
specx-project-structure
Create or reshape a Python FastAPI service repo into the specx clean core/delivery architecture using packaged scoped foundation bases. Use when starting an API backend, adding the first src package, or establishing AGENTS.md, core/, optional local foundation/, delivery/, infrastructure, ioc/, migrations, and tests.
specx-diwire-composition
Wire dependency injection for a specx Python service with diwire. Use when adding ioc/container.py, explicit dependency registrations for capabilities, repositories, gateways, UoW managers, clients, settings, or factories, Injected[...] constructor fields, FastAPI app factory/lifecycle composition, test overrides, or…
specx-add-core-use-case
Add or refactor a specx core scope use case. Use when implementing an externally meaningful application action under a core scope usecases package, adding same-file command/query inputs, result DTOs, coordinating services, opening a unit-of-work transaction, or moving behavior out of delivery or infrastructure into…
specx-project-tooling
Add strict Python project tooling for a specx service. Use when creating or updating pyproject.toml, uv dependency groups and lock checks, Ruff formatting and linting, mypy strict mode, pytest and HTTPX2 test configuration, Makefile commands, root AGENTS.md command guidance, or CI-like local guardrails.