Skip to content

syahiidkamil/Software-Engineer-AI-Agent-Atlas / .claude/skills/shadcn

shadcn

Verified

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", "switch to --preset", and for building a design system or applying a DESIGN.md or brand spec to shadcn/ui.

FileKindSize
LICENSE.mdmarkdown1.0 KB
SKILL.mdskill md21.1 KB
agents/openai.ymlconfig238 B
assets/shadcn-small.pngbinary1.0 KB
assets/shadcn.pngbinary3.8 KB
assets/showcase/color-pair.tsxother3.4 KB
assets/showcase/preview-states.cssother425 B
assets/showcase/state-matrix.tsxother1.6 KB
cli.mdmarkdown16.9 KB
customization.mdmarkdown6.1 KB
design-system-page.mdmarkdown15.4 KB
design-system.mdmarkdown21.1 KB
evals/evals.jsonconfig10.4 KB
mcp.mdmarkdown3.4 KB
registry.mdmarkdown8.6 KB
rules/base-vs-radix.mdmarkdown6.8 KB
rules/chat.mdmarkdown17.2 KB
rules/composition.mdmarkdown4.8 KB
rules/forms.mdmarkdown4.7 KB
rules/icons.mdmarkdown1.9 KB
rules/styling.mdmarkdown4.6 KB
scripts/showcase-coverage.mjsscript1.4 KB

assets/showcase/color-pair.tsx

View on GitHub
import * as React from "react"

import { cn } from "@/lib/utils"

// Resolves any CSS color (hex, rgb, oklch, color-mix) to sRGB by painting one pixel.
// Translucent colors are composited over the backdrop, as the browser would.
function toRgb(color: string, backdrop = "#fff") {
  const canvas = document.createElement("canvas")
  canvas.width = canvas.height = 1
  const context = canvas.getContext("2d", { willReadFrequently: true })
  if (!context) {
    return null
  }
  context.fillStyle = backdrop
  context.fillRect(0, 0, 1, 1)
  context.fillStyle = color
  context.fillRect(0, 0, 1, 1)
  const [r, g, b] = context.getImageData(0, 0, 1, 1).data
  return [r, g, b]
}

function toHex(rgb: number[]) {
  return `#${rgb.map((value) => value.toString(16).padStart(2, "0")).join("")}`
}

function luminance([r, g, b]: number[]) {
  const [R, G, B] = [r, g, b].map((value) => {
    const channel = value / 255
    return channel <= 0.03928
      ? channel / 12.92
      : ((channel + 0.055) / 1.055) ** 2.4
  })
  return 0.2126 * R + 0.7152 * G + 0.0722 * B
}

function contrast(a: number[], b: number[]) {
  const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x)
  return (light + 0.05) / (dark + 0.05)
}

export function ColorPair({
  name,
  background,
  foreground,
  className,
}: {
  name: string
  background: string
  foreground: string
  className?: string
}) {
  const ref = React.useRef<HTMLDivElement>(null)
  const [info, setInfo] = React.useState<{ ratio: number; bg: string } | null>(
    null
  )

  React.useEffect(() => {
    const element = ref.current
    if (!element) {
      return
    }
    // Re-measure when the theme class on <html> changes.
    const measure = () => {
      const style = getComputedStyle(element)
      const page = getComputedStyle(document.body).backgroundColor
      const bg = toRgb(style.backgroundColor, page)
      if (!bg) {
        return
      }
      const fg = toRgb(style.color, toHex(bg))
      if (fg) {
        setInfo({ ratio: contrast(bg, fg), bg: toHex(bg) })
      }
    }
    measure()
    const observer = new MutationObserver(measure)
    observer.observe(document.documentElement, { attributes: true })
    return () => observer.disconnect()
  }, [])

  const level = !info
    ? ""
    : info.ratio >= 7
      ? "AAA"
      : info.ratio >= 4.5
        ? "AA"
        : info.ratio >= 3
          ? "AA Large"
          : "Fail"

  return (
    <div
      className={cn(
        "flex flex-col overflow-hidden rounded-xl border",
        className
      )}
    >
      <div
        ref={ref}
        style={{
          backgroundColor: `var(--${background})`,
          color: `var(--${foreground})`,
        }}
        className="flex h-24 items-end justify-between p-4"
      >
        <span className="text-2xl font-medium">Aa</span>
        {info && (
          <span className="rounded-full border border-current/20 px-2 py-0.5 font-mono text-xs">
            {info.ratio.toFixed(2)} {level}
          </span>
        )}
      </div>
      <div className="flex flex-col gap-0.5 bg-background p-3">
        <span className="text-sm font-medium">{name}</span>
        <span className="font-mono text-xs text-muted-foreground">
          --{background} / --{foreground}
        </span>
        {info && (
          <span className="font-mono text-xs text-muted-foreground">
            {info.bg}
          </span>
        )}
      </div>
    </div>
  )
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 323kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall