Environment Setup¶
Setting up your local environment for AI-assisted development involves configuring tools, API keys, and project settings.
Prerequisites¶
Before starting, ensure you have:
- [ ] A code editor or IDE
- [ ] Terminal/command line access
- [ ] Git installed
- [ ] API keys for your chosen AI services
API Keys¶
Most AI tools require API keys. Here's how to set them up:
Anthropic (Claude)¶
- Create account at console.anthropic.com
- Generate API key
- Set environment variable:
OpenAI¶
- Create account at platform.openai.com
- Generate API key and set up billing
- Set environment variable:
Google (Gemini)¶
- Go to Google AI Studio
- Generate API key
- Set environment variable:
Persisting Environment Variables¶
Add keys to your shell profile so they persist:
Security Note
Never commit API keys to git. Use environment variables or .env files (and add .env to .gitignore).
Tool Installation¶
IDEs¶
CLI Tools¶
Configuration Directories¶
After installation, create your configuration directories:
# Create config directories
mkdir -p ~/.claude
mkdir -p ~/.cursor/rules
# Create global instructions
touch ~/.claude/CLAUDE.md
Project Setup¶
Initialize a Project¶
# Create project directory
mkdir my-project && cd my-project
# Initialize git
git init
# Create AI instructions
touch CLAUDE.md # For Claude Code
mkdir -p .cursor/rules # For Cursor
Project Instructions Template¶
Create a CLAUDE.md (or similar) in your project root:
# Project: My App
## Tech Stack
- Next.js 14 with App Router
- TypeScript (strict mode)
- Prisma + PostgreSQL
- Tailwind CSS
## Conventions
- Use functional components with hooks
- Prefer server components where possible
- Follow existing code patterns
## Important Files
- `src/app/` - App router pages
- `src/lib/` - Shared utilities
- `prisma/schema.prisma` - Database schema
Verification¶
Test your setup:
Test API Keys¶
# Test Anthropic
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-3-haiku-20240307","max_tokens":10,"messages":[{"role":"user","content":"Hi"}]}'
Test Tools¶
Troubleshooting¶
"API key not found"¶
- Verify the key is set:
echo $ANTHROPIC_API_KEY - Check for typos in variable name
- Reload shell config:
source ~/.zshrc
"Command not found"¶
- Verify installation:
which claudeorwhich aider - Check PATH includes install location
- Try reinstalling the tool
"Permission denied"¶
- Check file permissions:
ls -la ~/.claude/ - Fix if needed:
chmod 755 ~/.claude/