Transform your existing projects into AI-ready codebases that maximize the effectiveness of Cursor IDE and Claude Code.
An AI-optimized project isn’t just about the code—it’s about providing context, rules, and structure that AI can understand and leverage effectively.
Key Components of an AI-Ready Project
Component | Purpose | Priority |
---|
CLAUDE.md | Project context for Claude Code | Essential |
.cursor/rules/ | Coding standards for Cursor | Essential |
docs/PRD.md | Product requirements | High |
docs/ARCHITECTURE.md | System design decisions | High |
docs/API.md | Interface documentation | Medium |
tests/ | Comprehensive test suite | High |
.ai-templates/ | Prompt templates | Medium |
.github/ai-review.yml | AI review configuration | Low |
- Create CLAUDE.md in project root
This is a Next.js e-commerce application using:
- Next.js 14 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- Prisma ORM with PostgreSQL
- NextAuth for authentication
- Use server components by default
- Client components only when necessary
- All API routes in app/api/
- Shared components in components/ui/
- Run `npm run dev` for development
- Database migrations: `npx prisma migrate dev`
Working on checkout flow optimization
-
Set up .cursor/rules/
Create .cursor/rules/react.md
:
# React Development Rules
- Prefer functional components with hooks
- Use TypeScript interfaces over types
- Extract custom hooks for reusable logic
- Keep components under 150 lines
- Colocate tests with components
-
Document existing architecture
- Pages use Next.js App Router
- Global state with Zustand
- API calls via custom hooks
- Middleware for auth/logging
- Repository pattern for data
-
Create AI-friendly test structure
describe('Checkout Flow', () => {
it('should calculate tax correctly', () => {
// AI can understand and extend these
- Create comprehensive CLAUDE.md
/auth - Authentication endpoints
/orders - Order processing
/products - Product catalog
- Middleware for auth/validation
- Error handling with custom classes
- Response formatting helpers
- Database transactions for consistency
-
Document API endpoints
POST /api/v1/auth/refresh
-
Add coding standards
- Always validate input with Joi
- Use try-catch with async/await
- Return consistent error format
- Log all errors with context
- Use database transactions
- Mobile-specific CLAUDE.md
React Native app supporting:
- iOS 14+ and Android 10+
- Redux Toolkit for state
/screens - Screen components
/components - Shared components
/navigation - Navigation config
- Platform-specific rules
- Always test on both platforms
- Use Platform.select for OS differences
- Prefer styled-components
- Optimize images and assets
- Handle offline scenarios
Comprehensive CLAUDE.md Structure
Brief description of what the project does and its main purpose.
- Language: [e.g., TypeScript 5.0]
- Framework: [e.g., Next.js 14]
- Database: [e.g., PostgreSQL 15]
- Key Libraries: [List main dependencies]
/src
/components - React components
/pages - Next.js pages
/api - API routes
/lib - Utility functions
/styles - CSS/Sass files
1. Install dependencies: `npm install`
2. Set up environment: `cp .env.example .env.local`
3. Run database: `docker-compose up -d`
4. Run dev server: `npm run dev`
- TypeScript strict mode enabled
- ESLint + Prettier for formatting
- 100% test coverage goal
- [ ] Implementing user dashboard
- [ ] Optimizing database queries
- [ ] Adding real-time notifications
- Performance bottleneck in search
- Memory leak in WebSocket handler
## Architecture Decisions
- Using Server Components for SEO
- Chose PostgreSQL for JSONB support
- Implemented event-driven architecture
.cursor/rules/ Structure
├── general.md # Overall coding standards
├── typescript.md # TypeScript-specific rules
├── react.md # React patterns
├── testing.md # Test requirements
├── security.md # Security guidelines
└── performance.md # Performance rules
Example general.md
:
# General Coding Standards
- Keep functions under 50 lines
- Maximum 3 parameters per function
- Descriptive variable names
- Comments for complex logic only
- Never ignore errors silently
- Log errors with context
- User-friendly error messages
- Feature branches from develop
- Squash commits before merge
- Conventional commit messages
- PR requires 2 approvals
Product Requirements Document
# Feature: [Feature Name]
Brief description of the feature and its value proposition.
- As a [user type], I want to [action] so that [benefit]
- As a [user type], I want to [action] so that [benefit]
- [ ] Error handling for Z
## Technical Requirements
- Must work on mobile devices
- Support 1000 concurrent users
- Accessible (WCAG 2.1 AA)
## Non-Functional Requirements
- Security: OAuth 2.0 authentication
- Performance: CDN for static assets
- Monitoring: Track usage metrics
- Payment gateway integration
- Email service for notifications
- Analytics tracking setup
- 80% feature adoption rate
- 50% reduction in support tickets
-
Generate initial documentation
# Use AI to analyze and document
"Analyze this codebase and create:
- Overview of architecture
- List of main components
- Technology stack details
- Areas needing refactoring"
-
Identify anti-patterns
- Security vulnerabilities
- Performance bottlenecks
-
Create migration plan
## Phase 1: Documentation (Week 1)
## Phase 2: Testing (Week 2)
- Create integration tests
## Phase 3: Refactoring (Week 3-4)
Incremental Approach
- Start with documentation
- Add tests for existing code
- Refactor module by module
- Maintain backward compatibility
Big Bang Approach
- Complete rewrite planning
- Parallel development
- Feature parity checklist
- Staged rollout strategy
Documentation Generation Workflow
name: Update Documentation
- uses: actions/checkout@v3
- name: Generate API Docs
npx ai-doc-gen --source ./src --output ./docs/api
# AI updates project context
git commit -m "docs: auto-update documentation"
AI-Powered Code Review
- security_vulnerabilities
AI Test Generation Strategy
describe('[Component/Function]', () => {
// AI generates comprehensive tests
describe('Happy Path', () => {
it('should handle normal input', () => {
describe('Edge Cases', () => {
it('should handle empty input', () => {
it('should handle null values', () => {
describe('Error Scenarios', () => {
it('should throw on invalid input', () => {
Success Metrics
Metric | Before | After | Target |
---|
AI Understanding | 0% | 80% | 90% |
Documentation Coverage | 20% | 90% | 95% |
Test Coverage | 40% | 85% | 90% |
Refactoring Speed | 1 file/hour | 10 files/hour | 15 files/hour |
Bug Detection | Manual | AI-assisted | Automated |
Code Review Time | 2 hours | 30 minutes | 15 minutes |
Over-Documentation
Don’t document obvious things. Focus on:
- Architecture decisions
- Business logic reasoning
- Complex algorithms
- External integrations
Rigid Rules
Rules should guide, not constrain:
- Allow exceptions with justification
- Update rules based on learnings
- Keep rules concise and clear
Ignoring Context
Always provide business context:
- Why features exist
- User journey understanding
- Performance requirements
- Security considerations
Complete Conversion Checklist
- Start with documentation - Create CLAUDE.md today
- Add one rule file - Begin with general coding standards
- Convert one module - Pick a well-understood component
- Measure improvement - Track time saved and quality gains
- Iterate and expand - Apply learnings to rest of project
The goal isn’t perfection—it’s creating a foundation that makes AI assistance more effective and your development more efficient.