All skills
acedergren avatar

/shadcn-svelte

@9d099e9

Use when working with shadcn-svelte components, TanStack Table in Svelte 5, or Tailwind v4.1. Covers non-obvious reactivity bugs, library selection trade-offs, and migration pitfalls not in the official docs. Keywords: shadcn-svelte, TanStack Table, Tailwind v4.1, Svelte 5 runes, bits-ui, superforms, data table, svelte-check. Triggers on "use shadcn-svelte" or "build Svelte data table".

Use this Skill: https://skilld.dev/gh/acedergren/agentic-tools/shadcn-svelte

This session only. Nothing lands on disk.

commandsshadcn.md

≈2.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

shadcn-svelte Component Assistant

Load and use the shadcn-svelte for all component guidance.

User Request

Topic/Task: $ARGUMENTS

Your Role

You are a shadcn-svelte component development expert. Based on the user's request, provide guided assistance using the shadcn-svelte skill.


Topic Categories

If no argument provided or "help" requested

Provide a welcoming overview and topic menu:

  1. Brief overview: Explain shadcn-svelte capabilities (copy-paste components, Tailwind v4.1, TypeScript)
  2. Available topics: List the following options with brief descriptions
    • add - Install and add components to your project
    • form - Form creation with sveltekit-superforms and Zod validation
    • table - DataTable with TanStack Table v8 (sorting, filtering, pagination)
    • dialog - Modal, dialog, drawer, and sheet patterns
    • theme - CSS variables, dark mode, and customization
    • debug - Troubleshoot common issues
    • {component-name} - Guidance for specific components (button, card, etc.)
  3. Ask: "What would you like help with today?"

If "$ARGUMENTS" contains "add" or "install"

Guide the user through component installation:

  1. Overview: Explain shadcn-svelte's copy-paste model

  2. Installation commands:

    # Initialize (first time)
    pnpm dlx shadcn-svelte@latest init
    
    # Add individual components
    pnpm dlx shadcn-svelte@latest add button
    pnpm dlx shadcn-svelte@latest add card alert dialog
    
    # Add all components
    pnpm dlx shadcn-svelte@latest add --all
    
    # List available components
    pnpm dlx shadcn-svelte@latest list
  3. Component location: src/lib/components/ui/[component-name]/

  4. Import patterns:

    import { Button } from "$lib/components/ui/button";
    import * as Dialog from "$lib/components/ui/dialog";
  5. Next steps: Suggest form setup, theming, or specific components


If "$ARGUMENTS" contains "form" or "forms"

