init-python-project
Original:🇺🇸 English
Translated
5 scriptsChecked / no sensitive code detected
Initialize Python Project (New or Fork). Use when the user wants to create a new production-ready Python/ML project structure, or fork and enhance an existing project. Uses uv for environment management.
14installs
Added on
NPX Install
npx skill4agent add a-green-hand-jack/ml-research-skills init-python-projectTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Initialize Python Project
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.
Skill Directory Layout
text
<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
│ ├── CLAUDE.md
│ ├── pyproject.toml.tmpl
│ ├── tests/
│ └── docs/
└── ml/
├── .agent/
├── docs/
├── experiments/
├── infra/
├── eval/
└── scripts/Progressive Loading
Read only the references needed for the current path:
- Always read
references/architecture.md - For new projects, read
references/new-project.md - For fork/enhancement work, read
references/fork-enhancement.md - If you need policy, tradeoff, or failure-handling guidance, read
references/best-practices.md
Use as the source of truth for file contents instead of reproducing long inline snippets.
Use as the source of truth for which template groups and placeholders the scaffold supports.
templates/template_manifest.jsonStep 1 — Gather Project Information
Ask the user in a single message:
- Project type:
- — create a new project
new - — clone and enhance an existing repository
fork
- If :
new- Project name
- Package name (default: snake_case of project name)
- Short description
- Python version (default: )
3.11 - Project type: ,
ml,web, orlibgeneral
- If :
fork- GitHub repository URL
- Whether they want a fork workflow or just a local enhancement
- For both:
- GitHub repository URL for the target repo, if available
- Author name and email
Wait for the answer before continuing.
Step 2 — Choose the Execution Path
Path A: New Project
Read and .
references/new-project.mdreferences/architecture.md2A.1 Create the project root
bash
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.
2A.2 Preferred path for new + ml
new + mlFor a new ML project, prefer the bundled scaffold script:
bash
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 init- source/test/docs directory creation
- copying templates from and
templates/common/templates/ml/ - placeholder replacement
- creating
.env - bootstrapping remote-project memory files for local-to-remote workflows
- writing files
.gitkeep
After 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.
2A.3 Manual fallback: create the directory layout
For projects, create the full four-layer structure from .
mlreferences/architecture.mdAt minimum, create:
bash
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__.pyFor non-ML projects, keep the common project files but only create ML-specific directories if the user explicitly wants them.
2A.4 Materialize templates
Use the templates under and replace placeholders:
templates/{{PROJECT_NAME}}{{PACKAGE_NAME}}{{DESCRIPTION}}{{PYTHON_VERSION}}{{AUTHOR_NAME}}{{AUTHOR_EMAIL}}{{REPO_URL}}
Write these common files from :
templates/common/.gitignore.env.exampleREADME.mdCLAUDE.mdpyproject.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.json
For projects, also write:
mlexperiments/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.py
Create as an empty file with a short comment header if it does not exist.
.env2A.5 Add placeholder files for empty directories
Use where needed so empty directories are tracked:
.gitkeepbash
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/.gitkeepOnly create placeholders for directories that actually exist in the chosen project type.
2A.6 Install and verify
For ML projects:
bash
uv pip install -e ".[dev,ml]"For non-ML projects:
bash
uv pip install -e ".[dev]"Run an initial test:
bash
pytest tests/ -vIf there are no tests yet, create a placeholder test and rerun:
bash
cat > tests/test_placeholder.py <<'EOF'
def test_placeholder():
assert True
EOF
pytest tests/2A.7 Initialize git and optional remote
bash
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 , show , and ask before pushing:
origingit remote -vbash
git remote add origin <github-ssh-url>
CURRENT_BRANCH="$(git branch --show-current)"
git push -u origin "$CURRENT_BRANCH"Path B: Fork / Existing Project
Read , , and .
references/fork-enhancement.mdreferences/architecture.mdreferences/best-practices.md2B.1 Clone and inspect
bash
git clone <github-ssh-url> <project-name>
cd <project-name>
ls -laCheck for:
- ,
pyproject.toml,setup.pyrequirements.txt - ,
src/,tests/,docs/scripts/ - ,
.env.example,CLAUDE.md.vscode/settings.json
2B.2 Report gaps before bulk edits
Produce a concise report showing:
- Existing structure
- Missing high-value components
- Whether the repo is already installable
- Whether docs/test isolation are missing
Then ask whether to:
- Add all missing components
- Add only selected components
- Generate a checklist without editing
2B.3 Add only missing components
When the user approves edits, use the templates under to fill gaps:
templates/common/.env.exampleCLAUDE.mdtests/conftest.py- docs templates
.vscode/settings.json- if migrating from
pyproject.tomlrequirements.txt
Do not force the full ML layout onto an existing repo unless the user explicitly wants that migration.
Template Application Rules
- Keep existing substantial files when they are already good enough.
- Prefer surgical edits over overwriting.
- For templated files, replace placeholders consistently.
- If a template is only partially relevant, copy the relevant sections instead of dumping the whole file verbatim.
Final Summary
Report:
text
✓ Python project initialized or enhanced: <project-name>
✓ Project type: <new|fork> / <ml|web|lib|general>
✓ Common scaffolding applied
✓ UV environment configured
✓ 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 pytest before the next commitImportant Notes
- Use when you hit edge cases.
references/best-practices.md - Keep this focused on orchestration; the detailed file content should live in
SKILL.mdandtemplates/.references/ - 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
experiments/.docs/runs/ - When this code repo belongs to a project control root, prefer sibling code worktrees under instead of nested worktrees inside
<ProjectName>/code-worktrees/.code/