---
name: block-type-ignore
enabled: true
event: file
action: block
conditions:
  - field: file_path
    operator: regex_match
    pattern: \.(py|pyi)$
  - field: new_text
    operator: regex_match
    pattern: (#\s*type:\s*ignore|#\s*pyright:\s*ignore|#\s*noqa:\s*(PGH003|PYI|ANN|TC)|#\s*pyre-ignore|#\s*pyre-fixme|#\s*pyrefly:\s*ignore|#\s*basedpyright:\s*ignore)
---

🚫 **BLOCKED: Type Suppression Comment Detected**

You are attempting to add a type suppression comment, which is **strictly forbidden** in this codebase.

## Blocked Patterns

| Tool | Blocked Pattern |
|------|-----------------|
| **Python/mypy** | `# type: ignore` |
| **Basedpyright** | `# pyright: ignore`, `# basedpyright: ignore` |
| **Ruff** | `# noqa: PGH003`, `# noqa: PYI*`, `# noqa: ANN*`, `# noqa: TC*` |
| **Pyre/Pyrefly** | `# pyre-ignore`, `# pyre-fixme`, `# pyrefly: ignore` |

## Why Type Suppressions Are Forbidden

- Suppressing type errors hides real bugs
- It creates technical debt that compounds over time
- It bypasses the safety net that type checking provides
- Future developers lose context on why the suppression was added

## What to Do Instead

1. **Fix the actual type error** - usually by adding proper annotations
2. **Use explicit type narrowing** - `isinstance()`, `assert`, `TypeGuard`
3. **Refactor the code** - sometimes the type error reveals a design issue
4. **Use `cast()`** - only as a last resort with a comment explaining why

## Need Help?

Run the **`/type-strictness`** skill to get guidance on fixing the underlying type issue:

```
/type-strictness
```

This skill will analyze the type error and suggest the proper fix instead of suppression.
