[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71951JDWCYMS8GDC2C7395D":3,"skill-same:01M71951JDWCYMS8GDC2C7395D":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M71951JDWCYMS8GDC2C7395D","type-strictness",null,"Enforce strict type compliance by eliminating `Any` types and `# type: ignore` comments. Use when:\n(1) Editing code that contains `Any` as a type annotation\n(2) Code has `# type: ignore` or `# pyright: ignore` comments\n(3) User requests type fixes or type strictness enforcement\n(4) Importing from untyped third-party libraries\n(5) User asks to \"fix types\", \"remove Any\", or \"add proper typing\"\n(6) Pyrefly or mypy reports type errors that need resolution\n(7) Code review reveals weak typing patterns\nFollows hierarchical resolution: codebase inference → type stubs → library inspection → type guards → casting (last resort).","vasceannie\u002Fslopgate","vasceannie","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20271133?v=4","01M718RGA8VV2EF22XJEMXVQ0Q","Travis Vasceannie","01M718RGB0GWSXBBZBN67Q6NHQ",1,"MIT","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"type strictness","type","patterns","library","pyright","mypy","pyrefly","casting","libraries","reports","review","code","when","inspection","errors","fix","code review","remove","types","typing","2026-11-10 10:12:30",false,"---\nname: type-strictness\ndescription: |\n  Enforce strict type compliance by eliminating `Any` types and `# type: ignore` comments. Use when:\n  (1) Editing code that contains `Any` as a type annotation\n  (2) Code has `# type: ignore` or `# pyright: ignore` comments\n  (3) User requests type fixes or type strictness enforcement\n  (4) Importing from untyped third-party libraries\n  (5) User asks to \"fix types\", \"remove Any\", or \"add proper typing\"\n  (6) Pyrefly or mypy reports type errors that need resolution\n  (7) Code review reveals weak typing patterns\n  Follows hierarchical resolution: codebase inference → type stubs → library inspection → type guards → casting (last resort).\n---\n\n# Type Strictness\n\nEliminate `Any` types and type suppression comments through systematic resolution.\n\n## Core Principle\n\n**Never suppress type errors. Always fix them.**\n\nThe type system exists to catch bugs. Suppressing errors with `Any`, `# type: ignore`, or linter config changes defeats this purpose and hides real issues that will manifest as runtime bugs.\n\n## Resolution Hierarchy\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│  1. INFER FROM CODEBASE                                         │\n│     Search for existing type definitions, protocols, base       │\n│     classes. Use find_symbol, find_referencing_symbols.         │\n├─────────────────────────────────────────────────────────────────┤\n│  2. FIND TYPE STUBS                                             │\n│     Search PyPI for types-{package} or {package}-stubs.         │\n│     Check typeshed for stdlib\u002Fpopular package coverage.         │\n├─────────────────────────────────────────────────────────────────┤\n│  3. INSPECT LIBRARY SOURCE                                      │\n│     Read library source for method signatures, return types.    │\n│     Use site-packages inspection or GitHub source.              │\n├─────────────────────────────────────────────────────────────────┤\n│  4. TYPE GUARDS & NARROWING                                     │\n│     Use TypeGuard, isinstance, hasattr checks.                  │\n│     See references\u002Fresolution-patterns.md                       │\n├─────────────────────────────────────────────────────────────────┤\n│  5. CASTING (LAST RESORT)                                       │\n│     Only when all above fail and type is provably correct.      │\n│     Document why cast is necessary.                             │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Forbidden Patterns\n\n| Pattern | Why Forbidden | Action |\n|---------|---------------|--------|\n| `Any` | Disables type checking | Resolve through hierarchy |\n| `# type: ignore` | Hides real issues | Fix underlying error |\n| `# type: ignore[code]` | Still suppresses | Fix the specific issue |\n| `# pyright: ignore` | Same as above | Fix underlying error |\n| `# noqa` (for type errors) | Circumvents linting | Address the actual issue |\n| `object` as catch-all | Poor typing | Use Protocol or Union |\n| Modifying strictness config | Weakens entire codebase | Fix issues individually |\n| `cast(Any, x)` | Undermines type system | Use specific cast type |\n| `-> None  # type: ignore` | Lying about return | Fix return annotation |\n\n## Also Forbidden\n\n- Changing `strict = true` to `false` in pyproject.toml\n- Disabling specific pyright rules in config\n- Adding packages to mypy's `ignore_missing_imports`\n- Using `--no-strict-optional` or similar flags\n\n## Phase 1: Detect Issues\n\nRun type checker to identify issues:\n\n```bash\n# Pyrefly (preferred)\npyrefly check src\u002F --output-format json 2>\u002Fdev\u002Fnull | python3 -c \"\nimport sys, json\nd = json.load(sys.stdin)\nfor e in d.get('errors', []):\n    print(f\\\"{e['path']}:{e['line']}:{e['column']} [{e['severity']}] {e['name']} - {e['concise_description']}\\\")\n\"\n\n# Mypy alternative\nmypy src\u002F --show-error-codes 2>&1 | grep -E \"(Any|type: ignore)\"\n```\n\nSearch for violations:\n\n```bash\n# Find Any types\ngrep -rn \":\\s*Any\" --include=\"*.py\" src\u002F\ngrep -rn \"-> Any\" --include=\"*.py\" src\u002F\ngrep -rn \"list\\[Any\\]\" --include=\"*.py\" src\u002F\n\n# Find type ignores\ngrep -rn \"# type: ignore\" --include=\"*.py\" src\u002F\ngrep -rn \"# pyright: ignore\" --include=\"*.py\" src\u002F\n```\n\n## Phase 2: Resolve Types\n\n### Step 1: Codebase Inference\n\nSearch for existing definitions:\n\n```python\n# Find where the type is actually defined\nfind_symbol(name_path_pattern=\"ClassName\", include_body=True)\n\n# Find how it's used elsewhere (reveals expected type)\nfind_referencing_symbols(name_path=\"function_name\", relative_path=\"module.py\")\n\n# Search for protocol definitions\nsearch_for_pattern(\n    substring_pattern=\"class.*Protocol\",\n    paths_include_glob=\"**\u002Fdomain\u002F**\u002F*.py\"\n)\n```\n\n### Step 2: Find Type Stubs\n\nCommon stub packages:\n\n| Library | Stub Package |\n|---------|--------------|\n| requests | `types-requests` |\n| redis | `types-redis` |\n| PyYAML | `types-PyYAML` |\n| python-dateutil | `types-python-dateutil` |\n| Pillow | `types-Pillow` |\n| boto3 | `boto3-stubs` |\n| SQLAlchemy | Built-in (2.0+) |\n\nCheck availability:\n\n```bash\n# Search PyPI for stubs\npip index versions types-{package} 2>\u002Fdev\u002Fnull\npip index versions {package}-stubs 2>\u002Fdev\u002Fnull\n```\n\nFor complete list: See `references\u002Fcommon-stubs.md`\n\n### Step 3: Library Inspection\n\nInspect installed package:\n\n```bash\n# Find package location\npython3 -c \"import {package}; print({package}.__file__)\"\n\n# Read source for signatures\npython3 -c \"import {package}; help({package}.{function})\"\n```\n\n### Step 4: Type Guards & Narrowing\n\nSee `references\u002Fresolution-patterns.md` for:\n- TypeGuard functions\n- isinstance narrowing\n- hasattr checks\n- Protocol definitions\n- Overload patterns\n\n### Step 5: Casting (Last Resort)\n\nOnly if:\n- All resolution steps exhausted\n- Type is provably correct at runtime\n- Documented with justification\n\n```python\nfrom typing import cast\n\n# BAD: unexplained cast\nvalue = cast(str, unknown_value)\n\n# ACCEPTABLE: documented necessity\n# cast required: third-party lib returns untyped dict but structure is documented\nconfig = cast(dict[str, int], load_config())\n```\n\n## Tool Usage\n\n| Tool | Purpose |\n|------|---------|\n| `pyrefly check` \u002F `mypy` | Identify type errors |\n| `find_symbol` | Find existing type definitions |\n| `find_referencing_symbols` | Infer types from usage |\n| `search_for_pattern` | Find Protocol\u002FTypeVar patterns |\n| `pip index versions` | Check for type stubs |\n| `python -c \"help(...)\"` | Inspect library signatures |\n\n## Output Checklist\n\nAfter fixing, verify:\n\n- [ ] No `Any` types remain (except in unavoidable edge cases with documentation)\n- [ ] No `# type: ignore` comments\n- [ ] No `# pyright: ignore` comments\n- [ ] No linter config modifications that weaken type checking\n- [ ] Type checker passes: `pyrefly check src\u002F`\n- [ ] If cast used, justification comment present\n- [ ] Stubs installed for all third-party imports\n\n## Reference Documents\n\n| Reference | Contents |\n|-----------|----------|\n| `references\u002Ferror-code-fixes.md` | Pyrefly\u002FMypy error codes with specific fix strategies |\n| `references\u002Fresolution-patterns.md` | Advanced typing patterns: TypeGuard, Protocol, TypeVarTuple, Self, etc. |\n| `references\u002Fcommon-stubs.md` | Type stub packages for popular libraries |\n| `references\u002Fthird-party-typing.md` | Strategies for typing untyped library code |\n\n## Quick Decision Tree\n\n```\nGot a type error?\n│\n├─ Is it \"Unknown type\" or missing annotation?\n│  └─ Add explicit type annotation at source\n│\n├─ Is it from third-party library?\n│  ├─ Check for types-{pkg} stubs → Install\n│  ├─ Check for {pkg}-stubs → Install\n│  ├─ Library has py.typed? → Already typed, check version\n│  └─ No stubs? → Create local .pyi stub (see third-party-typing.md)\n│\n├─ Is it a return type mismatch?\n│  ├─ Function can return None? → Add `| None` to return type\n│  ├─ Missing return path? → Add the return statement\n│  └─ Wrong type returned? → Fix the return value\n│\n├─ Is it an argument type mismatch?\n│  ├─ Can widen parameter? → Use Union or Protocol\n│  ├─ Call site wrong? → Fix the call site\n│  └─ Need overloads? → Add @overload signatures\n│\n├─ Is it Optional\u002FNone access?\n│  ├─ Add None check before access\n│  ├─ Use early return pattern\n│  └─ Use walrus operator for assignment+check\n│\n└─ Complex dynamic type?\n   ├─ Create TypedDict for dict structures\n   ├─ Create Protocol for duck typing\n   ├─ Use TypeGuard for runtime checks\n   └─ See resolution-patterns.md for advanced patterns\n```\n\n## Common Scenarios\n\n### JSON Data\n\n```python\n# BAD\ndef parse(data: str) -> dict[str, Any]:\n    return json.loads(data)\n\n# GOOD\nclass UserData(TypedDict):\n    id: int\n    name: str\n\ndef parse(data: str) -> UserData:\n    result = json.loads(data)\n    # Validate structure\n    if not is_user_data(result):\n        raise ValueError(\"Invalid data\")\n    return result\n```\n\n### Callback Functions\n\n```python\n# BAD\ndef register(callback: Callable[..., Any]) -> None: ...\n\n# GOOD\nfrom typing import ParamSpec, TypeVar\nP = ParamSpec(\"P\")\nR = TypeVar(\"R\")\n\ndef register(callback: Callable[P, R]) -> Callable[P, R]: ...\n```\n\n### Dictionary Access\n\n```python\n# BAD\nconfig: dict[str, Any] = load_config()\ntimeout = config[\"timeout\"]  # Unknown type\n\n# GOOD\nclass Config(TypedDict):\n    timeout: int\n    retries: int\n\nconfig: Config = load_config()\ntimeout = config[\"timeout\"]  # int\n```\n\n### Optional Chaining\n\n```python\n# BAD (suppresses error)\nuser: User | None = get_user()\nname = user.name  # type: ignore\n\n# GOOD\nuser: User | None = get_user()\nif user is not None:\n    name = user.name\n# OR\nname = user.name if user else \"Unknown\"\n```\n\n## Modern Python Features (3.10+)\n\nPrefer modern syntax for cleaner types:\n\n| Old Style | Modern Style |\n|-----------|--------------|\n| `Optional[str]` | `str \\| None` |\n| `Union[int, str]` | `int \\| str` |\n| `List[str]` | `list[str]` |\n| `Dict[str, int]` | `dict[str, int]` |\n| `Tuple[int, ...]` | `tuple[int, ...]` |\n| `Type[T]` | `type[T]` |\n\n## When You're Truly Stuck\n\nIf after exhausting all options a type truly cannot be resolved:\n\n1. **Isolate it**: Create a wrapper function\u002Fmodule that contains the untyped code\n2. **Document it**: Add a detailed comment explaining why typing isn't possible\n3. **Minimize scope**: Use the most specific type possible, not `Any`\n4. **Open an issue**: If it's a library bug, report it upstream\n\nExample of acceptable containment:\n\n```python\n# _untyped_wrappers.py\n\"\"\"Wrappers for genuinely untyped library code.\n\nEach wrapper isolates untyped library calls and provides typed interfaces.\nDocument why each is necessary.\n\"\"\"\n\ndef get_legacy_config() -> dict[str, str]:\n    \"\"\"Wrap legacy_lib.config() which has no types and no stubs.\n\n    Library is unmaintained (last update 2019) and we're migrating away.\n    The return type is validated at runtime.\n    \"\"\"\n    from legacy_lib import config  # Untyped import contained here\n    result = config()\n    if not isinstance(result, dict):\n        raise TypeError(\"Unexpected config type\")\n    return {str(k): str(v) for k, v in result.items()}\n```\n","# Type Strictness\n\nEliminate `Any` types and type suppression comments through systematic resolution.\n\n## Core Principle\n\n**Never suppress type errors. Always fix them.**\n\nThe type system exists to catch bugs. Suppressing errors with `Any`, `# type: ignore`, or linter config changes defeats this purpose and hides real issues that will manifest as runtime bugs.\n\n## Resolution Hierarchy\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│  1. INFER FROM CODEBASE                                         │\n│     Search for existing type definitions, protocols, base       │\n│     classes. Use find_symbol, find_referencing_symbols.         │\n├─────────────────────────────────────────────────────────────────┤\n│  2. FIND TYPE STUBS                                             │\n│     Search PyPI for types-{package} or {package}-stubs.         │\n│     Check typeshed for stdlib\u002Fpopular package coverage.         │\n├─────────────────────────────────────────────────────────────────┤\n│  3. INSPECT LIBRARY SOURCE                                      │\n│     Read library source for method signatures, return types.    │\n│     Use site-packages inspection or GitHub source.              │\n├─────────────────────────────────────────────────────────────────┤\n│  4. TYPE GUARDS & NARROWING                                     │\n│     Use TypeGuard, isinstance, hasattr checks.                  │\n│     See references\u002Fresolution-patterns.md                       │\n├─────────────────────────────────────────────────────────────────┤\n│  5. CASTING (LAST RESORT)                                       │\n│     Only when all above fail and type is provably correct.      │\n│     Document why cast is necessary.                             │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Forbidden Patterns\n\n| Pattern | Why Forbidden | Action |\n|---------|---------------|--------|\n| `Any` | Disables type checking | Resolve through hierarchy |\n| `# type: ignore` | Hides real issues | Fix underlying error |\n| `# type: ignore[code]` | Still suppresses | Fix the specific issue |\n| `# pyright: ignore` | Same as above | Fix underlying error |\n| `# noqa` (for type errors) | Circumvents linting | Address the actual issue |\n| `object` as catch-all | Poor typing | Use Protocol or Union |\n| Modifying strictness config | Weakens entire codebase | Fix issues individually |\n| `cast(Any, x)` | Undermines type system | Use specific cast type |\n| `-> None  # type: ignore` | Lying about return | Fix return annotation |\n\n## Also Forbidden\n\n- Changing `strict = true` to `false` in pyproject.toml\n- Disabling specific pyright rules in config\n- Adding packages to mypy's `ignore_missing_imports`\n- Using `--no-strict-optional` or similar flags\n\n## Phase 1: Detect Issues\n\nRun type checker to identify issues:\n\n```bash\n# Pyrefly (preferred)\npyrefly check src\u002F --output-format json 2>\u002Fdev\u002Fnull | python3 -c \"\nimport sys, json\nd = json.load(sys.stdin)\nfor e in d.get('errors', []):\n    print(f\\\"{e['path']}:{e['line']}:{e['column']} [{e['severity']}] {e['name']} - {e['concise_description']}\\\")\n\"\n\n# Mypy alternative\nmypy src\u002F --show-error-codes 2>&1 | grep -E \"(Any|type: ignore)\"\n```\n\nSearch for violations:\n\n```bash\n# Find Any types\ngrep -rn \":\\s*Any\" --include=\"*.py\" src\u002F\ngrep -rn \"-> Any\" --include=\"*.py\" src\u002F\ngrep -rn \"list\\[Any\\]\" --include=\"*.py\" src\u002F\n\n# Find type ignores\ngrep -rn \"# type: ignore\" --include=\"*.py\" src\u002F\ngrep -rn \"# pyright: ignore\" --include=\"*.py\" src\u002F\n```\n\n## Phase 2: Resolve Types\n\n### Step 1: Codebase Inference\n\nSearch for existing definitions:\n\n```python\n# Find where the type is actually defined\nfind_symbol(name_path_pattern=\"ClassName\", include_body=True)\n\n# Find how it's used elsewhere (reveals expected type)\nfind_referencing_symbols(name_path=\"function_name\", relative_path=\"module.py\")\n\n# Search for protocol definitions\nsearch_for_pattern(\n    substring_pattern=\"class.*Protocol\",\n    paths_include_glob=\"**\u002Fdomain\u002F**\u002F*.py\"\n)\n```\n\n### Step 2: Find Type Stubs\n\nCommon stub packages:\n\n| Library | Stub Package |\n|---------|--------------|\n| requests | `types-requests` |\n| redis | `types-redis` |\n| PyYAML | `types-PyYAML` |\n| python-dateutil | `types-python-dateutil` |\n| Pillow | `types-Pillow` |\n| boto3 | `boto3-stubs` |\n| SQLAlchemy | Built-in (2.0+) |\n\nCheck availability:\n\n```bash\n# Search PyPI for stubs\npip index versions types-{package} 2>\u002Fdev\u002Fnull\npip index versions {package}-stubs 2>\u002Fdev\u002Fnull\n```\n\nFor complete list: See `references\u002Fcommon-stubs.md`\n\n### Step 3: Library Inspection\n\nInspect installed package:\n\n```bash\n# Find package location\npython3 -c \"import {package}; print({package}.__file__)\"\n\n# Read source for signatures\npython3 -c \"import {package}; help({package}.{function})\"\n```\n\n### Step 4: Type Guards & Narrowing\n\nSee `references\u002Fresolution-patterns.md` for:\n- TypeGuard functions\n- isinstance narrowing\n- hasattr checks\n- Protocol definitions\n- Overload patterns\n\n### Step 5: Casting (Last Resort)\n\nOnly if:\n- All resolution steps exhausted\n- Type is provably correct at runtime\n- Documented with justification\n\n```python\nfrom typing import cast\n\n# BAD: unexplained cast\nvalue = cast(str, unknown_value)\n\n# ACCEPTABLE: documented necessity\n# cast required: third-party lib returns untyped dict but structure is documented\nconfig = cast(dict[str, int], load_config())\n```\n\n## Tool Usage\n\n| Tool | Purpose |\n|------|---------|\n| `pyrefly check` \u002F `mypy` | Identify type errors |\n| `find_symbol` | Find existing type definitions |\n| `find_referencing_symbols` | Infer types from usage |\n| `search_for_pattern` | Find Protocol\u002FTypeVar patterns |\n| `pip index versions` | Check for type stubs |\n| `python -c \"help(...)\"` | Inspect library signatures |\n\n## Output Checklist\n\nAfter fixing, verify:\n\n- [ ] No `Any` types remain (except in unavoidable edge cases with documentation)\n- [ ] No `# type: ignore` comments\n- [ ] No `# pyright: ignore` comments\n- [ ] No linter config modifications that weaken type checking\n- [ ] Type checker passes: `pyrefly check src\u002F`\n- [ ] If cast used, justification comment present\n- [ ] Stubs installed for all third-party imports\n\n## Reference Documents\n\n| Reference | Contents |\n|-----------|----------|\n| `references\u002Ferror-code-fixes.md` | Pyrefly\u002FMypy error codes with specific fix strategies |\n| `references\u002Fresolution-patterns.md` | Advanced typing patterns: TypeGuard, Protocol, TypeVarTuple, Self, etc. |\n| `references\u002Fcommon-stubs.md` | Type stub packages for popular libraries |\n| `references\u002Fthird-party-typing.md` | Strategies for typing untyped library code |\n\n## Quick Decision Tree\n\n```\nGot a type error?\n│\n├─ Is it \"Unknown type\" or missing annotation?\n│  └─ Add explicit type annotation at source\n│\n├─ Is it from third-party library?\n│  ├─ Check for types-{pkg} stubs → Install\n│  ├─ Check for {pkg}-stubs → Install\n│  ├─ Library has py.typed? → Already typed, check version\n│  └─ No stubs? → Create local .pyi stub (see third-party-typing.md)\n│\n├─ Is it a return type mismatch?\n│  ├─ Function can return None? → Add `| None` to return type\n│  ├─ Missing return path? → Add the return statement\n│  └─ Wrong type returned? → Fix the return value\n│\n├─ Is it an argument type mismatch?\n│  ├─ Can widen parameter? → Use Union or Protocol\n│  ├─ Call site wrong? → Fix the call site\n│  └─ Need overloads? → Add @overload signatures\n│\n├─ Is it Optional\u002FNone access?\n│  ├─ Add None check before access\n│  ├─ Use early return pattern\n│  └─ Use walrus operator for assignment+check\n│\n└─ Complex dynamic type?\n   ├─ Create TypedDict for dict structures\n   ├─ Create Protocol for duck typing\n   ├─ Use TypeGuard for runtime checks\n   └─ See resolution-patterns.md for advanced patterns\n```\n\n## Common Scenarios\n\n### JSON Data\n\n```python\n# BAD\ndef parse(data: str) -> dict[str, Any]:\n    return json.loads(data)\n\n# GOOD\nclass UserData(TypedDict):\n    id: int\n    name: str\n\ndef parse(data: str) -> UserData:\n    result = json.loads(data)\n    # Validate structure\n    if not is_user_data(result):\n        raise ValueError(\"Invalid data\")\n    return result\n```\n\n### Callback Functions\n\n```python\n# BAD\ndef register(callback: Callable[..., Any]) -> None: ...\n\n# GOOD\nfrom typing import ParamSpec, TypeVar\nP = ParamSpec(\"P\")\nR = TypeVar(\"R\")\n\ndef register(callback: Callable[P, R]) -> Callable[P, R]: ...\n```\n\n### Dictionary Access\n\n```python\n# BAD\nconfig: dict[str, Any] = load_config()\ntimeout = config[\"timeout\"]  # Unknown type\n\n# GOOD\nclass Config(TypedDict):\n    timeout: int\n    retries: int\n\nconfig: Config = load_config()\ntimeout = config[\"timeout\"]  # int\n```\n\n### Optional Chaining\n\n```python\n# BAD (suppresses error)\nuser: User | None = get_user()\nname = user.name  # type: ignore\n\n# GOOD\nuser: User | None = get_user()\nif user is not None:\n    name = user.name\n# OR\nname = user.name if user else \"Unknown\"\n```\n\n## Modern Python Features (3.10+)\n\nPrefer modern syntax for cleaner types:\n\n| Old Style | Modern Style |\n|-----------|--------------|\n| `Optional[str]` | `str \\| None` |\n| `Union[int, str]` | `int \\| str` |\n| `List[str]` | `list[str]` |\n| `Dict[str, int]` | `dict[str, int]` |\n| `Tuple[int, ...]` | `tuple[int, ...]` |\n| `Type[T]` | `type[T]` |\n\n## When You're Truly Stuck\n\nIf after exhausting all options a type truly cannot be resolved:\n\n1. **Isolate it**: Create a wrapper function\u002Fmodule that contains the untyped code\n2. **Document it**: Add a detailed comment explaining why typing isn't possible\n3. **Minimize scope**: Use the most specific type possible, not `Any`\n4. **Open an issue**: If it's a library bug, report it upstream\n\nExample of acceptable containment:\n\n```python\n# _untyped_wrappers.py\n\"\"\"Wrappers for genuinely untyped library code.\n\nEach wrapper isolates untyped library calls and provides typed interfaces.\nDocument why each is necessary.\n\"\"\"\n\ndef get_legacy_config() -> dict[str, str]:\n    \"\"\"Wrap legacy_lib.config() which has no types and no stubs.\n\n    Library is unmaintained (last update 2019) and we're migrating away.\n    The return type is validated at runtime.\n    \"\"\"\n    from legacy_lib import config  # Untyped import contained here\n    result = config()\n    if not isinstance(result, dict):\n        raise TypeError(\"Unexpected config type\")\n    return {str(k): str(v) for k, v in result.items()}\n```\n",{"name":5,"description":7},"master","5fab8004af1390aa17b3447f2780766c8bf2482c","bundle\u002Fshared\u002Fskills\u002Ftype-strictness",0,"https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate","https:\u002F\u002Fgithub.com\u002Fvasceannie","thingswithstuff.io","2026-11-12 20:22:46",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add vasceannie\u002Fslopgate --skill type-strictness",{"tool":63,"command":64},"bunx","bunx skills add vasceannie\u002Fslopgate --skill type-strictness",{"tool":66,"command":67},"pnpm","pnpm dlx skills add vasceannie\u002Fslopgate --skill type-strictness","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002FSKILL.md",true,[71,77,81,85],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fcommon-stubs.md","REFERENCE","参考文档",3436,"https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002Freferences\u002Fcommon-stubs.md",{"path":78,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Ferror-code-fixes.md",8028,"https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002Freferences\u002Ferror-code-fixes.md",{"path":82,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fresolution-patterns.md",12225,"https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002Freferences\u002Fresolution-patterns.md",{"path":86,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fthird-party-typing.md",12445,"https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Ftype-strictness\u002Freferences\u002Fthird-party-typing.md",[90,117,154,179,200,217],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":100,"publishedAt":44},"01M7194XGBQXSE7Y5BZ4K5CSTK","slopgate-test-extender","Extend Python test suites with parametrization, fixture reuse, and quality enforcement. Use when asked to add tests, extend existing tests, improve test coverage, consolidate duplicate tests, fix test quality issues, or when Slopgate reports untested-production-code, missing test references, or coverage gaps. Triggers on requests like \"add tests for X\", \"extend these tests\", \"parametrize tests\", \"consolidate tests\", \"fix test quality\", \"improve test coverage\", \"write tests for this function\", \"test this module\", \"behavior tests\", \"integration tests\", \"missing tests\", \"coverage holes\", \"untested code\", or when a hook denies with test-related findings.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Fslopgate-test-extender\u002FSKILL.md",[96,97],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":98,"categoryName":99,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",[101,102,103,104,105,39,106,107,108,109,110,111,36,35,112,113,33,114,115,116],"slopgate test extender","test","coverage","fixture","testing","issues","write tests","improve","only","cleanup","loop","candidate","consolidate","references","opencode","orchestrator",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":138,"publishedAt":44},"01M7194RMVQS5YJJ4ZEFXX20VS","slopgate-intelligent-coding-patterns","Pattern-selection playbook for agents editing code with complex branching, stateful parsers\u002Fworkflows, duplicated skeletons, policy checks, or ordered transforms. Load before refactoring if\u002Felif dispatch chains, boolean-flag state machines, repeated validation predicates, parallel provider\u002Flanguage implementations, or regex\u002Fcontent transformation pipelines. Also load when asked to \"apply a design pattern\", \"which pattern should I use here\", \"refactor this switch statement\", \"replace if-elif chain\", \"state machine pattern\", \"strategy pattern\", \"template method\", \"pipeline pattern\", \"specification pattern\", \"dispatch table\", \"guard clause refactor\", \"reduce cyclomatic complexity\", or when Slopgate fires PY-CODE-014, PY-CODE-017, PY-CODE-018, QUALITY-LINT-001, or PY-QUALITY-010. Use with behavior-locking tests and avoid pattern theater for simple one-off code.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Fslopgate-intelligent-coding-patterns\u002FSKILL.md",[123,124,127,130,135],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":136,"categoryName":137,"taxonomyType":133,"taxonomyTypeDesc":134},"01JBSEEDCAT000000000000032","设计师",[139,140,26,141,142,143,144,145,146,147,148,149,150,109,110,151,152,36,153,35],"coding patterns","slopgate intelligent coding patterns","coding","stateful","complexity","branch","which","chain","parsers","pipeline","selection","design","utility","workflows","reduce",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":162,"publishedAt":44},"01M7194KTXBM85GB0W7JKFQD55","slopgate-hygiene-orchestrator","Orchestrate systematic elimination of linter warnings and errors across Python, TypeScript, and Rust codebases. Use when asked to \"clean up lints\", \"fix all warnings\", \"run hygiene\", \"eliminate type errors\", \"orchestrate code quality fixes\", \"fix lint errors\", \"resolve quality gate failures\", \"pass CI checks\", \"reduce tech debt\", \"refactor to pass hooks\", or when a Slopgate hook denies with QUALITY-LINT-001, PY-CODE-017, PY-CODE-018, or any collector finding. This skill coordinates multiple code-hygiene-enforcer agents working in parallel on non-conflicting file groupings, tracks progress persistently via JSON exports, and loops until all issues are resolved. CRITICAL: Never run linters directly—always use `slopgate lint check` as the primary gate, discover project-specific tools from config files, and export findings to JSON for tracking.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Fslopgate-hygiene-orchestrator\u002FSKILL.md",[160,161],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},[163,164,116,165,39,166,167,168,169,170,110,153,171,172,173,174,175,176,177,178],"slopgate hygiene orchestrator","hygiene","project","ci","local","clean","never run","files","run","lint check","systematic","config","typescript","debt","quality-gates","hook",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":187,"publishedAt":44},"01M7194G50FZYXXT8VNK360RPA","slopgate-code-smell-utility-locator","Autoactivate when code-smell hooks or reviews mention feature envy, thin wrappers, duplicate helpers, duplicate code,\nscattered helpers, builders\u002Ffactories\u002Fconfig\u002Fconstants\u002Fdataclass reuse, PY-CODE-012, PY-CODE-013, QUALITY-LINT-001,\nor repeated slopgate code-quality denials. Also load when asked to \"find existing helpers\", \"consolidate utilities\",\n\"search for duplicate code\", \"where is this already implemented\", \"reuse existing logic\", \"don't duplicate this\",\n\"find similar functions\", \"utility inventory\", \"code smell radar\", or before adding new helpers\u002Fwrappers so agents can\nfind existing shared utilities and consolidate instead of duplicating.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Fslopgate-code-smell-utility-locator\u002FSKILL.md",[185,186],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},[151,188,35,189,103,190,191,192,193,109,194,36,195,113,115,196,197,174,198,199],"slopgate code smell utility locator","shared","reviews","inventory","search","hooks","new","coordination","radar","code-quality","Utilities","dataclass",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":208,"publishedAt":44},"01M7194AWG1Q37F9756H4SFDH9","slopgate-code-hygiene-refactor","Recovery playbook for Slopgate and project quality failures. Load after hook\u002Flint denials such as PY-CODE-017 flat sibling modules, PY-CODE-018 oversized modules, QUALITY-LINT-001 post-edit quality backstops, PY-QUALITY-010 magic numbers \u002F repeated literals, PY-CODE-012\u002FPY-CODE-013 smell findings, type-suppression bans, duplicate helpers, or repeated hygiene retry loops. Also load when asked to \"refactor this module\", \"split this file\", \"extract a class\", \"reduce complexity\", \"fix god class\", \"flatten module hierarchy\", \"move code to a package\", \"extract helpers\", \"consolidate duplicates\", \"replace magic numbers with constants\", or when a hook blocks an edit with structural complaints. Focuses on preserving public APIs while refactoring toward packages, cohesive modules, typed seams, and focused tests.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Fslopgate-code-hygiene-refactor\u002FSKILL.md",[206,207],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},[209,210,35,211,164,212,143,213,214,165,215,191,216,39,109,151,36,153,195,113],"code hygiene","slopgate code hygiene refactor","refactor","modules","duplicates","retry","move","structural",{"skillNo":218,"name":219,"nameZh":6,"description":220,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":221,"categories":222,"keywords":223,"publishedAt":44},"01M719488FDQ2J2TKHZPDHXH5F","rtk-cli","Use when running shell commands in agent sessions to cut Bash output tokens, or when the user asks to install\u002Fconfigure RTK, reduce context from git\u002Ftest\u002Flint commands, or use rtk git\u002Frg\u002Fcargo wrappers. Triggers on \"rtk\", \"token savings\", \"compact git status\", or heavy command output eating context.","https:\u002F\u002Fgithub.com\u002Fvasceannie\u002Fslopgate\u002Fblob\u002Fmaster\u002Fbundle\u002Fshared\u002Fskills\u002Frtk-cli\u002FSKILL.md",[],[224,225,226,227,228,229,230,231,232,233,234,36,153,235,236,237,238,102,239,240],"rtk cli","cli","rtk","running","cargo","tokens","sessions","triggers","use","compact","rg","configure","Bash","lint","output","command","shell"]