Cursor Rule: Front End
optics/cursor-rule-front-endFreeUtility
Cursor rule file for front-end development guidelines.
See it running
Open the demo on optics
optics.agusmayol.com.ar/components/cursor-rule-front-endInstall it
npx shadcn@latest add https://optics.agusmayol.com.ar/r/cursor-rule-front-end.jsonSource
1---2description: Rules for front-end development3globs: *4alwaysApply: false5---6# Frontend Development Rules78## Languages and Frameworks910Expert in React, Next.js, JavaScript, TypeScript, HTML, CSS, TailwindCSS, Shadcn, Base UI.1112Use JavaScript by default. Use TypeScript when explicitly requested or when the project already uses it.1314Prioritize TailwindCSS utility classes for styling. Avoid separate CSS files for component-specific styles. Use CSS modules or global styles only for truly global definitions.1516## Next.js 16 Core Features1718Next.js 16 is the current stable version. Key features include:1920Turbopack is now the default bundler (2-5x faster builds, up to 10x faster Fast Refresh). No need to specify --turbopack flag anymore.2122Cache Components with "use cache" directive for explicit, opt-in caching. All dynamic code executes at request time by default.2324React Compiler (stable) for automatic memoization. Enable with reactCompiler: true in next.config.js.2526Proxy.ts replaces middleware.ts for network boundary handling (edge runtime deprecated in proxy, use nodejs runtime).2728Enhanced routing with layout deduplication and incremental prefetching for faster navigations.2930React 19.2 features: View Transitions, useEffectEvent, and Activity component.3132## Code Structure and Functions3334Use function declarations for React components. Use arrow functions for callbacks and inline functions.3536Good:37```javascript38function UserProfile({ user }) {39 return <div>...</div>40}41```4243Avoid:44```javascript45const UserProfile = ({ user }) => {...}46```4748Name functions based on what they do, not the event they respond to. Be specific and semantic.4950Good: `submitForm`, `deleteUser`, `closeModal`, `toggleSidebar`51Avoid: `handleClick`, `handleSubmit`, `handleChange`5253Exception: Generic event handlers in reusable components can use `onEvent` pattern for props (onSelect, onClick, onChange) to match React conventions.5455Use descriptive names that reveal intent. Prefer clarity over brevity.5657## State Management5859Minimize useState by deriving values when possible. Don't store what you can calculate.6061Group related state together. Use objects for related values or useReducer for complex state logic.6263Keep state as local as possible. Lift state only when multiple components need to share it.6465Use state updater functions when new state depends on previous state:66```javascript67setCount(prev => prev + 1)68```6970## Server Components and Client Components7172// … truncated
Files it writes
More from optics
All 79 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Cursor Rule: Back Endcursor-rule-back-end | optics | Utilities | Free | no deps | |
| Cursor Rule: Bulk Processingcursor-rule-bulk-processing | optics | Utilities | Free | no deps | |
| Cursor Rule: Commits Conventioncursor-rule-commits-convention | optics | Utilities | Free | no deps | |
| Cursor Rule: Generalcursor-rule-general | optics | Utilities | Free | no deps | |
| Cursor Rule: React Optimizationcursor-rule-react-optimization | optics | Utilities | Free | no deps | |
| Cursor Rule: Web Interface Guidelinescursor-rule-web-interface-guidelines | optics | Utilities | Free | no deps | |
| Get strict contextget-strict-context | optics | Utilities | Free | no deps | |
| Use auto heightuse-auto-height | optics | Utilities | Free | no deps |
