check-quality

A quick checker that reads Python files recursively and compares them with 22 code-design rules. It checks naming, function size and responsibilities, class structure, nesting, and type-safety practices.

In plain words
What is it for?
Use it for a fast quality pass on a Python file, folder, or project before refactoring or requesting a more detailed review.
Why use it?
It catches common maintainability problems before a deeper architecture review. The result points you toward code that is vague, overly complex, duplicated in structure, or responsible for too many things.

Command

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.

agentmods
npx agentmods add commands/mktoronto/python-clean-architecture/check-quality
Clone the repo
git clone --depth 1 https://github.com/MKToronto/python-clean-architecture
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 780 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00013 $0.00780
Opus 5 $0.00006 $0.00390
Sonnet 5 $0.00003 $0.00156
Haiku 4.5 $0.00001 $0.00078

Measured 2d ago against content hash 6afda85a0de2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

check-quality 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.

commands/check-quality.md · 68 lines

What it actually says

Run a focused code quality check on $ARGUMENTS (or the current working directory if no path given) against the 22 design rules. This is a lighter, faster check than /review-architecture.

Process

  1. Read the code — Find and read ALL Python files in the target path recursively.

  2. Check the 22 rules — For each file, check:

    Naming & Structure:

    1. No type abuse (don't embed type in name: user_listusers)
    2. No vague identifiers (data, info, temp, result, handle)
    3. No single-letter variables outside comprehensions and lambdas
    4. No abbreviations (cfgconfig, mgrmanager)

    Functions: 5. No flag parameters (boolean args that switch behavior → split into two functions) 6. No deep nesting (3+ levels → early returns or extract function) 7. Tell don't ask (don't query state then act on it — tell the object to act) 8. Functions do one thing (extract if doing two things)

    Classes: 9. No god classes (too many responsibilities → extract classes) 10. No parallel data structures (two lists tracking same entities → single dataclass) 11. Information Expert (methods should live on the class that owns the data)

    Types & Safety: 12. Type hints on all function signatures 13. Enums for fixed option sets (not bare strings) 14. No mutable default arguments (def f(items=[])def f(items=None)) 15. No wildcard imports (from x import *)

    Error Handling: 16. No broad exception catching (except Exception → catch specific exceptions) 17. Context managers for resources (with open() not manual try/finally)

    Advanced Design: 18. No isinstance checks for dispatch (move behavior into the class hierarchy or use a strategy dict) 19. No overloaded classes (too many instance variables → extract cohesive groups) 20. No asymmetric naming (consistent method names across similar classes, use dunder methods) 21. No misleading method names (create_X should create and return, add_X should add to collection) 22. No hardwired initialization sequences (factory method or __init__ guarantees complete setup)

  3. Report findings — For each violation:

    • Rule number and name
    • File and line
    • Fix — short code snippet showing the correction

    Group by file for easy navigation. Show a summary count at the top:

    Quality Check: 14 files scanned, 8 issues found
    ─────────────────────────────────────────────────
    Rule 6  (deep nesting):     3 instances
    Rule 12 (missing types):    2 instances
    Rule 16 (broad except):     2 instances
    Rule 5  (flag parameter):   1 instance
    

For detailed rule explanations and examples, consult:

  • ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/references/code-quality.md
  • ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/references/types-and-type-hints.md (for rules 12–13)
  • ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/references/error-handling.md (for rules 16–17)
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. 2d ago First seen · 68 lines · 13 tokens per session scan A 6afda85a0de2

Subscribe to this mod's changes

check-quality is a command published in the GitHub repository MKToronto/python-clean-architecture (8 stars, last pushed 2mo ago), licensed MIT. It adds 13 tokens to every session and 780 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.