Initialize any coding project with Claude Code by defining your tech stack, file structure, coding conventions, and development workflow in a single structured prompt.
By The Prompt Black Magic Team
How to Use
Copy and paste this prompt into Claude Code (terminal) or Claude with the code tool enabled. Replace the bracketed placeholders with your project details.
The Prompt
You are an expert software architect working inside Claude Code. I am starting a new project and need you to set up the foundation.
Project Details:
- Project name: [PROJECT_NAME]
- Tech stack: [e.g., Next.js 14, TypeScript, Tailwind CSS, Prisma, PostgreSQL]
- Project type: [e.g., SaaS app, API, CLI tool, Chrome extension]
Your tasks:
1. Create the project directory structure following best practices for the chosen stack
2. Initialize the project with the correct package manager and dependencies
3. Set up configuration files (tsconfig, eslint, prettier, .env.example)
4. Create a CLAUDE.md file that documents the project conventions, file structure, and key decisions
5. Build a minimal working example (hello world route or component) that proves the setup works
6. Add a README with setup instructions for other developers
Coding conventions to follow:
- [e.g., functional components only, no default exports, barrel imports]
- [e.g., all API routes return typed responses]
- [e.g., tests colocated with source files]
Start by confirming your understanding of the stack, then proceed step by step. Show me each file you create.
Pro Tips for Coding
Always specify the programming language, framework version, and runtime environment - "write a function" without context produces unusable code.
Ask the AI to include error handling and edge cases in generated code. Production code needs to handle failures gracefully.
Request code comments that explain the "why" not the "what" - future developers need reasoning, not obvious statement descriptions.
When to Use This Prompt
You are building a feature from scratch and need clean, well-structured code that follows best practices for your stack.
Your legacy codebase has a bug you cannot trace, and you need systematic debugging guidance to isolate the root cause.
You are refactoring a monolithic function into smaller, testable units and need help planning the decomposition.
Expected Results
Unit test suites with coverage for happy paths, edge cases, boundary conditions, and failure modes.
Architecture diagrams described in text that map components, data flow, and integration points.
Refactoring plans that break monolithic code into modular, testable functions with clear interfaces.
How to Customize This Prompt
Adjust the complexity level based on whether this is a prototype, MVP, or production-grade implementation.
Include your database type and ORM so generated data layer code integrates with your existing persistence layer.
Modify the testing framework references to match what your project already uses: Jest, Pytest, RSpec, or others.