First Session
A hands-on walkthrough with a real project
This guide walks you through your first Claude Code session using the lab’s template-research-project. You’ll learn the core patterns for exploring, modifying, and committing code.
Setup
1. Set Up Your Global Configuration
Before your first session, copy the lab’s student CLAUDE.md template to your global config. This gives Claude your lab-wide standards in every project:
mkdir -p ~/.claude
cp ~/rashid-lab-setup/lab-handbook/config/claude/student-CLAUDE.md ~/.claude/CLAUDE.mdThis file contains lab coding standards (base R + data.table, not tidyverse), common commands, project consistency rules, and key links. You set this up once and it applies to every project.
2. Clone the Template
# Clone the research project template
cd ~/rashid-lab-setup
git clone git@github.com:rashidlab/template-research-project.git my-first-project
cd my-first-project3. Initialize Claude for Your Project
Run /init to generate a project-specific CLAUDE.md based on your repo’s structure:
claude /init/init scans your project — files, README, existing configs — and generates a starter .claude/CLAUDE.md. Think of this as your project’s memory: every time Claude starts a session, it reads this file to understand your project context.
Claude loads two files every session:
- Global (
~/.claude/CLAUDE.md) — Lab standards, applied to all projects - Project (
.claude/CLAUDE.md) — Repo-specific context, key files, commands
The global file provides your defaults; the project file adds specifics. See Configuration Hierarchy for details.
If you cloned a lab template, .claude/CLAUDE.md already exists with a starter structure — open it and fill in the [Project Name] placeholders and project-specific details.
For existing repos without a template, /init creates a reasonable starting point. You’ll refine it over time as you work (see Daily Workflow — Improving CLAUDE.md).
4. Start Claude
claudeYou should see Claude’s prompt. The first thing Claude does is read both CLAUDE.md files to understand your lab standards and project context.
Exploring the Project
Ask about structure
> What is the structure of this project?
Claude will read the directory and explain the layout. For a targets-based project, you’ll see:
_targets.R— Pipeline definitionR/— Function filesdata/— Input data (often symlinked)output/— Resultsdocs/— Documentation
Understand the pipeline
> Explain the targets pipeline in _targets.R
Claude reads the file and explains each target, their dependencies, and what they produce.
Check configuration
> What configuration files does this project use?
Claude will find files like: - config/globals.yml — Project constants (single source of truth) - CLAUDE.md — Project context for Claude
Running Commands
Check pipeline status
> Run tar_outdated() to see what needs to run
Claude executes:
Rscript -e "targets::tar_outdated()"Run the pipeline
> Run the targets pipeline
Claude executes:
Rscript -e "targets::tar_make()"Claude asks for permission before running commands. You can pre-approve common commands by adding them to .claude/settings.json (see Advanced Configuration).
Making Changes
Modify a function
> Open R/analysis.R and add a function that calculates the median
> of a numeric vector, following the lab's base R style
Claude will: 1. Read the existing file 2. Write a new function using base R (not tidyverse) 3. Show you the diff
Review the change
> Show me what you changed
Claude displays the diff of modified files.
Test the change
> Run the pipeline to make sure everything still works
Code Review
Before committing, use Claude’s built-in review capabilities:
> Review my changes for any issues
Claude checks for: - Logic errors — Does the code do what it claims? - Lab standards — Using base R + data.table? Following style guide? - Common mistakes — Off-by-one errors, missing edge cases?
For more thorough reviews, use the /review skill:
> /review
This runs a structured 9-step code review process.
Committing Changes
Check git status
> What files have changed?
Claude runs git status and summarizes the changes.
Create a commit
> Commit these changes with an appropriate message
Claude will: 1. Stage the relevant files 2. Write a commit message following lab conventions 3. Create the commit
Or use the /commit skill for a streamlined workflow:
> /commit
Claude follows the lab’s commit message style: - Start with a verb (Add, Fix, Update, Refactor) - Keep the first line under 72 characters - Reference issues when applicable
Learning Mode
Claude is also a teaching tool. Try:
> Explain what data.table's := operator does
> What's the difference between targets::tar_make() and tar_make_future()?
> Why do we use symlinks for data instead of committing files?
Claude explains concepts in context, referencing your actual code when helpful.
Session Summary
In this first session, you learned to:
| Task | Command |
|---|---|
| Start Claude | claude |
| Explore project | “What is the structure?” |
| Understand code | “Explain the pipeline” |
| Run commands | “Run the targets pipeline” |
| Modify code | “Add a function that…” |
| Review changes | /review or “Review my changes” |
| Commit | /commit or “Commit these changes” |
| Learn concepts | “Explain what X does” |
Key Takeaways
- Claude reads CLAUDE.md first — Project context is automatically loaded
- Explore before modifying — Understand existing code before changing it
- Commands need permission — Claude asks before running bash commands
- Review before committing — Use
/reviewto catch issues early - Ask questions freely — Claude is a learning tool, not just a coder
Next Steps
- Daily Workflow — Common patterns for everyday use
- Lab Integration — Working with targets, git, and Quarto
- HPC Usage — Using Claude on Longleaf