skills/init-python-project/SKILL.md
Initialize or enhance a Python/ML project. Use for new repos or forks needing production structure, uv environment setup, and research evidence docs.
npx skillsauth add a-green-hand-jack/ml-research-skills init-python-projectInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Help the user create a production-ready Python project or upgrade an existing one without inlining large file bodies inside this skill. Use the bundled references and templates as the source of truth. Treat the Python toolchain as an explicit gate: default to non-mutating checks, run format/fix commands only when requested or required, and record the actual commands in repo guidance. Use pre-commit as the optional local gate runner for code, shell, secrets, notebooks, configs, GitHub Actions, and docs links.
<installed-skill-dir>/
├── SKILL.md
├── references/
│ ├── architecture.md
│ ├── new-project.md
│ ├── fork-enhancement.md
│ └── best-practices.md
├── scripts/
│ └── scaffold_new_project.py
├── template_manifest.json
└── templates/
├── common/
│ ├── .gitignore
│ ├── .env.example
│ ├── README.md
│ ├── AGENTS.md
│ ├── CLAUDE.md
│ ├── pyproject.toml.tmpl
│ ├── tests/
│ └── docs/
└── ml/
├── .agent/
├── docs/
├── experiments/
├── infra/
├── eval/
└── scripts/
Read only the references needed for the current path:
references/architecture.mdreferences/new-project.mdreferences/fork-enhancement.mdreferences/best-practices.mdUse templates/ as the source of truth for file contents instead of reproducing long inline snippets.
Use template_manifest.json as the source of truth for which template groups and placeholders the scaffold supports.
Ask the user in a single message:
new — create a new projectfork — clone and enhance an existing repositorynew:
3.11)ml, web, lib, or generalfork:
ruff, black, isort, mypy, pyright, pytest, pre-commit, gitleaks, shellcheck, shfmt, actionlint, nbstripout, CI, or custom commandsWait for the answer before continuing.
Read references/new-project.md and references/architecture.md.
mkdir <project-name>
cd <project-name>
uv init --name <package_name> --python <version>
If the directory already exists, stop and ask whether to choose a new name or reuse it.
new + mlFor a new ML project, prefer the bundled scaffold script:
python3 <installed-skill-dir>/scripts/scaffold_new_project.py \
<target-dir> \
--project-name <project-name> \
--package-name <package-name> \
--description "<short-description>" \
--python-version <version> \
--author-name "<author-name>" \
--author-email "<author-email>" \
--repo-url "<repo-url-or-TBD>"
The script handles:
uv inittemplates/common/ and templates/ml/.env.gitkeep filesAfter it completes, continue with install, verification, and git setup in Steps 2A.6 and 2A.7.
If the user wants a non-ML layout or the script is not suitable, fall back to the manual path below.
For ml projects, create the full four-layer structure from references/architecture.md.
At minimum, create:
mkdir -p src/<package_name>/{models,data,utils}
mkdir -p tests/{data,outputs}
mkdir -p docs/outlines docs/dev/features docs/src docs/results docs/reports docs/runs
mkdir -p .vscode .cursor .claude/commands
touch src/<package_name>/__init__.py
touch src/<package_name>/models/__init__.py
touch src/<package_name>/data/__init__.py
touch src/<package_name>/utils/__init__.py
touch tests/__init__.py
For non-ML projects, keep the common project files but only create ML-specific directories if the user explicitly wants them.
Use the templates under templates/ and replace placeholders:
{{PROJECT_NAME}}{{PACKAGE_NAME}}{{DESCRIPTION}}{{PYTHON_VERSION}}{{AUTHOR_NAME}}{{AUTHOR_EMAIL}}{{REPO_URL}}Write these common files from templates/common/:
.gitignore.env.exampleREADME.mdAGENTS.mdCLAUDE.md.pre-commit-config.yamlpyproject.tomltests/conftest.pydocs/outlines/project_plan.mddocs/outlines/progress.mddocs/results/.gitkeepdocs/reports/.gitkeepdocs/runs/.gitkeepdocs/dev/feature_template.mddocs/src/dependencies.md.vscode/settings.jsonFor ml projects, also write:
experiments/config.pyexperiments/configs/base.yamlinfra/envs/local.yamlinfra/envs/cluster.yaml.exampleinfra/remote-projects.yamlinfra/README.mddocs/ops/current-status.mddocs/ops/decision-log.md.agent/local-overrides.yamleval/baselines/README.mdscripts/train.pyscripts/download_data.pyCreate .env as an empty file with a short comment header if it does not exist.
Use .gitkeep where needed so empty directories are tracked:
touch experiments/configs/.gitkeep
touch eval/benchmarks/.gitkeep
touch eval/baselines/reproduced/.gitkeep
touch infra/submit/slurm/.gitkeep
touch docs/results/.gitkeep
touch docs/reports/.gitkeep
touch docs/runs/.gitkeep
touch tests/data/.gitkeep
touch tests/outputs/.gitkeep
Only create placeholders for directories that actually exist in the chosen project type.
If this code repo is part of a project-control-root layout (<ProjectName>/code/ with sibling <ProjectName>/code-worktrees/), use a shared project-code uv environment before running any uv sync or uv run command:
export UV_PROJECT_ENVIRONMENT=<absolute-project-root>/.uv-envs/code
Do not use a relative UV_PROJECT_ENVIRONMENT for this policy; uv resolves relative values against each active workspace root, so different worktrees can still fork into different environments. Run Python entry points through uv run from the active worktree rather than directly invoking the shared env's bin/python. Use a separate stage env only when dependencies, Python/CUDA stack, destructive package tests, or real concurrent sync risk requires it, and record that exception in worktree or project guidance.
For ML projects:
uv sync
uv pip install -e ".[dev,ml]"
For non-ML projects:
uv sync
uv pip install -e ".[dev]"
Run the default non-mutating gates. Omit paths that do not exist in the chosen project type:
uv run ruff format --check src tests experiments scripts
uv run ruff check src tests experiments scripts
uv run mypy src
uv run pytest tests -v
uv run pre-commit run --all-files
If there are no tests yet, create a placeholder test and rerun:
cat > tests/test_placeholder.py <<'EOF'
def test_placeholder():
assert True
EOF
uv run pytest tests/
Do not run uv run ruff format ..., uv run ruff check --fix ..., shfmt -w, nbstripout without --dry-run, or other mutating fix commands silently. Use mutating commands only when the user requests formatting/fixes or a documented project policy requires them, then review the diff.
git rev-parse --git-dir >/dev/null 2>&1 || git init
git add .
git commit -m "Initial Python project structure"
If the user provided a GitHub URL, add origin, show git remote -v, and ask before pushing:
git remote add origin <github-ssh-url>
CURRENT_BRANCH="$(git branch --show-current)"
project-push --set-upstream . origin "$CURRENT_BRANCH"
Read references/fork-enhancement.md, references/architecture.md, and references/best-practices.md.
git clone <github-ssh-url> <project-name>
cd <project-name>
ls -la
Check for:
pyproject.toml, setup.py, requirements.txtsrc/, tests/, docs/, scripts/.env.example, AGENTS.md, CLAUDE.md, .vscode/settings.jsonProduce a concise report showing:
Then ask whether to:
When the user approves edits, use the templates under templates/common/ to fill gaps:
.env.exampleAGENTS.mdCLAUDE.md.pre-commit-config.yamltests/conftest.py.vscode/settings.jsonpyproject.toml if migrating from requirements.txtDo not force the full ML layout onto an existing repo unless the user explicitly wants that migration.
Preserve an existing healthy toolchain. Do not replace black, isort, pyright, pre-commit, gitleaks, shellcheck, shfmt, actionlint, nbstripout, or CI commands just because the new scaffold defaults to ruff, mypy, pytest, and local pre-commit hooks.
Report:
✓ Python project initialized or enhanced: <project-name>
✓ Project type: <new|fork> / <ml|web|lib|general>
✓ Common scaffolding applied
✓ UV environment configured
✓ Toolchain gates configured: format / lint / type-check / test / secrets / shell / notebooks / configs / docs links
✓ Git status: initialized / existing repo reused
✓ Remote: <configured or skipped>
Project location: <full-path>
Next steps:
1. cd <project-name>
2. cp .env.example .env
3. Fill in project-specific settings
4. Start implementing in src/<package_name>/
5. Put stable experiment summaries in docs/results/, reports in docs/reports/, and run pointers in docs/runs/
6. Run the toolchain gates before the next commit:
`uv run ruff format --check src tests experiments scripts`
`uv run ruff check src tests experiments scripts`
`uv run mypy src`
`uv run pytest tests -v`
`uv run pre-commit run --all-files`
references/best-practices.md when you hit edge cases.SKILL.md focused on orchestration; the detailed file content should live in templates/ and references/.experiments/ is runnable experiment logic, not a result archive. Raw outputs, checkpoints, logs, and wandb/tensorboard caches should stay in ignored paths or external storage, with small pointers in docs/runs/.<ProjectName>/code-worktrees/ instead of nested worktrees inside code/.project-push <repo> <remote> <branch> rather than raw git push, git -C <repo> push, cd <repo> && git push, or shell-wrapped push variants.memory/project.yaml and component guidance. Gate status is stale unless verified in the current branch/worktree.testing
Bootstrap project-local ml-research-skills. Use from global installs when creating a new ML research project, enabling this collection in an existing ML research repo, or deciding whether to install the full bundle locally. Route to project-init for new projects; do not handle paper or experiment work directly.
development
Route project operations tasks — git, memory, bootstrap, remote, workspace, code review, timeline, ops — to the correct skill. Use when the task involves commits, pushes, worktrees, project memory, enabling project-local skills, SSH/server coordination, sidecar runners, or audits. Do not solve the ops task directly.
testing
Route ML/AI paper writing tasks to the correct skill — contract planning, prose drafting, section writing, consistency editing, review simulation, rebuttal, submission, or citation work. Use when the task involves writing, revising, reviewing, or submitting a paper instead of guessing between paper-writing-assistant, paper-writing-contract-planner, paper-reviewer-simulator, auto-paper-improvement-loop, or citation skills. Do not draft prose directly.
data-ai
Project-local router for ML research skill selection. Use inside an initialized ML research project, or while maintaining this skill repo, when the user describes an ML research/paper/experiment/discovery/ops/release workflow and may not know the skill; route to a domain router or high-signal leaf. Do not use for generic non-ML projects.