

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234567# TypeScript & Utilities Rules89## Shared Type Definitions1011### Core Application Types12```tsx13// lib/types.ts - Always define shared types here14export interface User {15 id: string16 email: string17 name: string18 avatar?: string19 role: UserRole20 createdAt: string21 updatedAt: string22}2324export interface ApiResponse<T> {25 data: T26 message: string27 success: boolean28 meta?: {29 total: number30 page: number31 limit: number32 }33}3435export type UserRole = 'admin' | 'user' | 'guest'36export type Theme = 'light' | 'dark' | 'system'37export type LoadingState = 'idle' | 'loading' | 'success' | 'error'38```3940### Form Type Patterns41```tsx42// Derive form types from Zod schemas43export type UserFormData = z.infer<typeof userSchema>44export type CreateUserData = z.infer<typeof createUserSchema>45export type UpdateUserData = z.infer<typeof updateUserSchema>4647// Component prop types48export interface UserCardProps {49 user: User50 onEdit: (id: string) => void51 onDelete: (id: string) => void52 className?: string53}54```5556## Utility Functions5758### Keep Existing cn Function59```tsx60// lib/utils.ts - NEVER modify this function61export function cn(...inputs: ClassValue[]) {62 return twMerge(clsx(inputs))63}64```6566### Common Utility Patterns67```tsx68// Date formatting69export function formatDate(date: Date | string, format?: string): string {70 return new Intl.DateTimeFormat('en-US', {71 year: 'numeric',72 month: 'short',73 day: 'numeric',74 ...format75 }).format(new Date(date))76}7778// Debounce utility79export function debounce<T extends (...args: any[]) => any>(80 func: T,81 wait: number82): (...args: Parameters<T>) => void {83 let timeout: NodeJS.Timeout84 return (...args: Parameters<T>) => {85 clearTimeout(timeout)86 timeout = setTimeout(() => func(...args), wait)87 }88}8990// Sleep utility for demos/testing91export const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))92```9394## Constants Organization9596### API and Route Constants97```tsx98// lib/constants.ts99export const API_ENDPOINTS = {100 USERS: '/api/users',101 PRODUCTS: '/api/products',102 AUTH: '/api/auth',103} as const104105export const QUERY_KEYS = {106 USERS: 'users',107 PRODUCTS: 'products',108 USER_PROFILE: 'user-profile',109} as const110111export const ROUTES = {112 HOME: '/',113 DASHBOARD: '/dashboard',114 USERS: '/users',115 PROFILE: '/profile',116} as const117```118119### Configuration Constants120```tsx121export const APP_CONFIG = {122 APP_NAME: 'My App',123 API_BASE_URL: import.meta.env.VITE_API_URL || 'http://localhost:3000',124 ITEMS_PER_PAGE: 10,125 MAX_FILE_SIZE: 5 * 1024 * 1024, // 5MB126} as const127128export const BREAKPOINTS = {129 sm: '640px',130 md: '768px',131 lg: '1024px',132 xl: '1280px',133 '2xl': '1536px',134} as const135```136137## TypeScript Best Practices138139### Generic Patterns140```tsx141// API response wrapper142export interface PaginatedResponse<T> {143 data: T[]144 meta: {145 total: number146 page: number147 limit: number148 totalPages: number149 }150}151152// Generic hook return type153export interface UseQueryResult<T> {154 data: T | undefined155 isLoading: boolean156 error: Error | null157 refetch: () => void158}159```160161### Environment Variables Typing162```tsx163// vite-env.d.ts additions164interface ImportMetaEnv {165 readonly VITE_API_URL: string166 readonly VITE_APP_NAME: string167 // Add more environment variables as needed168}169170interface ImportMeta {171 readonly env: ImportMetaEnv172}173```174175## Type Anti-Patterns176- Using `any` type177- Inline interface definitions in components178- Not leveraging Zod for runtime validation179- Duplicate type definitions across files180181## Type Best Practices182- Define shared types in `lib/types.ts`183- Use Zod schemas for validation and type inference184- Leverage TypeScript strict mode185- Use proper generic constraints186
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/architecture.instructions.md · 65 | Copilot instructions | stylearchtypesdatabase+2 | 69/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/core.mdc · 65 | Cursor rules | buildlint-formatarchui+1 | 92/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/forms.mdc · 65 | Cursor rules | setupstyledo-not | 73/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/hooks.mdc · 65 | Cursor rules | styleuido-not | 61/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/quality.mdc · 65 | Cursor rules | buildlint-formatstyleui+3 | 88/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/services.mdc · 65 | Cursor rules | archtypesdo-not | 73/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/components.instructions.md · 65 | Copilot instructions | styleuido-not | 61/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/design.instructions.md · 65 | Copilot instructions | lint-formatstyleuido-not | 61/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/development.instructions.md · 65 | Copilot instructions | setupbuildtestlint-format+7 | 88/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 65 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/hooks.instructions.md · 65 | Copilot instructions | styleui | 54/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/lib.instructions.md · 65 | Copilot instructions | archtypesdo-not | 69/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/pages.instructions.md · 65 | Copilot instructions | archuido-not | 69/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/quality.instructions.md · 65 | Copilot instructions | lint-formatdeploymentdo-not | 63/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/reusable.instructions.md · 65 | Copilot instructions | uido-notagent-behaviour | 32/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/components.mdc · 65 | Cursor rules | stylearchuido-not | 65/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.cursor/rules/design.mdc · 65 | Cursor rules | styleuido-not | 65/100 | 14 days ago | |
| chihebnabil/lovable-boilerplateCLAUDE.md · 65 | CLAUDE.md | setupbuildtestlint-format+5 | 89/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/chihebnabil-lovable-boilerplate-cursor-rules-typescript)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.