{"data":{"slug":"discovered-02163764f34dd31a1e43b65769d81ed57f50f7262c2eddbb","title":"Koi Component Builder","summary":"Adds a new component to a Koi design system project (Next.js + shadcn\/ui) and registers it under \/koi\/styleguide with a showcase route. Always checks the shadcn registry first via MCP, prefers extending existing primitives over building from scratch, and produces both the implementation and the styleguide documentation in a single pass.","url":"https:\/\/skillshunter.net\/skills\/discovered-02163764f34dd31a1e43b65769d81ed57f50f7262c2eddbb","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-02163764f34dd31a1e43b65769d81ed57f50f7262c2eddbb","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-02163764f34dd31a1e43b65769d81ed57f50f7262c2eddbb.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-02163764f34dd31a1e43b65769d81ed57f50f7262c2eddbb\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The design system must already be initialized (i.e., the `\/koi\/styleguide` route must exist). If it isn't, run the `koi-foundation` skill first. Confirm with the user whether they want a wrapper around an existing shadcn primitive (e.g., Badge) or a brand-new component when given a generic name (e.g., \"Tag\", \"Pill\").","instructions":"---\nname: koi-component\ndescription: >\n  Adds a new component to a Koi design system project (Next.js +\n  shadcn\/ui) and registers it under \/koi\/styleguide with a showcase\n  route. Always checks the shadcn registry first via MCP, prefers extending\n  existing primitives over building from scratch, and produces both the\n  implementation and the styleguide documentation in a single pass. Use\n  whenever the user asks to \"add component\", \"install Button\/Card\/Dialog\/Input\/etc.\",\n  \"create custom component\", \"wrap shadcn\", \"extend Button\", \"build a\n  component for the design system\", \"register component in the styleguide\",\n  or names any component to include in the system.\n---\n\n# Koi \u2014 Component Builder\n\nAdd a component to the project using shadcn\/ui as the primitive layer and\nregister it in `Koi\/styleguide`. The hierarchy is always **shadcn registry \u2192\nextend shadcn \u2192 build custom**.\n\n> **Prerequisite:** the design system must already be initialized\n> (`\/koi\/styleguide` route in place). If it isn't, run the\n> `koi-foundation` skill first.\n\n## Input\n\n```txt\nComponent name: [COMPONENT NAME]\nTarget project: [PROJECT PATH OR CURRENT REPOSITORY]\nDesign reference: [OPTIONAL SCREENSHOT, FIGMA URL, OR DESCRIPTION]\nStatus: [official | playground]\n```\n\n## Non-negotiables\n\n- shadcn\/ui stays the primitive layer.\n- The canonical namespace is `Koi\/styleguide`.\n- Repository docs and component inventory live under `\/koi\/styleguide`.\n- Next.js App Router showcase pages live under `\/app\/koi\/styleguide`.\n- Do **not** use `\/app\/styleguide`.\n- A component is not done until it's implemented, documented, and visible in\n  Koi\/styleguide.\n\n## Workflow\n\n### 1. Inspect the existing system\n\nInspect:\n\n- `\/koi\/styleguide\/foundation`\n- `\/koi\/styleguide\/components`\n- `\/koi\/styleguide\/playground\/components`\n- `\/app\/koi\/styleguide`\n- `components\/ui`\n- existing app components\n- `components.json`\n- Tailwind + shadcn setup\n- styleguide navigation or registry files\n\nReuse existing conventions. Never invent a parallel structure when one already exists.\n\n### 2. Check shadcn first\n\nIf `components.json` or shadcn aliases are missing, initialize before installing:\n\n```bash\nnpx shadcn@latest init\n```\n\nUse **shadcn MCP** when available \u2014 it's the authoritative source:\n\n- `search_items_in_registries` for `[component name]`\n- `view_items_in_registries` for structure and dependencies\n- `get_item_examples_from_registries` for usage examples (try `[component]-demo`)\n- `get_add_command_for_items` for the install command\n\n**Decision tree:**\n\n- shadcn component exists exactly \u2192 install or reuse.\n- shadcn component is close but not exact \u2192 wrap or extend.\n- shadcn component doesn't exist \u2192 build custom from shadcn primitives + Koi tokens.\n\n**Quick reference \u2014 common shadcn components:**\n\n- **Layout:** Card, Separator, Tabs, Accordion, Collapsible\n- **Forms:** Button, Input, Select, Checkbox, Radio Group, Switch, Textarea, Label, Form\n- **Feedback:** Alert, Toast\/Sonner, Progress, Skeleton, Badge\n- **Overlay:** Dialog, Drawer, Popover, Tooltip, Dropdown Menu, Context Menu, Alert Dialog\n- **Navigation:** Navigation Menu, Breadcrumb, Pagination, Command, Sidebar\n- **Data:** Table, Calendar, Chart\n\n### 3. Install or reuse the shadcn primitive\n\n```bash\nnpx shadcn@latest add [component-name]\n```\n\nThen **read the generated file** in `components\/ui` and identify:\n\n- exported names\n- variants\n- size options\n- data attributes\n- accessibility behavior\n- which CSS variables it consumes\n\nDon't blindly overwrite local modifications.\n\n### 4. Implement the Koi component\n\nStrategy, in order:\n\n1. Reuse an existing official Koi component when it already fits.\n2. Wrap a shadcn primitive when the API or visual layer needs Koi naming.\n3. Compose multiple shadcn primitives for complex UI.\n4. Build custom only when shadcn doesn't provide a suitable primitive.\n\nRequirements every component meets:\n\n- TypeScript with typed props\n- `className` support (use `cn()`)\n- semantic HTML\n- accessible keyboard behavior\n- ARIA attributes when needed\n- design tokens and Tailwind classes \u2014 **no hardcoded styling**\n- stable layout across states (no jumps when loading\/disabled)\n- `lucide-react` icons when icons are needed\n\n**Wrapper pattern** (when extending a shadcn primitive):\n\n```tsx\nimport * as React from \"react\"\nimport { Button } from \"@\/components\/ui\/button\"\nimport { cn } from \"@\/lib\/utils\"\n\ntype KoiButtonProps = React.ComponentProps<typeof Button> & {\n  intent?: \"default\" | \"success\" | \"warning\" | \"info\"\n}\n\nexport function KoiButton({\n  intent = \"default\",\n  className,\n  ...props\n}: KoiButtonProps) {\n  return (\n    <Button\n      className={cn(\n        intent === \"success\" && \"bg-success text-success-foreground hover:bg-success\/90\",\n        intent === \"warning\" && \"bg-warning text-warning-foreground hover:bg-warning\/90\",\n        intent === \"info\" && \"bg-info text-info-foreground hover:bg-info\/90\",\n        className,\n      )}\n      {...props}\n    \/>\n  )\n}\n```\n\n### 5. Document in Koi\/styleguide\n\nCreate or update the component documentation:\n\n```txt\n\/koi\/styleguide\/components\/[component-name]\n```\n\nIf the component is new and unreviewed, put it under:\n\n```txt\n\/koi\/styleguide\/playground\/components\/[component-name]\n```\n\nEach entry includes:\n\n- purpose\n- anatomy\n- variants\n- sizes\n- states\n- props\n- token usage\n- accessibility notes\n- shadcn primitives used\n- import path\n- implementation status\n\nIf the project uses a route-based styleguide, also create the showcase:\n\n```txt\n\/app\/koi\/styleguide\/components\/[component-name]\/page.tsx\n```\n\nThe showcase must include:\n\n- all variants\n- all sizes\n- disabled \/ loading \/ error states when relevant\n- dark mode preview when supported\n- realistic usage examples\n- code snippets\n\n### 6. Update navigation and registry\n\nUpdate whichever files the project already uses:\n\n```txt\n\/app\/koi\/styleguide\/navigation.ts\n\/koi\/styleguide\/registry\/components.json\n\/koi\/styleguide\/components\/index.ts\n```\n\nDon't invent a new registry format if the project already has one.\n\n### 7. Validate\n\nRun available checks:\n\n```bash\nnpm run lint\nnpm run typecheck\nnpm run test\nnpm run build\n```\n\n## Output to return\n\n```md\nKoi component complete.\n\nComponent:\n- [COMPONENT NAME]\n\nChanged:\n- [file path] \u2014 what changed\n\nStyleguide:\n- Source entry: [path]\n- Showcase route: [path or \"n\/a\"]\n- Navigation updated: yes \/ no\n\nshadcn\/ui:\n- Used: yes \/ no\n- Primitive(s): [list]\n- Install command: [or \"n\/a\"]\n\nValidation:\n- [command] \u2014 passed \/ failed \/ not available\n```\n\n## Notes\n\n- Always prefer extending shadcn over creating custom UI.\n- Official components \u2192 `\/koi\/styleguide\/components`.\n- Unreviewed \/ experimental components \u2192 `\/koi\/styleguide\/playground\/components`.\n- Anything imported by the app should be findable from Koi\/styleguide.\n- If the user gives a generic name (e.g. \"Tag\", \"Pill\"), confirm whether they\n  want a wrapper around an existing shadcn primitive (Badge) or a brand-new component.\n","use_cases":["Add a component to the Koi design system","Install a component like Button, Card, or Dialog","Create a custom component for the design system","Wrap a shadcn primitive with Koi naming","Extend a shadcn component for use in the Koi project","Register a component in the Koi styleguide"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/MirandaSls\/koi-design\/blob\/d86c88cb439045af1785329fcabfbd645fa3b646\/skills\/design-system\/koi-component\/SKILL.md","source_commit":"d86c88cb439045af1785329fcabfbd645fa3b646","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:44:03.000000Z","updated_at":"2026-11-29T10:53:15.000000Z","seo_title":"Koi Component Builder for Next.js and shadcn\/ui","seo_description":"Add a new component to a Koi design system project using shadcn\/ui as the primitive layer and register it under \/koi\/styleguide with a showcase route.","seo_keywords":["Koi component","shadcn\/ui","Next.js design system","component builder","styleguide registration","Koi styleguide","design system component","component registration"]}}