Agent skill

python-type-safety

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.

Seth Hobson38,331★ · +219/wk · 1 repos on radarProfile →
claude-codecodexcopilotcursorMIT
Install
npx skills add wshobson/agents --skill python-type-safety --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 6 KB
Bundled scripts: none
Path: plugins/python-development/skills/python-type-safety/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 38,479 · +148 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Python Type Safety Leverage Python's type system to catch errors at static analysis time. Type annotations serve as enforced documentation that tooling validates automatically. ## When to Use This Skill - Adding type hints to existing code - Creating generic, reusable classes - Defining structural interfaces with protocols - Configuring mypy or pyright for strict checking - Understanding type narrowing and guards - Building type-safe APIs and libraries ## Core Concepts ### 1. Type Annotations Declare expected types for function parameters, return values, and variables. ### 2. Generics Write reusable code that preserves type information across different types. ### 3. Protocols Define structural interfaces without inheritance (duck typing with type safety). ### 4. Type Narrowing Use guards and conditionals to narrow types within code blocks. ## Quick Start ```python def get_user(user_id: str) -> User | None: """Return type makes 'might not exist' explicit.""" ... # Type checker enforces handling None case user = get_user("123") if user is None: raise UserNotFoundError("123") print(user.name) # Type checker knows user is User here ``` ## Fundamental Patterns ### Pattern 1: Annotate

What's inside
Steps it walks through
  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
Ships with 1 file
  • references/details.md
More from agents
All skills →
About this skill
What does the python-type-safety skill do?

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.

How do I install it?

Run `npx skills add wshobson/agents --skill python-type-safety --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From wshobson/agents, a repository with 38,479 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going