Keep the repository root clean when working on pytest, temp files, caches, or local artifacts in the MS preprocessing toolkit. Use when tests create `tmp*` folders, `.pytest*` directories, repo-local caches, or when changing test fixtures, cleanup scripts, or temp-path behavior in either the top-level repo or `ms-core`.
Use this skill to prevent temporary files, pytest artifacts, and machine-local caches from leaking into the repository root.
This repository already has a preferred pattern:
tests/conftest.pyms-core tests use matching fixtures in ms-core/tests/conftest.pyscripts/clean_local_artifacts.ps1If a change touches pytest behavior, temp directories, benchmark outputs, 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 rootms-core temp behaviorDo not use this skill for general cleanup unrelated to test/temp/cache behavior.
TemporaryDirectory(dir=Path.cwd()) in this repository.tests/conftest.py:
project_temp_rootproject_temp_dirtmp_pathms-core tests, prefer fixtures from ms-core/tests/conftest.py:
project_temp_rootproject_temp_dir.gitignore only as a second line of defense after fixing the write location.Run:
git status --short --branch
Get-ChildItem -Force | Where-Object { $_.Name -like 'tmp*' -or $_.Name -like '.pytest*' -or $_.Name -eq '.tmp' -or $_.Name -eq '__pycache__' }
Get-ChildItem -Force ms-core | Where-Object { $_.Name -like 'tmp*' -or $_.Name -like '.pytest*' -or $_.Name -eq '.tmp' -or $_.Name -eq '__pycache__' }
If the task involves temp creation, inspect:
tests/conftest.pyms-core/tests/conftest.pypyproject.tomlms-core/pyproject.tomlscripts/clean_local_artifacts.ps1Common fixes:
TemporaryDirectory(dir=Path.cwd()) with project_temp_dir()Expected ignored local artifacts include:
.tmp/.pytest-local-temp/tmp*/Mirror ignore changes in ms-core/.gitignore when ms-core produces the same class of artifacts.
Top-level focused check:
$env:PYTHONPATH='ms-core/src'; pytest tests/test_root_hygiene.py -v --tb=short
Top-level full check:
$env:PYTHONPATH='ms-core/src'; pytest tests/ -v --tb=short -x
ms-core check:
pytest ms-core/tests -v --tb=short -x
Use:
powershell -ExecutionPolicy Bypass -File scripts\clean_local_artifacts.ps1
This script is reliable for normal writable temp folders created after the hygiene changes.
If cleanup fails for old folders, call out the exact directories and note that local ACL state is blocking removal.
When reporting the result:
tests/conftest.pytests/test_root_hygiene.pyms-core/tests/conftest.pyms-core/tests/test_root_hygiene.pyscripts/clean_local_artifacts.ps1