agentleFS
michaelalbermichaelalber/ai-toolkit/skills/python-architecture-checklist/SKILL.md

python-architecture-checklist

Skill3 starsChanged 3 months agoMITView on GitHub

Grades an existing Python codebase. Detects Python version, framework (FastAPI/Django/Flask), and package layout, then checks clean-architecture boundaries, type-safety discipline, complexity, dependency direction, and config/secrets hygiene with file:line evidence. Use to review or grade a Python codebase. Not for Socratic critique (architecture-review), security audits (python-security-review), or new test-first code (tdd).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Evidence or it is not a finding: Run the tools; cite file:line.

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Architecture Checklist

"A checklist cannot fly a plane, but a pilot cannot fly safely without one." — Atul Gawande

Core Philosophy

Shared across the dotnet / python / php / rust architecture checklists — same values, language-specific checks.

#ValueWhat it means
1Detect before judgeDetermine version/framework/structure before applying any item; context decides what is idiomatic.
2Evidence over opinionEvery finding cites file:line and the offending pattern. "Overuses globals" is not a finding; "config.py:12 mutates a module-level global" is.
3Feature cohesionOrganized by business capability, not technical layer. Cross-feature coupling is a violation.
4Dependencies point inwardDomain logic does not import infrastructure (DB, HTTP, filesystem). Boundaries are explicit.
5Explicit error handlingFailures handled at the right layer; no silent swallowing; errors carry diagnostic context.
6Config & secrets hygieneNo hardcoded secrets; configuration injected, not reached for globally; secrets from env / secret-manager.
7Version awarenessRecommendations are gated to the detected version; never suggest an API that does not exist there.
8Tests gate changeUntested code is a finding; high-risk modules without tests are prioritized.
9Graded, actionable outputA letter grade (A–F) from counted findings, plus prioritized, version-correct recommendations.

Workflow

Shared skeleton: DETECT → SCAN → REPORT → RECOMMEND.

DETECT     Python version (pyproject.toml / .python-version), framework (FastAPI/Django/Flask),
           layout (src/ vs flat, packages), and whether a test suite exists. Record findings; if a
           version cannot be determined, ask — never assume 3.13.

SCAN       Run the Python Checklist below section by section. Gather evidence with tooling:
             ruff check .         # style + lint + complexity drift
             mypy <pkg>           # type completeness and correctness
             radon cc -s <pkg>    # cyclomatic complexity hot spots
             radon mi <pkg>       # maintainability index
           Every violation becomes a finding with file:line and a severity (critical/high/medium/low).

REPORT     Emit the graded report (Output Template). Grade = function of counted findings.

RECOMMEND  Prioritize: critical → quick wins → modernization. Version-gate every recommendation;
           never suggest an API absent from the detected Python version.

Python Checklist (language-specific)

#CheckSeverity
1Clean boundaries — domain modules import zero infrastructure; boundaries use typing.Protocol; no circular importsCritical
2Type safety — all public functions fully annotated; mypy clean; no bare # type: ignore (each needs a reason)High
3YAGNI / Rule of Three — abstractions justified by ≥3 concrete uses; no speculative base classes or plugin layersHigh
4Complexity — radon cc grade ≥ B per function; maintainability index ≥ 70; no god-modulesHigh
5Dependency discipline — versions pinned in pyproject.toml (not setup.py); stdlib preferred; each dep justifiedMedium
6Async discipline — async def for I/O-bound work; no blocking calls (time.sleep, sync I/O) inside async; ProcessPoolExecutor for CPU-boundHigh
7Resource lifecycle — file handles / sessions / connections via context managers, not manual open/closeMedium
8Config & secrets — settings via pydantic BaseSettings; secrets from env; no hardcoded credentialsCritical
9Test coverage — behavioral tests exist for business logic; AAA; high-risk untested modules flaggedHigh

Tooling config: ruff · mypy. Full section-by-section list + grounding query map: review checklist.

State Block

<arch-checklist-state>
language: python
mode: DETECT | SCAN | REPORT | RECOMMEND | COMPLETE
detected: [python 3.x | framework | layout | tests:yes/no]
issues_found: [critical:N high:N medium:N low:N]
last_action: [what was just done]
next_action: [what should happen next]
</arch-checklist-state>

Output Template

Shared across all four architecture checklists.

## Architecture Checklist: [project] (Python)
**Version**: [3.x] | **Framework**: [FastAPI/Django/Flask/none] | **Tests**: [yes/no]

| Section | Pass | Fail | Warn |
|---------|------|------|------|
| Boundaries / Types / Complexity / Deps / Async / Config / Tests | … | … | … |

### Grade: [A–F]
Grading: **A** 0 crit/0 high/≤3 med · **B** 0 crit/≤2 high · **C** 0 crit, gaps in one area ·
**D** 1+ crit · **F** fundamental problems (no boundaries, secrets in code, untyped public API).

| Severity | Location | Finding | Recommendation |
|----------|----------|---------|----------------|
| CRITICAL | file:line | [pattern] | [version-gated fix] |

**Quick wins**: [low-effort, high-impact] · **Modernization**: [larger items with effort estimate]

AI Discipline Rules

  • Detect the Python version first. Recommending match statements or tomllib to a 3.9 project produces invalid findings.
  • Evidence or it is not a finding. Run the tools; cite file:line. Never grade on vibes.
  • Architecture, not security. Vulnerability findings (injection, deserialization, secrets exposure) belong to python-security-review — note them and route there.
  • Do not rewrite during a review. Produce findings + recommendations; the team decides and tdd drives the fix.

Integration with Other Skills

  • architecture-review — When the grade is D/F, escalate to the Socratic critic: this checklist finds what is wrong; architecture-review builds why.
  • python-security-review — Companion for the security dimension (OWASP, bandit, pip-audit).
  • python-feature-slice — Correct-pattern reference when the checklist flags structural violations.
  • tdd — Methodology for adding tests the checklist flags as missing, and for driving any refactor.
  • dotnet / php / rust-architecture-checklist — Sibling skills sharing this exact Core Values + workflow + output.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.