| name | StreamFlow Mypy Type Checking |
| description | This skill should be used when the user asks to "fix mypy errors", "add type annotations", "fix type checking", "resolve no-untyped-def", "fix mypy type errors", or when working with type hints while respecting StreamFlow's forbidden type constraints (no Any, dict[str, Any], etc.). |
| version | 0.1.0 |
StreamFlow Mypy Type Checking Skill
Core Constraint
See AGENTS.md for the authoritative forbidden types list. If a fix requires a forbidden type, DO NOT FIX IT. Skip the error entirely.
Sub-Skills
| Error code | Description | Sub-skill |
|---|
[no-untyped-def] | Function missing type annotations | StreamFlow Mypy no-untyped-def Fixer skill |
[var-annotated] | Variable missing type annotation | StreamFlow Mypy var-annotated Fixer skill |
General Workflow
- Classify: Can the fix use concrete types only? If NO → skip entirely
- Fix: Add annotations (see sub-skill for patterns)
- Validate — must return no output:
git diff | grep -E "Any\b|MutableMapping\[.*Any|MutableSequence\[.*Any|list\[Any|dict\[.*Any"
- Quality check — must pass:
uv run make format-check codespell-check typing
- Commit: Load the StreamFlow Git Workflow skill
Allowed Types Quick Reference
- Primitives:
None, bool, int, str, float, bytes
- Concrete classes:
Workflow, Connector, Port, Token, etc.
- Unions:
str | None, int | bool
- Generics:
list[str], dict[str, int], set[Token]
- Special:
Self, type[MyClass], Literal["a", "b"]
Prefer Literal over str/int for fixed value sets (statuses, connector types, mode flags).
Broad arguments, narrow returns: parameters use abstract types (Iterable, Sequence, Mapping); return types use concrete types (list, dict, set).
Annotation Patterns
def process(self, workflow: Workflow, config: WorkflowConfig) -> bool: ...
@classmethod
async def load(cls, persistent_id: int) -> Self: ...
def get(self, name: str) -> Connector | None: ...
async def close(self) -> None: ...
When in doubt, skip it. Better to leave an error than violate the forbidden types constraint.
See Also
- AGENTS.md — Forbidden types list, mandatory rules
- StreamFlow Git Workflow skill — Commit message format and approval workflow
- StreamFlow Code Style skill — Code style guidelines