Development
python - Claude MCP Skill
Python development with ruff, mypy, pytest - TDD and type safety
SEO Guide: Enhance your AI agent with the python tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to python development with ruff, mypy, pytest - tdd and type safety... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# Python Skill
---
## Type Hints
- Use type hints on all function signatures
- Use `typing` module for complex types
- Run `mypy --strict` in CI
```python
def process_user(user_id: int, options: dict[str, Any] | None = None) -> User:
...
```
---
## Project Structure
```
project/
āāā src/
ā āāā package_name/
ā āāā __init__.py
ā āāā core/ # Pure business logic
ā ā āāā __init__.py
ā ā āāā models.py # Pydantic models / dataclasses
ā ā āāā services.py # Pure functions
ā āāā infra/ # Side effects
ā ā āāā __init__.py
ā ā āāā api.py # FastAPI routes
ā ā āāā db.py # Database operations
ā āāā utils/ # Shared utilities
āāā tests/
ā āāā unit/
ā āāā integration/
āāā pyproject.toml
āāā CLAUDE.md
```
---
## Tooling (Required)
```toml
# pyproject.toml
[tool.ruff]
line-length = 100
select = ["E", "F", "I", "N", "W", "UP"]
[tool.mypy]
strict = true
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--cov=src --cov-report=term-missing --cov-fail-under=80"
```
---
## Testing with Pytest
```python
# tests/unit/test_services.py
import pytest
from package_name.core.services import calculate_total
class TestCalculateTotal:
def test_returns_sum_of_items(self):
# Arrange
items = [{"price": 10}, {"price": 20}]
# Act
result = calculate_total(items)
# Assert
assert result == 30
def test_returns_zero_for_empty_list(self):
assert calculate_total([]) == 0
def test_raises_on_invalid_item(self):
with pytest.raises(ValueError):
calculate_total([{"invalid": "item"}])
```
---
## GitHub Actions
```yaml
name: Python Quality Gate
on: [push, pull_request]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install -e ".[dev]"
- name: Lint (Ruff)
run: ruff check .
- name: Format Check (Ruff)
run: ruff format --check .
- name: Type Check (mypy)
run: mypy src/
- name: Test with Coverage
run: pytest
```
---
## Pre-Commit Hooks
```yaml
# .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: [pydantic]
args: [--strict]
- repo: local
hooks:
- id: pytest
name: pytest
entry: pytest tests/unit -x --tb=short
language: system
pass_filenames: false
always_run: true
```
Install and setup:
```bash
pip install pre-commit
pre-commit install
```
---
## Patterns
### Pydantic for Data Validation
```python
from pydantic import BaseModel, Field
class CreateUserRequest(BaseModel):
email: str = Field(..., min_length=5)
name: str = Field(..., max_length=100)
```
### Dependency Injection
```python
# Don't import dependencies directly in business logic
# Pass them in
# Bad
from .db import database
def get_user(user_id: int) -> User:
return database.fetch(user_id)
# Good
def get_user(user_id: int, db: Database) -> User:
return db.fetch(user_id)
```
### Result Pattern (No Exceptions in Core)
```python
from dataclasses import dataclass
@dataclass
class Result[T]:
value: T | None
error: str | None
@property
def is_ok(self) -> bool:
return self.error is None
```
---
## Python Anti-Patterns
- ā `from module import *`
- ā Mutable default arguments
- ā Bare `except:` clauses
- ā Using `type: ignore` without explanation
- ā Global variables for state
- ā Classes when functions sufficeSignals
Information
- Repository
- alinaqi/claude-bootstrap
- Author
- alinaqi
- Last Sync
- 9/3/2026
- Repo Updated
- 9/1/2026
- Created
- 1/14/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
upgrade-nodejs
Upgrading Bun's Self-Reported Node.js Version
cursorrules
CrewAI Development Rules
README
Agents ā Working Implementations
cn-check
Install and run the Continue CLI (`cn`) to execute AI agent checks on local code changes. Use when asked to "run checks", "lint with AI", "review my changes with cn", or set up Continue CI locally.
Related Guides
Bear Notes Claude Skill: Your AI-Powered Note-Taking Assistant
Learn how to use the bear-notes Claude skill. Complete guide with installation instructions and examples.
OpenAI Whisper API Claude Skill: Complete Guide to AI-Powered Audio Transcription
Learn how to use the openai-whisper-api Claude skill. Complete guide with installation instructions and examples.
Mastering the Oracle CLI: A Complete Guide to the Claude Skill for Database Professionals
Learn how to use the oracle Claude skill. Complete guide with installation instructions and examples.