RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/herringtondarkholme-megarepo-clinerules-02-development ↔ herringtondarkholme-megarepo-cursorrules

Comparison

A · Cline rules · HerringtonDarkholme/megarepoB · .cursorrules · HerringtonDarkholme/megarepo
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections113402%
Commands21429%
Section tags701041%

What each file covers

Sections

1 shared · 13 only in A · 40 only in B
  • − Development Guidelines
  • − Technology Stack
  • − When Source Code is Added
  • − Always verify package.json exists first
  • − Install dependencies with appropriate timeout
  • − Build with extended timeout for AI projects
  • − Run tests with adequate time
  • − Build with reasonable timeout for most projects
  • − AI Integration Best Practices
  • − Preferred AI Dependencies
  • − Code Organization
  • − Error Handling Pattern
  • − File Structure Standards
  • + Cursor Rules for Megarepo - AI Setup Repository
  • + Repository Overview
  • + Core Development Principles
  • + 1. AI-First Development
  • + 2. Security & API Key Management
  • + 3. Code Quality Standards
  • + Technology Stack Guidelines
  • + Node.js/Next.js Development
  • + AI Integration Patterns
  • + Common AI Dependencies
  • + File Structure and Organization
  • + Expected Project Structure
  • + Key Directories
  • + Before Writing Code
  • + Code Development
  • + Testing AI Components
  • + Environment Setup
  • + Required Environment Variables
  • + AI Service Keys
  • + Application Settings
  • + Database (if needed)
  • + Development Commands
  • + AI-Specific Best Practices
  • + 1. Prompt Engineering
  • + 2. Response Handling
  • + 3. Performance Optimization
  • + 4. User Experience
  • + Code Style and Formatting
  • + TypeScript Preferences
  • + React Patterns
  • + API Development
  • + Error Handling and Monitoring
  • + AI Service Errors
  • + Monitoring and Logging
  • + Documentation Requirements
  • + Code Documentation
  • + API Documentation
  • + Security Considerations
  • + Data Privacy
  • + API Security
  •   Development Workflow

Commands

2 shared · 1 only in A · 4 only in B
  • − npm test
  • + npm run dev
  • + npm run test
  • + npm run lint
  • + npm run type-check
  •   npm install
  •   npm run build

Section tags

7 shared · 0 only in A · 10 only in B
  • + lint-format
  • + types
  • + testing-strategy
  • + git-pr
  • + security
  • + database
  • + api
  • + performance
  • + do-not
  • + docs
  •   setup
  •   build
  •   test
  •   code-style
  •   architecture
  •   dependencies
  •   agent-behaviour

Line diff

+239 added−66 removed22 unchanged8.4% identical
HerringtonDarkholme/megarepo · .clinerules/02-development.md
@@ −1 @@
1# Development Guidelines
2 
3## Technology Stack
4This repository is pre-configured for **Node.js/Next.js development** with AI integrations.
5 
6### When Source Code is Added
7Follow these patterns based on existing repository guidelines:
8 
9```bash
10# Always verify package.json exists first
11test -f package.json && echo "Node.js project detected" || echo "No package.json found"
12 
13# Install dependencies with appropriate timeout
14npm install # Allow 10+ minutes for completion
 
 
15 
16# Build with extended timeout for AI projects
17npm run build # Allow 60+ minutes - AI projects can have complex builds
18 
19# Run tests with adequate time
20npm test # Allow 30+ minutes for comprehensive test suites
21```
22# Build with reasonable timeout for most projects
23npm run build # Allow 15-30 minutes for most Node.js/Next.js builds with AI integrations
24 
25# Run tests with adequate time
26npm test # Allow 30+ minutes for comprehensive test suites
27## AI Integration Best Practices
 
 
 
