# Python Audit

> Auditoría de calidad, arquitectura y performance para proyectos Python. Trigger: Cuando se audita un repositorio Python, se inicia un refactor o se configura CI/CD.

- Skill: `crozzbite/python-audit` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add crozzbite/python-audit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/crozzbite/python-audit/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: crozzbite (https://skillmd.com/u/crozzbite)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/crozzbite/python-audit

---


## When to Use
Load this skill when:
- Auditing a new Python repository (FastAPI/General).
- Configuring CI/CD pipelines or pre-commit hooks.
- Starting a refactor of legacy services.

## Critical Patterns

### 1. The Bones (Infraestructura)
"Bones + Brain" - A solid structure is non-negotiable.

| Component | Standard | Why |
|-----------|----------|-----|
| Package Manager | `uv` | Modern, fast, and reliable lockfiles. |
| Configuration | `pyproject.toml` | Single source of truth for tools. |
| MCP Servers | No `print()` | Avoid breaking the protocol; use logging. |

### 2. The Brain (Type Safety)
Strict typing ensures long-term maintainability.

| Pattern | Rule |
|---------|------|
| Typing | `mypy --strict` mandatory. |
| `Any` | Prohibited unless justified with `# type: ignore`. |
| Coverage | >95% in business logic. |

## Code Examples

### Example: Standard pyproject.toml
```toml
[tool.mypy]
strict = true
ignore_missing_imports = true

[tool.ruff]
line-length = 88
target-version = "py311"
```

## Anti-Patterns

### Don't: Manual Dependencies
Why: Manual `requirements.txt` are brittle. Use `uv.lock`.
```text
# ❌ Using requirements.txt without a lockfile
```

### Don't: Pokemon Exception Handling
Why: Masking errors makes debugging impossible.
```python
# ❌ except Exception: pass
```

## Quick Reference
- **Runner**: `pytest` only.
- **MCP Logging**: Log to `stderr`.
- **Formatting**: `ruff` is the standard.

