shadcn-patterns
Skill10 starsChanged 6 months agoMITView on GitHub
Use when adding UI with shadcn/ui: dialogs, sheets, data tables, forms, command palette, dropdowns, or layout components. Not for non-shadcn design systems or backend-only work.
In this repository56 other files it gives its agents.
- accessibility-passSkill
- analytics-eventsSkill
- api-error-handlingSkill
- audit-logging-backendSkill
- background-jobs-and-cronSkill
- dark-mode-and-themingSkill
- dashboard-charts-rechartsSkill
- edge-functions-and-webhooksSkill
- email-and-notificationsSkill
- error-states-and-empty-uiSkill
- feature-flags-and-togglesSkill
- file-upload-storageSkill
- i18n-multi-languageSkill
- lovable-prompting-playbookSkill
- lovable-ship-checklistSkill
- migration-playbookSkill
- multi-tenant-backendSkill
- onboarding-copySkill
- optimistic-updatesSkill
- payment-failed-and-recoverySkill
- payment-webhook-idempotencySkill
- payment-webhook-testingSkill
- performance-budgetSkill
- pg-cron-recipesSkill
- pg-cron-scheduled-jobsSkill
- pg-cron-with-pg-net-edgeSkill
- postgres-full-text-searchSkill
- postgres-triggers-and-functionsSkill
- pricing-and-billingSkill
- programmatic-seo-content-qualitySkill
- programmatic-seo-pagesSkill
- rate-limiting-edgeSkill
- realtime-and-subscriptionsSkill
- refactor-safe-diffSkill
- release-notesSkill
- seo-core-web-vitalsSkill
- seo-landing-pageSkill
- seo-meta-tags-spaSkill
- seo-sitemap-generationSkill
- seo-ssr-and-prerenderingSkill
- seo-structured-dataSkill
- server-input-validationSkill
- soft-delete-and-archivingSkill
- stripe-one-time-payment-webhooksSkill
- stripe-payment-webhooksSkill
- supabase-auth-flowsSkill
- supabase-database-designSkill
- supabase-rls-and-authSkill
- support-replySkill
- tanstack-infinite-queriesSkill
- tanstack-mutations-and-invalidationSkill
- tanstack-prefetch-and-hydrationSkill
- tanstack-query-alternativeSkill
- tanstack-router-data-loadersSkill
- tanstack-start-server-routesSkill
- typed-api-hooks-formsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use existing shadcn components from @/components/ui.
- Very specific: line 20
Always include DialogTitle / SheetTitle for accessibility.
- Very specific: line 24
Use @tanstack/react-table with shadcn Table, DataTable pattern.
- Very specific: line 46
Use Sonner (<Toaster /> once at the root) for transient feedback.
- Distinctive: line 67
Test at 375px width.
- Very specific: line 71
Use CSS variables from shadcn (bg-background, text-foreground) — never hardcoded #fff.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
shadcn/ui patterns
Use existing shadcn components from @/components/ui. Do not reinvent primitives.
Dialog vs Sheet
| Use | Component |
| Desktop modal, short forms | Dialog |
| Mobile-first, filters, long forms | Sheet (side or bottom) |
Always include DialogTitle / SheetTitle for accessibility.
Data tables
- Use
@tanstack/react-tablewith shadcnTable,DataTablepattern. - Column headers sortable when list is large.
- Row actions in
DropdownMenu, not 5 inline buttons. - Empty/error states via
error-states-and-empty-uiskill.
Forms
Form,FormField,FormItem,FormLabel,FormControl,FormMessage.- Pair with Zod + react-hook-form (
typed-api-hooks-formsskill).
Buttons and actions
- One primary action per section; destructive uses
variant="destructive". Button+disabled={isPending}during mutations.
Command palette
Command,CommandInput,CommandList,CommandItemfor search/navigation.- Keyboard: Cmd/Ctrl+K when spec asks for it.
Toasts and notifications
- Use Sonner (
<Toaster />once at the root) for transient feedback. - One toast per action; don't stack 5 success toasts.
- Errors: short message + optional retry; never raw
error.messagefrom Supabase.
import { toast } from "sonner";
toast.success("Project created");
toast.error("Could not save changes", { description: "Please try again." });Navigation patterns
- Persistent left
Sidebarfor app shell;Tabsinside a route for sub-views. Breadcrumbonce routes go ≥ 3 levels deep.- Mobile: bottom nav or
Sheetdrawer — never desktop sidebar squeezed onto phones.
Responsive
- Stack filters in
Sheeton mobile; inline onmd+. - Touch targets ≥ 44px where possible.
- Test at 375px width.
Theming
- Use CSS variables from shadcn (
bg-background,text-foreground) — never hardcoded#fff. - Dark mode: see
dark-mode-and-themingskill.
Avoid
- Raw HTML
<button>styled ad hoc when shadcn exists. - Nested dialogs without clear close path.
- Missing
arialabels on icon-only buttons. - Multiple toast libraries (Sonner + react-hot-toast + custom) in one app.
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.

