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 skills add KunanonJ/ai-skills-hub --skill python-best-practicesgit clone --depth 1 https://github.com/KunanonJ/ai-skills-hubWrote 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.
[](https://agentmods.dev/skills/kunanonj/ai-skills-hub/python-best-practices)<a href="https://agentmods.dev/skills/kunanonj/ai-skills-hub/python-best-practices"><img src="https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/python-best-practices/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.
<a href="https://agentmods.dev/skills/kunanonj/ai-skills-hub/python-best-practices"><img src="https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/python-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.00648 |
| Opus 5.5 | $0.00020 | $0.00259 |
| Sonnet 5.5 | $0.00010 | $0.00130 |
| Haiku 4.5 | $0.00005 | $0.00065 |
Grade A, and why
python-best-practices 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 3mo 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 — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python + FastAPI Best Practices — Quick Reference
Layered Architecture
Router → Service → Repository → Database. Each layer only calls the one below it.
See code-patterns.md for full project structure and layer examples.
Pydantic v2
Separate Create/Update/Response schemas. Use ConfigDict(from_attributes=True) for ORM integration. Use str | None syntax (not Optional[str]).
See code-patterns.md for schema examples.
Async Patterns
async def for I/O routes, plain def for CPU-bound. Use lifespan context manager (not on_event). Use httpx.AsyncClient for external HTTP calls.
See code-patterns.md for async examples.
Soft Delete
Use a SoftDeleteMixin on SQLAlchemy models. Filter where(Model.deleted_at.is_(None)) in all queries.
See code-patterns.md for mixin and repository patterns.
Configuration
Use pydantic-settings for all config. Never hardcode secrets, URLs, or magic numbers.
See code-patterns.md for Settings class pattern.
Pagination
Use a generic PaginatedResponse[T] for all list endpoints. Always return total, page, limit, has_more.
See code-patterns.md for the pattern.
Gotchas
-
async defvsdefmatters for performance. Anasync defroute that calls blocking code (liketime.sleep()or sync DB drivers) blocks the entire event loop. Use plaindeffor CPU-bound work — FastAPI runs it in a threadpool. Useasync defonly when youawaitsomething. -
datetime.utcnow()is deprecated since Python 3.12. Usedatetime.now(UTC)instead. The old function returns a naive datetime (no timezone), which causes comparison bugs. The new one returns timezone-aware UTC. -
Mutable default arguments in Pydantic look safe but have a catch.
tags: list[str] = []works in Pydantic (it copies the default). Buttags: list[str] = Field(default_factory=list)is explicit and safer for nested models. For simple fields, either works. For complex nested defaults, always usedefault_factory.
What ships with it
1 file 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.
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.
- 3mo ago First seen · 61 lines · 50 tokens per session scan A 74e25c6954e3
python-best-practices is a skill published in the GitHub repository KunanonJ/ai-skills-hub (5 stars, last pushed 2mo ago), licensed MIT. It adds 50 tokens to every session and 648 once invoked, about $0.0002 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-09-03.
python-best-practices compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| python-best-practicesKunanonJ/ai-skills-hub | Skill | 5 | 2mo ago | MIT | A | 50 | Claude Code |
| fastapi-templateswshobson/agents | Skill | 43k | 3d ago | MIT | A | 37 | Claude Code |
| fastapiericrisco/rsc-harness | Skill | 709 | 3d ago | MIT | A | 94 | Claude Code, Codex |
| djangoericrisco/rsc-harness | Skill | 709 | 3d ago | MIT | A | 84 | Claude Code, Codex |
| supabase-pythonalinaqi/maggy | Skill | 712 | 9d ago | MIT | A | 15 | Claude Code |
| reddit-apialinaqi/maggy | Skill | 712 | 9d ago | MIT | B | 20 | Claude Code |
| beautifulsoup-parsingMindrally/skills | Skill | 326 | 1mo ago | Apache-2.0 | A | 32 | Claude Code |