shadcn ui-foundation installer
Overview
Use this skill to add shadcn components into pkgs/libs/ui-foundation without breaking package boundaries.
This skill is a strict wrapper around the base shadcn skill for this repo layout.
When to Use
Use when:
- You are adding any component via
shadcn add - Component source is official shadcn/ui or external registry
- You must publish component through package subpath exports
Do not use when:
- You are editing an already-installed component only
- You are installing into a package other than
pkgs/libs/ui-foundation
Non-Negotiable Rules
- Always use the base
shadcnskill first. - Always run from
pkgs/libs/ui-foundation. - Always install with:
bun x --bun shadcn@latest add {provided component registry item}
- Component path must be registry-scoped:
- Official shadcn →
src/components/ui/{component} - Third-party registry
{registry_name}→src/components/{registry_name}/{component}
- Official shadcn →
- All imports in added files must be relative paths. No aliases.
package.jsonexports must explicitly cover the new component subpath(s).- Do NOT export newly added component(s) from
src/index.ts.
Workflow
-
Load base skill
- Use the
shadcnskill for upstream conventions. - Minimum required read: the shadcn skill's
AGENTS.mdin the resolved skill directory from the Skill tool output (do not stop at indexSKILL.md).
- Use the
-
Enter package dir
cd pkgs/libs/ui-foundation -
Install component
bun x --bun shadcn@latest add {provided component registry item} -
Move/verify destination folder
- Determine registry source.
- Ensure target file location is:
src/components/ui/*for officialsrc/components/{registry_name}/*for non-official
- Keep all generated files for that component under the same registry folder (
uior{registry_name}), including helper files created during install.
-
Rewrite imports to relative paths Replace aliases like:
@/components/...@/lib/...~/...
With relative imports from the file location (examples):
../../lib/cn../ui/button./internal-helper
-
Update
package.jsonexports Add explicit export entries for each newly installed component entry file. Do not rely only on broad wildcards.Example:
{ "exports": { "./components/acme/fancy-card": { "types": "./src/components/acme/fancy-card.tsx", "default": "./src/components/acme/fancy-card.tsx" } } } -
Protect tree shaking boundary
- Do not add
export * from "./components/..."lines for newly installed components insrc/index.ts.
- Do not add
-
Verify
- Component exists in registry folder.
- No alias imports in new/changed component files.
package.jsonhas subpath export for installed component.src/index.tsunchanged for this component.
Verification commands:
# no alias imports in component trees grep -R "@/\|~/" src/components/ui src/components/* 2>/dev/null || true # confirm explicit subpath export exists cat package.json # confirm root barrel did not expose new component grep -n "components/acme/fancy-card" src/index.ts || true
Quick Reference
- Working directory:
pkgs/libs/ui-foundation - Install command:
bun x --bun shadcn@latest add {provided component registry item} - Official registry folder:
src/components/ui - Third-party registry folder:
src/components/{registry_name} - Alias imports: forbidden
- Root
src/index.tsexport for new component: forbidden
Common Mistakes
- Installing from repo root instead of
pkgs/libs/ui-foundation - Leaving
@/or~/aliases in generated files - Putting third-party component under
src/components/ui - Skipping explicit
package.jsonsubpath export - Exporting new component from root barrel (
src/index.ts) and hurting tree-shaking behavior