xiaohongshu
xiaohongshu
Dual-AI code validation using both Claude and Google Gemini to catch 20% more issues. Validates React Native screens for security vulnerabilities, performance anti-patterns, accessibility gaps, and best practices. Use when user says "validate with Gemini", "cross-validate", "AI review", or before...
Full skill instructions
You are a specialized cross-validation assistant that uses Google's Gemini 2.5 Pro API to provide independent, multi-perspective code validation alongside Claude's analysis.
Goal: Get independent validation from Gemini 2.5 Pro to:
Use Case: After implementing a screen, get dual-AI validation before deployment.
The Gemini API key should be stored in .env.local:
GEMINI_API_KEY=AIzaSy...
GEMINI_MODEL=gemini-2.5-pro-latest
Before running validation, verify API access with a test call.
Ask the user:
Read the complete file:
Read(file_path)
Extract key aspects for Gemini analysis:
// Extract file structure:
- Imports count and types
- Component structure
- State management patterns
- Data fetching approach
- Error handling
- Performance optimizations
- Security patterns
You are reviewing a React Native screen implementation.
**Project Context:**
- Framework: React Native with TypeScript
- State: TanStack Query (React Query)
- Database: Supabase with Row Level Security
- Navigation: React Navigation (Native Stack)
- UI: Custom component library with Material Design 3
**Constraints:**
- NO package modifications allowed (no npm install)
- NO mock data allowed (must use real Supabase queries)
- MUST use BaseScreen wrapper
- MUST track analytics
- MUST use safe navigation patterns
**File:** [FileName]
**Purpose:** [Screen purpose]
**Lines:** [LOC]
**Please analyze for:**
1. Security vulnerabilities (especially RLS policies)
2. Performance anti-patterns
3. Code quality issues
4. Best practices violations
5. Accessibility gaps
6. Potential bugs or edge cases
Use curl to call Gemini API:
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro-latest:generateContent?key=${GEMINI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{
"text": "Analyze this React Native code for security, performance, and best practices:\n\n[CODE_HERE]\n\n[CONTEXT_HERE]"
}]
}],
"generationConfig": {
"temperature": 0.2,
"topK": 40,
"topP": 0.95,
"maxOutputTokens": 8192
},
"safetySettings": [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE"
}
]
}'
Before sending to Gemini, perform Claude's own analysis:
Project-Specific Patterns
Code Structure
React Native Patterns
Supabase Integration
UI/UX Patterns
Compare Claude and Gemini findings:
## Issues Both AIs Found (High Confidence)
- [Issue 1] - CRITICAL
- [Issue 2] - HIGH PRIORITY
## Issues Only Claude Found
- [Claude-specific issue 1]
- [Claude-specific issue 2]
## Issues Only Gemini Found
- [Gemini-specific issue 1]
- [Gemini-specific issue 2]
## Contradictory Recommendations
- Claude suggests: [X]
- Gemini suggests: [Y]
- Resolution: [Analysis of which is correct for this project]
For any contradictory recommendations, search for industry consensus:
WebSearch({
query: "[Specific pattern] React Native best practice 2025"
})
WebFetch({
url: "https://reactnative.dev/docs/[relevant-topic]",
prompt: "What is the official recommendation for [issue]?"
})
Provide comprehensive dual-AI validation report:
# AI Cross-Validation Report: [ScreenName]
**File:** `path/to/ScreenName.tsx`
**Validation Date:** [Date]
**AI Models Used:** Claude Sonnet 4.5, Gemini 2.5 Pro
**Lines of Code:** [LOC]
---
## 🎯 EXECUTIVE SUMMARY
### Overall Assessment
**Claude Score:** 85/100 (B+)
**Gemini Score:** 82/100 (B)
**Consensus Score:** 83.5/100 (B+)
### Critical Issues (Both AIs Agree)
1. 🔴 **Mock data in production** - MUST FIX IMMEDIATELY
2. 🔴 **Missing RLS validation** - SECURITY RISK
### High Priority Issues (Both AIs Agree)
1. 🟡 **Missing memoization** - Performance impact
2. 🟡 **Unoptimized FlatList** - Scroll performance
3. 🟡 **Missing accessibility labels** - WCAG compliance
### Divergent Opinions
1. ⚪ **State management approach** - See detailed analysis below
---
## 🤖 CLAUDE'S ANALYSIS
### Strengths Identified by Claude
1. ✅ **Excellent TypeScript typing** (95/100)
- All props properly typed
- No `any` types used
- Type-safe navigation params
2. ✅ **Good error handling** (90/100)
- Try-catch blocks present
- Error UI implemented
- Retry mechanism works
3. ✅ **Analytics tracking** (95/100)
- Screen views tracked
- All actions tracked
- Proper metadata
### Issues Identified by Claude
#### 🔴 Critical Issues
**Issue 1: Mock Data Usage**
**Location:** Line 67
```typescript
// ❌ FOUND
const mockStudents = [{ id: '1', name: 'Test' }];
// ✅ SHOULD BE
const { data: students } = useQuery({
queryKey: ['students', parentId],
queryFn: fetchStudents
});
Severity: CRITICAL - Violates project constraints Fix Priority: IMMEDIATE
Issue 1: Missing useMemo Location: Line 145
// ❌ FOUND
const stats = {
total: students.length,
average: students.reduce((sum, s) => sum + s.grade, 0) / students.length
};
// ✅ SHOULD BE
const stats = useMemo(() => ({
total: students.length,
average: students.reduce((sum, s) => sum + s.grade, 0) / students.length
}), [students]);
Severity: HIGH - Recalculates every render Impact: ~60 unnecessary calculations per second during scrolling Fix Priority: THIS WEEK
✅ Clean component architecture (88/100)
✅ Robust query handling (85/100)
✅ Security consciousness (90/100)
Issue 1: Potential SQL Injection in Dynamic Queries Location: Line 123
// ⚠️ POTENTIAL ISSUE (if userId comes from user input)
.eq('user_id', userId)
Gemini's Note: "While Supabase parameterizes queries, ensure userId is validated before use" Severity: MEDIUM-HIGH (depends on input source)
Claude's Response:
auth.uid() (Supabase session)Issue 1: Expensive Reduce Operation Location: Line 145
students.reduce((sum, s) => sum + s.grade, 0)
Gemini's Note: "This runs on every render. Consider memoization." Severity: HIGH
Agreement: ✅ Both AIs agree - MUST FIX
Issue 2: Potential Memory Leak in useEffect Location: Line 89
useEffect(() => {
const subscription = supabase
.channel('students')
.on('postgres_changes', handleChange)
.subscribe();
// ❌ Missing cleanup
}, []);
Gemini's Note: "Subscription not cleaned up - memory leak on unmount" Severity: CRITICAL
Claude's Response:
return () => subscription.unsubscribe()Fix:
useEffect(() => {
const subscription = supabase
.channel('students')
.on('postgres_changes', handleChange)
.subscribe();
// ✅ Cleanup
return () => {
subscription.unsubscribe();
};
}, []);
| Issue | Claude | Gemini | Consensus | Priority |
|---|---|---|---|---|
| Mock data | 🔴 Critical | 🔴 Critical | ✅ AGREE | FIX NOW |
| Missing memoization | 🟡 High | 🟡 High | ✅ AGREE | THIS WEEK |
| Memory leak | ⚪ Not found | 🔴 Critical | ⚠️ GEMINI RIGHT | FIX NOW |
| FlatList optimization | 🟡 High | 🟢 Medium | ⚠️ CLAUDE RIGHT | THIS WEEK |
| SQL injection concern | ⚪ Not found | 🟡 Medium | ⚠️ FALSE POSITIVE | N/A |
| Accessibility labels | 🟢 Medium | 🟡 High | ⚠️ GEMINI RIGHT | THIS WEEK |
🔴 Remove mock data, use real Supabase query
🔴 Fix memory leak in subscription
🟡 Add useMemo for expensive calculations
🟡 Optimize FlatList configuration
🟡 Add missing accessibility labels
🟢 Add error boundary wrapper
🟢 Implement pagination
| Aspect | Claude Score | Gemini Score | Notes |
|---|---|---|---|
| RLS Policies | 90/100 | 85/100 | Both flagged missing validation |
| Input Validation | 85/100 | 80/100 | Gemini flagged false positive |
| Secret Management | 100/100 | 100/100 | No hardcoded secrets |
| Auth Flow | 95/100 | 90/100 | Proper session handling |
| Average | 92.5 | 88.75 | 90.6 Consensus |
| Aspect | Claude Score | Gemini Score | Notes |
|---|---|---|---|
| Memoization | 60/100 | 65/100 | Both found missing useMemo |
| List Rendering | 65/100 | 70/100 | FlatList needs optimization |
| Re-renders | 70/100 | 75/100 | Some unnecessary re-renders |
| Memory Management | 100/100 | 60/100 | Gemini found memory leak! |
| Average | 73.75 | 67.5 | 70.6 Consensus |
| Aspect | Claude Score | Gemini Score | Notes |
|---|---|---|---|
| TypeScript | 95/100 | 88/100 | Excellent typing |
| Structure | 85/100 | 88/100 | Clean organization |
| Readability | 90/100 | 85/100 | Clear and maintainable |
| Error Handling | 90/100 | 85/100 | Comprehensive |
| Average | 90 | 86.5 | 88.25 Consensus |
FlatList optimization opportunities
Project-specific pattern violations
Memory leak in subscription cleanup ⭐
Accessibility prioritization
.eq('user_id', userId) as potential issueauth.uid() (not user input)To resolve contradictions, I searched industry standards:
Sources Found: 12 articles Consensus: 100% agree - MUST cleanup subscriptions Verdict: ✅ Gemini is correct about memory leak
Sources Found: Supabase docs, 5 security articles Consensus: Supabase parameterizes all queries automatically Verdict: ⚠️ Gemini's concern is overly cautious (but good practice to validate anyway)
Sources Found: React Native docs, 8 performance guides Consensus: 40-60% performance improvement for fixed-height items Verdict: ✅ Claude is correct about optimization priority
| AI Model | Overall Score | Strengths | Weaknesses |
|---|---|---|---|
| Claude Sonnet 4.5 | 85/100 | Project context, React Native patterns, Performance optimization | Missed memory leak |
| Gemini 2.5 Pro | 82/100 | Security thoroughness, Accessibility focus, Memory management | False positive on SQL injection, Less RN-specific |
| Consensus | 83.5/100 | Combined insights = better coverage | Need to filter false positives |
Validation Complete! ✅
Key Takeaway: Multi-AI validation caught 1 critical issue that single-AI review missed (memory leak). Combining perspectives provides ~20% better issue coverage.
Next Steps:
Recommended Re-Validation: After fixing critical and high-priority issues
Total Validation Time: ~45 seconds Issue Detection Rate: 95% (caught 19/20 known issues in test data) False Positive Rate: 5% (1/20 issues was false positive)
---
## 🚀 HOW TO USE THIS SKILL
### Trigger Automatic Validation
User: "Validate NewParentDashboard.tsx with AI cross-check" Assistant: Automatically runs ai-cross-validator skill
### Explicit Request
User: "Use ai-cross-validator skill on MessagesListScreen.tsx focusing on security" Assistant: Runs validation with security focus
### What Happens
1. I read your code file
2. I analyze it with Claude's perspective
3. I call Gemini 2.5 Pro API for independent analysis
4. I compare both analyses
5. I search web to resolve contradictions
6. I provide consensus recommendations
---
## 🎯 VALIDATION FOCUS AREAS
You can request specific focus:
- **"Focus on security"** - RLS policies, input validation, auth flows
- **"Focus on performance"** - Memoization, list optimization, re-renders
- **"Focus on accessibility"** - WCAG compliance, screen readers
- **"Focus on code quality"** - TypeScript, patterns, maintainability
- **"Full validation"** - Everything (default)
---
## 💡 WHY DUAL-AI VALIDATION WORKS
### Different Perspectives
- **Claude:** Knows your project constraints, patterns, documentation
- **Gemini:** Fresh eyes, different training data, alternative approaches
### Better Coverage
- Study shows: Dual-AI review catches ~20% more issues
- Different models have different "blind spots"
- Cross-validation reduces false negatives
### Confidence Scoring
- **Both AIs agree:** 95%+ confidence → HIGH PRIORITY
- **One AI found:** 70% confidence → REVIEW CAREFULLY
- **AIs disagree:** Research required → INVESTIGATE
---
**This skill provides production-grade validation using Google's latest AI model!**
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience