8 Project Initialization
Starting a new project well sets you up for success. Let’s see how Claude Code helps with project setup.
8.1 The Blank Canvas Problem
Starting with an empty folder can be daunting: - What files do I need? - How should I structure things? - What configuration is required?
Claude Code can scaffold a project based on what you want to build.
8.2 Basic Project Setup
8.2.1 Step 1: Create and Enter the Folder
mkdir ~/Projects/my-new-project
cd ~/Projects/my-new-project
claude8.2.2 Step 2: Describe Your Project
> I'm starting a new Python project for analyzing gene expression data. Help me set up a good project structure.
Claude will create: - Directory structure (src/, data/, notebooks/, etc.) - README.md with project description - .gitignore for Python projects - requirements.txt (empty or with common packages) - Maybe a basic main.py or __init__.py
8.2.3 Step 3: Initialize Git
> Initialize this as a git repository and make the first commit
8.3 Project Templates by Type
Different projects need different structures. Here are examples:
8.3.1 Data Analysis Project
> Set up a data analysis project with folders for raw data, processed data, notebooks, and results
Typical structure:
project/
├── data/
│ ├── raw/ # Original, immutable data
│ └── processed/ # Cleaned/transformed data
├── notebooks/ # Jupyter notebooks
├── src/ # Python modules
│ ├── __init__.py
│ ├── data.py # Data loading/processing
│ └── analysis.py # Analysis functions
├── results/ # Output figures, tables
├── .gitignore
├── README.md
└── requirements.txt
8.3.2 Python Package
> Set up this as a Python package called "geneutils" that I can install with pip
Structure:
geneutils/
├── geneutils/
│ ├── __init__.py
│ ├── core.py
│ └── utils.py
├── tests/
│ └── test_core.py
├── .gitignore
├── README.md
├── setup.py
└── pyproject.toml
8.3.3 Simple Script Project
> I just need a single script with a config file
Structure:
project/
├── main.py
├── config.yaml
├── .gitignore
└── README.md
8.4 Setting Up Dependencies
8.4.1 Python: requirements.txt
> I'll need pandas, numpy, matplotlib, and seaborn for this project. Set up the requirements.
Claude creates requirements.txt:
pandas>=2.0.0
numpy>=1.24.0
matplotlib>=3.7.0
seaborn>=0.12.0
Then:
> Install the requirements
Claude runs: pip install -r requirements.txt
8.4.2 Python: Virtual Environment
For isolated dependencies:
> Create a virtual environment for this project and install the dependencies there
Claude will: 1. Create venv: python -m venv venv 2. Activate it 3. Install packages 4. Update .gitignore to exclude venv
Always use a virtual environment for Python projects. It prevents package conflicts between projects.
8.4.3 R: renv
> Set up renv for R package management
8.4.4 JavaScript: package.json
> Initialize this as a Node.js project with express and axios
8.5 Configuration Files
Most projects need configuration. Claude can create:
8.5.1 .gitignore
> Create a comprehensive gitignore for a Python data science project
Includes: - Python artifacts (__pycache__/, *.pyc) - Virtual environments (venv/, .env) - Data files (*.csv, *.xlsx) - Jupyter checkpoints (.ipynb_checkpoints/) - IDE settings (.vscode/, .idea/) - OS files (.DS_Store, Thumbs.db)
8.5.2 README.md
> Create a README that explains this project, how to set it up, and how to run it
Good READMEs have: - Project title and description - Installation instructions - Usage examples - License - Contact information
8.5.3 Configuration Files
> Create a config file for database settings that I can change without editing code
Options: - config.yaml (human-readable) - config.json (widely supported) - .env (for secrets - add to .gitignore!)
8.6 Git Best Practices
8.6.1 First Commit
> Initialize git and commit the project structure
Claude will: 1. git init 2. git add . (respecting .gitignore) 3. git commit -m "Initial project structure"
8.6.2 Connect to GitHub
> Create a private GitHub repository for this project and push
Claude uses gh to: 1. Create the repo on GitHub 2. Add remote 3. Push initial commit
8.6.3 Branching Strategy
For larger projects:
> Set up a develop branch that we'll work on
8.7 Environment Variables and Secrets
For API keys and passwords:
> Set up a .env file for secrets like API keys
Claude creates: - .env.example (template with placeholder values - committed) - .env (actual values - in .gitignore) - Code to load with python-dotenv
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("API_KEY")8.8 Documentation from the Start
> Add docstrings to all the files we created
> Create a docs folder with a getting started guide
Starting with documentation makes it easier to maintain.
8.9 Complete Example
Let’s set up a project from scratch:
mkdir ~/Projects/paper-analysis
cd ~/Projects/paper-analysis
claude> I'm starting a project to analyze citation patterns in scientific papers. I'll need:
> - A script to fetch paper data from APIs
> - Processing scripts to clean and structure the data
> - Analysis code to find patterns
> - Visualization for results
>
> Set up an appropriate project structure.
Review and approve the structure.
> Add pandas, requests, matplotlib, and seaborn to requirements
> Create a virtual environment and install the requirements
> Create a config file for the API endpoints I'll use
> Set up git and push to GitHub as a private repo called paper-analysis
Now you have a fully initialized project!
8.10 Checklist: New Project Setup
Use this checklist when starting projects:
- Create project folder
- Initialize with Claude Code
- Set up directory structure
-
Create
.gitignore -
Create
README.md - Set up dependencies (requirements.txt, package.json, etc.)
- Create virtual environment if needed
- Set up configuration files
-
Set up
.envfor secrets - Initialize git
- Make first commit
- Connect to GitHub (optional)
8.11 Next Steps
Your project is set up. Now let’s do something interesting with it!
Choose your path: - Part 3: Paper Writing Track - Work on academic writing with PubMed MCP - Part 4: Data Analysis Track - Analyze scientific data