sdlc-kit / rules
Cursor rule1 starsChanged 10 days agoMITView on GitHub
Frontend standards for React + TypeScript + Tailwind CSS + shadcn/ui code.
- Reads credentials
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,183 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/00-ticket-workflow.mdcCursor rule
- .cursor/rules/10-general-standards.mdcCursor rule
- .cursor/rules/20-backend-standards.mdcCursor rule
- .cursor/rules/40-database-standards.mdcCursor rule
- .cursor/rules/50-testing-standards.mdcCursor rule
- backend-implementSkill
- chatSkill
- codebase-exploreSkill
- db-migrationSkill
- frontend-implementSkill
- gitlab-mrSkill
- implementation-planSkill
- jira-createSkill
- mr-feedbackSkill
- mr-reviewSkill
- quick-fixSkill
- run-checksSkill
- self-reviewSkill
- ticket-intakeSkill
- ticket-qaSkill
- write-testsSkill
The file
We split this 30-frontend-standards.mdc into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
No nested ternaries (in JSX too): use early returns or a small component.
- Very specific: line 31
Never put user data into dangerouslySetInnerHTML.
- Very specific: line 32
No direct DOM changes (document.querySelector(...), classList): use state, props or refs.
- Very specific: line 41
Every data view handles 4 states: loading (Skeleton), error (message + retry), empty (helpful text), success.
- Very specific: line 47
Use theme tokens (bg-background, text-muted-foreground, border-input), not raw colors like bg-gray-500.
- Very specific: line 49
Use an existing shadcn component before writing a custom one.
- Very specific: line 53
Every input has a label. Icon-only buttons have aria-label.
- Distinctive: line 54
Never show state by colour alone: add text or an icon.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: Frontend standards for React + TypeScript + Tailwind CSS + shadcn/ui code. globs: frontend/**/*.ts,frontend/**/*.tsx paths: frontend/**/*.ts,frontend/**/*.tsx alwaysApply: false --- # Frontend standards (React + TypeScript + Tailwind + shadcn/ui) ## Layout (follow the existing layout if it differs) | Path | Contains | |---------------------------------------|-------------------------------------------------------| | `src/components/ui/` | shadcn generated. Add with `npx shadcn@latest add <name>`. Don't hand-edit. | | `src/features/<feature>/components/` | One component per file, `PascalCase.tsx` | | `src/features/<feature>/hooks/` | `useX.ts` hooks (UI logic) | | `src/features/<feature>/api/` | fetch functions, TanStack Query hooks, `queryKeys.ts` | | `src/features/<feature>/schemas/` | zod schemas; types via `z.infer` | | `src/pages/` or `src/routes/` | Thin route components that compose feature parts | | `src/lib/` | api client, `cn()` and shared utils | ## TypeScript - Strict mode. No `any`, no `@ts-ignore`, no non-null `!`. `as` only for narrowing, with a comment. - API types come from the generated `src/api/schema.d.ts` when it exists; never hand-write them. Without it, they must match the backend response schema exactly (names, nullability): open the backend schema and compare. - No nested ternaries (in JSX too): use early returns or a small component. ## Components - Function components. Props type named `<Component>Props`. - Presentational components get data via props. Data fetching lives in `api/` hooks. - Move logic over ~15 lines out of JSX into a hook or helper. - Lists use a stable `key` (an id, never the array index). - Never put user data into `dangerouslySetInnerHTML`; React escapes plain text for you. - No direct DOM changes (`document.querySelector(...)`, `classList`): use state, props or refs. - Props passed down more than 3 levels → context, or restructure the tree. - No `useMemo`, `useCallback` or `React.memo` without a measured need. ## Data and forms - Server data: TanStack Query only. Never `fetch` inside `useEffect`. - Query keys come from `queryKeys.ts`. On mutation success, invalidate the affected keys. - Forms: `react-hook-form` + `zodResolver` + shadcn `Form` components. Show each field's error; show server errors (409/422) on the form; disable submit while pending. - Every data view handles 4 states: loading (`Skeleton`), error (message + retry), empty (helpful text), success. ## Styling - Tailwind classes only; merge with `cn()`. No inline `style`, no new CSS files. No arbitrary values (`w-[317px]`, `text-[#3b82f6]`): use the scale and theme tokens. - Images get `width` and `height`, so the layout doesn't jump. - Use theme tokens (`bg-background`, `text-muted-foreground`, `border-input`), not raw colors like `bg-gray-500`. - Mobile first: base classes for small screens, then `sm:`, `md:`, `lg:`. - Use an existing shadcn component before writing a custom one. Check `src/components/ui/` first. ## Accessibility - Semantic elements (`button`, `nav`, `main`, `table`). No clickable `div`. - Every input has a label. Icon-only buttons have `aria-label`. Everything works with the keyboard. - Never show state by colour alone: add text or an icon. Headings go in order, with no skipped level. ## Misc - API base URL from `import.meta.env.VITE_*`. Never hardcode URLs. - User-facing errors via toast or inline message. No `console.log`.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

