diff --git a/.gitignore b/.gitignore index 5d37bfd..2e496ee 100644 --- a/.gitignore +++ b/.gitignore @@ -45,10 +45,7 @@ next-env.d.ts # local agent/tooling artifacts .agents/ -.pi/ -prompts/ -docs-component-format-spec.md -AGENTS.md + skills-lock.json bun.lock .env.local diff --git a/.pi/prompts/README.md b/.pi/prompts/README.md new file mode 100644 index 0000000..6da7dd0 --- /dev/null +++ b/.pi/prompts/README.md @@ -0,0 +1,17 @@ +# jal-co/ui Prompts + +Repo-aware prompts for creating, reviewing, and ideating jalco ui registry content. + +## Prompts + +- `/component-create` — create a new component, block, or registry item through the standard workflow +- `/component-review` — audit an existing component against the jalco ui quality bar +- `ideate-jalco-components.md` — ideate new additions based on the current repo state + +## How they work + +Each prompt: +- reads the repo first (AGENTS.md, registry.json, existing patterns) +- consults local skills before generating output +- acts as an implementation/review partner, not a generic text generator +- follows Conventional Branch naming for feature branches diff --git a/.pi/prompts/component-create.md b/.pi/prompts/component-create.md new file mode 100644 index 0000000..57af655 --- /dev/null +++ b/.pi/prompts/component-create.md @@ -0,0 +1,50 @@ +# /component-create + +Build a new jalco ui component through the standard repository workflow. + + +Use this prompt when the user wants to create a new component, block, registry item, or docs-facing UI artifact. + + + + +1. Create a feature branch: `feat/`. +2. Read `.pi/skills/jalco-component-builder/SKILL.md` first and treat it as the primary workflow. +3. If the request is underspecified, use the `question` or `questionnaire` tool to clarify the component before coding. +4. Use concise, Socratic questioning to determine: + - the core use case + - whether this is a primitive, composed component, or block + - whether it belongs in the public registry, docs site only, or both + - the intended default feel and strongest default state + - the minimum public API + - which variants are truly justified + - whether the component should stay in one file + - whether any dependency is genuinely needed +5. SHOULD prefer a single-file implementation unless multiple files materially improve readability, runtime correctness, reuse, or installability. +6. Use supporting references named in `jalco-component-builder` as needed, especially for shadcn ergonomics, Tailwind v4 patterns, composition, React/Next implementation quality, and accessibility. +7. Reuse established Jalco and shadcn variant language when appropriate, but MUST NOT add variants mechanically. +8. SHOULD prefer strong default styling, realistic preview content, and restrained visual treatment over decorative complexity. +9. If this is a public component, MUST update the docs, preview/demo coverage, and any relevant registry metadata in the same change. +10. MUST create a catalog card preview at `components/docs/previews/.tsx` showing key variants, and run `pnpm previews:generate`. +11. MUST add the sidebar nav entry in `lib/docs.ts` with `badge: "New"` and `badgeAdded` set to today's ISO date. +12. MUST generate screenshots via `/dev/screenshots` — save `-dark.png` and `-light.png` to `public/previews/`. +13. MUST run `pnpm registry:build` and `pnpm build` to verify. +14. MUST open a PR using the component template and attach dark/light screenshots. +15. MUST keep comments compact and useful. Use Jalco-style file headers when appropriate. MUST NOT add decorative separator banners. + + + + + +## Output expectations + +Before implementing, briefly state: +- the component's use case +- the proposed API shape +- the justified variants +- the one-file vs multi-file decision +- any dependency decision + +Then implement the component and related docs updates. + + diff --git a/.pi/prompts/component-review.md b/.pi/prompts/component-review.md new file mode 100644 index 0000000..a8f9665 --- /dev/null +++ b/.pi/prompts/component-review.md @@ -0,0 +1,46 @@ +# /component-review + +Audit a jalco ui component using the repository's public component quality bar. + + +Use this prompt when the user wants feedback on an existing component, registry item, docs-facing component, preview, or public API. + + + + +1. MUST read `.pi/skills/jalco-component-builder/SKILL.md` first and use it as the review rubric. +2. MUST inspect the component source, related demos/previews, and relevant docs before judging quality. +3. Evaluate the component for: + - clarity of use case + - quality of the default state + - visual hierarchy and restraint + - API size and semantic clarity + - variant discipline + - one-file vs multi-file appropriateness + - dependency justification + - accessibility and copy-paste ergonomics + - alignment across implementation, preview, docs, and registry metadata + - presence of a catalog card preview file in `components/docs/previews/` + - sidebar nav entry in `lib/docs.ts` +4. MUST be direct and critical when needed. MUST NOT praise weak work just because it is technically valid. +5. If recommending changes, prioritize: + - what SHOULD be removed or simplified + - which variants SHOULD be merged or cut + - whether the file structure SHOULD be collapsed + - whether dependencies SHOULD be avoided + - how the default example SHOULD be improved + + + + + +## Output structure + +1. What feels strong +2. What feels off or generic +3. API and variant issues +4. File structure and dependency issues +5. Recommended changes in priority order +6. Whether the component is ready for jalco ui in its current form + + diff --git a/.pi/prompts/ideate-jalco-components.md b/.pi/prompts/ideate-jalco-components.md new file mode 100644 index 0000000..c7bba65 --- /dev/null +++ b/.pi/prompts/ideate-jalco-components.md @@ -0,0 +1,78 @@ +# /ideate-jalco-components + +Ideate new jalco ui additions based on repository context and gaps. + + + +Before ideating, MUST read these files: +- `AGENTS.md` +- `README.md` +- `registry.json` +- `app/page.tsx` +- `.pi/skills/vercel-react-best-practices/SKILL.md` +- `.pi/skills/vercel-composition-patterns/SKILL.md` +- `.pi/skills/tailwind-design-system/SKILL.md` + +Then inspect the current registry items and identify what categories, use cases, or quality levels are missing. + + + + + +## Task + +Help ideate new jalco ui additions based on this context: + +{{IDEATION_CONTEXT}} + +## Ideation goals + +Suggested additions MUST be: +- practical +- installable +- visually strong +- differentiated from generic examples +- documentation-friendly +- aligned with jalco ui's brand and quality bar + +Consider whether each idea is best as a: +- component +- block +- hook +- pattern +- docs concept + +## Required process + +1. MUST read the required files first. +2. MUST inspect the current registry and surface obvious gaps. +3. SHOULD propose ideas that balance usefulness, visual appeal, and implementation value. +4. SHOULD prioritize ideas that would make jalco ui more distinctive. +5. SHOULD call out quick wins versus longer-term standout additions. + + + + + +## Output format + +Return these sections: + +1. **Current gap summary** +2. **Top 10 proposed additions** + - name + - type + - what it does + - why it belongs in jalco ui + - implementation complexity: low / medium / high + - docs/demo appeal: low / medium / high +3. **Best 3 quick wins** +4. **Best 3 standout additions** +5. **Suggested build order** +6. **Docs categories these ideas support** + + + + +Optimize for additions that would make jalco ui feel curated, not bloated. + diff --git a/.pi/references/docs-component-format-spec.md b/.pi/references/docs-component-format-spec.md new file mode 100644 index 0000000..1051d0c --- /dev/null +++ b/.pi/references/docs-component-format-spec.md @@ -0,0 +1,125 @@ +# Component Docs Format Spec + +Canonical reference for the structure, section order, writing rules, and review checklist of jalco ui component documentation pages. + +## Page anatomy + +Every component docs page MUST use `ComponentDocsPage` from `components/docs/component-docs-page.tsx` and follow this section order: + +1. **Metadata** — `export const metadata: Metadata` with `title` and `description` +2. **Header** — rendered by `ComponentDocsPage`: title, description, AiCopyButton, DependencyBadges +3. **Preview** — live component inside `ComponentPreview` with source file tabs +4. **Installation** — `InstallCommand` with registry name; `installNote` for bundled exports +5. **Usage** — import snippet via `CodeLine`, minimal usage example, server/client rendering context +6. **Children** (optional, order as needed): + - Playground + - Examples (variants, sizes, configurations, etc.) + - API Reference + - Notes + +## ComponentDocsPage props + +| Prop | Type | Required | Purpose | +|---|---|---|---| +| `title` | `string` | yes | Display name (e.g. "GitHub Stars Button") | +| `description` | `string` | yes | One-sentence summary | +| `registryName` | `string` | no | Registry item name; enables install block and badges | +| `sourceFiles` | `(string \| { path, name?, language? })[]` | no | Source file paths for the code tab | +| `preview` | `ReactNode` | no | Live component for the Preview section | +| `installNote` | `ReactNode` | no | Note below install command (e.g. bundled-in explanation) | +| `usage` | `ReactNode` | no | Usage section content | +| `children` | `ReactNode` | no | Everything after Usage | + +## Writing rules + +### Descriptions + +- MUST be one sentence, capability-first +- MUST NOT start with "A", "An", or "A React component for..." +- MUST NOT contain implementation details, subjective adjectives, or unnecessary jargon +- MUST match across: page `metadata.description`, `ComponentDocsPage` `description` prop, and `registry.json` description + +### Usage section + +- MUST include an import snippet via `CodeLine` +- MUST include a minimal usage example via `CodeLine` +- Server/client rendering context MUST be stated here (e.g. "Async server component") +- The first example SHOULD be minimal — layer complexity in the Examples section + +### Examples section + +- MUST use `VariantGrid` with labeled items when showing multiple visual states +- MUST group items by meaning: Variants, Sizes, Icon Styles, Configurations, etc. +- MUST NOT label everything as a "variant" — use the most accurate grouping label +- SHOULD use realistic, polished content over placeholder text + +### Playground section + +- MAY be included when the component has multiple interactive props worth exploring +- SHOULD be a client component that lets users toggle props and see results + +### API Reference section + +- SHOULD be included when the component has a non-obvious public API +- MUST use `ApiRefTable` from `registry/api-ref-table/api-ref-table` +- SHOULD list all public props with name, type, required flag, and description + +### Notes section + +- MUST contain only caveats, limitations, and external service behavior +- MUST NOT contain architecture decisions, feature highlights, or rendering context +- SHOULD be brief — a short bulleted list + +### Bundled exports + +- When a component is bundled inside another registry item, MUST use `installNote` to explain +- MUST set `bundledIn` on the nav item in `lib/docs.ts` + +## Section heading style + +All `

