/init step that generates CLAUDE.md, how Claude inspects your repository, and an example of the kind of scaffolding it may propose for a CSV-based utility.

/init to create a CLAUDE.md file that contains project metadata, developer notes, and usage instructions for Claude. Claude will scan the repository (looking for files like package.json, pyproject.toml, requirements.txt, etc.), infer the project type, and propose edits or scaffolding — for example converting a single script into a small package with tests and a CLI. Treat Claude Code like another engineer: be explicit and concrete when describing expected behavior, file formats, command-line interfaces, and failure modes.
Be specific in prompts — describe file formats, expected command-line behavior, inputs, and error handling, just as you would when assigning a task to a teammate.
- Below is the cleaned-up utility script this repository started with. Claude often finds single-purpose scripts like this and suggests packaging and tests. This snippet is robust and includes UTF-8 handling and header name flexibility.
/init typically produces
- Claude inspects repository files and creates
CLAUDE.mdwith project metadata, usage instructions, and developer notes. - It may propose turning a single-purpose script into a package with packaging files, a test suite, a CLI entrypoint, and CI configuration.
- When Claude proposes changes, it displays interactive edit prompts so you can accept, decline, or modify suggested edits.
CLAUDE.md
- Short project description, e.g. “Simple Python project that processes member data from a CSV file”.
- Runtime & development instructions: Python version, virtual environment activation, and how to run the main script.
- Short architecture summary: single-purpose script vs package, suggested package layout.
- Suggested next steps: add
pyproject.toml/setup.py, tests, CLI, and CI/CD setup.
Example
__init__.py for csv_member_reader:
exceptions.py:
reader.py (core functionality with dataclass):
pyproject.toml excerpt (tooling & testing hints):
cli.py start):
examples/basic_usage.sh):
- Claude can scaffold
pytesttests. Example test below verifies the package handles header variations likefirst_nameorFirst Name.
CLAUDE.md
- Generated instructions may assume a particular environment or layout. Always open
CLAUDE.mdand confirm commands before running. - If you get
ModuleNotFoundError: No module named 'csv_member_reader', ensure you installed the package in editable mode (pip install -e .) or that your PYTHONPATH includes the project root. - Mypy errors such as “Source file found twice under different module names” usually indicate package layout or duplicate top-level folders; verify
pyproject.tomland source layout.
Generated scaffolding is a strong starting point but not a guarantee of a fully working configuration. Validate tests, linter settings, and packaging instructions before publishing. If Claude suggests commands you don’t understand (for example,
pip install -e ".[dev]"), consult the relevant docs and adapt commands for your OS (on macOS you may need pip3).- Run
/initto generateCLAUDE.mdand let Claude analyze and propose repository changes. - Be explicit in prompts; treat Claude as a developer who needs clear requirements.
- Review and validate any generated package layout,
pyproject.toml, tests, and CI before publishing. - Use Claude to accelerate repetitive scaffolding (package boilerplate, tests, CLI, docs), but always review and iterate.
- Python Packaging User Guide
- pytest Documentation
- Black Formatter
- mypy — Optional Static Typing for Python
- pre-commit — A framework for managing and maintaining multi-language pre-commit hooks