agentleFS
bkjain655bkjain655/agent-skills/skills/shadcn-ui-setup/SKILL.md

shadcn-ui-setup

Skill0 starsChanged 3 months agoMITView on GitHub

Initializes and extends shadcn/ui in Next.js: init command, essential components, Tooltip/Dialog providers, form wiring, and reusable UI patterns. Use when adding shadcn, Radix primitives, component libraries, tooltips, dialogs, selects, or building form-heavy UIs.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add these before feature work — most apps need them:

    line 22
  2. Distinctive:

    Use Dialog (not page navigation) for inline CRUD:

    line 113
  3. Distinctive:

    Use grouped options for year/decade pickers and long lists.

    line 133
  4. Very specific:

    Use cva for variants on repeated patterns (badges, buttons)

    line 139
  5. Very specific:

    Every icon-only button needs aria-label

    line 144
  6. Very specific:

    Never nest <button> inside <button> — use role="group" row pattern (see react-components-patterns)

    line 147

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

shadcn/ui Setup

Init (new project)

npx shadcn@latest init

Defaults: New York style, zinc/slate base, CSS variables, @/components, @/lib/utils.

Install components upfront

Add these before feature work — most apps need them:

npx shadcn@latest add button input label textarea select dialog sheet \
  dropdown-menu tooltip popover separator badge card progress tabs

For forms:

npx shadcn@latest add form checkbox radio-group switch
npm install react-hook-form @hookform/resolvers zod

For dates (calendar popover):

npx shadcn@latest add calendar
npm install date-fns react-day-picker

cn() utility

Ensure src/lib/utils.ts exports:

import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Global providers

Wrap app once in root layout:

import { TooltipProvider } from "@/components/ui/tooltip";

<TooltipProvider delayDuration={300}>
  {children}
</TooltipProvider>

For shadcn forms, no extra provider needed.

Help tooltip pattern

Reusable contextual help (keeps copy out of JSX):

// components/ui/help-tooltip.tsx
export function HelpTooltip({ content, ariaLabel = "More info" }: { content: React.ReactNode; ariaLabel?: string }) {
  return (
    <Tooltip>
      <TooltipTrigger asChild>
        <button type="button" aria-label={ariaLabel} className="text-muted-foreground">
          <Info className="h-4 w-4" />
        </button>
      </TooltipTrigger>
      <TooltipContent side="top" className="max-w-xs">{content}</TooltipContent>
    </Tooltip>
  );
}

Centralize copy in lib/help-text.ts keyed by field/feature.

Form pattern (RHF + Zod + shadcn Form)

const schema = z.object({ email: z.string().email(), name: z.string().min(1) });
const form = useForm<z.infer<typeof schema>>({ resolver: zodResolver(schema), defaultValues: { email: "", name: "" } });

<Form {...form}>
  <form onSubmit={form.handleSubmit(onSubmit)}>
    <FormField control={form.control} name="email" render={({ field }) => (
      <FormItem>
        <FormLabel>Email</FormLabel>
        <FormControl><Input {...field} /></FormControl>
        <FormMessage />
      </FormItem>
    )} />
    <Button type="submit">Save</Button>
  </form>
</Form>

Dialog for create/edit flows

Use Dialog (not page navigation) for inline CRUD:

  • List view shows items + "Add" card
  • Dialog hosts form; onOpenChange resets form state
  • Primary action validates before close

Select with groups

Wrap shadcn Select for app-specific API:

interface AppSelectProps {
  options?: { value: string; label: string }[];
  groups?: { label: string; options: { value: string; label: string }[] }[];
  value: string;
  onChange: (value: string) => void;
  placeholder?: string;
}

Use grouped options for year/decade pickers and long lists.

Component conventions

  • "use client" only on interactive components
  • Primitives in components/ui/; feature components in components/{feature}/
  • Use cva for variants on repeated patterns (badges, buttons)
  • Icons: lucide-react, consistent h-4 w-4 in buttons

Accessibility defaults

  • Every icon-only button needs aria-label
  • Dialog: focus trap handled by Radix; provide DialogTitle
  • Form fields: associate <Label htmlFor> with input id
  • Never nest <button> inside <button> — use role="group" row pattern (see react-components-patterns)

Related skills

  • tailwind-css-v4 — theme tokens and cn()
  • specialized-form-inputs — currency/DOB beyond shadcn defaults
  • web-accessibility-wcag — landmarks, axe testing

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.