28 
29### Preferred AI Dependencies
30When adding AI functionality, use these established packages:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31- `openai` - Official OpenAI API client
32- `@langchain/core` - LangChain framework for AI workflows
33- `@vercel/ai` - Vercel AI SDK for streaming and UI integration
34- `@huggingface/inference` - Hugging Face API client
35- `@anthropic-ai/sdk` - Anthropic Claude API client
36 
37### Code Organization
38- Place AI client configurations in `src/lib/` directory
39- Create reusable AI components in `src/components/ai/`
40- Implement API routes for AI services in `src/app/api/` (Next.js App Router)
41- Define TypeScript types for AI responses in `src/types/`
42 
43### Error Handling Pattern
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44```javascript
45// Implement comprehensive error handling for AI services
46try {
47 const response = await aiClient.chat.completions.create({
48 model: "gpt-4",
49 messages: [{ role: "user", content: prompt }]
 
 
 
 
 
50 });
51 return response.choices[0].message.content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52} catch (error) {
53 if (error.code === 'rate_limit_exceeded') {
54 throw new AIRateLimitError('Rate limit exceeded, please try again later');
 
 
 
 
 
 
 
 
 
55 }
56 if (error.code === 'insufficient_quota') {
57 throw new AIQuotaError('API quota exceeded');
58 }
59 throw new AIServiceError(`AI service failed: ${error.message}`);
60}
61```
62 
63## File Structure Standards
64Follow the established minimal structure and expand thoughtfully:
 
 
 
65 
66```
67.
68├── .clinerules/ # Cline AI rules (this directory)
69├── .github/ # GitHub workflows and Copilot instructions
70├── .kiro/steering/ # Kiro AI steering files
71├── .cursorrules # Cursor AI development rules
72├── CLAUDE.md # Claude AI specific configuration
73├── GEMINI.md # Gemini CLI configuration
74├── AGENT.md # Universal AI agent instructions
75├── package.json # Dependencies and scripts (when added)
76├── src/ # Source code (when added)
77│ ├── lib/ # AI clients and utilities
78│ ├── components/ # React components including AI components
79│ ├── app/ # Next.js App Router (pages and API routes)
80│ └── types/ # TypeScript definitions
81└── public/ # Static assets
82```
83 
84## Development Workflow
851. **Before Changes**: Check repository state and existing patterns
862. **During Development**: Follow TypeScript best practices and AI patterns
873. **Testing**: Include AI service mocks and error scenario testing
884. **Documentation**: Update relevant AI configuration files as needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
HerringtonDarkholme/megarepo · .cursorrules
@@ +1 @@
1# Cursor Rules for Megarepo - AI Setup Repository
2 
3You are an expert AI developer working in the Megarepo, a comprehensive AI setup repository designed for AI-related projects. Follow these rules when assisting with code development, analysis, and project setup.
 
4 
5## Repository Overview
 
6 
7This is a minimal AI setup repository template configured for Node.js/Next.js development. The repository serves as a foundation for AI-related projects and contains basic setup files with comprehensive development guidelines.
 
 
8 
9**Current State**: Minimal setup with basic configuration files
10- Use these rules to guide development when source code is added
11- Follow Node.js/Next.js patterns and best practices
12- Prioritize AI-specific development patterns and security
13 
14## Core Development Principles
 
