Cursor rules for building AI-powered fortune telling systems with Gemini integration. Enforces TypeScript/React best practices, Next.js conventions, and structured project organization for divination applications.
This skill configures Cursor for building AI-powered fortune telling systems based on Google's Gemini API, with strict TypeScript/React conventions and Next.js best practices.
Enforce the following directory organization:
Apply these naming rules strictly:
1. **Components**: PascalCase with `.tsx` extension (e.g., `FortuneCard.tsx`)
2. **Pages**: kebab-case with `.tsx` extension (e.g., `fortune-reading.tsx`)
3. **Library files**: camelCase with `.ts` extension (e.g., `geminiClient.ts`)
4. **Type definitions**: PascalCase with `.types.ts` suffix (e.g., `Fortune.types.ts`)
5. **Test files**: Match source file name with `.test.ts` suffix (e.g., `geminiClient.test.ts`)
6. **Style modules**: Match component name with `.module.css` suffix (e.g., `FortuneCard.module.css`)
Organize imports in this exact sequence:
1. React imports
2. Next.js imports
3. External library imports
4. Internal/relative imports
5. Style imports
Example:
```typescript
import { useState } from 'react';
import { useRouter } from 'next/router';
import axios from 'axios';
import { FortuneService } from '@/lib/fortuneService';
import styles from './Fortune.module.css';
```
Example:
```typescript
/**
* FortuneCard displays a fortune reading result
*
* @example
* <FortuneCard
* result="Your fortune shows great prosperity"
* timestamp={new Date()}
* />
*/
interface FortuneCardProps {
result: string;
timestamp: Date;
}
export function FortuneCard({ result, timestamp }: FortuneCardProps) {
// Implementation
}
```
Example:
```typescript
/**
* Fetches fortune prediction from Gemini API
*
* @param birthDate - User's birth date in ISO format
* @param question - Fortune telling question
* @returns Promise resolving to fortune reading text
* @throws Error if API call fails
*/
async function getFortune(birthDate: string, question: string): Promise<string> {
// Implementation
}
```
Example:
```typescript
/**
* POST /api/fortune
*
* Request: { birthDate: string, question: string }
* Response: { fortune: string, timestamp: string }
*
* Errors:
* - 400: Invalid request payload
* - 500: Gemini API failure
*/
```
This ruleset references external configuration files:
Ensure these files exist in your project if referenced by your tooling.
1. **Type Safety**: Leverage TypeScript's strict mode for maximum type safety
2. **Component Isolation**: Keep components small, focused, and reusable
3. **Documentation First**: Write documentation as you code, not after
4. **Consistent Naming**: Follow naming conventions without exception
5. **Structured Organization**: Maintain clear directory hierarchy
This skill is optimized for:
When generating code, always validate against these rules and auto-format according to the specified conventions.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/xuanji-ai-fortune-system/raw