ub-python

Enforce modern Python typing, boundary validation, and structured error handling.

6|2|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/robert-hoffmann/uncle-bob --skill ub-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ub-python
Source: https://github.com/robert-hoffmann/uncle-bob/tree/main/.agents/skills/ub-python
Command: npx skills add https://github.com/robert-hoffmann/uncle-bob --skill ub-python

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design, review, refactor, and test repository Python code using typed Python (latest stable) patterns, boundary validation, and structured error handling. Use when tasks involve Python files, pytest/ruff/mypy workflows, packaging/tooling decisions, dataclass or Pydantic modeling, or Python service/repository logic.

Core Features & Use Cases

  • Enforce typing discipline: promote typing annotations, modern syntax, and strict contracts across Python code.
  • Boundary validation and structured error handling: provide robust data validation and error pathways.
  • Migration guidance: help move code toward newer Python versions with minimal disruption.
  • Use Case: refactor a service to adopt dataclasses and Pydantic v2 models, while maintaining tests.

Quick Start

Identify the project's Python version from pyproject.toml, then propose a minimal, typed refactor plan that improves typing coverage and boundary validation.

Frequently Asked Questions about ub-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce strict type-checking and boundary validation in Python projects?

Enforce type-checking and boundary validation by applying modern Python typing annotations and structured error handling across your codebase. Use Pydantic or dataclasses for robust data validation and clear error pathways at system boundaries.

What's the best way to refactor a Python service to use Pydantic v2 and dataclasses?

Refactor Python services to Pydantic v2 and dataclasses by proposing a minimal, typed migration plan. Identify the target Python version from pyproject.toml first, then improve typing coverage while maintaining existing tests.

Does this approach work with my existing pytest, ruff, and mypy workflows?

Yes, this approach works directly with pytest, ruff, and mypy workflows. Validation steps are aligned with your existing project tooling to ensure type safety and boundary checks integrate seamlessly into your testing pipelines.

How do I migrate legacy Python code to newer Python versions with minimal disruption?

Migrate legacy Python code to newer versions by following guided migration paths that offer multiple implementation options with tradeoffs. This ensures minimal disruption while adopting modern syntax and strict typing contracts.

When should I choose dataclasses over Pydantic for Python data modeling?

Choose between dataclasses and Pydantic by evaluating multiple implementation-path options with tradeoffs. Dataclasses offer lightweight structured data, while Pydantic provides robust runtime boundary validation and structured error handling.