ワンクリックで
qa-check
// Run linting and unit tests against the current repository, auto-discovering the correct commands from Justfile, Makefile, pyproject.toml, or package.json.
// Run linting and unit tests against the current repository, auto-discovering the correct commands from Justfile, Makefile, pyproject.toml, or package.json.
Use when AI-generated or AI-modified changes need a Code Health gate before commit, handoff, or pull request.
Create a conventional commit from staged changes, with a diff-derived description body.
Reliably obtain a non-empty unified git diff for the current branch using safe fallbacks (origin/HEAD...HEAD, origin/main...HEAD, origin/master...HEAD) and return structured JSON containing the diff and the command used.
Produce an implementation plan with a functional-leaning, idiomatic style mindset; prefers lightweight data structures over dataclasses/pydantic unless justified.
Coding style policy for generated code: prefer idiomatic language conventions with a functional-leaning approach (pure-ish functions, composability), and prefer lightweight data structures over heavy schema/class abstractions unless clearly justified.
| name | qa-check |
| description | Run linting and unit tests against the current repository, auto-discovering the correct commands from Justfile, Makefile, pyproject.toml, or package.json. |
Verify code quality after changes by running linting and unit tests. This skill discovers the correct commands for the current repository automatically, so it works across different project setups and languages.
This skill MUST be used after an agent produces or modifies code.
Follow these steps strictly and in order.
Run:
git rev-parse --show-toplevel
Capture the output as REPO_ROOT. All subsequent file lookups and commands
use REPO_ROOT as the working directory.
Check for project manifest files in REPO_ROOT:
If pyproject.toml, setup.py, or setup.cfg exists → project type is Python.
Else if package.json exists → project type is JS/TS.
Else → unknown. Report:
"Unable to determine project type. Skipping QA checks."
and stop — do not continue to subsequent steps.
Check for a virtual environment in this order:
REPO_ROOT/.venv/bin/activateREPO_ROOT/venv/bin/activateIf found, prefix every shell command in subsequent steps with:
source REPO_ROOT/.venv/bin/activate &&
(using the path that was found).
This ensures that just, make, and direct tool invocations all run
inside the activated virtual environment.
If no virtual environment is found, run commands without a prefix.
No environment activation is needed. Commands will use the package manager detected from the project:
REPO_ROOT/pnpm-lock.yaml exists → use pnpm.REPO_ROOT/yarn.lock exists → use yarn.Capture the chosen package manager as PM for use in later steps.
Try each source below in order. Stop at the first match.
Check if REPO_ROOT/justfile or REPO_ROOT/Justfile exists.
If it does, look for a recipe named lint (a line starting with lint
followed by : or arguments).
If found, the lint command is:
just lint
Check if REPO_ROOT/Makefile exists.
If it does, look for a target named lint (a line starting with lint:).
If found, the lint command is:
make lint
Python — inspect pyproject.toml:
[tool.ruff] section → command: ruff check .[tool.flake8] or a flake8 dependency → command: flake8[tool.pylint] section or a pylint dependency → command: pylintJS/TS — inspect the scripts object in package.json:
lint script exists → command: PM run lint
(where PM is the package manager from Step 3).If none of the above matched, report:
"No lint command found. Skipping linting."
and continue to Step 6.
Execute the lint command discovered in Step 4 from REPO_ROOT,
using the environment setup from Step 3.
Do not auto-fix lint errors. Report them and continue to Step 6.
Try each source below in order. Stop at the first match.
Check the Justfile for a recipe named test or unit-test
(a line starting with test or unit-test followed by : or arguments).
If found, the test command is:
just unit-test
or just test (prefer unit-test if both exist, to avoid
accidentally running integration tests).
Check the Makefile for a target named test or unit-test.
If found, the test command is:
make unit-test
or make test (prefer unit-test if both exist).
Python — inspect pyproject.toml:
[tool.pytest] or [tool.pytest.ini_options] section, or a
pytest dependency → runner is pytest.Exclude integration tests with these heuristics:
tests/unit or tests/unit_tests directory exists, target it
directly: pytest tests/unit (or equivalent path).pytest -m "not integration" or pytest --ignore=tests/integration.integration directory or tests/integration directory exists,
use --ignore to skip it.JS/TS — inspect the scripts object in package.json:
test:unit script exists → command: PM run test:unittest script exists → command: PM run test
(prefer test:unit if both exist, to avoid integration tests).Where PM is the package manager from Step 3.
If none of the above matched, report:
"No unit test command found. Skipping tests."
and continue to Step 8.
Execute the test command discovered in Step 6 from REPO_ROOT,
using the environment setup from Step 3.
Present a short summary:
| Check | Result |
|---|---|
| Lint | ✅ / ❌ / ⏭️ skipped |
| Unit tests | ✅ / ❌ / ⏭️ skipped |
If either check failed, advise the user to review the errors before committing.
unit-test over test,
test:unit over test) to avoid accidentally running integration suites.REPO_ROOT.just and make targets.pnpm, yarn,
or npm) consistently.