PlugWiki

python-type-safety Skill for Claude: Type Hints, Generics and mypy

Teaches Claude to add Python type hints, generics and protocols, and to set up strict mypy or pyright checking.

Installs
12.9K
on skills.sh
Stars
42.1K
on GitHub
Files
1
besides SKILL.md
Updated
Oct 2026
last repo commit

python-type-safety is a guidance skill from the wshobson/agents collection. When you ask Claude to annotate existing code, write generic classes, define protocols, or configure mypy or pyright, it follows the skill's patterns: annotate public signatures, use the modern X | None union syntax, narrow types with guards, and bound type variables.

The skill bundles no scripts. SKILL.md holds four core concepts and four patterns, and references/details.md adds six more patterns plus a strict-mode checklist with a pyproject.toml mypy block. Claude reads that file only when the main one is not enough.

Good for

  • Python developers adding type hints to an untyped codebase
  • Library authors writing generic classes and protocols
  • Teams moving a project to mypy --strict or pyright in CI step by step
  • Reviewers who want Claude to flag missing annotations on public APIs

Install python-type-safety

Claude Code

  1. 1

    Copy this prompt.

    Install the python-type-safety skill in Claude Code. Run this command:
    
    /plugin marketplace add wshobson/agents
    /plugin install python-development@claude-code-workflows
    
    Then check that it loaded and tell me how to use it.
  2. 2

    Paste it into Claude Code. It shows the change and asks before running it.

Pick one route. The plugin routes install the whole python-development plugin: 3 agents, 1 command and 16 skills (counted from the plugin folder in the repo tree, which has no hooks or MCP config files). The skills-only routes install just this skill, with no agents or commands.

From the project README. Source.

What's in the skill

When it loads

Python type safety with type hints, generics, protocols, and strict type checking. Use when adding type annotations, implementing generic classes, defining structural interfaces, or configuring mypy/pyright.

Sections in SKILL.md

  1. When to Use This Skill
  2. Core Concepts
  3. 1. Type Annotations
  4. 2. Generics
  5. 3. Protocols
  6. 4. Type Narrowing
  7. Quick Start
  8. Fundamental Patterns
  9. Pattern 1: Annotate All Public Signatures
  10. Pattern 2: Use Modern Union Syntax
  11. Pattern 3: Type Narrowing with Guards
  12. Pattern 4: Generic Classes
  13. Detailed worked examples and patterns
  14. Best Practices Summary

Key facts

Author
wshobson
Repository
wshobson/agents
Installs on skills.sh
12,936 as of 2026-11-02
Last commit to the repo
2026-10-30

What it includes

  • Pattern 1: every public function, method and class gets type annotations

    Claude adds annotations to public functions, methods and class attributes, and suggests mypy --strict or pyright in CI. For existing projects it enables strict mode module by module.

    Try: “Add type hints to the public functions in app/services/users.py.”

    Annotate public signatures

  • Pattern 2: write X | None instead of Optional[X]

    Uses the Python 3.10+ union form, and keeps Optional and Union for code that must support 3.9.

    Modern union syntax

  • Pattern 3: None checks and filters that narrow types

    Shows how an early raise or an `is not None` filter lets the type checker know the narrower type.

    Type narrowing with guards

  • Pattern 4: TypeVar and Generic for reusable containers

    Builds containers such as a Result type that keep type information. The reference file adds bounded TypeVars and a generic repository.

    Try: “Make this Result wrapper generic over its value and error types.”

    Generic classes

  • Patterns 7 to 10 in references/details.md: protocols, aliases, callables

    Covers structural typing with Protocol and runtime_checkable, type aliases (including the Python 3.12 type statement) and callable types.

    Read · Protocols and aliases

  • A pyproject.toml mypy block and a list of incremental adoption goals

    Gives a [tool.mypy] block with strict = true and related flags, then goals such as annotating all parameters and return types and minimizing Any.

    Strict mode checklist

From the official docs

Questions

What does the python-type-safety skill do?

It guides Claude through Python typing: annotations, generics, protocols, type narrowing and strict mypy or pyright settings.

How do I install it in Claude Code, the Claude app or Codex?

Use the install box at the top of this page. It installs the skill folder with SKILL.md and references/details.md.

Does it run mypy or pyright for me?

The skill bundles no scripts to run them. SKILL.md recommends mypy --strict in CI and gives a pyproject.toml settings block.

Does it need an API key?

No key is mentioned in SKILL.md or references/details.md, and the skill bundles no scripts.

Is it safe?

It is instructions and code samples with no bundled scripts. As with any skill, review the edits Claude proposes to your code before you accept them.

Which Python version does it assume?

It prefers Python 3.10+ union syntax and notes the older Optional style for 3.9. The strict-mode example sets python_version to 3.12, and one alias pattern uses the 3.12 type statement.

Information

updated Nov 2, 2026

Repository
wshobson/agents
Folder
plugins/python-development/skills/python-type-safety

wshobson/agentsskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 4
  1. python-type-safety SKILL.md · github.com
  2. wshobson/agents README · github.com
  3. python-development plugin manifest · github.com
  4. python-type-safety references/details.md · github.com

Updated Nov 2, 2026.