From 01fd7999d17d74a1072b5fc9a9420e1dee2cb807 Mon Sep 17 00:00:00 2001 From: Justin Levine <20596508+justinlevinedotme@users.noreply.github.com> Date: Fri, 13 Mar 2026 10:04:27 -0700 Subject: [PATCH 1/3] chore(repo): track AGENTS.md and .pi/, clean up skills and prompts - Remove AGENTS.md and .pi/ from .gitignore - Apply RFC 2119 keywords to AGENTS.md for unambiguous requirements - Update branch naming to follow Conventional Branch spec - Remove posthog-integration and seo-aeo-best-practices skills - Consolidate duplicate prompts (keep component-create, component-review, ideate) - Remove create-jalco-component, create-jalco-block, review-jalco-component - Update prompts README --- .gitignore | 4 +- .pi/skills/frontend-design/LICENSE.txt | 177 + .pi/skills/frontend-design/SKILL.md | 42 + .pi/skills/jalco-component-builder/SKILL.md | 295 ++ .pi/skills/jalco-shadcn-registry/README.md | 28 + .pi/skills/jalco-shadcn-registry/SKILL.md | 216 ++ .../jalco-writing-component-docs/SKILL.md | 94 + .pi/skills/tailwind-design-system/SKILL.md | 866 +++++ .../vercel-composition-patterns/AGENTS.md | 946 ++++++ .../vercel-composition-patterns/README.md | 60 + .../vercel-composition-patterns/SKILL.md | 89 + .../rules/architecture-avoid-boolean-props.md | 100 + .../rules/architecture-compound-components.md | 112 + .../patterns-children-over-render-props.md | 87 + .../rules/patterns-explicit-variants.md | 100 + .../rules/react19-no-forwardref.md | 42 + .../rules/state-context-interface.md | 191 ++ .../rules/state-decouple-implementation.md | 113 + .../rules/state-lift-state.md | 125 + .../vercel-react-best-practices/AGENTS.md | 2975 +++++++++++++++++ .../vercel-react-best-practices/README.md | 123 + .../vercel-react-best-practices/SKILL.md | 137 + .../rules/advanced-event-handler-refs.md | 55 + .../rules/advanced-init-once.md | 42 + .../rules/advanced-use-latest.md | 39 + .../rules/async-api-routes.md | 38 + .../rules/async-defer-await.md | 80 + .../rules/async-dependencies.md | 51 + .../rules/async-parallel.md | 28 + .../rules/async-suspense-boundaries.md | 99 + .../rules/bundle-barrel-imports.md | 59 + .../rules/bundle-conditional.md | 31 + .../rules/bundle-defer-third-party.md | 49 + .../rules/bundle-dynamic-imports.md | 35 + .../rules/bundle-preload.md | 50 + .../rules/client-event-listeners.md | 74 + .../rules/client-localstorage-schema.md | 71 + .../rules/client-passive-event-listeners.md | 48 + .../rules/client-swr-dedup.md | 56 + .../rules/js-batch-dom-css.md | 107 + .../rules/js-cache-function-results.md | 80 + .../rules/js-cache-property-access.md | 28 + .../rules/js-cache-storage.md | 70 + .../rules/js-combine-iterations.md | 32 + .../rules/js-early-exit.md | 50 + .../rules/js-hoist-regexp.md | 45 + .../rules/js-index-maps.md | 37 + .../rules/js-length-check-first.md | 49 + .../rules/js-min-max-loop.md | 82 + .../rules/js-set-map-lookups.md | 24 + .../rules/js-tosorted-immutable.md | 57 + .../rules/rendering-activity.md | 26 + .../rules/rendering-animate-svg-wrapper.md | 47 + .../rules/rendering-conditional-render.md | 40 + .../rules/rendering-content-visibility.md | 38 + .../rules/rendering-hoist-jsx.md | 46 + .../rules/rendering-hydration-no-flicker.md | 82 + .../rendering-hydration-suppress-warning.md | 30 + .../rules/rendering-svg-precision.md | 28 + .../rules/rendering-usetransition-loading.md | 75 + .../rules/rerender-defer-reads.md | 39 + .../rules/rerender-dependencies.md | 45 + .../rules/rerender-derived-state-no-effect.md | 40 + .../rules/rerender-derived-state.md | 29 + .../rules/rerender-functional-setstate.md | 74 + .../rules/rerender-lazy-state-init.md | 58 + .../rules/rerender-memo-with-default-value.md | 38 + .../rules/rerender-memo.md | 44 + .../rules/rerender-move-effect-to-event.md | 45 + .../rerender-simple-expression-in-memo.md | 35 + .../rules/rerender-transitions.md | 40 + .../rerender-use-ref-transient-values.md | 73 + .../rules/server-after-nonblocking.md | 73 + .../rules/server-auth-actions.md | 96 + .../rules/server-cache-lru.md | 41 + .../rules/server-cache-react.md | 76 + .../rules/server-dedup-props.md | 65 + .../rules/server-hoist-static-io.md | 142 + .../rules/server-parallel-fetching.md | 83 + .../rules/server-serialization.md | 38 + AGENTS.md | 387 +++ 81 files changed, 10459 insertions(+), 2 deletions(-) create mode 100644 .pi/skills/frontend-design/LICENSE.txt create mode 100644 .pi/skills/frontend-design/SKILL.md create mode 100644 .pi/skills/jalco-component-builder/SKILL.md create mode 100644 .pi/skills/jalco-shadcn-registry/README.md create mode 100644 .pi/skills/jalco-shadcn-registry/SKILL.md create mode 100644 .pi/skills/jalco-writing-component-docs/SKILL.md create mode 100644 .pi/skills/tailwind-design-system/SKILL.md create mode 100644 .pi/skills/vercel-composition-patterns/AGENTS.md create mode 100644 .pi/skills/vercel-composition-patterns/README.md create mode 100644 .pi/skills/vercel-composition-patterns/SKILL.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/architecture-compound-components.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/react19-no-forwardref.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/state-context-interface.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/state-decouple-implementation.md create mode 100644 .pi/skills/vercel-composition-patterns/rules/state-lift-state.md create mode 100644 .pi/skills/vercel-react-best-practices/AGENTS.md create mode 100644 .pi/skills/vercel-react-best-practices/README.md create mode 100644 .pi/skills/vercel-react-best-practices/SKILL.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/advanced-init-once.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/advanced-use-latest.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/async-api-routes.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/async-defer-await.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/async-dependencies.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/async-parallel.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/bundle-conditional.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/bundle-preload.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/client-event-listeners.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/client-localstorage-schema.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/client-swr-dedup.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-batch-dom-css.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-cache-function-results.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-cache-property-access.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-cache-storage.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-combine-iterations.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-early-exit.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-hoist-regexp.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-index-maps.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-length-check-first.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-min-max-loop.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-set-map-lookups.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-activity.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-conditional-render.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-content-visibility.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-svg-precision.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-defer-reads.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-dependencies.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-derived-state.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-memo.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-transitions.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-after-nonblocking.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-auth-actions.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-cache-lru.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-cache-react.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-dedup-props.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-hoist-static-io.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-parallel-fetching.md create mode 100644 .pi/skills/vercel-react-best-practices/rules/server-serialization.md create mode 100644 AGENTS.md diff --git a/.gitignore b/.gitignore index 5d37bfd..f818a7a 100644 --- a/.gitignore +++ b/.gitignore @@ -45,10 +45,10 @@ 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/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..5be498e --- /dev/null +++ b/.pi/skills/frontend-design/SKILL.md @@ -0,0 +1,42 @@ +--- +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 +--- + +This skill guides 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. There are so many flavors to choose from. 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? + +**CRITICAL**: 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 Guidelines + +Focus on: +- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font. +- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. +- **Motion**: 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 (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise. +- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density. +- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays. + +NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character. + +Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations. + +**IMPORTANT**: Match implementation complexity to 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. + +Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision. diff --git a/.pi/skills/jalco-component-builder/SKILL.md b/.pi/skills/jalco-component-builder/SKILL.md new file mode 100644 index 0000000..17285cf --- /dev/null +++ b/.pi/skills/jalco-component-builder/SKILL.md @@ -0,0 +1,295 @@ +--- +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 + +Use this skill when 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 is the primary workflow skill for public component work in jalco ui. It should guide 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, read: +- `AGENTS.md` +- `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 + +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 should not merely be valid. They should: +- 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 + +Do 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. Do not ask endless open-ended questions if a small number of targeted choices will do. + +### 2. Define the component before implementation + +Before writing code, 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, do not start coding yet. + +### 3. Prefer one file by default + +For public jalco ui components, 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 + +Avoid 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 should 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 + +Avoid decorative-only variants or tiny visual permutations. + +Consistency matters, but do not mechanically copy another component's variant list. + +Examples of acceptable variant language when appropriate: +- `default`, `primary`, `secondary`, `outline`, `ghost` +- `muted` and `colored` for icon treatments when those are meaningful and already established + +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 + +Prefer: +- strong spacing and hierarchy +- clear typography +- semantic color usage +- realistic layout rhythm +- calm defaults + +Avoid: +- layering border + tint + shadow + glow + gradient without purpose +- adding icons just to make a demo look more interesting +- overusing nested rounded containers +- generic card wrappers with no clear opinion +- 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 + +Do not add a dependency casually. + +Before adding one, ask: +- 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. If using a dependency like Motion or another animation package, the implementation and docs should make that choice feel justified. + +### 7. Implement with jalco ui conventions + +Implementation should: +- 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: +- use the Jalco-style compact file header when appropriate +- do not add decorative separator comments +- 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, 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, run `pnpm previews:generate` to regenerate the import map. The codegen also runs automatically on `pnpm dev` and `pnpm build`. + +Card preview files: +- default-export an async server component +- render a miniature version of the component with realistic sample data +- show key variants, sizes, or layout exports when the component has them +- are docs-site only, not 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 should 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, do 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? + +Prefer multiple-choice clarification when possible. + +## Anti-patterns + +Avoid: +- jumping to code before clarifying the use case +- splitting modest components into many files +- creating variants for completeness rather than usefulness +- using icons, badges, or gradients to hide weak structure +- over-abstracting local helpers +- adding dependencies without a clear payoff +- shipping public components without aligned docs +- treating 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..08beb31 --- /dev/null +++ b/.pi/skills/jalco-shadcn-registry/README.md @@ -0,0 +1,28 @@ +# jalco-shadcn-registry + +Repo-local Pi 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..9ad665d --- /dev/null +++ b/.pi/skills/jalco-shadcn-registry/SKILL.md @@ -0,0 +1,216 @@ +--- +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, 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, also inspect: +- `components.json` +- `public/r` +- `registry/` +- `components/open-in-v0-button.tsx` +- `app/page.tsx` + +## What this skill covers + +Use this skill for: +- 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 whether an item should be `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. +- jalco ui should keep `registry.json` valid 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. +- jalco ui should preserve a clean, public-quality registry index with useful titles and descriptions. + +### File organization +- Prefer placing source files under `registry/[style]/[item-name]/...`. +- For grouped items, prefer internal folders like `components/`, `hooks/`, and `lib/`. +- Imports inside registry source should use the `@/registry/...` path when referencing registry-local files. +- Keep file structure intentional and installable. + +### Choosing item types +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`. +- Use explicit targets for universal items. +- Keep target paths clear, intentional, and safe. + +### Dependencies +- Use `dependencies` for npm packages. +- Use `devDependencies` only for development-only packages. +- Use `registryDependencies` for shadcn items, namespaced items, or remote registry item URLs. +- Make dependencies complete and accurate. +- Prefer minimal dependency sets. + +### Metadata quality +- Always provide useful `title` and `description` values. +- Prefer meaningful `categories` and `meta` when they improve discoverability. +- Use `docs` to show extra installation/setup guidance when needed. +- Prefer descriptions that help both humans and MCP/AI systems understand the item quickly. + +## Namespaces + +jalco ui should plan for namespace support early. + +### Namespace rules +- Namespace names must start with `@`. +- Use `@namespace/resource-name` format. +- Namespace config belongs in `components.json` under `registries`. +- Support `{name}` in registry URLs. +- Support `{style}` when serving style-specific variants is useful. + +### 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: +- prefer HTTPS always +- prefer environment-variable-backed credentials +- support Bearer token or API key auth for CLI consumers +- use query parameter auth only when needed for Open in v0 compatibility +- never 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: +- keep `registry.json` valid and discoverable +- make item names consistent and kebab-case +- provide good descriptions +- declare dependencies accurately +- preserve clear relationships in `registryDependencies` +- ensure a registry index item is 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 should be root-addressable +- do not rely on embedded `content` in the public registry index listing +- validate the final hosted shape against shadcn requirements before submission + +## jal-co/ui standards for registry work + +Every registry item should be: +- installable +- readable +- accessible +- polished +- documentation-ready +- consistent with jalco ui naming and design standards + +Prefer: +- strong preview value +- practical examples +- accurate install guidance +- minimal surprises for consumers + +Avoid: +- 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..ec4932b --- /dev/null +++ b/.pi/skills/jalco-writing-component-docs/SKILL.md @@ -0,0 +1,94 @@ +--- +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: + +**`docs-component-format-spec.md`** (project root) + +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. `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 + +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 `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 `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 +- One sentence, capability-first +- No "A", "An", or "A React component for..." prefix +- No subjective adjectives +- Must match across: page metadata, ComponentDocsPage props, registry.json + +### Usage section +- Include import and minimal usage snippets via `CodeLine` +- Put server/client rendering context here, not in Notes +- Keep the first example minimal — layer complexity in Examples + +### Examples +- Use `VariantGrid` with labeled items +- Group by meaning: Variants, Sizes, Languages, etc. +- Do not call everything a variant +- Use realistic content + +### Notes +- Caveats, limitations, and external service behavior only +- Not for architecture decisions, feature highlights, or rendering context +- Keep brief + +### Bundled exports +- Use `installNote` to explain the relationship +- Set `bundledIn` on the nav item in `lib/docs.ts` + +## Review checklist + +Use the checklist in `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..7df5760 --- /dev/null +++ b/.pi/skills/tailwind-design-system/SKILL.md @@ -0,0 +1,866 @@ +--- +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 ( +