Add type hints to an untyped Python module and verify the result with mypy --strict on that module without weakening project-level config.
Adds type hints to a previously-untyped Python module, then proves the module passes mypy --strict without changing the project-wide mypy configuration. Each function and method gains parameter and return annotations; module-level constants gain Final annotations.
module_path: path to a .py file or a package directory.repo_dir: project root containing pyproject.toml or mypy.ini.monkeytype_db: path to a MonkeyType SQLite db with runtime traces, used for hint inference.python -c "import ast; ast.parse(open('<module_path>').read())" to confirm the file parses.monkeytype_db is provided, run monkeytype apply <module-import-path> to seed coarse hints from runtime traces.def f(x=0) -> x: int, def g(items=()) -> items: tuple[Any, ...], return None if the body has no return with a value.from typing import List, Dict, Tuple with builtin generics (list, dict, tuple) for Python >= 3.9.from __future__ import annotations at the top so forward references work without quoting.Final: MAX_RETRIES: Final[int] = 3.self only if it's a generic-bound (Self from typing); otherwise omit.mypy --strict <module_path> from repo_dir and capture errors.# type: ignore unless the error is a known third-party stub gap, in which case add a comment with the issue link.The original module_path with annotations added in place. A sibling mypy-strict-report.md listing the count of annotations added, the count of # type: ignore exits taken (each with a reason), and the final mypy command output.
Run mypy --strict <module_path> from a clean shell and confirm exit 0 plus zero errors. Run the project's existing test suite (pytest <tests-for-module>) and confirm pass/fail counts match the pre-migration baseline. Diff the file with git diff --stat to confirm only annotations and imports changed; any logic edits are out of scope and must be reverted.
getattr(obj, name)): annotate with Any and note in the report; refactoring is out of scope.functools.wraps is fine, but click.command mutates types): use cast at the call site if mypy complains.pip install types-<lib>) or add [[tool.mypy.overrides]] ignore in a separate PR — do not weaken project config in this skill's scope.from x import *): refuse to type-hint; ask the maintainer to convert to explicit imports first.Other publishers' experience with this skill. Self-rating is blocked.
Ratings are limited to publishers while the registry is small — sign in and publish a public skill to rate.
No ratings yet. Be the first.
Same domains or capabilities as amitte/python-type-hints-backfiller.
Headless browser helper — capture_screenshot, capture_element (read-only) plus a guarded run_js that only executes allowlisted snippet ids.
Read-only RubyGems helper — search_gems, get_gem_info, list_versions. Surface for Ruby dependency discovery from an agent.
Read-only crates.io helper — search_crates, get_crate_info, list_versions. Surface for Rust dependency discovery from an agent.
Group a list of commit subjects into Keep-a-Changelog sections (Added, Changed, Fixed, Removed) using Conventional Commits prefixes and content heuristics.
Cross-CI status surface — get_workflow_status, list_runs, get_job_logs across GitHub Actions, CircleCI, and Buildkite. Read-only.
Build a one-page cheatsheet for a CLI tool's 80% case by parsing the output of tool --help and grouping flags by intent.