python-best-practices
Skill14 starsChanged 38 days agoMITView on GitHub
Python code review and best practices validation. Comprehensive analysis including type hints, testing, linting, and package management.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- mahdy-gribkov/arcanatheir own version, first seen Nov 8, 2026
- The-AIOS/aiostheir own version, first seen Nov 3, 2026
- medy-gribkov/arcanatheir own version, first seen Nov 1, 2026
- jkitchin/knowhowtheir own version, first seen Nov 1, 2026
- OpenxIntelligence/Coding-Agent-Skillstheir own version, first seen Nov 1, 2026
- fullerzz/agent-skillstheir own version, first seen Oct 25, 2026
Used with
Projects with it also use typescript-best-practices and skill-creator.
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.
jaydubya818Skilltypescript-best-practices
Use when TypeScript needs focused type-safety, API, or error-handling guidance.
Also in 3 projects that use this
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 4 projects that use this
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- The-AIOS/aios★ 105same name
- jefflester/claude-skills-supercharged★ 43same name
- baekenough/oh-my-customcode★ 42same name
- jkitchin/knowhow★ 42same name
- arnabdeypolimi/claude_code_setup★ 4same name
- I-Onlabs/claude-code-skills★ 4same name
- OpenxIntelligence/Coding-Agent-Skills★ 4same name
- Sanskar015/claude-skills-supercharged★ 3same name
- amirrezaalasti/codescribe★ 2same name
- b12consulting/skills★ 2same name
9 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 repository44 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adaptSkill
- animateSkill
- auditSkill
- bolderSkill
- brainstormSkill
- build-fixSkill
- business-panelSkill
- checkpointSkill
- clarifySkill
- colorizeSkill
- composition-patternsSkill
- confidence-checkSkill
- config-doctorSkill
- critiqueSkill
- delightSkill
- design-auditSkill
- devils-advocateSkill
- distillSkill
- eval-harnessSkill
- feature-plannerSkill
- fix-prSkill
- frontend-designSkill
- gap-analysisSkill
- grill-with-docsSkill
- hardenSkill
- impeccableSkill
- layoutSkill
- learnSkill
- optimizeSkill
- overdriveSkill
- polishSkill
- pytest-runnerSkill
- quieterSkill
- react-best-practicesSkill
- sc-helpSkill
- security-auditSkill
- shapeSkill
- tddSkill
- typesetSkill
- ui-ux-pro-maxSkill
- uv-packageSkill
- verifySkill
- web-design-guidelinesSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
3
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
- Distinctive: line 14
Auto-execute: when Python code review requested
- Very specific: line 15
When analyzing .py files
- Distinctive: line 16
When reviewing FastAPI, Django, Flask projects
- Distinctive: line 17
When inspecting package dependencies
- Very specific: line 64
Test files exist (tests/, *_test.py)
“Common” is measured: kept by at least 6 in 10 of the 15 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 Best Practices Skill
Purpose
Comprehensively analyze Python code quality, type safety, test coverage, and linting compliance.
When to Use
- Auto-execute when Python code review requested
- When analyzing
.pyfiles - When reviewing FastAPI, Django, Flask projects
- When inspecting package dependencies
Analysis Categories
1. Type Hints (25%)
Check Items:
- Function parameter type hints
- Return type annotations
- Complex types (Generic, Union, Optional)
- TypedDict, Protocol usage
# ❌ Bad
def get_user(id):
return db.query(id)
# ✅ Good
def get_user(id: int) -> User | None:
return db.query(id)Verification Tool: mypy --strict
2. Code Quality (25%)
Check Items:
- PEP 8 style compliance
- Function/class complexity
- Import organization
- Docstring presence
# ❌ Bad
def f(x,y,z): return x+y+z
# ✅ Good
def calculate_sum(a: int, b: int, c: int) -> int:
"""Calculate the sum of three integers."""
return a + b + cVerification Tool: ruff check, ruff format --check
3. Testing (20%)
Check Items:
- Test files exist (
tests/,*_test.py) - Test coverage (≥80% recommended)
- Fixture usage
- Mocking patterns
# ✅ Good test structure
def test_get_user_returns_user(db_session: Session):
user = create_user(db_session, name="test")
result = get_user(user.id)
assert result.name == "test"
def test_get_user_returns_none_for_invalid_id():
result = get_user(999999)
assert result is NoneVerification Tool: pytest --cov
4. Security (15%)
Check Items:
- SQL Injection prevention
- Hardcoded secrets
- Unsafe deserialization
- Input validation
# ❌ Bad
query = f"SELECT * FROM users WHERE id = {user_id}"
# ✅ Good
query = "SELECT * FROM users WHERE id = :id"
result = db.execute(query, {"id": user_id})Verification Tool: bandit
5. Dependencies (15%)
Required Rule: Use uv (pip, poetry, pipenv prohibited)
Check Items:
pyproject.toml(PEP 621 standard) existsuv.lockexists and committed- Version ranges properly specified (
^,~) - Development dependency groups separated
# ✅ Good pyproject.toml (PEP 621 / uv)
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = []
[dependency-groups]
dev = [
"pytest>=8.0",
"mypy>=1.8",
"ruff>=0.1",
]# ❌ Bad - Using requirements.txt or Poetry format
[tool.poetry]
dependencies = {python = "^3.11"}
# ❌ Bad - Using poetry.lockVerification Tool: uv lock --check, uv sync --frozen
Docker Pattern:
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-devOutput Format
High Quality (≥90%)
📋 Python Best Practices Check:
✅ Type Hints: 95% coverage (mypy strict pass)
✅ Code Quality: A (ruff 0 errors)
✅ Testing: 87% coverage (42 tests)
✅ Security: No issues (bandit clean)
✅ Dependencies: All pinned, no vulnerabilities
📊 Score: 0.94 (94%)
✅ Production ReadyNeeds Improvement (70-89%)
📋 Python Best Practices Check:
✅ Type Hints: 78% coverage
⚠️ Code Quality: B (12 ruff warnings)
✅ Testing: 72% coverage
⚠️ Security: 2 low-severity issues
✅ Dependencies: OK
📊 Score: 0.76 (76%)
⚠️ Review Recommended
💡 Improvements Needed:
1. src/utils.py:45 - Missing type hints
2. src/api.py:120 - High complexity (refactor recommended)
3. src/db.py:67 - Caution with SQL string formattingPoor Quality (<70%)
📋 Python Best Practices Check:
❌ Type Hints: 32% coverage
❌ Code Quality: D (47 errors)
❌ Testing: 15% coverage (3 tests)
⚠️ Security: 5 issues
❌ Dependencies: Unpinned versions
📊 Score: 0.42 (42%)
❌ Not Ready for Review
🚨 Critical Issues:
1. Insufficient type safety - mypy cannot run
2. Test coverage critically low
3. requirements.txt versions not pinnedVerification Commands
# Run in uv environment
# Type checking
uv run mypy --strict src/
# Linting & formatting
uv run ruff check src/
uv run ruff format --check src/
# Testing
uv run pytest --cov=src --cov-report=term-missing
# Security
uv run bandit -r src/
# Dependencies
uv lock --check # Check lock file sync
uv sync --frozen # Verify install from lock
uv pip list --outdated # List updatable packages
# Virtual environment management
uv venv # Show/create environment info
uv sync # Install dependencies
uv lock --upgrade # Upgrade dependenciesFramework-Specific Checks
FastAPI
# ✅ Good patterns
from fastapi import Depends, HTTPException, status
from pydantic import BaseModel
class UserCreate(BaseModel):
name: str
email: EmailStr
@app.post("/users", response_model=UserResponse)
async def create_user(
user: UserCreate,
db: Session = Depends(get_db)
) -> UserResponse:
...Additional Checks:
- Pydantic model usage
- Dependency injection pattern
- Async endpoints
- OpenAPI documentation
Django
# ✅ Good patterns
from django.db import models
from django.core.validators import MinLengthValidator
class User(models.Model):
name = models.CharField(max_length=100, validators=[MinLengthValidator(2)])
email = models.EmailField(unique=True)
class Meta:
indexes = [models.Index(fields=['email'])]Additional Checks:
- Model indexes
- Migration state
- Security middleware
- CSRF protection
Integration with Other Skills
/confidence-check → Verify Python project architecture
│
▼
/python-best-practices → Analyze code quality
│
▼
/verify → Verify build/tests
│
▼
/learn → Save patternsCommands
| Command | Description |
/python-best-practices | Full analysis |
/python-best-practices --quick | Type/lint only |
/python-best-practices --security | Security focus |
/python-best-practices --deps | Dependencies focus |
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.