15 
16### 1. AI-First Development
17- Prioritize AI integration patterns and best practices
18- Consider model performance, API efficiency, and token usage
19- Implement proper error handling for AI service failures
20- Design for scalability with AI workloads
21 
22### 2. Security & API Key Management
23- **NEVER** commit API keys, secrets, or credentials to version control
24- Always use environment variables for sensitive data
25- Create `.env.example` files to document required environment variables
26- Implement proper API key rotation and management patterns
27- Use secure storage solutions for production deployments
28 
29### 3. Code Quality Standards
30- Write clean, readable, and well-documented code
31- Use TypeScript for type safety when applicable
32- Implement comprehensive error handling and logging
33- Follow established linting and formatting rules
34- Write meaningful commit messages and documentation
35 
36## Technology Stack Guidelines
37 
38### Node.js/Next.js Development
39- Follow Next.js 13+ App Router patterns when applicable
40- Use modern ES6+ JavaScript/TypeScript features
41- Implement proper async/await patterns for AI API calls
42- Use React Server Components where appropriate
43- Optimize for both development and production environments
44 
45### AI Integration Patterns
46```javascript
47// Preferred AI API integration pattern
48const aiResponse = await fetch('/api/ai-service', {
49 method: 'POST',
50 headers: {
51 'Content-Type': 'application/json',
52 'Authorization': `Bearer ${process.env.AI_API_KEY}`
53 },
54 body: JSON.stringify({ prompt, options })
55});
56 
57if (!aiResponse.ok) {
58 throw new Error(`AI service error: ${aiResponse.status}`);
59}
60```
61 
62### Common AI Dependencies
63When adding AI functionality, prefer these well-established packages:
64- `openai` - Official OpenAI API client
65- `@langchain/core` - LangChain framework
66- `@vercel/ai` - Vercel AI SDK
67- `@huggingface/inference` - Hugging Face API client
 
