python-patterns
Skill1 starsChanged 6 months agoMITView on GitHub
General Python coding standards: naming, logging, exception handling, type hints, and project structure. Use for any Python project task.
- Reads credentials
56 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- dmoreq/agent-grimoiretheir own version, first seen Nov 8, 2026
- Ashfaqbs/ai-coding-agent-toolkittheir own version, first seen Nov 8, 2026
- komluk/scaffoldingtheir own version, first seen Nov 7, 2026
- Lukk17/agent-standardstheir own version, first seen Nov 7, 2026
- pankaj-mahaur/Agent-Daemontheir own version, first seen Nov 6, 2026
Used with
Projects with it also use configure-ecc, nuxt4-patterns and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
royaluniondesign-sysSkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
loulanyueSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 10 projects that use this
RojiosSkilldart-flutter-patterns
Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.
Also in 7 projects that use this
royaluniondesign-sysSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 16 projects that use this
TironFoxSkillagent-payment-x402
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.
Also in 6 projects that use this
TironFoxSkillopenclaw-persona-forge
为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。
Also in 5 projects that use this
- +1 more from royaluniondesign-sys
Other versions56 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 56
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- openJiuwen-ai/agent-core★ 464same name
- loulanyue/awesome-claude-notes★ 272same name
- xenitV1/Antigravity-Workflows★ 130same name
- Fmarzochi/EGC★ 61same name
- kumaran-is/claude-code-onboarding★ 35same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- Ashfaqbs/ai-coding-agent-toolkit★ 27same name
- Benkapner/claude-code-basecamp★ 17same name
46 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- finishing-a-development-branchSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- systematic-debuggingSkill
- verification-before-completionSkill
- api-designSkill
- database-migrationsSkill
- fastapi-patternsSkill
- logging-standardsSkill
- redis-patternsSkill
- springboot-patternsSkill
- security-reviewSkill
- using-superpowersSkill
- java-testingSkill
- python-testingSkill
- test-driven-developmentSkill
- brainstormingSkill
- executing-plansSkill
- subagent-driven-developmentSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 53 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Never silently swallow exceptions.
- Very specific: line 42
Never use print() to record application events.
- Distinctive: line 124
Keep empty or limit to public re-exports — no business logic inside
“Common” is measured: kept by at least 6 in 10 of the 53 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Coding Patterns
Mandatory
Rules in this section block task completion when violated.
No Bare Except
Never silently swallow exceptions. A bare except: or except Exception: pass hides bugs and makes debugging impossible.
# BAD
try:
result = process(data)
except:
pass
# BAD — catches too broadly and discards the error
try:
result = process(data)
except Exception:
pass
# GOOD — catch specific exception, log with context, re-raise or handle
try:
result = process(data)
except ValueError as e:
logger.error("Invalid data in process: %s", e)
raise
except IOError as e:
logger.error("IO failure in process: %s", e)
raise RuntimeError("Processing unavailable") from eNo print() for Logging
Never use print() to record application events. print() has no log level, no timestamp, and cannot be filtered or routed in production.
# BAD
print(f"Processing user {user_id}")
print("ERROR: " + str(e))
# GOOD
import logging
logger = logging.getLogger(__name__)
logger.info("Processing user %s", user_id)
logger.error("Failed to process user %s: %s", user_id, e)Recommended
Rules in this section are flagged in review but do not block submission.
Naming Conventions (Python)
| Target | Convention | Example |
| Function / variable | snake_case | get_user, user_name |
| Class | PascalCase | UserService, OrderRequest |
| Constant | UPPER_SNAKE_CASE | MAX_RETRIES = 3 |
| Module / package | lowercase_underscore | user_service.py |
| Private attribute | leading _ | _cache, _conn |
| Boolean variable | is_ / has_ / can_ prefix | is_active, has_permission |
Type Hints
Recommended for all new code. Not a hard gate — absence does not block review. Static analysis (mypy, pyright) is optional but encouraged on CI.
# Recommended — explicit contracts
from typing import Optional
def get_user(user_id: int) -> Optional[User]:
...
def create_order(request: OrderRequest) -> OrderResponse:
...
# Acceptable when type is unambiguous from context
def _double(x):
return x * 2Function and File Size
- Function body: ≤ 50 lines, cyclomatic complexity ≤ 10
- Single file: ≤ 500 lines — split by responsibility when approaching the limit
Project Structure
Standard layout for a Python backend service:
project/
├── src/ # optional src layout
│ ├── __init__.py
│ ├── api/ # route handlers / controllers
│ ├── services/ # business logic
│ ├── models/ # domain models / Pydantic schemas
│ ├── repositories/ # data access layer
│ └── config.py
├── tests/
│ ├── conftest.py # shared fixtures
│ ├── unit/
│ └── integration/
├── requirements.txt # or pyproject.toml / uv.lock
└── .env.example__init__.py:
- Required in each package directory for explicit package declaration
- Keep empty or limit to public re-exports — no business logic inside
Package management is project-specific: pip + venv, Poetry, and uv are all acceptable. Do not prescribe a tool unless the project already has one established.
Logging
Obtain a module-level logger once per file. Never configure logging inside library/module code (only in application entry point).
import logging
# One logger per module — do this at module level
logger = logging.getLogger(__name__)
def process_order(order_id: int) -> None:
logger.info("Processing order %s", order_id)
try:
result = _run(order_id)
logger.info("Order %s completed: %s", order_id, result.status)
except ProcessingError as e:
# Pass exc_info=True (or the exception) to capture full traceback
logger.error("Order %s failed: %s", order_id, e, exc_info=True)
raiseLog level guide:
| Level | Use when |
DEBUG | Developer diagnostics, verbose internal state |
INFO | Normal operational events (started, completed, state changed) |
WARNING | Unexpected but recoverable (retry attempted, fallback used) |
ERROR | Operation failed, requires attention |
CRITICAL | System cannot continue, immediate action required |
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
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.