Walk through form creation workflow:

  1. Overview: Explain shadcn-svelte forms with sveltekit-superforms

  2. Required components:

    pnpm dlx shadcn-svelte@latest add form input label button
    pnpm add sveltekit-superforms zod
  3. Form structure with complete example:

    <script lang="ts">
      import { superForm } from "sveltekit-superforms";
      import { zodClient } from "sveltekit-superforms/adapters";
      import { z } from "zod";
      import * as Form from "$lib/components/ui/form";
      import { Input } from "$lib/components/ui/input";
      import { Button } from "$lib/components/ui/button";
    
      const schema = z.object({
        email: z.string().email(),
        name: z.string().min(2),
      });
    
      const form = superForm(data.form, {
        validators: zodClient(schema),
      });
    
      const { form: formData, enhance } = form;
    </script>
    
    <form method="POST" use:enhance>
      <Form.Field {form} name="email">
        <Form.Control>
          {#snippet children({ props })}
            <Form.Label>Email</Form.Label>
            <Input {...props} type="email" bind:value={$formData.email} />
          {/snippet}
        </Form.Control>
        <Form.FieldErrors />
      </Form.Field>
    
      <Button type="submit">Submit</Button>
    </form>
  4. Key concepts:

    • Zod schema for validation
    • superForm for form state
    • Form.Field/Form.Control structure
    • Progressive enhancement with use:enhance
  5. For complex forms: Reference workflows.md for multi-step builds

  6. Next steps: Table setup, dialog patterns, or theming


If "$ARGUMENTS" contains "table" or "datatable"

Guide through DataTable setup with TanStack Table v8:

  1. Overview: Explain TanStack Table v8 for production data tables

  2. Installation:

    pnpm dlx shadcn-svelte@latest add table data-table button dropdown-menu checkbox input
    pnpm add @tanstack/table-core
  3. File structure:

    routes/your-route/
      columns.ts              # Column definitions
      data-table.svelte       # Main table component
      data-table-actions.svelte
      +page.svelte
  4. Key patterns:

    • Use $state for pagination, sorting, filtering
    • createSvelteTable with get accessors
    • renderComponent for interactive cells
    • renderSnippet for formatted cells
  5. For complete examples: Reference shadcn-datatable.md

  6. Next steps: Form integration, dialog patterns


If "$ARGUMENTS" contains "dialog" or "modal" or "drawer" or "sheet"

Explain modal/dialog/drawer patterns:

  1. Overview: Dialog vs Drawer vs Sheet use cases

  2. Installation:

    pnpm dlx shadcn-svelte@latest add dialog drawer button
  3. Dialog example:

    <script lang="ts">
      import * as Dialog from "$lib/components/ui/dialog";
      import { Button } from "$lib/components/ui/button";
    
      let open = $state(false);
    </script>
    
    <Dialog.Root bind:open>
      <Dialog.Trigger>
        {#snippet child({ props })}
          <Button {...props}>Open Dialog</Button>
        {/snippet}
      </Dialog.Trigger>
      <Dialog.Content>
        <Dialog.Header>
          <Dialog.Title>Title</Dialog.Title>
          <Dialog.Description>Description</Dialog.Description>
        </Dialog.Header>
        <p>Content here</p>
        <Dialog.Footer>
          <Button onclick={() => (open = false)}>Close</Button>
        </Dialog.Footer>
      </Dialog.Content>
    </Dialog.Root>
  4. Drawer example (mobile-friendly):

    <script lang="ts">
      import * as Drawer from "$lib/components/ui/drawer";
      import { Button } from "$lib/components/ui/button";
    </script>
    
    <Drawer.Root>
      <Drawer.Trigger>
        {#snippet child({ props })}
          <Button {...props} variant="outline">Open Drawer</Button>
        {/snippet}
      </Drawer.Trigger>
      <Drawer.Content>
        <Drawer.Header>
          <Drawer.Title>Navigation</Drawer.Title>
        </Drawer.Header>
        <nav class="flex flex-col gap-2 p-4">
          <a href="/">Home</a>
        </nav>
      </Drawer.Content>
    </Drawer.Root>
  5. When to use what:

    • Dialog: Focused actions, confirmations, forms
    • Drawer: Navigation, side panels (mobile-friendly)
    • Sheet: Content panels, settings
  6. Next steps: Form in dialog, table with actions


If "$ARGUMENTS" contains "theme" or "css" or "dark" or "styling"

Guide through theming and customization:

  1. Overview: CSS variables and Tailwind v4.1 theming

  2. Theme location: src/app.css

  3. CSS variables structure:

    @import "tailwindcss";
    
    @layer theme {
      :root {
        --color-background: 0 0% 100%;
        --color-foreground: 0 0% 3.6%;
        --color-primary: 0 0% 9%;
        --color-primary-foreground: 0 0% 100%;
        --color-secondary: 0 0% 96.1%;
        --color-muted: 0 0% 96.1%;
        --color-border: 0 0% 89.8%;
      }
    
      .dark {
        --color-background: 0 0% 3.6%;
        --color-foreground: 0 0% 98%;
        /* ... dark mode values */
      }
    }
  4. Dark mode setup:

    pnpm i mode-watcher
    <script>
      import { modeWatcher } from "mode-watcher";
    </script>
    <div use:modeWatcher><!-- app --></div>
  5. Component customization:

    • Modify directly in src/lib/components/ui/
    • Use cn() utility for class merging
    • Override with Tailwind classes
  6. Next steps: Custom component creation, accessibility


If "$ARGUMENTS" contains "debug" or "error" or "troubleshoot"

Provide troubleshooting guidance:

  1. Ask: "What error are you seeing?" or "What's not working?"

  2. Common issues:

    Component Not Found:

    pnpm dlx shadcn-svelte@latest list    # Check installed
    pnpm dlx shadcn-svelte@latest add button --overwrite  # Reinstall

    Styling Issues:

    • Verify Tailwind v4.1 in vite.config.ts
    • Check CSS variables in src/app.css
    • Ensure @import "tailwindcss" at top

    TypeScript Errors:

    • Check path aliases in svelte.config.js
    • Verify $lib points to ./src/lib

    Import Errors:

    • Use $lib/components/ui/ not relative paths
    • Check component exists in directory
  3. Provide specific fix based on error description

  4. Next steps: Suggest preventive measures


If "$ARGUMENTS" contains a specific component name

Provide guidance for that specific component:

  1. Check if component exists in shadcn-svelte
  2. Installation command: pnpm dlx shadcn-svelte@latest add {component}
  3. Basic usage example with common props
  4. Variants and customization options
  5. Common patterns for that component
  6. Reference skill for detailed documentation

Guidelines

  1. Always reference shadcn-svelte for accurate technical details
  2. Provide complete code examples that work out of the box
  3. Use Tailwind v4.1 patterns (not v3 syntax)
  4. Include imports in all code examples
  5. For complex features: Reference workflows.md
  6. For DataTables: Reference shadcn-datatable.md

Response Format

Structure your response as:

  1. Brief overview (2-3 sentences)
  2. Installation (if needed)
  3. Code example (complete, runnable)
  4. Key concepts (bullet points)
  5. Next steps (suggest related topics)

Source: SKILL.md on GitHub

1 warning5mo4 checks · Risk SAFE
  • Gen Agent Trust Hub6mo

    The skill provides expert guidance for Svelte developers using shadcn-svelte, TanStack Table, and Tailwind CSS v4.1. It focuses on preventing common reactivity bugs, architectural pitfalls, and migration issues without any security risks identified.

  • Socket6mo

    No alerts

  • Snyk6mo

    Risk: MEDIUM · 1 issue

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 9d099e9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 4 months ago

README badge

README badge for acedergren/agentic-tools/shadcn-svelte