Skip to content
Prompt

bklit — Cursor Rules

by bklit

AI Summary

This Cursor rules booster provides developers with standardized patterns for data fetching using tRPC and real-time SSE, including server/client component examples and best practices for React Query and Prisma integration.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "bklit — Cursor Rules" prompt rules to my project.
Repository: https://github.com/bklit/bklit

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

Data fetching patterns with tRPC and real-time SSE

Data Fetching

Use tRPC for data fetching and check our schema.prisma file for database models.

tRPC Patterns

`tsx // Server component - use caller directly const data = await trpc.session.getById({ sessionId, projectId, organizationId }); // Client component - use useQuery const { data, isLoading } = useQuery( trpc.session.liveUsers.queryOptions({ projectId, organizationId }) ); `

Best Practices

• Always wrap client requests in Suspense with skeleton.tsx fallbacks • Avoid useEffect for data fetching - prefer React Query's declarative approach • Use staleTime and refetchInterval for caching strategy • Invalidate queries with queryClient.invalidateQueries({ queryKey: [...] })

Real-Time Data

For live/real-time features, use our SSE-based hooks instead of polling: `tsx import { useLiveEventStream } from "@/hooks/use-live-event-stream"; // Subscribe to real-time events (pageviews, custom events, session ends) const { isConnected } = useLiveEventStream(projectId, { onPageview: (data) => { / handle pageview / }, onEvent: (data) => { / handle custom event / }, onSessionEnd: (data) => { / handle session end / }, }); `

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 2mo ago
Active
Adoption100+ stars on GitHub
229 ★ · Growing
DocsMissing or thin
Undocumented

GitHub Signals

Stars229
Forks25
Issues5
Updated2mo ago
View on GitHub
No License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more