npx skills add ...
npx skills add microsoft/agent-framework --skill python-code-quality
npx skills add microsoft/agent-framework --skill python-code-quality
Code quality checks, linting, formatting, and type checking commands for the Agent Framework Python codebase. Use this when running checks, fixing lint errors, or troubleshooting CI failures.
All commands run from the python/ directory:
Prek hooks run automatically on commit. They stay lightweight and only check changed files.
They run changed-package syntax formatting/checking, markdown code lint only
when markdown files change, and sample syntax lint/pyright only when files
under samples/ change.
They intentionally do not run workspace pyright or mypy by default.
Following the "too many type checkers" approach, type checkers are split by target:
| Target | Checker(s) | Mode | Config |
|---|---|---|---|
Source (agent_framework*) | pyright | strict | [tool.pyright] in pyproject.toml |
| Tests | pyright, mypy, pyrefly, ty, zuban | relaxed/basic | pyrightconfig.tests.json, [tool.mypy], pyrefly.toml, ty rules |
| Samples | pyright, pyrefly, ty | basic | pyrightconfig.samples.json, pyrefly.samples.toml, ty.samples.toml |
basic profile over the tests and samples (so the surfaces customers copy from are
validated by every checker, including pyright). MyPy was removed from source; its
[tool.mypy] block is now a relaxed profile used only for tests/samples.pyright, mypy, pyrefly, ty, and zuban — all five run by
default and gate CI. zuban is the strictest of the mypy-compatible pair, so the same
[tool.mypy] config yields more findings; suppress zuban-only friction with shared
# type: ignore[code]. Suppress relaxed-pyright friction with # pyright: ignore[rule].pyright to pyrefly + ty — mypy/zuban can't resolve script-style
sample layouts (numeric-prefixed dirs, duplicate main.py), but pyright handles them.[tool.pyright]) enforces reportUnnecessaryTypeIgnoreComment
and excludes tests/samples; the relaxed test/sample pyright configs do not flag unnecessary
ignores.[tool.pyright]), reportUnnecessaryTypeIgnoreComment = "error",
excludes tests, samples, .venv, packages/devui/frontend.basic profile (pyrightconfig.tests.json) — private import/usage and
not-required TypedDict access allowed; runs as the pyright checker in test-typing.basic profile (pyrightconfig.samples.json, with a py310 variant) —
runs as the pyright checker in test-typing -S.The task runner (scripts/task_runner.py) executes the cross-product of
(package × task) in parallel using ThreadPoolExecutor. Single items run
in-process with streaming output.
CI splits into 4 parallel jobs:
check -S plus markdown-code-lintci-test-typing)# Install hooks
uv run poe prek-install
# Run all hooks manually
uv run prek run -a
# Run on last commit
uv run prek run --last-commit