Skip to content

Python Type Safety

Helps the agent add and check Python type hints, generics, protocols and mypy/pyright strict checking.

Repository
wshobson/agents
Stars
42,095
Licence
MIT
Files
2 files

What it does

When installed, the agent follows a set of Python typing guidelines whenever you ask it to add type annotations, write generic classes, define protocol interfaces, or configure mypy or pyright. It will favour modern syntax such as X | None, narrow types with guards, annotate public signatures, and suggest running strict type checking in CI. It is a guidance document rather than a tool, so it changes how the agent writes code instead of running checks itself.

Great for

  • Python developers adding type hints to an existing codebase
  • Library authors who want typed public APIs
  • Teams setting up mypy --strict or pyright in CI

Skip it if

  • Non-Python projects, since the guidance is specific to Python typing (the reason: it will not apply to other languages)
  • Quick scripts where full annotations add effort without benefit (the reason: strict typing is most useful for maintained code)

Try asking

  • “Add type hints to this Python module and fix any mypy errors”
  • “Refactor this function to use a generic Result type”
  • “Configure mypy strict mode for this project incrementally”
  • “Define a Protocol for the storage backends in this codebase”
Step-by-step guide: how to use Python Type SafetyInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the MIT licence and an attribution note.

    python-type-safety.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip python-type-safety.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip python-type-safety.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Point the agent at a specific module or file so it can apply the patterns to real code.
  • Ask it to run mypy or pyright on your project so you can see the actual errors rather than relying on the guidance alone.
  • State your minimum Python version up front so it chooses between X | None and Optional[X] correctly.

What's inside

  • references/details.md
  • SKILL.md

Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.