{"enrichment":{"faq":[{"a":"Python Best Practices Type Safety teaches you to use type hints and annotations throughout your codebase. Start by annotating function parameters and return types using the typing module\u2014for example, `def greet(name: str) -> str:`. For variables, use inline annotations like `count: int = 0`. The skill covers Optional types for nullable values, generics for collections, and patterns for complex scenarios. Type annotations are optional at runtime but enable static type checkers to catch errors before execution.","q":"How do I add types to Python code effectively?"},{"a":"Python Best Practices Type Safety explains static type checking\u2014analyzing your code without running it to find type errors early. Tools like mypy and pyright scan your annotated code and report mismatches. To set up: install mypy (`pip install mypy`), annotate your code with type hints, then run `mypy your_file.py`. The skill guides configuration via `mypy.ini` or `pyproject.toml`, integration with CI/CD pipelines, and interpreting error messages to fix issues systematically.","q":"What is static type checking python and how do I set it up?"},{"a":"Python Best Practices Type Safety covers type hints\u2014annotations that declare expected types for variables, parameters, and return values. They improve code clarity, enable IDE autocompletion, and let static checkers catch bugs like passing a string where an integer is expected. Hints don't enforce types at runtime but document intent. The skill shows practical examples: `def add(x: int, y: int) -> int:` and `users: list[str] = []`, demonstrating how hints make code safer and more maintainable.","q":"What are python type hints and why use them?"},{"a":"Python Best Practices Type Safety outlines enforcement strategies: add comprehensive type annotations to all functions and module-level variables, configure mypy or pyright with strict settings, integrate type checking into your CI/CD pipeline to block non-compliant commits, and use pre-commit hooks for local validation. The skill addresses common patterns\u2014Optional handling, generics for collections, and attribute issues\u2014and provides automation scripts for batch corrections across large codebases.","q":"How do I enforce type safety in Python projects?"},{"a":"Python Best Practices Type Safety teaches key patterns: use `Optional[T]` or `T | None` for nullable values, leverage generics like `list[User]` for type-safe collections, define TypedDict for structured dictionaries, and use Protocol for duck typing. Avoid `Any` when possible; prefer Union types for multiple valid types. The skill emphasizes gradual adoption\u2014start with public APIs and critical paths\u2014and shows how to handle third-party libraries lacking annotations using type stubs or `# type: ignore` comments judiciously.","q":"What are python typing best practices and patterns?"},{"a":"Python Best Practices Type Safety explains mypy as a static type checker that reads your annotated code and configuration, then reports type errors without executing. It infers types from assignments, validates function calls against signatures, and checks attribute access. Run `mypy your_file.py` to scan; mypy outputs line numbers and error descriptions. The skill covers mypy configuration options (strict mode, ignore patterns), integration with editors for real-time feedback, and interpreting common errors like type mismatches and missing Optional handling.","q":"How does mypy python type checking work?"}],"shadow_tags":["static-analysis","code-quality","type-annotations","mypy-integration","runtime-safety","development-workflow","python-tooling","error-prevention"],"summary_rewrite":"This skill diagnoses and resolves Python type checking errors by categorizing them into patterns\u2014missing annotations, type mismatches, Optional handling, generics, and attribute issues\u2014then applies targeted fixes. It works with pyright and mypy output, includes automation scripts for batch corrections, and guides you through verification to maintain strict type safety."},"gist":{"api_url":"https://skillfed.io/api/skills/dawiddutoit/custom-claude/python-best-practices-type-safety.json","as_of":"2026-01-26","description":"Python Best Practices Type Safety fixes pyright and mypy type errors through systematic categorization.","install":{"manual":["git clone https://github.com/dawiddutoit/custom-claude","cp -r custom-claude ~/.claude/skills/python-best-practices-type-safety"],"primary":"npx skillfed install dawiddutoit/custom-claude/python-best-practices-type-safety","version":"7583ed42"},"kind":"skill","mirror_url":"https://skillfed.io/dawiddutoit/custom-claude/python-best-practices-type-safety.md","similar":[{"id":"dawiddutoit/custom-claude/util-resolve-serviceresult-errors","name":"Util Resolve Serviceresult Errors","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/util-resolve-serviceresult-errors"},{"id":"dawiddutoit/custom-claude/quality-run-type-checking","name":"Quality Run Type Checking","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/quality-run-type-checking"},{"id":"jiatastic/open-python-skills/ty-skills","name":"ty-skills","publisher":"jiatastic/open-python-skills","url":"https://skillfed.io/jiatastic/open-python-skills/ty-skills"},{"id":"dawiddutoit/custom-claude/quality-run-quality-gates","name":"Quality Run Quality Gates","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/quality-run-quality-gates"}],"title":"Python Best Practices Type Safety by dawiddutoit \u2014 SkillFed","use":{"when":["Python Best Practices Type Safety explains static type checking\u2014analyzing your code without running it to find type errors early.","Python Best Practices Type Safety covers type hints\u2014annotations that declare expected types for variables, parameters, and return values."]},"what":{"lead":"Python Best Practices Type Safety fixes pyright and mypy type errors through systematic categorization and proven fix templates.","rest":"This skill diagnoses and resolves Python type checking errors by categorizing them into patterns\u2014missing annotations, type mismatches, Optional handling, generics, and attribute issues\u2014then applies targeted fixes. It works with pyright and mypy output, includes automation scripts for batch corrections, and guides you through verification to maintain strict type safety."}},"id":"dawiddutoit/custom-claude/python-best-practices-type-safety","install":{"mode":"external","repo":"https://github.com/dawiddutoit/custom-claude"},"links":{"html":"https://skillfed.io/dawiddutoit/custom-claude/python-best-practices-type-safety","md":"https://skillfed.io/dawiddutoit/custom-claude/python-best-practices-type-safety.md","repo":"https://github.com/dawiddutoit/custom-claude"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":0,"language":"Python","last_updated":"2026-01-26","license":null,"name":"Python Best Practices Type Safety","publisher":"dawiddutoit","stars":1},"relations":{"similar":[{"id":"dawiddutoit/custom-claude/util-resolve-serviceresult-errors"},{"id":"dawiddutoit/custom-claude/quality-run-type-checking"},{"id":"dawiddutoit/custom-claude/test-debug-failures"},{"id":"jiatastic/open-python-skills/ty-skills"},{"id":"hyperb1iss/hyperskills/ty"},{"id":"dawiddutoit/custom-claude/architecture-single-responsibility-principle"},{"id":"astral-sh/claude-code-plugins/ty"},{"id":"dawiddutoit/custom-claude/implement-retry-logic"},{"id":"dawiddutoit/custom-claude/quality-run-quality-gates"},{"id":"dawiddutoit/custom-claude/observability-instrument-with-otel"}]},"slug":{"owner":"dawiddutoit","repo":"custom-claude","skill":"python-best-practices-type-safety"},"version":"7583ed42"}
