@skyroc/scripts 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/README.md +6 -3
  2. package/dist/cli.mjs +1 -1
  3. package/dist/{config-BKkdncJS.mjs → config-Cj9IzlRz.mjs} +105 -5
  4. package/dist/index.mjs +1 -1
  5. package/package.json +3 -3
  6. package/templates/admin/package.json +5 -1
  7. package/templates/admin/src/assets/svg-icon/logo.svg +1 -1
  8. package/templates/admin/uno.config.ts +1 -1
  9. package/templates/admin-root/.agents/skills/component-doc/SKILL.md +304 -0
  10. package/templates/admin-root/.agents/skills/component-refactoring/SKILL.md +483 -0
  11. package/templates/admin-root/.agents/skills/component-refactoring/references/complexity-patterns.md +493 -0
  12. package/templates/admin-root/.agents/skills/component-refactoring/references/component-splitting.md +477 -0
  13. package/templates/admin-root/.agents/skills/component-refactoring/references/hook-extraction.md +317 -0
  14. package/templates/admin-root/.agents/skills/doc-coauthoring/SKILL.md +375 -0
  15. package/templates/admin-root/.agents/skills/feature-dev/SKILL.md +78 -0
  16. package/templates/admin-root/.agents/skills/frontend-code-review/SKILL.md +73 -0
  17. package/templates/admin-root/.agents/skills/frontend-code-review/references/business-logic.md +15 -0
  18. package/templates/admin-root/.agents/skills/frontend-code-review/references/code-quality.md +44 -0
  19. package/templates/admin-root/.agents/skills/frontend-code-review/references/performance.md +45 -0
  20. package/templates/admin-root/.agents/skills/frontend-design/LICENSE.txt +177 -0
  21. package/templates/admin-root/.agents/skills/frontend-design/SKILL.md +42 -0
  22. package/templates/admin-root/.agents/skills/frontend-testing/SKILL.md +325 -0
  23. package/templates/admin-root/.agents/skills/frontend-testing/assets/component-test.template.tsx +293 -0
  24. package/templates/admin-root/.agents/skills/frontend-testing/assets/hook-test.template.ts +207 -0
  25. package/templates/admin-root/.agents/skills/frontend-testing/assets/utility-test.template.ts +154 -0
  26. package/templates/admin-root/.agents/skills/frontend-testing/references/async-testing.md +345 -0
  27. package/templates/admin-root/.agents/skills/frontend-testing/references/checklist.md +205 -0
  28. package/templates/admin-root/.agents/skills/frontend-testing/references/common-patterns.md +449 -0
  29. package/templates/admin-root/.agents/skills/frontend-testing/references/domain-components.md +523 -0
  30. package/templates/admin-root/.agents/skills/frontend-testing/references/mocking.md +512 -0
  31. package/templates/admin-root/.agents/skills/frontend-testing/references/workflow.md +269 -0
  32. package/templates/admin-root/.agents/skills/migrate-nativewind-to-uniwind/SKILL.md +734 -0
  33. package/templates/admin-root/.agents/skills/migrate-oxfmt/SKILL.md +202 -0
  34. package/templates/admin-root/.agents/skills/migrate-oxlint/SKILL.md +196 -0
  35. package/templates/admin-root/.agents/skills/native-component-doc/SKILL.md +245 -0
  36. package/templates/admin-root/.agents/skills/senior-frontend/SKILL.md +209 -0
  37. package/templates/admin-root/.agents/skills/senior-frontend/references/frontend_best_practices.md +103 -0
  38. package/templates/admin-root/.agents/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
  39. package/templates/admin-root/.agents/skills/senior-frontend/references/react_patterns.md +103 -0
  40. package/templates/admin-root/.agents/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
  41. package/templates/admin-root/.agents/skills/senior-frontend/scripts/component_generator.py +114 -0
  42. package/templates/admin-root/.agents/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
  43. package/templates/admin-root/.agents/skills/skill-creator/SKILL.md +355 -0
  44. package/templates/admin-root/.agents/skills/skill-creator/references/output-patterns.md +86 -0
  45. package/templates/admin-root/.agents/skills/skill-creator/references/workflows.md +28 -0
  46. package/templates/admin-root/.agents/skills/skill-creator/scripts/init_skill.py +300 -0
  47. package/templates/admin-root/.agents/skills/skill-creator/scripts/package_skill.py +110 -0
  48. package/templates/admin-root/.agents/skills/skill-creator/scripts/quick_validate.py +97 -0
  49. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/SKILL.md +163 -0
  50. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/acceptance-checklist.md +75 -0
  51. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/evidence-order.md +109 -0
  52. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prd-rules.md +103 -0
  53. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prototype-rules.md +85 -0
  54. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/scripts/verify-prototypes.mjs +144 -0
  55. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/admin-page.html +771 -0
  56. package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/prd.md +182 -0
  57. package/templates/admin-root/.agents/skills/ui-ux-pro-max/SKILL.md +292 -0
  58. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
  59. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
  60. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
  61. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
  62. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
  63. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  64. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  65. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  66. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  67. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  68. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  69. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  70. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  71. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  72. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  73. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  74. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  75. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  76. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  77. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
  78. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
  79. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  80. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  81. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  82. package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
  83. package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  84. package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
  85. package/templates/admin-root/.agents/skills/uniwind/SKILL.md +64 -0
  86. package/templates/admin-root/.agents/skills/uniwind/references/component-bindings.md +338 -0
  87. package/templates/admin-root/.agents/skills/uniwind/references/css-and-utilities.md +325 -0
  88. package/templates/admin-root/.agents/skills/uniwind/references/integrations.md +75 -0
  89. package/templates/admin-root/.agents/skills/uniwind/references/pro.md +354 -0
  90. package/templates/admin-root/.agents/skills/uniwind/references/setup.md +144 -0
  91. package/templates/admin-root/.agents/skills/uniwind/references/styling-patterns.md +237 -0
  92. package/templates/admin-root/.agents/skills/uniwind/references/theming.md +309 -0
  93. package/templates/admin-root/.agents/skills/uniwind/references/troubleshooting.md +179 -0
  94. package/templates/admin-root/.agents/skills/uniwind/references/variants-and-selectors.md +224 -0
  95. package/templates/admin-root/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
  96. package/templates/admin-root/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
  97. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  98. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  99. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  100. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  101. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  102. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  103. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  104. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  105. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  106. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  107. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  108. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  109. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  110. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  111. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  112. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  113. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  114. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  115. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  116. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  117. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  118. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  119. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  120. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  121. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  122. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  123. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  124. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  125. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  126. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  127. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  128. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  129. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  130. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  131. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  132. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  133. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  134. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  135. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  136. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  137. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  138. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  139. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  140. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  141. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  142. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  143. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  144. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  145. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  146. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  147. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  148. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  149. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  150. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  151. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  152. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  153. package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  154. package/templates/admin-root/.claude/settings.json +5 -0
  155. package/templates/admin-root/.claude/skills/component-doc/SKILL.md +304 -0
  156. package/templates/admin-root/.claude/skills/component-refactoring/SKILL.md +483 -0
  157. package/templates/admin-root/.claude/skills/component-refactoring/references/complexity-patterns.md +493 -0
  158. package/templates/admin-root/.claude/skills/component-refactoring/references/component-splitting.md +477 -0
  159. package/templates/admin-root/.claude/skills/component-refactoring/references/hook-extraction.md +317 -0
  160. package/templates/admin-root/.claude/skills/doc-coauthoring/SKILL.md +375 -0
  161. package/templates/admin-root/.claude/skills/feature-dev/SKILL.md +78 -0
  162. package/templates/admin-root/.claude/skills/frontend-code-review/SKILL.md +73 -0
  163. package/templates/admin-root/.claude/skills/frontend-code-review/references/business-logic.md +15 -0
  164. package/templates/admin-root/.claude/skills/frontend-code-review/references/code-quality.md +44 -0
  165. package/templates/admin-root/.claude/skills/frontend-code-review/references/performance.md +45 -0
  166. package/templates/admin-root/.claude/skills/frontend-design/LICENSE.txt +177 -0
  167. package/templates/admin-root/.claude/skills/frontend-design/SKILL.md +42 -0
  168. package/templates/admin-root/.claude/skills/frontend-testing/SKILL.md +325 -0
  169. package/templates/admin-root/.claude/skills/frontend-testing/assets/component-test.template.tsx +293 -0
  170. package/templates/admin-root/.claude/skills/frontend-testing/assets/hook-test.template.ts +207 -0
  171. package/templates/admin-root/.claude/skills/frontend-testing/assets/utility-test.template.ts +154 -0
  172. package/templates/admin-root/.claude/skills/frontend-testing/references/async-testing.md +345 -0
  173. package/templates/admin-root/.claude/skills/frontend-testing/references/checklist.md +205 -0
  174. package/templates/admin-root/.claude/skills/frontend-testing/references/common-patterns.md +449 -0
  175. package/templates/admin-root/.claude/skills/frontend-testing/references/domain-components.md +523 -0
  176. package/templates/admin-root/.claude/skills/frontend-testing/references/mocking.md +512 -0
  177. package/templates/admin-root/.claude/skills/frontend-testing/references/workflow.md +269 -0
  178. package/templates/admin-root/.claude/skills/migrate-nativewind-to-uniwind +1 -0
  179. package/templates/admin-root/.claude/skills/native-component-doc/SKILL.md +245 -0
  180. package/templates/admin-root/.claude/skills/senior-frontend/SKILL.md +209 -0
  181. package/templates/admin-root/.claude/skills/senior-frontend/references/frontend_best_practices.md +103 -0
  182. package/templates/admin-root/.claude/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
  183. package/templates/admin-root/.claude/skills/senior-frontend/references/react_patterns.md +103 -0
  184. package/templates/admin-root/.claude/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
  185. package/templates/admin-root/.claude/skills/senior-frontend/scripts/component_generator.py +114 -0
  186. package/templates/admin-root/.claude/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
  187. package/templates/admin-root/.claude/skills/skill-creator/SKILL.md +355 -0
  188. package/templates/admin-root/.claude/skills/skill-creator/references/output-patterns.md +86 -0
  189. package/templates/admin-root/.claude/skills/skill-creator/references/workflows.md +28 -0
  190. package/templates/admin-root/.claude/skills/skill-creator/scripts/init_skill.py +300 -0
  191. package/templates/admin-root/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  192. package/templates/admin-root/.claude/skills/skill-creator/scripts/quick_validate.py +97 -0
  193. package/templates/admin-root/.claude/skills/ui-ux-pro-max/SKILL.md +386 -0
  194. package/templates/admin-root/.claude/skills/ui-ux-pro-max/data +1 -0
  195. package/templates/admin-root/.claude/skills/ui-ux-pro-max/scripts +1 -0
  196. package/templates/admin-root/.claude/skills/uniwind +1 -0
  197. package/templates/admin-root/.claude/skills/vercel-react-best-practices/AGENTS.md +2934 -0
  198. package/templates/admin-root/.claude/skills/vercel-react-best-practices/SKILL.md +136 -0
  199. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  200. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  201. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  202. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  203. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  204. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  205. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  206. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  207. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  208. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  209. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  210. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  211. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  212. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  213. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  214. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  215. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  216. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  217. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  218. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  219. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  220. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  221. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  222. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  223. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  224. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  225. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  226. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  227. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  228. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  229. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  230. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  231. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  232. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  233. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  234. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  235. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  236. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  237. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  238. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  239. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  240. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  241. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  242. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  243. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  244. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  245. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  246. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  247. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  248. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  249. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  250. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  251. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  252. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  253. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  254. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  255. package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  256. package/templates/admin-root/.cursor/settings.json +10 -0
  257. package/templates/admin-root/.editorconfig +19 -0
  258. package/templates/admin-root/.gitattributes +16 -0
  259. package/templates/admin-root/.oxfmtrc.json +35 -0
  260. package/templates/admin-root/AGENTS.md +297 -0
  261. package/templates/admin-root/CLAUDE.md +1 -0
  262. package/templates/admin-root/skills-lock.json +27 -0
  263. package/templates/admin-root.manifest.json +1317 -0
  264. package/templates/admin.meta.json +9 -4
  265. package/LICENSE +0 -21
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: migrate-oxfmt
3
+ description: Guide for migrating a project from Prettier or Biome to Oxfmt. Use when asked to migrate, convert, or switch a JavaScript/TypeScript project's formatter from Prettier or Biome to Oxfmt.
4
+ ---
5
+
6
+ This skill guides you through migrating a JavaScript/TypeScript project from Prettier or Biome to [Oxfmt](https://oxc.rs/docs/guide/usage/formatter).
7
+
8
+ ## Overview
9
+
10
+ Oxfmt is a high-performance, Prettier-compatible code formatter. Most Prettier options are supported directly.
11
+
12
+ An automated migration tool is built into oxfmt, supporting both Prettier and Biome as migration sources.
13
+
14
+ ## Step 1: Run Automated Migration
15
+
16
+ ### From Prettier
17
+
18
+ ```bash
19
+ npx oxfmt@latest --migrate prettier
20
+ ```
21
+
22
+ This will:
23
+
24
+ - Find and read your Prettier config (any format Prettier supports)
25
+ - Create `.oxfmtrc.json` with migrated options
26
+ - Migrate `.prettierignore` patterns to `ignorePatterns`
27
+ - Migrate `prettier-plugin-tailwindcss` options to `sortTailwindcss`
28
+ - Detect `prettier-plugin-packagejson` and enable `sortPackageJson`
29
+
30
+ ### From Biome
31
+
32
+ ```bash
33
+ npx oxfmt@latest --migrate biome
34
+ ```
35
+
36
+ This will:
37
+
38
+ - Find and read `biome.json` or `biome.jsonc`
39
+ - Create `.oxfmtrc.json` with migrated options
40
+ - Migrate negated patterns from `files.includes` to `ignorePatterns`
41
+ - Map Biome's two-level config (`formatter.*` and `javascript.formatter.*`) to oxfmt options
42
+
43
+ Biome option mapping:
44
+
45
+ | Biome | oxfmt |
46
+ | ----------------------------------------------------------- | --------------------------------- |
47
+ | `formatter.indentStyle` (`"tab"`/`"space"`) | `useTabs` (`true`/`false`) |
48
+ | `formatter.indentWidth` | `tabWidth` |
49
+ | `formatter.lineWidth` | `printWidth` |
50
+ | `javascript.formatter.quoteStyle` | `singleQuote` |
51
+ | `javascript.formatter.jsxQuoteStyle` | `jsxSingleQuote` |
52
+ | `javascript.formatter.quoteProperties` (`"asNeeded"`) | `quoteProps` (`"as-needed"`) |
53
+ | `javascript.formatter.trailingCommas` | `trailingComma` |
54
+ | `javascript.formatter.semicolons` (`"always"`/`"asNeeded"`) | `semi` (`true`/`false`) |
55
+ | `javascript.formatter.arrowParentheses` (`"asNeeded"`) | `arrowParens` (`"avoid"`) |
56
+ | `formatter.bracketSameLine` | `bracketSameLine` |
57
+ | `formatter.bracketSpacing` | `bracketSpacing` |
58
+ | `formatter.attributePosition` (`"multiline"`) | `singleAttributePerLine` (`true`) |
59
+
60
+ Notes (both sources):
61
+
62
+ - Fails if `.oxfmtrc.json` already exists. Delete it first if you want to re-run.
63
+ - If no source config is found, creates a blank `.oxfmtrc.json` instead.
64
+ - `overrides` cannot be auto-migrated for either source and must be converted manually.
65
+
66
+ ## Step 2: Review Generated Config
67
+
68
+ After migration, review the generated `.oxfmtrc.json` for these key differences:
69
+
70
+ ### printWidth
71
+
72
+ Prettier and Biome default is 80, oxfmt default is 100. The migration tool sets `printWidth: 80` if not specified in your source config. Decide whether to keep 80 or adopt 100.
73
+
74
+ ### Unsupported Options (Prettier only)
75
+
76
+ These Prettier options are skipped during migration:
77
+
78
+ | Option | Status |
79
+ | ------------------------------ | ------------------------------------------------ |
80
+ | `endOfLine: "auto"` | Not supported. Use `"lf"` or `"crlf"` explicitly |
81
+ | `experimentalTernaries` | Not supported in JS/TS files yet |
82
+ | `experimentalOperatorPosition` | Not supported in JS/TS files yet |
83
+
84
+ ### sortPackageJson (Prettier only)
85
+
86
+ Enabled by default in oxfmt, but the migration tool disables it unless `prettier-plugin-packagejson` was detected. Review whether you want this enabled.
87
+
88
+ Note: Oxfmt's sorting algorithm differs from `prettier-plugin-packagejson`.
89
+
90
+ ### embeddedLanguageFormatting (Prettier only)
91
+
92
+ Embedded language formatting (e.g., CSS-in-JS) generally works, but some formatting may differ from Prettier.
93
+
94
+ ### overrides
95
+
96
+ The `overrides` field cannot be auto-migrated from either Prettier or Biome. Convert manually:
97
+
98
+ ```json
99
+ {
100
+ "overrides": [
101
+ {
102
+ "files": ["*.md"],
103
+ "options": { "tabWidth": 4 }
104
+ }
105
+ ]
106
+ }
107
+ ```
108
+
109
+ ### Nested Config
110
+
111
+ Oxfmt does not support nested configuration files (e.g., a separate `.oxfmtrc.json` in a subdirectory). If your project used per-directory Prettier or Biome configs, consolidate them using `overrides` with file glob patterns, or run oxfmt separately per directory with different working directories.
112
+
113
+ ### Prettier-Compatible Options
114
+
115
+ These options transfer directly with the same behavior:
116
+ `tabWidth`, `useTabs`, `semi`, `singleQuote`, `jsxSingleQuote`, `quoteProps`, `trailingComma`, `arrowParens`, `bracketSpacing`, `bracketSameLine`, `endOfLine`, `proseWrap`, `htmlWhitespaceSensitivity`, `singleAttributePerLine`, `vueIndentScriptAndStyle`
117
+
118
+ ## Step 3: Configure Oxfmt Extensions
119
+
120
+ Oxfmt offers features not available in Prettier:
121
+
122
+ ### sortImports
123
+
124
+ Sort import statements, inspired by `eslint-plugin-perfectionist/sort-imports` (disabled by default):
125
+
126
+ ```json
127
+ {
128
+ "sortImports": {
129
+ "partitionByNewline": true,
130
+ "newlinesBetween": false
131
+ }
132
+ }
133
+ ```
134
+
135
+ ### sortTailwindcss
136
+
137
+ Replaces `prettier-plugin-tailwindcss`. Auto-migrated with renamed options:
138
+
139
+ | Prettier (top-level) | oxfmt (`sortTailwindcss.*`) |
140
+ | ---------------------------- | --------------------------- |
141
+ | `tailwindConfig` | `config` |
142
+ | `tailwindStylesheet` | `stylesheet` |
143
+ | `tailwindFunctions` | `functions` |
144
+ | `tailwindAttributes` | `attributes` |
145
+ | `tailwindPreserveWhitespace` | `preserveWhitespace` |
146
+ | `tailwindPreserveDuplicates` | `preserveDuplicates` |
147
+
148
+ ### Other Extensions
149
+
150
+ | Option | Default | Description |
151
+ | -------------------- | ------- | ---------------------------------------------------------------------------- |
152
+ | `insertFinalNewline` | `true` | Whether to add a final newline at end of file |
153
+ | `sortPackageJson` | `true` | Sort `package.json` keys. Set `{ "sortScripts": true }` to also sort scripts |
154
+
155
+ ## Step 4: Update CI and Scripts
156
+
157
+ Replace formatter commands with oxfmt:
158
+
159
+ ```bash
160
+ # Before (Prettier)
161
+ npx prettier --write .
162
+ npx prettier --check .
163
+
164
+ # Before (Biome)
165
+ npx biome format --write .
166
+ npx biome check .
167
+
168
+ # After
169
+ npx oxfmt@latest
170
+ npx oxfmt@latest --check
171
+ ```
172
+
173
+ ### Common CLI Options
174
+
175
+ | Prettier / Biome | oxfmt |
176
+ | ----------------------------------------------- | -------------------------------------------- |
177
+ | `prettier --write .` / `biome format --write .` | `oxfmt` (default: cwd, `--write` mode) |
178
+ | `prettier --check .` / `biome check .` | `oxfmt --check` |
179
+ | `prettier --list-different .` | `oxfmt --list-different` |
180
+ | `prettier --config path` | `oxfmt --config path` |
181
+ | `prettier --ignore-path .prettierignore` | `oxfmt --ignore-path .prettierignore` |
182
+ | `cat file \| prettier --stdin-filepath=file.ts` | `cat file \| oxfmt --stdin-filepath=file.ts` |
183
+
184
+ ### File Type Coverage
185
+
186
+ - JS/TS: Formatted natively by oxfmt
187
+ - TOML: Formatted natively (via taplo)
188
+ - CSS, HTML, YAML, Markdown, GraphQL, etc.: Delegated to Prettier internally (when using `npx oxfmt`)
189
+
190
+ ## Tips
191
+
192
+ - EditorConfig: Oxfmt reads `.editorconfig` automatically for `useTabs`, `tabWidth`, `endOfLine`, `insertFinalNewline`, and `printWidth`. Options in `.oxfmtrc.json` take precedence.
193
+ - CI: Use `npx oxfmt@latest --check` to enforce formatting in CI.
194
+ - LSP: Run `oxfmt --lsp` for editor integration via Language Server Protocol.
195
+ - Schema support: Add `"$schema": "./node_modules/oxfmt/configuration_schema.json"` to `.oxfmtrc.json` for editor autocompletion.
196
+ - Init: Run `npx oxfmt@latest --init` to create a default `.oxfmtrc.json` without migration.
197
+
198
+ ## References
199
+
200
+ - [CLI Reference](https://oxc.rs/docs/guide/usage/formatter/cli.html)
201
+ - [Config File Reference](https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html)
202
+ - [Unsupported Features](https://oxc.rs/docs/guide/usage/formatter/unsupported-features.html)
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: migrate-oxlint
3
+ description: Guide for migrating a project from ESLint to Oxlint. Use when asked to migrate, convert, or switch a JavaScript/TypeScript project's linter from ESLint to Oxlint.
4
+ ---
5
+
6
+ This skill guides you through migrating a JavaScript/TypeScript project from ESLint to [Oxlint](https://oxc.rs/docs/guide/usage/linter/).
7
+
8
+ ## Overview
9
+
10
+ Oxlint is a high-performance linter that implements many popular ESLint rules natively in Rust. It can be used alongside ESLint or as a full replacement.
11
+
12
+ An official migration tool is available, and will be used by this skill: [`@oxlint/migrate`](https://github.com/oxc-project/oxlint-migrate)
13
+
14
+ ## Step 1: Run Automated Migration
15
+
16
+ Run the migration tool in the project root:
17
+
18
+ ```bash
19
+ npx @oxlint/migrate
20
+ ```
21
+
22
+ This reads your ESLint flat config (`eslint.config.js` for example) and generates a `.oxlintrc.json` file from it. It will find your ESLint config file automatically in most cases.
23
+
24
+ See options below for more info.
25
+
26
+ ### Key Options
27
+
28
+ | Option | Description |
29
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
30
+ | `--type-aware` | Include type-aware rules from `@typescript-eslint` (will require the `oxlint-tsgolint` package to be installed after migrating) |
31
+ | `--with-nursery` | Include experimental rules still under development, may not be fully stable or consistent with ESLint equivalents |
32
+ | `--js-plugins [bool]` | Enable/disable ESLint plugin migration via `jsPlugins` (default: enabled) |
33
+ | `--details` | List rules that could not be migrated |
34
+ | `--replace-eslint-comments` | Convert all `// eslint-disable` comments to `// oxlint-disable` |
35
+ | `--output-file <file>` | Specify a different output path (default: `.oxlintrc.json`) |
36
+
37
+ If your ESLint config is not at the default location, pass the path explicitly:
38
+
39
+ ```bash
40
+ npx @oxlint/migrate ./path/to/eslint.config.js
41
+ ```
42
+
43
+ ## Step 2: Review Generated Config
44
+
45
+ After migration, review the generated `.oxlintrc.json`.
46
+
47
+ ### Plugin Mapping
48
+
49
+ The migration tool automatically maps ESLint plugins to oxlint's built-in equivalents. The following table is for reference when reviewing the generated config:
50
+
51
+ | ESLint Plugin | Oxlint Plugin Name |
52
+ | --------------------------------------------------- | ------------------ |
53
+ | `@typescript-eslint/eslint-plugin` | `typescript` |
54
+ | `eslint-plugin-react` / `eslint-plugin-react-hooks` | `react` |
55
+ | `eslint-plugin-import` / `eslint-plugin-import-x` | `import` |
56
+ | `eslint-plugin-unicorn` | `unicorn` |
57
+ | `eslint-plugin-jsx-a11y` | `jsx-a11y` |
58
+ | `eslint-plugin-react-perf` | `react-perf` |
59
+ | `eslint-plugin-promise` | `promise` |
60
+ | `eslint-plugin-jest` | `jest` |
61
+ | `@vitest/eslint-plugin` | `vitest` |
62
+ | `eslint-plugin-jsdoc` | `jsdoc` |
63
+ | `eslint-plugin-next` | `nextjs` |
64
+ | `eslint-plugin-node` | `node` |
65
+ | `eslint-plugin-vue` | `vue` |
66
+
67
+ Default plugins (enabled when `plugins` field is omitted): `unicorn`, `typescript`, `oxc`.
68
+ Setting the `plugins` array explicitly overrides these defaults.
69
+
70
+ ESLint core rules are usable in oxlint without needing to configure a plugin in the config file.
71
+
72
+ ### Rule Categories
73
+
74
+ Oxlint groups rules into categories for bulk configuration, though only `correctness` is enabled by default:
75
+
76
+ ```json
77
+ {
78
+ "categories": {
79
+ "correctness": "error",
80
+ "suspicious": "warn"
81
+ }
82
+ }
83
+ ```
84
+
85
+ Available categories: `correctness` (default: enabled), `suspicious`, `pedantic`, `perf`, `style`, `restriction`, `nursery`.
86
+
87
+ Individual rule settings in `rules` override category settings.
88
+
89
+ `@oxlint/migrate` will turn `correctness` off to avoid enabling additional rules that weren't enabled by your ESLint config. You can choose to enable additional categories after migration if desired.
90
+
91
+ ### Check Unmigrated Rules
92
+
93
+ Run with `--details` to see which ESLint rules could not be migrated:
94
+
95
+ ```bash
96
+ npx @oxlint/migrate --details
97
+ ```
98
+
99
+ Review the output and decide whether to keep ESLint for those rules or not. Some rules may be mentioned in the output from `--details` as having equivalents in oxlint that were not automatically mapped by the migration tool. In those cases, consider enabling the equivalent oxlint rule manually after migration.
100
+
101
+ ## Step 3: Install Oxlint
102
+
103
+ Install the core oxlint package (use `yarn install`, `pnpm install`, `vp install`, `bun install`, etc. depending on your package manager):
104
+
105
+ ```bash
106
+ npm install -D oxlint
107
+ ```
108
+
109
+ If you want to add the `oxlint-tsgolint` package, if you intend to use type-aware rules that require TypeScript type information:
110
+
111
+ ```bash
112
+ npm install -D oxlint-tsgolint
113
+ ```
114
+
115
+ No other packages besides the above are needed by default, though you will need to keep/install any additional ESLint plugins that were migrated into `jsPlugins`. Do not add `@oxlint/migrate` to the package.json, it is meant for one-off usage.
116
+
117
+ ## Step 4: Handle Unsupported Features
118
+
119
+ Some features require manual attention:
120
+
121
+ - Local plugins (relative path imports): Must be migrated manually to `jsPlugins`
122
+ - `eslint-plugin-prettier`: Supported, but very slow. It is recommended to use [oxfmt](https://oxc.rs/docs/guide/usage/formatter) instead, or switch to `prettier --check` as a separate step alongside oxlint.
123
+ - `settings` in override configs: Oxlint does not support `settings` inside `overrides` blocks.
124
+ - ESLint v9+ plugins: Not all work with oxlint's JS Plugins API, but the majority will.
125
+
126
+ ### Local Plugins
127
+
128
+ If you have any custom ESLint rules in the project repo itself, you can migrate them manually after running the migration tool by adding them to the `jsPlugins` field in `.oxlintrc.json`:
129
+
130
+ ```json
131
+ {
132
+ "jsPlugins": ["./path/to/my-plugin.js"],
133
+ "rules": {
134
+ "local-plugin/rule-name": "error"
135
+ }
136
+ }
137
+ ```
138
+
139
+ ### External ESLint Plugins
140
+
141
+ For ESLint plugins without a built-in oxlint equivalent, use the `jsPlugins` field to load them:
142
+
143
+ ```json
144
+ {
145
+ "jsPlugins": ["eslint-plugin-custom"],
146
+ "rules": {
147
+ "custom/my-rule": "warn"
148
+ }
149
+ }
150
+ ```
151
+
152
+ ## Step 5: Update CI and Scripts
153
+
154
+ Replace ESLint commands with oxlint. Path arguments are optional; oxlint defaults to the current working directory.
155
+
156
+ ```bash
157
+ # Before
158
+ npx eslint src/
159
+ npx eslint --fix src/
160
+
161
+ # After
162
+ npx oxlint src/
163
+ npx oxlint --fix src/
164
+ ```
165
+
166
+ ### Common CLI Options
167
+
168
+ | ESLint | oxlint equivalent |
169
+ | ------------------------- | ---------------------------------------------- |
170
+ | `eslint .` | `oxlint` (default: lints the cwd) |
171
+ | `eslint src/` | `oxlint src/` |
172
+ | `eslint --fix` | `oxlint --fix` |
173
+ | `eslint --max-warnings 0` | `oxlint --deny-warnings` or `--max-warnings 0` |
174
+ | `eslint --format json` | `oxlint --format json` |
175
+
176
+ Additional oxlint options:
177
+
178
+ - `--tsconfig <path>`: Specify tsconfig.json path, likely unnecessary unless you have a non-standard name for `tsconfig.json`.
179
+
180
+ ## Tips
181
+
182
+ - You can run alongside ESLint if necessary: Oxlint is designed to complement ESLint during migration, but with JS Plugins many projects can switch over fully without losing many rules.
183
+ - Disable comments work: `// eslint-disable` and `// eslint-disable-next-line` comments are supported by oxlint. Use `--replace-eslint-comments` when running @oxlint/migrate to convert them to `// oxlint-disable` equivalents if desired.
184
+ - List available rules: Run `npx oxlint --rules` to see all supported rules, or refer to the [rule documentation](https://oxc.rs/docs/guide/usage/linter/rules.html).
185
+ - Schema support: Add `"$schema": "./node_modules/oxlint/configuration_schema.json"` to `.oxlintrc.json` for editor autocompletion if the migration tool didn't do it automatically.
186
+ - Output formats: `default`, `stylish`, `json`, `github`, `gitlab`, `junit`, `checkstyle`, `unix`
187
+ - Ignore files: `.eslintignore` is supported by oxlint if you have it, but it's recommended to move any ignore patterns into the `ignorePatterns` field in `.oxlintrc.json` for consistency and simplicity. All files and paths ignored via a `.gitignore` file will be ignored by oxlint by default as well.
188
+ - If you ran the migration tool multiple times, remove the `.oxlintrc.json.bak` backup file created by the migration tool once you've finished migrating.
189
+ - If you are not using any JS Plugins and have replaced your ESLint configuration, you can remove all ESLint packages from your project dependencies.
190
+ - Ensure your editor is configured to use oxlint instead of ESLint for linting and error reporting. You may want to install the Oxc extension for your preferred editor. See https://oxc.rs/docs/guide/usage/linter/editors.html for more details.
191
+
192
+ ## References
193
+
194
+ - [CLI Reference](https://oxc.rs/docs/guide/usage/linter/cli.html)
195
+ - [Config File Reference](https://oxc.rs/docs/guide/usage/linter/config-file-reference.html)
196
+ - [Complete Oxlint rule list and docs](https://oxc.rs/docs/guide/usage/linter/rules.html)
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: native-component-doc
3
+ description: 为 @skyroc/native-ui 组件编写文档。当用户说出 native 组件名(如 Button、Cell、ActionSheet)并要求写/补文档时触发。自动定位组件源码、playground demo、已有文档,按 native-ui-docs 的规范生成或更新 MDX。
4
+ argument-hint: 组件名,如 Button、Cell、ActionSheet
5
+ ---
6
+
7
+ # Native UI 组件文档工作流
8
+
9
+ 为 `@skyroc/native-ui`(React Native + Uniwind)编写文档的专用工作流。
10
+
11
+ > 这不是 web-ui 那套。native 的 `<Demo>` 会把 demo 源码整份渲染出来、右栏还有整页手机预览,
12
+ > 因此**不写内联代码块**、**demo 一律具名导出**、**每个 demo 都要在汇总页里串一遍**。
13
+ > 与 `component-doc`(web-ui 用)的差异见文末「与 web-ui 文档规范的差异」。
14
+
15
+ ## 文件定位规则
16
+
17
+ 给定组件名 `$COMPONENT`(如 `ActionSheet`),转 kebab-case `$slug`(如 `action-sheet`):
18
+
19
+ | 用途 | 路径 |
20
+ | ------------------- | -------------------------------------------------------------- |
21
+ | 组件源码 | `packages/native/ui/src/components/$slug/` |
22
+ | Playground 单点 demo | `apps/native-ui-playground/src/demos/$slug/*.tsx` |
23
+ | Playground 汇总页 | `apps/native-ui-playground/src/demos/$slug/index.tsx` |
24
+ | Playground 路由页 | `apps/native-ui-playground/app/components/$slug.tsx` |
25
+ | 文档 MDX | `docs/native-ui-docs/content/docs/components/($group)/$slug.mdx` |
26
+
27
+ **文档基础设施**(了解即可,不必每次都读):
28
+
29
+ | 文件 | 作用 |
30
+ | ----------------------------------------------- | -------------------------------------------------------------------- |
31
+ | `docs/native-ui-docs/components/mdx.tsx` | MDX 组件注册,只有 `Demo` / `PropsTable` / `TypeTable` / `UnionType` |
32
+ | `docs/native-ui-docs/components/demo/index.tsx` | `<Demo>`:读 demo 源码 + 渲染预览 + 「在 playground 打开」 |
33
+ | `docs/native-ui-docs/components/demo/demo-preview.tsx` | 动态 import demos 目录,**按模块名取具名导出** |
34
+ | `docs/native-ui-docs/components/props-table.tsx` | `<PropsTable>` API 属性表 |
35
+ | `docs/native-ui-docs/components/type-table.tsx` | `<TypeTable>` + `<UnionType>` 类型区 |
36
+ | `docs/native-ui-docs/components/type-anchor.tsx` | PascalCase 类型 → 锚点链接,`BUILTIN_TYPE_NAMES` 白名单 |
37
+ | `docs/native-ui-docs/components/type-registry.ts`| 跨页面类型链接注册表 |
38
+ | `docs/native-ui-docs/lib/playground-demo.ts` | 文档页 slug → playground 整页路由,决定是否分栏 |
39
+
40
+ ## 侧边栏分组
41
+
42
+ `content/docs/components/` 下按 fumadocs 路由组分组,路由组不进 URL(`(general)/button.mdx` → `/docs/components/button`)。
43
+ 写完文档后**必须**把 `$slug` 加进对应分组的 `meta.json` 的 `pages` 里(meta.json 已预置全部规划中的 slug,通常只需确认位置正确)。
44
+
45
+ | 目录 | 标题 | 组件 |
46
+ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
47
+ | `(general)` | 通用 | button, floating-button, text, text-ellipsis, divider, image |
48
+ | `(layout)` | 布局容器 | space, grid, cell, collapse |
49
+ | `(input)` | 输入 | form, field, input, password-input, search, checkbox, radio, switch, slider, stepper, rate, signature, picker, picker-group, date-picker, time-picker, calendar, number-keyboard, tree-select |
50
+ | `(data-display)` | 数据展示 | avatar, badge, tag, count-down, rolling-text, swipe-cell |
51
+ | `(navigation)` | 导航 | navbar, tabs, sidebar, anchor-nav, index-bar, back-top, pagination, dropdown-menu |
52
+ | `(overlay)` | 弹层覆盖 | popup, dialog, sheet, action-sheet, share-sheet |
53
+ | `(feedback)` | 反馈 | toast, notify |
54
+
55
+ `meta.json` 里列了但文件还不存在的 slug 会被 fumadocs 静默跳过(`resolveFolderItem` 找不到 node 直接 return),所以预置清单不会报错。
56
+
57
+ `meta.json` 里**不要写 `"collapsible": false`**。fumadocs-ui 16.14.4 的 `SidebarFolderTrigger`
58
+ 在 `collapsible: false` 分支直接渲染成 `jsx("div", { ...props })`,而上层
59
+ (`layouts/docs/slots/sidebar.js:220`)传下来的 `className` 是个 `(state) => string` 函数 ——
60
+ 函数原样落到 DOM 上,React 报
61
+ `Invalid value for prop \`className\` on <div> tag`,分组标题也因此丢掉全部样式类。
62
+ `collapsible` 走默认的 `true` 时,trigger 渲染成 Base UI 的 `Collapsible.Trigger`,函数 className
63
+ 会被 `useRenderElement` 正常解析。`defaultOpen: true` 已经能让分组默认展开,不需要 `collapsible: false`。
64
+
65
+ ## 执行流程
66
+
67
+ ### Phase 1:读源码与 demo,做一致性校验
68
+
69
+ 1. 读 `packages/native/ui/src/components/$slug/` 全部文件
70
+ - `index.ts`:实际导出了哪些组件、哪些类型
71
+ - `types.ts`:public props 与类型别名
72
+ - `*-variants.ts`:`slots` / `variants` / `compoundVariants` / `defaultVariants` —— **表格里的每一行数值都从这里抄,不要凭印象写**
73
+ - 主组件 `*.tsx`:props 实际怎么解构、默认值在哪、有没有 `hitSlop` / `accessibilityState` / `TextClassContext` / Portal 之类的 RN 特有行为
74
+ 2. 读 `apps/native-ui-playground/src/demos/$slug/` 全部 demo + `index.tsx` 汇总页
75
+ - 汇总页的 `<Section title/description>` 就是**天然的章节大纲**,文档章节直接对齐它
76
+ 3. 已有文档就读一遍,判断是补全还是重写
77
+ 4. 参考范例:`docs/native-ui-docs/content/docs/components/(general)/button.mdx`(当前唯一的完整样板)
78
+
79
+ #### 实现一致性校验(必须执行)
80
+
81
+ 文档不是 API 想象稿,从**源码 / 类型 / variants / demo** 四者交叉验证:
82
+
83
+ - `types.ts` 声明的 props,主组件是否真的解构并使用
84
+ - 默认值实际在哪里设置(`defaultVariants` vs 组件内 `= false`),两处不一致时以运行时为准
85
+ - `classNames` 的每个 slot 是否真的接到了对应节点上
86
+ - `index.ts` 是否真的导出了你要写进文档的类型
87
+ - RN 特有:`hitSlop`、`accessibilityRole` / `accessibilityState`、`Pressable` 透传、`TextClassContext` 继承范围、Portal / Modal 挂载点
88
+
89
+ 发现类型/API 承诺与实现不一致时:先明确指出这是实现问题;能改就改实现或类型,不要在文档里绕过去;不能改就在最终说明里列为风险,并且**不在文档中承诺未实现的能力**。不允许靠降低文档表述来掩盖实现 bug。
90
+
91
+ ### Phase 2:写文档
92
+
93
+ #### MDX 结构
94
+
95
+ ```mdx
96
+ ---
97
+ title: $COMPONENT
98
+ description: 一句话描述组件用途
99
+ ---
100
+
101
+ 概述段落:组件做什么、基于什么 RN 原语封装、有什么与众不同的行为。
102
+
103
+ \`\`\`tsx
104
+ import { $COMPONENT } from '@skyroc/native-ui';
105
+ \`\`\`
106
+
107
+ ## 基础用法
108
+
109
+ <Demo src="@playground/$slug/$DemoBasic" />
110
+
111
+ ## 何时使用
112
+
113
+ - 使用场景 / 移动端取舍
114
+ - 与相似组件的区分(如 Popup vs Sheet vs ActionSheet)
115
+
116
+ ## 功能章节(variant / color / size / shape / ...)
117
+
118
+ 说明文字 +(枚举类的)表格
119
+
120
+ <Demo src="@playground/$slug/$DemoName" />
121
+
122
+ 补充说明:容易踩的坑、和 web 端行为不同的地方
123
+
124
+ ## 无障碍
125
+
126
+ role / accessibilityState / 热区 等 RN 专属说明(有就写)
127
+
128
+ ## API
129
+
130
+ ### $COMPONENT
131
+
132
+ <PropsTable data={[...]} />
133
+
134
+ ## 类型
135
+
136
+ \`\`\`ts
137
+ import type { ... } from '@skyroc/native-ui';
138
+ \`\`\`
139
+
140
+ <UnionType ... />
141
+ <TypeTable data={[...]} />
142
+ ```
143
+
144
+ #### Demo 引用规则(native 专属)
145
+
146
+ - 格式:`<Demo src="@playground/$slug/$DemoName" />`,**没有 `modules/` 这一层**(那是 web-ui 的)
147
+ - **不要在 `<Demo>` 后面贴内联代码块**。`<Demo>` 已经把整份 demo 源码渲染在预览下方了,内联代码是重复噪音
148
+ - **覆盖率要求:`src/demos/$slug/index.tsx` 里串的每个子 demo,文档必须有且仅有一处 `<Demo>` 引用**。章节顺序也尽量对齐汇总页
149
+ - demo 缺失时**必须补 demo**,不能因为没 demo 就只写文字
150
+
151
+ 写完用这条命令核对覆盖率(无输出即一一对应):
152
+
153
+ ```bash
154
+ slug=button; group='(general)'
155
+ diff \
156
+ <(ls apps/native-ui-playground/src/demos/$slug | grep -v '^index' | sed 's/\.tsx$//' | sort) \
157
+ <(grep -o "@playground/$slug/[A-Za-z0-9]*" "docs/native-ui-docs/content/docs/components/$group/$slug.mdx" | sed 's|.*/||' | sort -u)
158
+ ```
159
+
160
+ #### 新建 Playground Demo 的规范
161
+
162
+ 1. 路径:`apps/native-ui-playground/src/demos/$slug/$DemoName.tsx`,`$DemoName` 以组件名开头(`ButtonLoading`、`CellSize`)
163
+ 2. **必须具名导出,且导出名 === 文件名** —— `demo-preview.tsx` 是按模块名去取 `mod[exportName]` 的,写成 `export default` 或改名都会拿不到组件
164
+ 3. 模板:
165
+
166
+ ```tsx
167
+ import { Button } from '@skyroc/native-ui';
168
+ import { View } from 'react-native';
169
+
170
+ const ButtonLoading = () => {
171
+ return (
172
+ <View className="gap-3 bg-background p-4">
173
+ {/* ... */}
174
+ </View>
175
+ );
176
+ };
177
+
178
+ export { ButtonLoading };
179
+ ```
180
+
181
+ 4. 约束:
182
+ - 不写 `'use client'`(RN,不是 Next 客户端组件)
183
+ - 从 `@skyroc/native-ui` 导入组件,不从内部路径导入
184
+ - 容器统一 `View` + uniwind 类名,带上 `bg-background p-4`,保证在文档预览的手机框里边距一致
185
+ - 每个 demo 只聚焦一个功能点,自包含,不依赖同目录 `shared.tsx`
186
+ - 需要文字就用 `@skyroc/native-ui` 的 `Text`,才能继承 `TextClassContext`
187
+ 5. **同步汇总页**:在 `src/demos/$slug/index.tsx` 里 import 并加一个 `<Section title description>`。汇总页只负责串场,不要把示例代码写回去
188
+ 6. **确认整页路由存在**:`apps/native-ui-playground/app/components/$slug.tsx`。它是文档右栏分栏预览的来源(`resolvePlaygroundPage` 按最后一段 slug 找同名文件),缺了文档就退回单栏
189
+
190
+ #### PropsTable 书写规则
191
+
192
+ - 短字面量联合**直接内联**到 `type` 字段,不要另起 PascalCase 类型名,也不要写 `<UnionType>`
193
+ - 例:`"'solid' | 'tonal' | 'outline' | 'ghost'"`、`"'sm' | 'md' | 'lg' | 'icon'"`、`"'horizontal' | 'vertical'"`
194
+ - 对象类型、slot 配置、子组件 Props、外部大型类型才用 PascalCase 引用
195
+ - `default` 用字符串写:`"'md'"`、`'false'`
196
+ - `required: true` 仅必填时加
197
+ - 表格开头或结尾说明透传关系:如「除下表外,`Button` 透传 `Pressable` 的全部属性」
198
+ - `ref` 也写进表里(RN 的 ref 常用于 `measure` / 滚动定位)
199
+
200
+ #### 类型完整性规则(严格遵循)
201
+
202
+ **PropsTable / TypeTable 中出现的每一个非内置 PascalCase 类型名,都必须在当前页 `## 类型` 区域有定义,或在 `type-registry.ts` 注册跨页链接。**
203
+
204
+ 写完逐项核对:
205
+
206
+ 1. 收集所有 `<PropsTable>` 的 `type`、所有 `<TypeTable>` 的 `fields[].type` 里的 PascalCase 词
207
+ 2. 排除 `type-anchor.tsx` 的 `BUILTIN_TYPE_NAMES`(含 RN 原语:`PressableProps` / `ViewStyle` / `TextStyle` / `StyleProp` / `GestureResponderEvent` / `AccessibilityRole` / `View` / `Ref` 等)
208
+ 3. 剩下的每一个都要满足:当前页 `<TypeTable name>` 定义 ∨ 当前页 `<UnionType name>` 定义 ∨ `type-registry.ts` 注册
209
+ 4. 遗漏的如果只是短联合 → 改成内联,不补 `<UnionType>`
210
+ 5. 用到了 PascalCase 但它是 React / RN / TS 内置或三方类型 → 加进 `BUILTIN_TYPE_NAMES`,否则会生成错误的本页锚点
211
+ 6. 跨页引用格式:`TypeName: '/docs/components/target-slug#anchor'`(注意 `docsRoute = '/docs'`,别漏 `/docs` 前缀)
212
+
213
+ #### 类型区写法
214
+
215
+ - 先给一段 `import type { ... } from '@skyroc/native-ui'` 代码块,列出本组件对外导出的类型
216
+ - `<UnionType>`:联合类型(由 variants 推导出来的 `XxxVariant` / `XxxSize` / `XxxSlots` 等),一句话说明它控制什么
217
+ - `<TypeTable>`:对象类型(`SlotClassNames`、子组件 Props、Option / ItemData 之类)
218
+ - 顺序建议:`<UnionType>` 在前(跟 Props 表顺序对应),`<TypeTable>` 在后
219
+
220
+ ### Phase 3:收尾核对
221
+
222
+ 1. 覆盖率命令跑一遍,`<Demo>` 与 demos 目录一一对应
223
+ 2. 分组 `meta.json` 的 `pages` 含 `$slug`
224
+ 3. 类型完整性清单逐条过
225
+ 4. 表格里的数值(高度、字号、间距、圆角)与 `*-variants.ts` 逐条对得上
226
+ 5. 最终回复里区分:本次改了哪些文件、发现但未处理的实现问题、未验证的部分及原因
227
+
228
+ ## 工作区边界
229
+
230
+ - 默认只动:目标 `$slug.mdx`、缺失的 playground demo 及其汇总页、分组 `meta.json`
231
+ - 不回滚、不格式化、不整理与本组件无关的用户改动
232
+ - 组件源码有未提交改动时,基于当前工作区实现写文档
233
+ - 只有实现问题导致文档无法正确描述组件时,才改组件源码或类型,且改之前先说明问题
234
+
235
+ ## 与 web-ui 文档规范的差异
236
+
237
+ | 维度 | web-ui (`component-doc`) | native-ui(本 skill) |
238
+ | ------------ | -------------------------------------------- | -------------------------------------------------- |
239
+ | Demo 路径 | `@playground/$slug/modules/Name` | `@playground/$slug/Name`(无 `modules`) |
240
+ | Demo 导出 | `export default` | **具名导出,名字 === 文件名** |
241
+ | 内联代码块 | 推荐,跟在 `<Demo>` 后 | **不写**,`<Demo>` 已渲染完整源码 |
242
+ | Demo 运行时 | react-live 沙箱 + `scope.ts` | Turbopack 动态 import 真实 RN 组件,`ssr: false` |
243
+ | 整页预览 | 无 | 右栏手机框渲染 `app/components/$slug.tsx` 整页 |
244
+ | `'use client'` | 需要 | 不需要 |
245
+ | 内置类型白名单 | DOM / React 为主 | 额外含 RN 原语(`PressableProps` / `ViewStyle` 等) |