Keep the repository root clean when working on pytest, temp files, caches, or local artifacts. Use when tests create tmp* folders, .pytest* directories, repo-local caches, or when changing test fixtures or temp-path behavior.
Use this skill to prevent temporary files, pytest artifacts, and machine-local caches from leaking into the repository root.
This repository's preferred pattern:
tmp_path fixtures provided by pytest (not TemporaryDirectory(dir=Path.cwd()))git clean -fdx --dry-run first, then manuallyIf a change touches pytest behavior, temp directories, or cache locations, follow this skill before adding more ignore rules.
Use this skill when:
git status shows tmp*, .pytest*, __pycache__, or .tmp/ clutter in the rootTemporaryDirectory(dir=Path.cwd()) or another path that writes into the repo rootDo not use this skill for general cleanup unrelated to test/temp/cache behavior.
TemporaryDirectory(dir=Path.cwd()) in this repository.tmp_path fixture — it routes temp files to a system temp directory outside the repo..gitignore only as a second line of defense after fixing the write location.git status --short
Also check:
tests/conftest.py for any temp directory configurationpyproject.toml (or pytest.ini) for tmp_path_retention_policy settingsCommon fixes:
TemporaryDirectory(dir=Path.cwd()) with the tmp_path fixtureanalysis_runs/ (already in .gitignore)addopts = "-p no:cacheprovider" if configured)Expected ignored local artifacts (already in .gitignore):
.tmp/tmp*/.pytest_cache/analysis_runs/analysis_output*/results/.worktrees/pytest tests/ -v --tb=short -x
git status --short
Confirm git status shows no new untracked clutter after running tests.
When reporting the result: