Project Setup
Do these once per project to set yourself up for success.
Create a solid project structure
AI works better with organized codebases. Set up clear folders from day one.
project/
βββ docs/ # Documentation only
βββ scripts/ # Utility scripts
βββ tests/ # All test files
βββ src/ # Source code
β βββ components/
β βββ utils/
β βββ services/
βββ .gitignore # Comprehensive, from day 1
βββ README.mdWrite a README or project doc
AI will reference this implicitly. Include:
# My Project
## What it does
A brief description of the project's purpose.
## Tech Stack
- Next.js 14
- Prisma + PostgreSQL
- TypeScript (strict)
## Key Patterns
- Use server components by default
- API routes in /app/api
- Zod for validationSet up your rules file
Create .cursorrules (or similar) for project-specific conventions:
# .cursorrules
## Language & Framework
- TypeScript strict mode
- Next.js App Router
- Tailwind CSS
## Conventions
- Use async/await, not .then()
- Prefer named exports
- Use Zod for all validation
## Security
- Never log sensitive data
- Always sanitize user input
- Use parameterized queries
## Don't
- Don't use any
- Don't add unnecessary dependencies
- Don't create files at project rootCreate .gitignore immediately
# Environment
.env
.env.local
.env*.local
# Dependencies
node_modules/
vendor/
# Build
dist/
build/
.next/
# IDE
.idea/
.vscode/
*.swp
# OS
.DS_Store
Thumbs.db
# Logs
*.log
logs/
# Secrets (belt and suspenders)
*.pem
*.key
secrets/β οΈ
Enforce file organization from day 1
AI will dump files wherever you let it. Explicitly specify paths in every prompt:
β
"Create the UserService class in /src/services/UserService.ts"
β "Create the UserService class" (AI picks random location)
When AI Puts Files in Wrong Places
Stop immediately. Move the file to correct location. Then tell AI:
"From now on, all services go in
/src/services/"
This trains the context for future prompts.