
Strict Python Mode
- 1 installs
- 77 repo stars
- Updated January 8, 2026
- afaneor/fastapi-docker-boilerplate
strict-python-mode is a Claude Code skill that enforces mandatory type hints, docstrings, modern Python syntax and ruff/mypy checks on Python code.
About
strict-python-mode is a Claude Code skill that enforces strict Python coding conventions while writing or refactoring code. It requires type hints on every parameter and return, Google-style docstrings, modern Python 3.12+ syntax, and passing ruff and mypy checks before finishing. A developer uses it to keep FastAPI and other Python code type-safe and production-ready. It includes FastAPI-specific rules for endpoint signatures and response models.
- Enforces mandatory type hints and Google-style docstrings
- Requires modern Python 3.12+ syntax (list[str], X | None)
- Gates code on ruff format, ruff check and mypy
Strict Python Mode by the numbers
- 1 all-time installs (skills.sh)
- Ranked #240 of 290 Python skills by installs in the Skillselion catalog
- Data as of Jul 24, 2026 (Skillselion catalog sync)
strict-python-mode capabilities & compatibility
- Capabilities
- type checking · linting · python refactoring · docstring enforcement
- Use cases
- refactoring · code review · api development
- IDEs
- vscode · pycharm
- Pricing
- Free
What strict-python-mode says it does
Enforces type hints, docstrings, and Python best practices.
Type hints are mandatory
npx skills add https://github.com/afaneor/fastapi-docker-boilerplate --skill strict-python-modeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 77 |
| Last updated | January 8, 2026 |
| Repository | afaneor/fastapi-docker-boilerplate ↗ |
What it does
Enforce type hints, docstrings and ruff/mypy checks when writing or refactoring Python and FastAPI code.
Who is it for?
Python and FastAPI developers who want type-safe, lint-clean, documented code by default
Skip if: Non-Python codebases or teams not using ruff, mypy or type hints
When should I use this skill?
Writing or refactoring Python code, creating new functions, or when the user asks for production-ready or type-safe code
What you get
Type-annotated, docstring-covered Python that passes ruff and mypy before it is shown
- type-annotated python code
- docstring coverage
- lint and type-check pass
By the numbers
- 5-item pre-commit validation checklist
- targets Python 3.12+
Files
Strict Python Mode
Core Principles
When writing Python code in this project, ALWAYS follow these rules:
1. Type hints are mandatory
- Every function parameter must have a type hint
- Every function must have a return type annotation
- Use
from collections.abc importfor generic types (list, dict, set) - Never use
Anytype - if type is unknown, useobjector create proper Protocol
2. Docstrings are required
- Every public function/method needs a docstring
- Use Google-style docstrings format
- Include Args, Returns, Raises sections
3. Modern Python syntax (3.12+)
- Use
list[str]instead ofList[str]from typing - Use
dict[str, int]instead ofDict[str, int] - Use
X | Noneinstead ofOptional[X] - Use
X | Yfor Union types
Code Quality Checks
Before finishing ANY code changes, run these checks:
# 1. Format with Ruff
poetry run ruff format .
# 2. Lint with Ruff
poetry run ruff check . --fix
# 3. Type check with mypy (if available)
poetry run mypy app/ --ignore-missing-importsExample: Good vs Bad
❌ Bad (will be rejected)
def get_user(id):
user = db.get(id)
return user✅ Good (approved)
def get_user(user_id: int) -> User | None:
"""Fetch user by ID from database.
Args:
user_id: The unique identifier of the user
Returns:
User object if found, None otherwise
Raises:
DatabaseError: If database connection fails
"""
user = db.get(user_id)
return userFastAPI-Specific Rules
Endpoint Signatures
# Always use dependency injection
@router.get("/users/{user_id}")
async def get_user(
user_id: int,
db: DatabaseSession = Depends(get_db),
current_user: User = Depends(get_current_user),
) -> UserResponse:
"""Get user by ID."""
...Response Models
# Always define explicit response models
class UserResponse(BaseModel):
id: int
username: str
email: EmailStr
created_at: datetime
class Config:
from_attributes = TrueValidation Rules
Before ANY commit: 1. All new functions have type hints 2. All public functions have docstrings 3. Ruff format passes with no changes needed 4. Ruff check passes with no errors 5. If mypy is available, it passes with no errors
If any check fails, FIX IT before showing me the code.
Related skills
FAQ
What checks does strict-python-mode run?
ruff format, ruff check --fix and mypy before any code is finalized.
Which Python version does it target?
Modern Python 3.12+ syntax such as list[str] and X | None instead of typing generics.