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 commands/mktoronto/python-clean-architecture/review-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.00011 | $0.01521 |
| Opus 5 | $0.00005 | $0.00760 |
| Sonnet 5 | $0.00002 | $0.00304 |
| Haiku 4.5 | $0.00001 | $0.00152 |
Grade A, and why
review-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 3d 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 — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Before starting the review, use AskUserQuestion to ask: "Which review depth?" with these options:
- Standard — "Reviews against built-in checklists. No extra permissions needed."
- In-depth — "Loads detailed reference files for deeper analysis with refactoring recipes and pattern guidance."
Then review the code at $ARGUMENTS (or the current working directory if no path given) against Python Clean Architecture principles.
Review Process
-
Read the code — Find and read ALL Python files in the target path recursively. Read every
.pyfile — do not skip any. Understand the project structure, imports, and relationships between files. -
Check architecture layers — Verify the three-layer separation:
- Routers (API) → Operations (business logic) → Database (persistence)
- No layer skipping (routers should not import DB modules directly)
- Operations accept
DataInterfaceProtocol, not concrete DB classes - Router acts as composition root (wires concrete implementations)
-
Check the 7 design principles — For each file/class/function, evaluate:
- High Cohesion — Does each unit have a single responsibility?
- Low Coupling — Are dependencies minimized? Any Law of Demeter violations?
- Depend on Abstractions — Protocol/Callable used for DI? Or concrete imports?
- Composition over Inheritance — Any deep hierarchies or mixins?
- Separate Creation from Use — One composition root? Dict mapping over if/elif?
- Start with the Data — Prefixed fields? Parallel lists? Methods far from data?
- Keep Things Simple — Over-engineered? Speculative features? Unnecessary abstractions?
-
Check code quality — Apply the 22 design rules:
- No type abuse, vague identifiers, flag parameters, deep nesting
- Tell don't ask, no parallel data structures, no god classes
- No broad exception catching, no mutable defaults, no wildcard imports
- Type hints on all functions, enums for fixed options, context managers for resources
-
Check Pythonic patterns — Are patterns implemented the Pythonic way?
- Strategy as Callable, not ABC hierarchy
- Factory as dict mapping, not if/elif
- Protocol over ABC (unless shared state needed)
- functools.partial for configuration, closures for builders
- Pub/Sub for notification side effects, not inline calls
- Registry for data-driven object creation, not if/elif
- Context managers for resource management, not try/finally
- Custom exception classes, not broad except catching
- Dataclasses for value objects and DTOs, not manual init
- Pure functions where possible, side effects pushed to boundaries
-
Check code cleanup opportunities — Look for concrete refactoring targets:
- Extract class when a class does two things
- Extract function when a function does two things
- Replace mutable globals with injected dataclass context
- Replace boolean flag parameters with separate functions
- Replace string constants with Enums
- Replace deep nesting (3+ levels) with early returns or extraction
- Replace god classes (too many responsibilities) with collaborators
- Move methods to the class that owns the data (Information Expert)
- Replace parallel data structures with a single data class
- Replace if/elif chains with dict mapping
-
Report findings — Structure the output in this order:
Architecture Summary
Classify every Python file into a layer, then show the dependency flows. Use a simple vertical list format — never multi-column ASCII art. Example:
Layers ────── API: routers/booking.py, routers/customer.py Logic: operations/booking.py, operations/customer.py Database: db/db_interface.py, db/models.py, db/database.py Unclear: utils/helpers.py (mixed concerns) Dependency Flows ──────────────── routers/booking.py → operations/booking.py → db/db_interface.py ✓ routers/customer.py → operations/customer.py → db/db_interface.py ✓ routers/admin.py → db/models.py ⚠ layer skip Layer Violations ──────────────── ⚠ routers/admin.py imports db/models.py directly — should go through operations
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.
- 3d ago First seen · 124 lines · 11 tokens per session scan A aaa28f94d9a0
review-architecture is a command published in the GitHub repository MKToronto/python-clean-architecture (8 stars, last pushed 2mo ago), licensed MIT. It adds 11 tokens to every session and 1,521 once invoked, about $0.0001 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 commands, from other repositories
go-stack.bundb.setup
Instructions to setup the go-stack BunDB integration for database access, migration management, and the bundled DB CLI command.
go-stack.project-update
Compare the current project against the latest go-stack scaffold template and propose or apply updates (tasks, linters, dependencies, skills, provider patterns, security tooling) while preserving project-specific business logic and module identity.
go-stack.inertia.setup
Instructions to setup the go-stack Inertia.js integration for fullstack Go applications, including boot provider wiring and frontend workflow.
design-to-code
Mockup-to-component pipeline using Google Stitch, 21st.dev, and Storybook MCP. Accepts a screenshot, a description, or a URL and produces production-ready React components, checking existing Storybook components before generating anything new. Use when implementing UI from a mockup or screenshot. To call the MCP tool…
deploy
Build, test, deploy with staged rollout.
test
QA verification with real dependencies — the quality gate before review.