agentleFS
davision0102davision0102/fabrik/.agents/skills/add-component/SKILL.md

add-component

Skill3 starsChanged 2 days agoMITView on GitHub

Installer un composant shadcn/ui (bouton, select, tabs, toast, tableau…) ou créer un composant réutilisable. À utiliser dès qu'il faut un élément d'interface qui n'existe pas encore dans src/components.

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Ajouter un composant

Composant shadcn/ui

  1. Vérifier s'il existe déjà dans src/components/ui/.
  2. L'installer :

    npx shadcn@latest add select

    Le style du projet est base-luma (basé sur Base UI, pas Radix) : la CLI installe la bonne variante grâce à components.json. Le serveur MCP shadcn (.mcp.json) permet aussi de chercher les composants disponibles.

  3. L'exposer sur la page /ui (src/routes/ui.tsx) dans un nouveau bloc <Showcase title="Select">, pour le voir en clair et en sombre.
  4. Vérifier : npm run lint && npm run build.

Les fichiers de src/components/ui/ appartiennent au projet : on peut les modifier, mais garder leur API (props, variantes) cohérente avec shadcn.

Composant maison

  • Le placer dans src/components/ (pas dans ui/, réservé à shadcn), un fichier par composant, nom en kebab-case : pricing-card.tsx.
  • Exporter une fonction nommée (export function PricingCard), accepter className et le fusionner avec cn() de @/lib/utils.
  • Construire à partir des composants ui/ existants plutôt que repartir de zéro.
  • Si le composant a de la logique (état, calcul), ajouter un test *.test.tsx à côté.

Composition Base UI

Pour qu'un composant en rende un autre, Base UI utilise la prop render (et non asChild) :

<DialogTrigger render={<Button variant="outline" />}>Ouvrir</DialogTrigger>

Pour un lien stylé comme un bouton : className={buttonVariants({ variant: 'outline' })}.

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.