68 
69## File Structure and Organization
 
 
 
 
70 
71### Expected Project Structure
72```
73.
74├── README.md # Project documentation
75├── LICENSE # MIT license
76├── .gitignore # Node.js/Next.js patterns
77├── .cursorrules # This file
78├── .env.example # Environment variable template
79├── package.json # Dependencies and scripts
80├── next.config.js # Next.js configuration
81├── tsconfig.json # TypeScript configuration
82├── src/
83│ ├── app/ # Next.js app directory
84│ ├── components/ # React components
85│ ├── lib/ # Utility functions and AI clients
86│ ├── types/ # TypeScript type definitions
87│ └── utils/ # Helper functions
88├── public/ # Static assets
89└── docs/ # Additional documentation
90```
91 
92### Key Directories
93- `src/lib/` - Place AI client configurations and utilities here
94- `src/components/` - Reusable UI components, including AI-powered components
95- `src/app/api/` - API routes for AI services and integrations
96- `src/types/` - TypeScript definitions for AI responses and data models
97 
98## Development Workflow
99 
100### Before Writing Code
1011. Check if `package.json` exists before running npm commands
1022. Review existing environment variable requirements
1033. Understand the AI service integrations being used
1044. Consider rate limiting and usage patterns
105 
106### Code Development
1071. Write TypeScript definitions for AI API responses
1082. Implement proper error handling for AI service failures
1093. Add loading states and user feedback for AI operations
1104. Consider performance implications of AI API calls
1115. Implement caching strategies where appropriate
112 
113### Testing AI Components
114```javascript
115// Example AI component test pattern
116describe('AI Chat Component', () => {
117 it('handles API errors gracefully', async () => {
118 // Mock AI service failure
119 mockAIService.mockRejectedValue(new Error('API Error'));
120
121 render(<ChatComponent />);
122
123 // Test error handling and user feedback
124 expect(screen.getByText(/error/i)).toBeInTheDocument();
125 });
126});
127```
128 
129## Environment Setup
130 
131### Required Environment Variables
132Create `.env.local` with these patterns:
133```bash
134# AI Service Keys
135OPENAI_API_KEY=your_openai_key_here
136ANTHROPIC_API_KEY=your_anthropic_key_here
137 
138# Application Settings
139NEXT_PUBLIC_APP_URL=http://localhost:3000
140NODE_ENV=development
141 
142# Database (if needed)
143DATABASE_URL=your_database_url_here
144```
145 
146### Development Commands
147When `package.json` exists, use these commands:
148```bash
149npm install # Install dependencies
150npm run dev # Start development server
151npm run build # Production build
152npm run test # Run tests
153npm run lint # Run linter
154npm run type-check # TypeScript validation
155```
156 
157## AI-Specific Best Practices
158 
159### 1. Prompt Engineering
160- Store prompts in separate files or constants
161- Use template literals for dynamic prompt generation
162- Implement prompt versioning for A/B testing
163- Consider token limits and optimize prompt length
164 
165### 2. Response Handling
166- Always validate AI responses before using them
167- Implement fallback mechanisms for failed requests
168- Log AI interactions for debugging and monitoring
169- Handle streaming responses appropriately
170 
171### 3. Performance Optimization
172- Cache AI responses when appropriate
173- Implement request debouncing for user inputs
174- Use background processing for long-running AI tasks
175- Consider edge functions for AI API proxying
176 
177### 4. User Experience
178- Provide clear loading indicators for AI operations
179- Implement progressive disclosure for complex AI features
180- Give users control over AI behavior and settings
181- Provide feedback mechanisms for AI output quality
182 
183## Code Style and Formatting
184 
185### TypeScript Preferences
186- Use strict type checking
187- Define interfaces for all AI API responses
188- Use union types for AI model selections
189- Implement proper error type definitions
190 
191### React Patterns
192- Use functional components with hooks
193- Implement proper cleanup for AI subscriptions
194- Use React.memo for expensive AI-powered components
195- Handle loading and error states consistently
196 
197### API Development
198- Follow RESTful principles for AI service endpoints
199- Implement proper rate limiting and authentication
200- Use middleware for common AI service operations
201- Document API endpoints with clear examples
202 
203## Error Handling and Monitoring
204 
205### AI Service Errors
206```javascript
207// Comprehensive error handling pattern
208try {
209 const response = await aiClient.complete(prompt);
210 return response;
211} catch (error) {
212 if (error.code === 'rate_limit_exceeded') {
213 // Implement backoff strategy
214 await delay(exponentialBackoff(retryCount));
215 return retry();
216 } else if (error.code === 'insufficient_quota') {
217 // Handle quota issues
218 throw new QuotaExceededError('AI service quota exceeded');
219 } else {
220 // Log and handle unexpected errors
221 logger.error('AI service error', error);
222 throw new AIServiceError('Unexpected AI service error');
223 }
 
 
 
 
224}
225```
226 
227### Monitoring and Logging
228- Log AI API usage and costs
229- Monitor response times and error rates
230- Track user interactions with AI features
231- Implement health checks for AI services
232 
233## Documentation Requirements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234 
235### Code Documentation
236- Document all AI-related functions and components
237- Include usage examples for AI integrations
238- Explain prompt engineering decisions
239- Document environment setup requirements
240 
241### API Documentation
242- Document all AI service endpoints
243- Include request/response examples
244- Explain rate limiting and authentication
245- Provide troubleshooting guides
246 
247## Security Considerations
248 
249### Data Privacy
250- Avoid sending sensitive user data to AI services
251- Implement data anonymization where possible
252- Follow GDPR and privacy regulations
253- Document data usage and retention policies
254 
255### API Security
256- Validate all inputs before sending to AI services
257- Implement proper CORS settings
258- Use HTTPS for all AI API communications
259- Regularly rotate API keys and secrets
260 
261Remember: This repository is designed as a foundation for AI projects. Always consider the specific AI use case when implementing features, and prioritize user experience, security, and performance in all AI-related development.
@@ −1 +1 @@
1−# Development Guidelines
1+# Cursor Rules for Megarepo - AI Setup Repository
22  
3−## Technology Stack
4−This repository is pre-configured for **Node.js/Next.js development** with AI integrations.
3+You are an expert AI developer working in the Megarepo, a comprehensive AI setup repository designed for AI-related projects. Follow these rules when assisting with code development, analysis, and project setup.
54  
6−### When Source Code is Added
7−Follow these patterns based on existing repository guidelines:
5+## Repository Overview
86  
9−```bash
10−# Always verify package.json exists first
11−test -f package.json && echo "Node.js project detected" || echo "No package.json found"
7+This is a minimal AI setup repository template configured for Node.js/Next.js development. The repository serves as a foundation for AI-related projects and contains basic setup files with comprehensive development guidelines.
128  
13−# Install dependencies with appropriate timeout
14−npm install # Allow 10+ minutes for completion
9+**Current State**: Minimal setup with basic configuration files
10+- Use these rules to guide development when source code is added
11+- Follow Node.js/Next.js patterns and best practices
12+- Prioritize AI-specific development patterns and security
1513  
16−# Build with extended timeout for AI projects
17−npm run build # Allow 60+ minutes - AI projects can have complex builds
14+## Core Development Principles
1815  
19−# Run tests with adequate time
20−npm test # Allow 30+ minutes for comprehensive test suites
21−```
22−# Build with reasonable timeout for most projects
23−npm run build # Allow 15-30 minutes for most Node.js/Next.js builds with AI integrations
16+### 1. AI-First Development
17+- Prioritize AI integration patterns and best practices
18+- Consider model performance, API efficiency, and token usage
19+- Implement proper error handling for AI service failures
20+- Design for scalability with AI workloads
2421  
25−# Run tests with adequate time
26−npm test # Allow 30+ minutes for comprehensive test suites
27−## AI Integration Best Practices
22+### 2. Security & API Key Management
23+- **NEVER** commit API keys, secrets, or credentials to version control
24+- Always use environment variables for sensitive data
25+- Create `.env.example` files to document required environment variables
26+- Implement proper API key rotation and management patterns
27+- Use secure storage solutions for production deployments
2828  
29−### Preferred AI Dependencies
30−When adding AI functionality, use these established packages:
29+### 3. Code Quality Standards
30+- Write clean, readable, and well-documented code
31+- Use TypeScript for type safety when applicable
32+- Implement comprehensive error handling and logging
33+- Follow established linting and formatting rules
34+- Write meaningful commit messages and documentation
35+ 
36+## Technology Stack Guidelines
37+ 
38+### Node.js/Next.js Development
39+- Follow Next.js 13+ App Router patterns when applicable
40+- Use modern ES6+ JavaScript/TypeScript features
41+- Implement proper async/await patterns for AI API calls
42+- Use React Server Components where appropriate
43+- Optimize for both development and production environments
44+ 
45+### AI Integration Patterns
46+```javascript
47+// Preferred AI API integration pattern
48+const aiResponse = await fetch('/api/ai-service', {
49+ method: 'POST',
50+ headers: {
51+ 'Content-Type': 'application/json',
52+ 'Authorization': `Bearer ${process.env.AI_API_KEY}`
53+ },
54+ body: JSON.stringify({ prompt, options })
55+});
56+ 
57+if (!aiResponse.ok) {
58+ throw new Error(`AI service error: ${aiResponse.status}`);
59+}
60+```
61+ 
62+### Common AI Dependencies
63+When adding AI functionality, prefer these well-established packages:
3164 - `openai` - Official OpenAI API client
32−- `@langchain/core` - LangChain framework for AI workflows
33−- `@vercel/ai` - Vercel AI SDK for streaming and UI integration
65+- `@langchain/core` - LangChain framework
66+- `@vercel/ai` - Vercel AI SDK
3467 - `@huggingface/inference` - Hugging Face API client
35−- `@anthropic-ai/sdk` - Anthropic Claude API client
3668  
37−### Code Organization
38−- Place AI client configurations in `src/lib/` directory
39−- Create reusable AI components in `src/components/ai/`
40−- Implement API routes for AI services in `src/app/api/` (Next.js App Router)
41−- Define TypeScript types for AI responses in `src/types/`
69+## File Structure and Organization
4270  
43−### Error Handling Pattern
71+### Expected Project Structure
72+```
73+.
74+├── README.md # Project documentation
75+├── LICENSE # MIT license
76+├── .gitignore # Node.js/Next.js patterns
77+├── .cursorrules # This file
78+├── .env.example # Environment variable template
79+├── package.json # Dependencies and scripts
80+├── next.config.js # Next.js configuration
81+├── tsconfig.json # TypeScript configuration
82+├── src/
83+│ ├── app/ # Next.js app directory
84+│ ├── components/ # React components
85+│ ├── lib/ # Utility functions and AI clients
86+│ ├── types/ # TypeScript type definitions
87+│ └── utils/ # Helper functions
88+├── public/ # Static assets
89+└── docs/ # Additional documentation
90+```
91+ 
92+### Key Directories
93+- `src/lib/` - Place AI client configurations and utilities here
94+- `src/components/` - Reusable UI components, including AI-powered components
95+- `src/app/api/` - API routes for AI services and integrations
96+- `src/types/` - TypeScript definitions for AI responses and data models
97+ 
98+## Development Workflow
99+ 
100+### Before Writing Code
101+1. Check if `package.json` exists before running npm commands
102+2. Review existing environment variable requirements
103+3. Understand the AI service integrations being used
104+4. Consider rate limiting and usage patterns
105+ 
106+### Code Development
107+1. Write TypeScript definitions for AI API responses
108+2. Implement proper error handling for AI service failures
109+3. Add loading states and user feedback for AI operations
110+4. Consider performance implications of AI API calls
111+5. Implement caching strategies where appropriate
112+ 
113+### Testing AI Components
44114 ```javascript
45−// Implement comprehensive error handling for AI services
46−try {
47− const response = await aiClient.chat.completions.create({
48− model: "gpt-4",
49− messages: [{ role: "user", content: prompt }]
115+// Example AI component test pattern
116+describe('AI Chat Component', () => {
117+ it('handles API errors gracefully', async () => {
118+ // Mock AI service failure
119+ mockAIService.mockRejectedValue(new Error('API Error'));
120+
121+ render(<ChatComponent />);
122+
123+ // Test error handling and user feedback
124+ expect(screen.getByText(/error/i)).toBeInTheDocument();
50125 });
51− return response.choices[0].message.content;
126+});
127+```
128+ 
129+## Environment Setup
130+ 
131+### Required Environment Variables
132+Create `.env.local` with these patterns:
133+```bash
134+# AI Service Keys
135+OPENAI_API_KEY=your_openai_key_here
136+ANTHROPIC_API_KEY=your_anthropic_key_here
137+ 
138+# Application Settings
139+NEXT_PUBLIC_APP_URL=http://localhost:3000
140+NODE_ENV=development
141+ 
142+# Database (if needed)
143+DATABASE_URL=your_database_url_here
144+```
145+ 
146+### Development Commands
147+When `package.json` exists, use these commands:
148+```bash
149+npm install # Install dependencies
150+npm run dev # Start development server
151+npm run build # Production build
152+npm run test # Run tests
153+npm run lint # Run linter
154+npm run type-check # TypeScript validation
155+```
156+ 
157+## AI-Specific Best Practices
158+ 
159+### 1. Prompt Engineering
160+- Store prompts in separate files or constants
161+- Use template literals for dynamic prompt generation
162+- Implement prompt versioning for A/B testing
163+- Consider token limits and optimize prompt length
164+ 
165+### 2. Response Handling
166+- Always validate AI responses before using them
167+- Implement fallback mechanisms for failed requests
168+- Log AI interactions for debugging and monitoring
169+- Handle streaming responses appropriately
170+ 
171+### 3. Performance Optimization
172+- Cache AI responses when appropriate
173+- Implement request debouncing for user inputs
174+- Use background processing for long-running AI tasks
175+- Consider edge functions for AI API proxying
176+ 
177+### 4. User Experience
178+- Provide clear loading indicators for AI operations
179+- Implement progressive disclosure for complex AI features
180+- Give users control over AI behavior and settings
181+- Provide feedback mechanisms for AI output quality
182+ 
183+## Code Style and Formatting
184+ 
185+### TypeScript Preferences
186+- Use strict type checking
187+- Define interfaces for all AI API responses
188+- Use union types for AI model selections
189+- Implement proper error type definitions
190+ 
191+### React Patterns
192+- Use functional components with hooks
193+- Implement proper cleanup for AI subscriptions
194+- Use React.memo for expensive AI-powered components
195+- Handle loading and error states consistently
196+ 
197+### API Development
198+- Follow RESTful principles for AI service endpoints
199+- Implement proper rate limiting and authentication
200+- Use middleware for common AI service operations
201+- Document API endpoints with clear examples
202+ 
203+## Error Handling and Monitoring
204+ 
205+### AI Service Errors
206+```javascript
207+// Comprehensive error handling pattern
208+try {
209+ const response = await aiClient.complete(prompt);
210+ return response;
52211 } catch (error) {
53212 if (error.code === 'rate_limit_exceeded') {
54− throw new AIRateLimitError('Rate limit exceeded, please try again later');
213+ // Implement backoff strategy
214+ await delay(exponentialBackoff(retryCount));
215+ return retry();
216+ } else if (error.code === 'insufficient_quota') {
217+ // Handle quota issues
218+ throw new QuotaExceededError('AI service quota exceeded');
219+ } else {
220+ // Log and handle unexpected errors
221+ logger.error('AI service error', error);
222+ throw new AIServiceError('Unexpected AI service error');
55223 }
56− if (error.code === 'insufficient_quota') {
57− throw new AIQuotaError('API quota exceeded');
58− }
59− throw new AIServiceError(`AI service failed: ${error.message}`);
60224 }
61225 ```
62226  
63−## File Structure Standards
64−Follow the established minimal structure and expand thoughtfully:
227+### Monitoring and Logging
228+- Log AI API usage and costs
229+- Monitor response times and error rates
230+- Track user interactions with AI features
231+- Implement health checks for AI services
65232  
66−```
67−.
68−├── .clinerules/ # Cline AI rules (this directory)
69−├── .github/ # GitHub workflows and Copilot instructions
70−├── .kiro/steering/ # Kiro AI steering files
71−├── .cursorrules # Cursor AI development rules
72−├── CLAUDE.md # Claude AI specific configuration
73−├── GEMINI.md # Gemini CLI configuration
74−├── AGENT.md # Universal AI agent instructions
75−├── package.json # Dependencies and scripts (when added)
76−├── src/ # Source code (when added)
77−│ ├── lib/ # AI clients and utilities
78−│ ├── components/ # React components including AI components
79−│ ├── app/ # Next.js App Router (pages and API routes)
80−│ └── types/ # TypeScript definitions
81−└── public/ # Static assets
82−```
233+## Documentation Requirements
83234  
84−## Development Workflow
85−1. **Before Changes**: Check repository state and existing patterns
86−2. **During Development**: Follow TypeScript best practices and AI patterns
87−3. **Testing**: Include AI service mocks and error scenario testing
88−4. **Documentation**: Update relevant AI configuration files as needed
235+### Code Documentation
236+- Document all AI-related functions and components
237+- Include usage examples for AI integrations
238+- Explain prompt engineering decisions
239+- Document environment setup requirements
240+ 
241+### API Documentation
242+- Document all AI service endpoints
243+- Include request/response examples
244+- Explain rate limiting and authentication
245+- Provide troubleshooting guides
246+ 
247+## Security Considerations
248+ 
249+### Data Privacy
250+- Avoid sending sensitive user data to AI services
251+- Implement data anonymization where possible
252+- Follow GDPR and privacy regulations
253+- Document data usage and retention policies
254+ 
255+### API Security
256+- Validate all inputs before sending to AI services
257+- Implement proper CORS settings
258+- Use HTTPS for all AI API communications
259+- Regularly rotate API keys and secrets
260+ 
261+Remember: This repository is designed as a foundation for AI projects. Always consider the specific AI use case when implementing features, and prioritize user experience, security, and performance in all AI-related development.
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack