Starting New Projects from the Terminal
You just got the green light on a new project. You know the stack you want — maybe Next.js with Prisma, maybe a Python FastAPI service, maybe a Phoenix LiveView app. In the past, you would spend the first day wiring up boilerplate: project structure, linter config, database connections, environment variables, CI pipeline. That is an entire day of work before you write a single line of business logic.
Claude Code compresses that into a single terminal session. You describe what you want, and Claude scaffolds the project, configures the tooling, and sets up a CLAUDE.md that makes every future session more productive. The key is knowing how to guide that first conversation so you get production-quality scaffolding instead of a generic template.
What You’ll Walk Away With
Section titled “What You’ll Walk Away With”- A repeatable process for bootstrapping any project type from the CLI
- A well-structured CLAUDE.md file that acts as persistent project memory
- Copy-paste prompts for common stacks (Next.js, FastAPI, Phoenix, Express)
- The
/initworkflow that analyzes existing projects and generates context automatically
The Bootstrap Workflow
Section titled “The Bootstrap Workflow”The most effective project initialization follows a three-phase pattern: describe the project, let Claude scaffold it, then lock in the conventions with CLAUDE.md.
-
Create the project directory and start Claude Code
Terminal window mkdir my-saas-app && cd my-saas-appgit initclaudeStarting with
git initmatters. Claude Code is git-aware and will create commits at logical checkpoints throughout the scaffolding process. Without a git repository, you lose the ability to rewind if something goes wrong during setup. -
Describe the project with enough specificity to avoid generic output
A vague prompt like “create a web app” gets you a generic template. A specific prompt gets you something you can actually build on. Include the stack, the primary features, and your conventions.
-
Review the generated structure before moving on
Claude will create files and make commits. Before proceeding, ask it to verify the setup actually works.
Run the dev server and confirm it starts without errors.Then run the linter and fix any issues. Show me the finalproject structure as a tree. -
Generate the CLAUDE.md file
This is the step most people skip, and it is the most important one. CLAUDE.md gives every future Claude session the context it needs to work effectively in your project.
/initThe
/initcommand analyzes your project structure, detects frameworks and tooling, and generates a starter CLAUDE.md. Review it and add anything project-specific that Claude cannot infer from the code alone.
Writing a CLAUDE.md That Actually Works
Section titled “Writing a CLAUDE.md That Actually Works”The /init command gives you a solid starting point, but the best CLAUDE.md files are refined over time. Here is what to include and what to leave out.
What belongs in CLAUDE.md
Section titled “What belongs in CLAUDE.md”# Build and test commandsnpm run dev # Start dev server on port 3000npm run build # Production buildnpm run test # Run vitestnpm run lint # ESLint checknpm run db:migrate # Run Prisma migrationsnpm run db:seed # Seed development data
# Code conventions- Use server components by default, client components only for interactivity- Named exports only, no default exports except page.tsx and layout.tsx- Colocate tests next to source files: Button.tsx / Button.test.tsx- Use Zod for all runtime validation, never trust client input
# Architecture decisions- Auth: NextAuth.js with database sessions (not JWT)- State: Server state via React Server Components, client state via Zustand only where needed- API: Server Actions for mutations, Route Handlers only for webhooks
# Common gotchas- Prisma client must be instantiated as singleton (see src/lib/db.ts)- Middleware runs on Edge Runtime -- no Node.js APIs available- IMPORTANT: Never commit .env files. Use .env.example for templates.What does not belong in CLAUDE.md
Section titled “What does not belong in CLAUDE.md”Do not include things Claude can figure out by reading your code: standard TypeScript conventions, how React hooks work, or what npm install does. Do not include documentation that changes frequently — link to it instead. If your CLAUDE.md is longer than about 50 lines, Claude starts losing track of individual rules. Keep it tight.
Stack-Specific Prompts
Section titled “Stack-Specific Prompts”Python FastAPI
Section titled “Python FastAPI”Phoenix LiveView
Section titled “Phoenix LiveView”Express with TypeScript
Section titled “Express with TypeScript”Initializing Existing Projects
Section titled “Initializing Existing Projects”Not every project starts from scratch. When you join an existing codebase, Claude Code’s /init command becomes your onboarding tool.
-
Navigate to the project root and run Claude Code
Terminal window cd /path/to/existing-projectclaude -
Generate CLAUDE.md from the existing codebase
/initClaude reads your package.json (or equivalent), examines your directory structure, detects test frameworks, and generates a CLAUDE.md tailored to the project.
-
Ask Claude to fill in what
/initmissedRead through the README, the CI configuration, and the last 20 commits.Update CLAUDE.md with any conventions, gotchas, or workflow patternsyou can identify that aren't already captured. -
Validate by asking a question only a well-configured session could answer
How do I run just the unit tests for the auth module?What is the deployment process?If Claude answers correctly from CLAUDE.md without reading additional files, your configuration is working.
Setting Up Hooks for Consistency
Section titled “Setting Up Hooks for Consistency”Hooks are scripts that run automatically at specific points in Claude’s workflow. Unlike CLAUDE.md instructions (which are advisory), hooks execute deterministically every time.
{ "hooks": { "PostToolUse": [ { "matcher": "Edit|Write", "command": "npx eslint --fix $FILE_PATH" } ] }}This hook runs ESLint with auto-fix after every file edit Claude makes. No more reviewing code and finding style issues that should have been caught automatically.
Creating Custom Skills for Your Team
Section titled “Creating Custom Skills for Your Team”Once your project is set up, you can encode team-specific workflows as skills that anyone can invoke.
---name: new-featuredescription: Scaffold a new feature with all required files---Create a new feature: $ARGUMENTS
1. Create a new branch named feature/$ARGUMENTS2. Add route handler in src/app/api/$ARGUMENTS/route.ts3. Add service in src/services/$ARGUMENTS.service.ts4. Add Zod schemas in src/schemas/$ARGUMENTS.schema.ts5. Add tests in src/services/$ARGUMENTS.service.test.ts6. Update CLAUDE.md if new conventions are introducedInvoke it with /new-feature user-preferences and Claude scaffolds the entire feature structure following your team’s conventions.
When This Breaks
Section titled “When This Breaks”Claude generates a generic template instead of what you described. Your prompt was too vague. Add specific framework versions, directory structure preferences, and conventions. The more specific your first prompt, the less course-correcting you do later.
The generated project has dependency conflicts. Claude sometimes pulls in incompatible package versions. Always include “run the dev server and fix any errors” as part of your scaffolding prompt. Claude is excellent at resolving dependency issues when it can see the actual error output.
CLAUDE.md gets ignored in later sessions. If the file exceeds roughly 50 lines or contains vague instructions like “write clean code,” Claude stops paying attention to individual rules. Keep every line specific and actionable. If removing a line would not change Claude’s behavior, remove it.
/init misses project conventions. The command analyzes code structure but cannot read your team’s unwritten rules. Always supplement /init output with the conventions that exist only in your team’s heads: branch naming, PR process, deployment procedures.
What’s Next
Section titled “What’s Next”Your project is scaffolded, your CLAUDE.md is configured, and your hooks are in place. Now it is time to learn how Claude Code navigates code you did not write.