| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 14 | 8 | 0% |
| Commands | 0 | 3 | 1 | 0% |
| Section tags | 3 | 4 | 0 | 43% |
What each file covers
Sections
0 shared · 14 only in A · 8 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
- − Development Workflow
- + Prompt Engineering Templates
- + Prompt Engineering Best Practices
- + 1. Prompt Structure Templates
- + 2. Prompt Versioning
- + 3. Dynamic Prompt Generation
- + 4. Context Management
- + 5. Prompt Optimization Techniques
- + 6. Testing and Validation
Commands
0 shared · 3 only in A · 1 only in B- − npm install
- − npm run build
- − npm test
- + task: string,
Section tags
3 shared · 4 only in A · 0 only in B- − setup
- − build
- − dependencies
- − agent-behaviour
- test
- code-style
- architecture
Line diff
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 · .cursor/rules/prompt-engineering.mdc
@@ +1 @@
1---
2description: "Prompt engineering templates and best practices for AI model interactions"
3alwaysApply: false
4---
5
6# Prompt Engineering Templates
7
8Guidelines and templates for effective AI prompt engineering. Use `@prompt-engineering` to include this rule.
9
10## Prompt Engineering Best Practices
11
12### 1. Prompt Structure Templates
13```typescript
14// System prompt template
15const SYSTEM_PROMPT = `
16You are an expert assistant specialized in [DOMAIN].
17Your responses should be:
18- Accurate and factual
19- Concise but comprehensive
20- Professional in tone
21- Focused on [SPECIFIC_GOAL]
22
23Context: [CONTEXT_INFORMATION]
24`;
25
26// User prompt template
27const createUserPrompt = (input: string, context?: string) => `
28Task: ${input}
29${context ? `Additional context: ${context}` : ''}
30
31Please provide a response that follows the system guidelines.
32`;
33```
34
35### 2. Prompt Versioning
36- Store prompts in separate configuration files
37- Version prompts for A/B testing
38- Track prompt performance and iterate
39- Document prompt changes and rationale
40
41### 3. Dynamic Prompt Generation
42```typescript
43interface PromptConfig {
44 system: string;
45 temperature: number;
46 maxTokens: number;
47 stopSequences?: string[];
48}
49
50const generatePrompt = (
51 task: string,
52 userInput: string,
53 config: PromptConfig
54) => {
55 // Build context-aware prompts
56 // Include relevant examples
57 // Optimize for token efficiency
58};
59```
60
61### 4. Context Management
62- Implement conversation memory
63- Manage context window limits
64- Prioritize relevant information
65- Handle context overflow gracefully
66
67### 5. Prompt Optimization Techniques
68- Use few-shot learning examples
69- Implement chain-of-thought prompting
70- Apply role-based prompting
71- Include output format specifications
72
73### 6. Testing and Validation
74- Create test suites for prompt effectiveness
75- Measure response quality metrics
76- Compare different prompt versions
77- Monitor prompt performance in production
@@ −1 +1 @@
1−# Development Guidelines
1+---
2+description: "Prompt engineering templates and best practices for AI model interactions"
3+alwaysApply: false
4+---
25
3−## Technology Stack
4−This repository is pre-configured for **Node.js/Next.js development** with AI integrations.
6+# Prompt Engineering Templates
57
6−### When Source Code is Added
7−Follow these patterns based on existing repository guidelines:
8+Guidelines and templates for effective AI prompt engineering. Use `@prompt-engineering` to include this rule.
89
9−```bash
10−# Always verify package.json exists first
11−test -f package.json && echo "Node.js project detected" || echo "No package.json found"
10+## Prompt Engineering Best Practices
1211
13−# Install dependencies with appropriate timeout
14−npm install # Allow 10+ minutes for completion
12+### 1. Prompt Structure Templates
13+```typescript
14+// System prompt template
15+const SYSTEM_PROMPT = `
16+You are an expert assistant specialized in [DOMAIN].
17+Your responses should be:
18+- Accurate and factual
19+- Concise but comprehensive
20+- Professional in tone
21+- Focused on [SPECIFIC_GOAL]
1522
16−# Build with extended timeout for AI projects
17−npm run build # Allow 60+ minutes - AI projects can have complex builds
23+Context: [CONTEXT_INFORMATION]
24+`;
1825
19−# Run tests with adequate time
20−npm test # Allow 30+ minutes for comprehensive test suites
26+// User prompt template
27+const createUserPrompt = (input: string, context?: string) => `
28+Task: ${input}
29+${context ? `Additional context: ${context}` : ''}
30+
31+Please provide a response that follows the system guidelines.
32+`;
2133 ```
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
2434
25−# Run tests with adequate time
26−npm test # Allow 30+ minutes for comprehensive test suites
27−## AI Integration Best Practices
35+### 2. Prompt Versioning
36+- Store prompts in separate configuration files
37+- Version prompts for A/B testing
38+- Track prompt performance and iterate
39+- Document prompt changes and rationale
2840
29−### Preferred AI Dependencies
30−When 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
46−try {
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}`);
41+### 3. Dynamic Prompt Generation
42+```typescript
43+interface PromptConfig {
44+ system: string;
45+ temperature: number;
46+ maxTokens: number;
47+ stopSequences?: string[];
6048 }
49+
50+const generatePrompt = (
51+ task: string,
52+ userInput: string,
53+ config: PromptConfig
54+) => {
55+ // Build context-aware prompts
56+ // Include relevant examples
57+ // Optimize for token efficiency
58+};
6159 ```
6260
63−## File Structure Standards
64−Follow the established minimal structure and expand thoughtfully:
61+### 4. Context Management
62+- Implement conversation memory
63+- Manage context window limits
64+- Prioritize relevant information
65+- Handle context overflow gracefully
6566
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−```
67+### 5. Prompt Optimization Techniques
68+- Use few-shot learning examples
69+- Implement chain-of-thought prompting
70+- Apply role-based prompting
71+- Include output format specifications
8372
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
73+### 6. Testing and Validation
74+- Create test suites for prompt effectiveness
75+- Measure response quality metrics
76+- Compare different prompt versions
77+- Monitor prompt performance in production