` headings inside `ComponentDocsPage` children MUST use: + +```tsx +

Section Title

+``` + +Sub-headings (`

`) inside example groups MUST use: + +```tsx +

Group Label

+``` + +## Naming alignment + +These MUST all refer to the same artifact using consistent naming: +- page `metadata.title` +- `ComponentDocsPage` `title` prop +- `registry.json` item `title` +- sidebar nav title in `lib/docs.ts` +- preview file name in `components/docs/previews/` +- component export name + +## File header and comment rules + +- Public Jalco-authored component source files SHOULD use the compact Jalco-style header +- Headers MUST be compact and human-written in tone +- Headers MUST NOT duplicate the docs page content +- Decorative separator banners MUST NOT appear in source code +- Inline comments MUST be minimal and useful +- Comments MUST NOT narrate straightforward code + +## Review checklist + +Before shipping a component docs page, verify: + +- [ ] Page uses `ComponentDocsPage` +- [ ] `metadata.description` matches `ComponentDocsPage` `description` and `registry.json` +- [ ] Preview renders a realistic default state +- [ ] Usage includes import, minimal example, and server/client context +- [ ] Examples use `VariantGrid` with accurate group labels +- [ ] Notes contains only caveats (no features, no architecture) +- [ ] Sidebar entry in `lib/docs.ts` is correct (title, order, badge, bundledIn) +- [ ] Card preview exists at `components/docs/previews/.tsx` +- [ ] Screenshots exist at `public/previews/-dark.png` and `-light.png` +- [ ] `pnpm previews:generate` has been run +- [ ] `pnpm registry:build` and `pnpm build` pass diff --git a/.pi/skills/frontend-design/LICENSE.txt b/.pi/skills/frontend-design/LICENSE.txt new file mode 100644 index 0000000..f433b1a --- /dev/null +++ b/.pi/skills/frontend-design/LICENSE.txt @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/.pi/skills/frontend-design/SKILL.md b/.pi/skills/frontend-design/SKILL.md new file mode 100644 index 0000000..172751b --- /dev/null +++ b/.pi/skills/frontend-design/SKILL.md @@ -0,0 +1,62 @@ +--- +name: frontend-design +description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics. +license: Complete terms in LICENSE.txt +--- + + +Guide creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. + +The user provides frontend requirements: a component, page, application, or interface to build. They MAY include context about the purpose, audience, or technical constraints. + + + + +## Design Thinking + +Before coding, understand the context and commit to a bold aesthetic direction: + +- **Purpose**: What problem does this interface solve? Who uses it? +- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. Use these for inspiration but design one that is true to the aesthetic direction. +- **Constraints**: Technical requirements (framework, performance, accessibility). +- **Differentiation**: What makes this unforgettable? What's the one thing someone will remember? + +The agent MUST choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work — the key is intentionality, not intensity. + +Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is: +- Production-grade and functional +- Visually striking and memorable +- Cohesive with a clear aesthetic point-of-view +- Meticulously refined in every detail + + + + + +## Frontend Aesthetics + +- **Typography**: MUST choose fonts that are beautiful, unique, and interesting. MUST NOT default to generic fonts like Arial and Inter. Pair a distinctive display font with a refined body font. +- **Color & Theme**: MUST commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. +- **Motion**: SHOULD use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions. +- **Spatial Composition**: SHOULD use unexpected layouts — asymmetry, overlap, diagonal flow, grid-breaking elements, generous negative space or controlled density. +- **Backgrounds & Visual Details**: SHOULD create atmosphere and depth rather than defaulting to solid colors. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays. + + + + + +## Anti-Patterns + +MUST NOT use generic AI-generated aesthetics: +- Overused font families (Inter, Roboto, Arial, system fonts) +- Cliched color schemes (particularly purple gradients on white backgrounds) +- Predictable layouts and component patterns +- Cookie-cutter design that lacks context-specific character + +MUST NOT converge on common choices (e.g. Space Grotesk) across generations. Each design MUST be distinct — vary between light and dark themes, different fonts, different aesthetics. + +## Complexity Matching + +Implementation complexity MUST match the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well. + + diff --git a/.pi/skills/jalco-component-builder/SKILL.md b/.pi/skills/jalco-component-builder/SKILL.md new file mode 100644 index 0000000..b940034 --- /dev/null +++ b/.pi/skills/jalco-component-builder/SKILL.md @@ -0,0 +1,315 @@ +--- +name: jalco-component-builder +description: "Build jalco ui components through a deliberate workflow: clarify requirements, judge scope and file boundaries, prefer strong default states and restrained variants, implement with shadcn-style ergonomics, and ship aligned docs. Use when the user asks to create a component, build a component, make a new UI component, add a registry component, create a docs component, add variants, refactor a component, or review public components, demos, or docs-facing UI." +--- + + + +# jal-co/ui Component Builder + +Primary workflow skill for creating, refining, or reviewing a jalco ui component, block, demo, or docs-facing UI. + +Common triggers include requests like: +- create a component +- build a component +- make a new UI component +- add a registry component +- create a docs component +- add variants to this component +- refactor this component +- review this component + +This skill guides the sequence of decisions before implementation, while treating other skills as supporting references rather than equal peers. + + + + + +## Required reading before changes + +Before implementing a public component, the agent MUST read: +- `AGENTS.md` +- `.pi/references/docs-component-format-spec.md` +- `.pi/skills/jalco-shadcn-registry/SKILL.md` for registry-backed work +- `.pi/skills/jalco-writing-component-docs/SKILL.md` for docs work + +The agent MUST also inspect: +- similar components already in the repo +- related demo or preview files +- related docs pages +- `app/page.tsx` when adding homepage-style showcases + +## Supporting references + +Use these as references during implementation, not as separate workflow owners: +- `shadcn-ui` for baseline shadcn component ergonomics, accessibility patterns, and common primitive composition +- `.pi/skills/tailwind-design-system/SKILL.md` for semantic tokens, Tailwind v4 patterns, and variant consistency +- `.pi/skills/vercel-composition-patterns/SKILL.md` for variant discipline, composition, and avoiding boolean-prop-heavy APIs +- `.pi/skills/vercel-react-best-practices/SKILL.md` for React and Next.js implementation quality +- `component-engineering` as a reference for semantics, accessibility, and prop/API discipline when needed + +## Core goal + +Build components that feel intentional, production-ready, readable, and easy to adapt. + +jalco ui components MUST NOT merely be valid. They MUST: +- have a clear reason to exist +- look strong in their default state +- use restrained, consistent styling +- prefer one strong layout idea over decorative layering +- be easy to scan, copy, and modify +- ship with aligned docs, preview, and registry metadata when public + + + + + +## Preferred workflow + +### 1. Clarify before coding + +The agent MUST NOT jump straight into implementation when the request is underspecified. + +Use the `question` or `questionnaire` tool to clarify what should be built when needed. + +Key questions to answer: +- What problem does this component solve? +- Is this a primitive, composed component, or a block? +- Is it meant for the public registry, docs site only, or both? +- What should the default state optimize for? +- What surrounding UI context should the preview suggest? +- Which variants are truly meaningful? +- Should icons be muted, colored, or omitted? +- Does motion materially improve the component or is static styling enough? +- Should this stay in one file? +- Is a new dependency truly justified? + +Use concise, Socratic questioning. Narrow the problem. SHOULD NOT ask endless open-ended questions if a small number of targeted choices will do. + +### 2. Define the component before implementation + +Before writing code, the agent MUST be able to state: +1. the core use case in one sentence +2. the primary visual idea +3. the minimum public API +4. the justified variants, if any +5. whether it should be one file or multi-file +6. whether any dependency is required +7. what the default preview should demonstrate + +If those decisions are fuzzy, the agent MUST NOT start coding yet. + +### 3. Prefer one file by default + +For public jalco ui components, the agent SHOULD prefer a single file unless multiple files materially improve: +- readability +- runtime correctness +- reuse across multiple items +- installability +- registry packaging clarity + +Keep local helpers, CVA variants, and small subcomponents inline when they are only meaningful inside the component. + +Use multiple files only when: +- runtime boundaries differ (`use client`, server-only logic, dynamic loading) +- a hook or utility is genuinely reused outside the component +- the item is a true multi-part block +- a single file becomes harder to understand than the separated version + +MUST NOT create unnecessary files like: +- `types.ts` for one local interface +- `constants.ts` for tiny local data +- `utils.ts` for one component-local helper +- internal file splitting that makes copy-paste adoption worse + +### 4. Prefer stronger defaults over more variants + +A component MUST be compelling in its default state. + +Variants MUST earn their existence. + +Use public variants only when they represent real differences in: +- use case +- semantics +- structure +- emphasis +- layout behavior + +MUST NOT include decorative-only variants or tiny visual permutations. + +If a component needs substantially different structure across modes, prefer: +- explicit exports +- compound composition +- separate components + +rather than one overloaded variant API. + +### 5. Keep styling restrained and product-like + +SHOULD prefer: +- strong spacing and hierarchy +- clear typography +- semantic color usage +- realistic layout rhythm +- calm defaults + +MUST NOT: +- layer border + tint + shadow + glow + gradient without purpose +- add icons just to make a demo look more interesting +- overuse nested rounded containers +- create generic card wrappers with no clear opinion +- ship demos that only work because they are over-decorated + +If the component only looks good in its fanciest state, the base design is too weak. + +### 6. Judge dependencies explicitly + +The agent MUST NOT add a dependency casually. + +Before adding one, evaluate: +- Can this be done with existing repo dependencies? +- Can this be done with CSS, Radix, or browser APIs? +- Does the dependency materially improve the public component? +- Does it make the registry item heavier or harder to adopt? +- Would consumers reasonably expect this dependency? + +Default to no new dependency. Add one only when the benefit is clear. + +### 7. Implement with jalco ui conventions + +Implementation MUST: +- match existing naming and styling conventions +- use semantic tokens and repo utility patterns +- avoid boolean-prop-heavy APIs +- favor readable component code over architectural indirection +- preserve accessibility and copy-paste ergonomics + +For public entry files: +- SHOULD use the Jalco-style compact file header when appropriate +- MUST NOT add decorative separator comments +- MUST keep comments minimal and useful + +### 8. Ship docs and catalog preview as part of the component + +Public component work is not done until docs and the catalog card preview are updated. + +When applicable, the agent MUST update or create: +- component docs page +- preview/demo source +- install instructions +- usage examples +- relevant homepage/showcase examples +- registry metadata +- sidebar nav entry in `lib/docs.ts` +- catalog card preview at `components/docs/previews/.tsx` + +After creating or modifying a card preview file, `pnpm previews:generate` MUST be run to regenerate the import map. The codegen also runs automatically on `pnpm dev` and `pnpm build`. + +Card preview files: +- MUST default-export an async server component +- MUST render a miniature version of the component with realistic sample data +- SHOULD show key variants, sizes, or layout exports when the component has them +- MUST NOT be part of the installable registry item +- live in `components/docs/previews/`, not inside `registry/` +- also appear on the `/dev/screenshots` utility page for PNG export + +Descriptions, names, and preview coverage MUST stay aligned across all surfaces. + + + + + +## File boundary checklist + +Before splitting a component into multiple files, ask: +1. Does the user benefit from opening more than one file? +2. Are these parts reused outside this component family today? +3. Do runtime boundaries require the split? +4. Does the split improve installability or registry clarity? +5. Would a single file still be easier to scan and adapt? +6. Am I splitting because the design truly needs it, or because it feels more architectural? + +If most answers are no, keep it in one file. + +## Dependency checklist + +Before adding a new package, ask: +1. Is there an existing repo dependency that already solves this? +2. Can native CSS, Tailwind, or browser APIs handle it? +3. Does this make the component meaningfully better for users? +4. Will this complicate registry install or public adoption? +5. Would I still choose this dependency if the component were being copied into a production app today? + +If the answer is uncertain, MUST NOT add it. + +## Component quality checklist + +Before shipping a public component, verify: +1. The default example looks production-ready. +2. The use case is clear and specific. +3. The component is visually coherent without decorative extras. +4. The public API is smaller and more semantic than the first draft. +5. Variants map to real use cases. +6. The file structure is simpler than the first draft. +7. The preview content feels believable. +8. The component is distinct enough to justify public inclusion. +9. Docs, preview, and registry copy all describe the same artifact. +10. A user could realistically copy the default version into a real app with minimal cleanup. +11. A card preview file exists at `components/docs/previews/.tsx`. +12. The sidebar nav entry exists in `lib/docs.ts`. + + + + + +## Recommended questioning patterns + +When requirements are underspecified, prefer questions like: +- Which of these is closest: primitive, composed component, or block? +- Should the default feel neutral, branded, dense, or editorial? +- Is the main value layout, interaction, or presentation? +- Do you want one strong default, or a small set of meaningful variants? +- Should this optimize for docs-site display, public reuse, or both? +- Would you expect this to install as a single file? + +SHOULD prefer multiple-choice clarification when possible. + + + + + +## Anti-patterns + +MUST NOT: +- jump to code before clarifying the use case +- split modest components into many files +- create variants for completeness rather than usefulness +- use icons, badges, or gradients to hide weak structure +- over-abstract local helpers +- add dependencies without a clear payoff +- ship public components without aligned docs +- treat preview coverage as separate from design quality + + + + + +## Recommended workflow summary + +1. Create a feature branch: `feat/`. +2. Clarify the request. +3. Inspect related repo patterns. +4. Define use case, API, variants, file structure, and dependency needs. +5. Implement the component with a one-file bias. +6. Create or update previews and demos with realistic content. +7. Create a catalog card preview at `components/docs/previews/.tsx` with key variants. +8. Add the sidebar nav entry in `lib/docs.ts` with `badge: "New"` and `badgeAdded` set to today's ISO date. +9. Update docs and registry metadata when public. +10. Run `pnpm previews:generate` to update the import map. +11. Generate screenshots via `/dev/screenshots` — save both dark and light PNGs to `public/previews/`. +12. Run `pnpm registry:build` and `pnpm build` to verify. +13. Open a PR using the component template (`.github/PULL_REQUEST_TEMPLATE/component.md`). +14. Attach dark and light screenshots to the PR body. +15. Review against the quality, file-boundary, and dependency checklists. + + diff --git a/.pi/skills/jalco-shadcn-registry/README.md b/.pi/skills/jalco-shadcn-registry/README.md new file mode 100644 index 0000000..72c21bd --- /dev/null +++ b/.pi/skills/jalco-shadcn-registry/README.md @@ -0,0 +1,31 @@ +# jalco-shadcn-registry + +Repo-local skill for building and maintaining the jalco ui shadcn-compatible registry. + +## Use this skill for + +- registry item creation +- registry.json maintenance +- item type selection +- namespace planning +- authentication planning +- MCP compatibility checks +- Open in v0 compatibility checks +- registry review workflows + +## Primary references + +- `AGENTS.md` +- `registry.json` +- `package.json` +- shadcn registry docs +- local jalco ui component/design-system skills + +## Notes + +This skill is tailored to jalco ui's use of the shadcn registry system and emphasizes: +- installability +- high-quality metadata +- public/open-source quality +- future namespace support +- MCP-friendly registry structure diff --git a/.pi/skills/jalco-shadcn-registry/SKILL.md b/.pi/skills/jalco-shadcn-registry/SKILL.md new file mode 100644 index 0000000..c170cdd --- /dev/null +++ b/.pi/skills/jalco-shadcn-registry/SKILL.md @@ -0,0 +1,252 @@ +--- +name: jalco-shadcn-registry +description: Build and maintain the jalco ui shadcn-compatible registry. Use when creating or reviewing registry items, editing registry.json, choosing registry item types, configuring namespaced registries, planning authentication, adding docs metadata, or ensuring MCP/open-in-v0 compatibility. +--- + + + +# jal-co/ui shadcn Registry Skill + +Use this skill when working on jalco ui registry infrastructure, registry items, or registry-related docs. + + + + + +## Required reading before changes + +Before implementing registry work, the agent MUST read: +- `AGENTS.md` +- `registry.json` +- `package.json` +- `.pi/skills/vercel-react-best-practices/SKILL.md` +- `.pi/skills/vercel-composition-patterns/SKILL.md` +- `.pi/skills/tailwind-design-system/SKILL.md` + +When needed, the agent SHOULD also inspect: +- `components.json` +- `public/r` +- `registry/` +- `components/open-in-v0-button.tsx` +- `app/page.tsx` + +## What this skill covers + +- creating new registry items +- choosing the correct registry item type +- updating `registry.json` +- validating `files`, `target`, `dependencies`, and `registryDependencies` +- organizing items under `registry/[style]/...` +- planning namespaced registries +- preparing for MCP compatibility +- planning Open in v0 compatibility +- documenting installation and usage +- evaluating item types: `registry:component`, `registry:block`, `registry:ui`, `registry:lib`, `registry:hook`, `registry:style`, `registry:theme`, `registry:base`, or `registry:item` + + + + + +## Core rules from shadcn registry docs + +### Registry basics + +- The registry MUST expose a root `registry.json` payload. +- `registry.json` MUST validate against `https://ui.shadcn.com/schema/registry.json`. +- Registry items MUST conform to `https://ui.shadcn.com/schema/registry-item.json`. +- The `shadcn build` command generates item payloads under `public/r` by default. +- The registry index SHOULD maintain useful titles and descriptions. + +### File organization + +- Source files SHOULD be placed under `registry/[style]/[item-name]/...`. +- For grouped items, internal folders like `components/`, `hooks/`, and `lib/` SHOULD be used. +- Imports inside registry source MUST use the `@/registry/...` path when referencing registry-local files. +- File structure MUST be intentional and installable. + +### Choosing item types + +The agent MUST use the smallest correct type: +- `registry:component` for simple components +- `registry:ui` for reusable UI primitives and single-file primitives +- `registry:block` for multi-file installable blocks and richer examples +- `registry:hook` for hooks +- `registry:lib` for utilities and non-component code +- `registry:page` for route/page files +- `registry:file` for miscellaneous targeted files +- `registry:theme` for theme tokens +- `registry:style` for styles +- `registry:base` for full design-system base configuration +- `registry:item` for universal or framework-agnostic items + +### files and targets + +- Every file entry MUST include `path` and `type`. +- `target` is REQUIRED for `registry:page` and `registry:file`. +- Explicit targets SHOULD be used for universal items. +- Target paths MUST be clear, intentional, and safe. + +### Dependencies + +- `dependencies` MUST be used for npm packages. +- `devDependencies` MUST only be used for development-only packages. +- `registryDependencies` MUST be used for shadcn items, namespaced items, or remote registry item URLs. +- Dependencies MUST be complete and accurate. +- Dependency sets SHOULD be minimal. + +### Metadata quality + +- `title` and `description` MUST have useful values. +- Meaningful `categories` and `meta` SHOULD be provided when they improve discoverability. +- `docs` SHOULD be used to show extra installation/setup guidance when needed. +- Descriptions SHOULD help both humans and MCP/AI systems understand the item quickly. + + + + + +## Namespaces + +Namespace support SHOULD be planned early. + +### Namespace rules + +- Namespace names MUST start with `@`. +- Format MUST be `@namespace/resource-name`. +- Namespace config belongs in `components.json` under `registries`. +- `{name}` in registry URLs MUST be supported. +- `{style}` SHOULD be supported when serving style-specific variants. + +### Suggested jalco ui approach + +Start simple, then expand. + +Good initial public namespace options: +- `@jalco` for primary public items +- `@jalco-blocks` for blocks if separation becomes useful +- `@jalco-experimental` for unstable items later + +Default recommendation: +- keep the source registry simple first +- design item naming and docs so a namespace strategy can be layered on cleanly later + +## Authentication + +For private registries or future premium/internal variants: +- MUST use HTTPS +- SHOULD use environment-variable-backed credentials +- SHOULD support Bearer token or API key auth for CLI consumers +- MAY use query parameter auth when needed for Open in v0 compatibility +- MUST NOT commit tokens or real credentials + +### Open in v0 limitation + +Open in v0 does not support: +- namespaced registries +- cssVars +- css +- envVars +- advanced header-based authentication + +If Open in v0 support is required, prefer a public item URL or query-parameter-based auth. + +## MCP compatibility + +The shadcn MCP server works with shadcn-compatible registries without special custom server work. + +To stay MCP-friendly: +- `registry.json` MUST be valid and discoverable +- Item names MUST be consistent and kebab-case +- Descriptions SHOULD be informative +- Dependencies MUST be declared accurately +- `registryDependencies` MUST preserve clear relationships +- A registry index item MUST be available at the expected root registry endpoint + +## Open-source registry index + +If jalco ui is submitted to the shadcn open-source registry index later: +- the registry MUST be publicly accessible +- the registry SHOULD be flat at the public endpoint +- item payloads MUST be root-addressable +- MUST NOT rely on embedded `content` in the public registry index listing +- the final hosted shape MUST be validated against shadcn requirements before submission + + + + + +## jal-co/ui standards for registry work + +Every registry item MUST be: +- installable +- readable +- accessible +- polished +- documentation-ready +- consistent with jalco ui naming and design standards + +SHOULD prefer: +- strong preview value +- practical examples +- accurate install guidance +- minimal surprises for consumers + +MUST NOT include: +- vague descriptions +- bloated dependency lists +- unclear file targets +- overly clever item structures +- inconsistent item types +- undocumented environment variable requirements + + + + + +## Recommended workflow + +1. Create a feature branch: `feat/`. +2. Read `AGENTS.md` and relevant local skills. +3. Inspect similar registry items already in the repo. +4. Choose the correct item type. +5. Create files under the correct `registry/[style]/...` location. +6. Update `registry.json` with accurate metadata. +7. Verify dependencies and registry dependencies. +8. Create a catalog card preview at `components/docs/previews/.tsx` with key variants. +9. Add the sidebar nav entry in `lib/docs.ts` with `badge: "New"` and `badgeAdded` set to today's ISO date. +10. Run `pnpm previews:generate` to update the catalog import map. +11. Generate screenshots via `/dev/screenshots` — save dark and light PNGs to `public/previews/`. +12. Run `pnpm registry:build`. +13. Run `pnpm build` to verify full compilation. +14. Test the local endpoint in `public/r` or via the dev server. +15. Confirm docs/install copy is accurate. +16. Open a PR using the component template (`.github/PULL_REQUEST_TEMPLATE/component.md`). +17. If relevant, verify MCP and Open in v0 implications. + +## Useful commands + +```bash +pnpm install +pnpm dev +pnpm registry:build +pnpm dlx shadcn@latest view http://localhost:3000/r/.json +pnpm dlx shadcn@latest add http://localhost:3000/r/.json +``` + + + + + +## When reviewing registry work + +Check for: +- valid item type selection +- correct `files` and `target` usage +- complete dependency declarations +- good descriptions and categories +- installability +- consistent registry paths +- realistic docs guidance +- namespace/auth/MCP/open-in-v0 implications when relevant + + diff --git a/.pi/skills/jalco-writing-component-docs/SKILL.md b/.pi/skills/jalco-writing-component-docs/SKILL.md new file mode 100644 index 0000000..d4340b2 --- /dev/null +++ b/.pi/skills/jalco-writing-component-docs/SKILL.md @@ -0,0 +1,119 @@ +--- +name: jalco-writing-component-docs +description: Write and review jalco ui component documentation with consistent structure, concise descriptions, realistic examples, and registry-aligned metadata. Use when creating new component docs, updating existing docs, reviewing doc quality, or syncing registry-backed component copy. +--- + + + +# jal-co/ui Component Docs Skill + +Use this skill when creating, editing, or reviewing component documentation in jalco ui. + +## Canonical reference + +The single source of truth for docs page structure, section order, and formatting rules is: + +**`.pi/references/docs-component-format-spec.md`** + +The agent MUST read it before writing or updating any component docs. This skill provides workflow guidance and review steps, not a parallel format definition. + + + + + +## Required reading before changes + +1. `.pi/references/docs-component-format-spec.md` — page anatomy, section order, writing rules +2. `AGENTS.md` — project conventions, quality bar, comment style +3. `.pi/skills/jalco-shadcn-registry/SKILL.md` — for registry-backed items + +The agent MUST also inspect: +- similar component docs already in the repo +- the source component and its example/demo files +- any related registry metadata + +## What this skill covers + +- writing new component docs +- revising existing component docs +- reviewing docs for clarity and consistency +- writing or refining descriptions +- keeping registry-backed descriptions in sync + + + + + +## Workflow + +1. Read `.pi/references/docs-component-format-spec.md` and this skill. +2. Inspect similar docs pages in `app/docs/components/`. +3. Review the component source, public API, and demo files. +4. Create or update the page using `ComponentDocsPage` from `components/docs/component-docs-page.tsx`. +5. Supply: `title`, `description`, `registryName`, `sourceFiles`, `preview`, `usage`. +6. Add Examples, API Reference, Notes, or When to use sections as children — only when justified. +7. Sync description and naming with `registry.json` and `lib/docs.ts`. +8. Ensure a catalog card preview exists at `components/docs/previews/.tsx` with key variants. +9. Ensure the sidebar nav entry exists in `lib/docs.ts` with `badge: "New"` and `badgeAdded` set for new components. +10. Run `pnpm previews:generate` if the card preview file was created or renamed. +11. Ensure screenshots exist at `public/previews/-dark.png` and `-light.png`. +12. Review using the checklist in `.pi/references/docs-component-format-spec.md`. + + + + + +## Quick rules + +These are the rules most frequently needed during docs work. For full details, see the format spec. + +### Descriptions + +- MUST be one sentence, capability-first +- MUST NOT start with "A", "An", or "A React component for..." +- MUST NOT contain subjective adjectives +- MUST match across: page metadata, ComponentDocsPage props, registry.json + +### Usage section + +- MUST include import and minimal usage snippets via `CodeLine` +- Server/client rendering context MUST go here, not in Notes +- The first example SHOULD be minimal — layer complexity in Examples + +### Examples + +- MUST use `VariantGrid` with labeled items +- MUST group by meaning: Variants, Sizes, Languages, etc. +- MUST NOT call everything a variant +- SHOULD use realistic content + +### Notes + +- MUST contain only caveats, limitations, and external service behavior +- MUST NOT include architecture decisions, feature highlights, or rendering context +- SHOULD be brief + +### Bundled exports + +- MUST use `installNote` to explain the relationship +- MUST set `bundledIn` on the nav item in `lib/docs.ts` + + + + + +## Review checklist + +Use the checklist in `.pi/references/docs-component-format-spec.md` before shipping any docs page. + +Key things to verify: +1. Page uses `ComponentDocsPage` +2. Description matches across all surfaces +3. Preview is realistic +4. Usage includes runtime context +5. Examples are labeled correctly +6. Notes contains only caveats +7. Sidebar entry is correct (title, order, bundledIn) +8. Catalog card preview exists at `components/docs/previews/.tsx` + + diff --git a/.pi/skills/tailwind-design-system/SKILL.md b/.pi/skills/tailwind-design-system/SKILL.md new file mode 100644 index 0000000..1848e5b --- /dev/null +++ b/.pi/skills/tailwind-design-system/SKILL.md @@ -0,0 +1,894 @@ +--- +name: tailwind-design-system +description: Build scalable design systems with Tailwind CSS v4, design tokens, component libraries, and responsive patterns. Use when creating component libraries, implementing design systems, or standardizing UI patterns. +--- + + + +# Tailwind Design System (v4) + +Build production-ready design systems with Tailwind CSS v4, including CSS-first configuration, design tokens, component variants, responsive patterns, and accessibility. + +> **Note**: This skill targets Tailwind CSS v4 (2024+). For v3 projects, refer to the [upgrade guide](https://tailwindcss.com/docs/upgrade-guide). + + + + + +## When to Use This Skill + +- Creating a component library with Tailwind v4 +- Implementing design tokens and theming with CSS-first configuration +- Building responsive and accessible components +- Standardizing UI patterns across a codebase +- Migrating from Tailwind v3 to v4 +- Setting up dark mode with native CSS features + +## Key v4 Changes + +| v3 Pattern | v4 Pattern | +| ------------------------------------- | --------------------------------------------------------------------- | +| `tailwind.config.ts` | `@theme` in CSS | +| `@tailwind base/components/utilities` | `@import "tailwindcss"` | +| `darkMode: "class"` | `@custom-variant dark (&:where(.dark, .dark *))` | +| `theme.extend.colors` | `@theme { --color-*: value }` | +| `require("tailwindcss-animate")` | CSS `@keyframes` in `@theme` + `@starting-style` for entry animations | + + + + + +## Quick Start + +```css +/* app.css - Tailwind v4 CSS-first configuration */ +@import "tailwindcss"; + +/* Define your theme with @theme */ +@theme { + /* Semantic color tokens using OKLCH for better color perception */ + --color-background: oklch(100% 0 0); + --color-foreground: oklch(14.5% 0.025 264); + + --color-primary: oklch(14.5% 0.025 264); + --color-primary-foreground: oklch(98% 0.01 264); + + --color-secondary: oklch(96% 0.01 264); + --color-secondary-foreground: oklch(14.5% 0.025 264); + + --color-muted: oklch(96% 0.01 264); + --color-muted-foreground: oklch(46% 0.02 264); + + --color-accent: oklch(96% 0.01 264); + --color-accent-foreground: oklch(14.5% 0.025 264); + + --color-destructive: oklch(53% 0.22 27); + --color-destructive-foreground: oklch(98% 0.01 264); + + --color-border: oklch(91% 0.01 264); + --color-ring: oklch(14.5% 0.025 264); + + --color-card: oklch(100% 0 0); + --color-card-foreground: oklch(14.5% 0.025 264); + + /* Ring offset for focus states */ + --color-ring-offset: oklch(100% 0 0); + + /* Radius tokens */ + --radius-sm: 0.25rem; + --radius-md: 0.375rem; + --radius-lg: 0.5rem; + --radius-xl: 0.75rem; + + /* Animation tokens - keyframes inside @theme are output when referenced by --animate-* variables */ + --animate-fade-in: fade-in 0.2s ease-out; + --animate-fade-out: fade-out 0.2s ease-in; + --animate-slide-in: slide-in 0.3s ease-out; + --animate-slide-out: slide-out 0.3s ease-in; + + @keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + + @keyframes fade-out { + from { + opacity: 1; + } + to { + opacity: 0; + } + } + + @keyframes slide-in { + from { + transform: translateY(-0.5rem); + opacity: 0; + } + to { + transform: translateY(0); + opacity: 1; + } + } + + @keyframes slide-out { + from { + transform: translateY(0); + opacity: 1; + } + to { + transform: translateY(-0.5rem); + opacity: 0; + } + } +} + +/* Dark mode variant - use @custom-variant for class-based dark mode */ +@custom-variant dark (&:where(.dark, .dark *)); + +/* Dark mode theme overrides */ +.dark { + --color-background: oklch(14.5% 0.025 264); + --color-foreground: oklch(98% 0.01 264); + + --color-primary: oklch(98% 0.01 264); + --color-primary-foreground: oklch(14.5% 0.025 264); + + --color-secondary: oklch(22% 0.02 264); + --color-secondary-foreground: oklch(98% 0.01 264); + + --color-muted: oklch(22% 0.02 264); + --color-muted-foreground: oklch(65% 0.02 264); + + --color-accent: oklch(22% 0.02 264); + --color-accent-foreground: oklch(98% 0.01 264); + + --color-destructive: oklch(42% 0.15 27); + --color-destructive-foreground: oklch(98% 0.01 264); + + --color-border: oklch(22% 0.02 264); + --color-ring: oklch(83% 0.02 264); + + --color-card: oklch(14.5% 0.025 264); + --color-card-foreground: oklch(98% 0.01 264); + + --color-ring-offset: oklch(14.5% 0.025 264); +} + +/* Base styles */ +@layer base { + * { + @apply border-border; + } + + body { + @apply bg-background text-foreground antialiased; + } +} +``` + + + + + +## Core Concepts + +### 1. Design Token Hierarchy + +``` +Brand Tokens (abstract) + └── Semantic Tokens (purpose) + └── Component Tokens (specific) + +Example: + oklch(45% 0.2 260) → --color-primary → bg-primary +``` + +### 2. Component Architecture + +``` +Base styles → Variants → Sizes → States → Overrides +``` + +## Patterns + +### Pattern 1: CVA (Class Variance Authority) Components + +```typescript +// components/ui/button.tsx +import { Slot } from '@radix-ui/react-slot' +import { cva, type VariantProps } from 'class-variance-authority' +import { cn } from '@/lib/utils' + +const buttonVariants = cva( + // Base styles - v4 uses native CSS variables + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: 'border border-border bg-background hover:bg-accent hover:text-accent-foreground', + secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'size-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + } +) + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean +} + +// React 19: No forwardRef needed +export function Button({ + className, + variant, + size, + asChild = false, + ref, + ...props +}: ButtonProps & { ref?: React.Ref }) { + const Comp = asChild ? Slot : 'button' + return ( + + ) +} + +// Usage + + + +``` + +### Pattern 2: Compound Components (React 19) + +```typescript +// components/ui/card.tsx +import { cn } from '@/lib/utils' + +// React 19: ref is a regular prop, no forwardRef +export function Card({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +
+ ) +} + +export function CardHeader({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +
+ ) +} + +export function CardTitle({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +

+ ) +} + +export function CardDescription({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +

+ ) +} + +export function CardContent({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +

+ ) +} + +export function CardFooter({ + className, + ref, + ...props +}: React.HTMLAttributes & { ref?: React.Ref }) { + return ( +
+ ) +} + +// Usage + + + Account + Manage your account settings + + +
...
+
+ + + +
+``` + +### Pattern 3: Form Components + +```typescript +// components/ui/input.tsx +import { cn } from '@/lib/utils' + +export interface InputProps extends React.InputHTMLAttributes { + error?: string + ref?: React.Ref +} + +export function Input({ className, type, error, ref, ...props }: InputProps) { + return ( +
+ + {error && ( + + )} +
+ ) +} + +// components/ui/label.tsx +import { cva, type VariantProps } from 'class-variance-authority' + +const labelVariants = cva( + 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70' +) + +export function Label({ + className, + ref, + ...props +}: React.LabelHTMLAttributes & { ref?: React.Ref }) { + return ( +