@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,317 @@
1
+ # Hook Extraction Patterns
2
+
3
+ This document provides detailed guidance on extracting custom hooks from complex components in Dify.
4
+
5
+ ## When to Extract Hooks
6
+
7
+ Extract a custom hook when you identify:
8
+
9
+ 1. **Coupled state groups** - Multiple `useState` hooks that are always used together
10
+ 1. **Complex effects** - `useEffect` with multiple dependencies or cleanup logic
11
+ 1. **Business logic** - Data transformations, validations, or calculations
12
+ 1. **Reusable patterns** - Logic that appears in multiple components
13
+
14
+ ## Extraction Process
15
+
16
+ ### Step 1: Identify State Groups
17
+
18
+ Look for state variables that are logically related:
19
+
20
+ ```typescript
21
+ // ❌ These belong together - extract to hook
22
+ const [modelConfig, setModelConfig] = useState<ModelConfig>(...)
23
+ const [completionParams, setCompletionParams] = useState<FormValue>({})
24
+ const [modelModeType, setModelModeType] = useState<ModelModeType>(...)
25
+
26
+ // These are model-related state that should be in useModelConfig()
27
+ ```
28
+
29
+ ### Step 2: Identify Related Effects
30
+
31
+ Find effects that modify the grouped state:
32
+
33
+ ```typescript
34
+ // ❌ These effects belong with the state above
35
+ useEffect(() => {
36
+ if (hasFetchedDetail && !modelModeType) {
37
+ const mode = currModel?.model_properties.mode
38
+ if (mode) {
39
+ const newModelConfig = produce(modelConfig, (draft) => {
40
+ draft.mode = mode
41
+ })
42
+ setModelConfig(newModelConfig)
43
+ }
44
+ }
45
+ }, [textGenerationModelList, hasFetchedDetail, modelModeType, currModel])
46
+ ```
47
+
48
+ ### Step 3: Create the Hook
49
+
50
+ ```typescript
51
+ // hooks/use-model-config.ts
52
+ import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
53
+ import type { ModelConfig } from '@/models/debug'
54
+ import { produce } from 'immer'
55
+ import { useEffect, useState } from 'react'
56
+ import { ModelModeType } from '@/types/app'
57
+
58
+ interface UseModelConfigParams {
59
+ initialConfig?: Partial<ModelConfig>
60
+ currModel?: { model_properties?: { mode?: ModelModeType } }
61
+ hasFetchedDetail: boolean
62
+ }
63
+
64
+ interface UseModelConfigReturn {
65
+ modelConfig: ModelConfig
66
+ setModelConfig: (config: ModelConfig) => void
67
+ completionParams: FormValue
68
+ setCompletionParams: (params: FormValue) => void
69
+ modelModeType: ModelModeType
70
+ }
71
+
72
+ export const useModelConfig = ({
73
+ initialConfig,
74
+ currModel,
75
+ hasFetchedDetail,
76
+ }: UseModelConfigParams): UseModelConfigReturn => {
77
+ const [modelConfig, setModelConfig] = useState<ModelConfig>({
78
+ provider: 'langgenius/openai/openai',
79
+ model_id: 'gpt-3.5-turbo',
80
+ mode: ModelModeType.unset,
81
+ // ... default values
82
+ ...initialConfig,
83
+ })
84
+
85
+ const [completionParams, setCompletionParams] = useState<FormValue>({})
86
+
87
+ const modelModeType = modelConfig.mode
88
+
89
+ // Fill old app data missing model mode
90
+ useEffect(() => {
91
+ if (hasFetchedDetail && !modelModeType) {
92
+ const mode = currModel?.model_properties?.mode
93
+ if (mode) {
94
+ setModelConfig(produce(modelConfig, (draft) => {
95
+ draft.mode = mode
96
+ }))
97
+ }
98
+ }
99
+ }, [hasFetchedDetail, modelModeType, currModel])
100
+
101
+ return {
102
+ modelConfig,
103
+ setModelConfig,
104
+ completionParams,
105
+ setCompletionParams,
106
+ modelModeType,
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Step 4: Update Component
112
+
113
+ ```typescript
114
+ // Before: 50+ lines of state management
115
+ const Configuration: FC = () => {
116
+ const [modelConfig, setModelConfig] = useState<ModelConfig>(...)
117
+ // ... lots of related state and effects
118
+ }
119
+
120
+ // After: Clean component
121
+ const Configuration: FC = () => {
122
+ const {
123
+ modelConfig,
124
+ setModelConfig,
125
+ completionParams,
126
+ setCompletionParams,
127
+ modelModeType,
128
+ } = useModelConfig({
129
+ currModel,
130
+ hasFetchedDetail,
131
+ })
132
+
133
+ // Component now focuses on UI
134
+ }
135
+ ```
136
+
137
+ ## Naming Conventions
138
+
139
+ ### Hook Names
140
+
141
+ - Use `use` prefix: `useModelConfig`, `useDatasetConfig`
142
+ - Be specific: `useAdvancedPromptConfig` not `usePrompt`
143
+ - Include domain: `useWorkflowVariables`, `useMCPServer`
144
+
145
+ ### File Names
146
+
147
+ - Kebab-case: `use-model-config.ts`
148
+ - Place in `hooks/` subdirectory when multiple hooks exist
149
+ - Place alongside component for single-use hooks
150
+
151
+ ### Return Type Names
152
+
153
+ - Suffix with `Return`: `UseModelConfigReturn`
154
+ - Suffix params with `Params`: `UseModelConfigParams`
155
+
156
+ ## Common Hook Patterns in Dify
157
+
158
+ ### 1. Data Fetching Hook (React Query)
159
+
160
+ ```typescript
161
+ // Pattern: Use @tanstack/react-query for data fetching
162
+ import { useQuery, useQueryClient } from '@tanstack/react-query'
163
+ import { get } from '@/service/base'
164
+ import { useInvalid } from '@/service/use-base'
165
+
166
+ const NAME_SPACE = 'appConfig'
167
+
168
+ // Query keys for cache management
169
+ export const appConfigQueryKeys = {
170
+ detail: (appId: string) => [NAME_SPACE, 'detail', appId] as const,
171
+ }
172
+
173
+ // Main data hook
174
+ export const useAppConfig = (appId: string) => {
175
+ return useQuery({
176
+ enabled: !!appId,
177
+ queryKey: appConfigQueryKeys.detail(appId),
178
+ queryFn: () => get<AppDetailResponse>(`/apps/${appId}`),
179
+ select: data => data?.model_config || null,
180
+ })
181
+ }
182
+
183
+ // Invalidation hook for refreshing data
184
+ export const useInvalidAppConfig = () => {
185
+ return useInvalid([NAME_SPACE])
186
+ }
187
+
188
+ // Usage in component
189
+ const Component = () => {
190
+ const { data: config, isLoading, error, refetch } = useAppConfig(appId)
191
+ const invalidAppConfig = useInvalidAppConfig()
192
+
193
+ const handleRefresh = () => {
194
+ invalidAppConfig() // Invalidates cache and triggers refetch
195
+ }
196
+
197
+ return <div>...</div>
198
+ }
199
+ ```
200
+
201
+ ### 2. Form State Hook
202
+
203
+ ```typescript
204
+ // Pattern: Form state + validation + submission
205
+ export const useConfigForm = (initialValues: ConfigFormValues) => {
206
+ const [values, setValues] = useState(initialValues)
207
+ const [errors, setErrors] = useState<Record<string, string>>({})
208
+ const [isSubmitting, setIsSubmitting] = useState(false)
209
+
210
+ const validate = useCallback(() => {
211
+ const newErrors: Record<string, string> = {}
212
+ if (!values.name) newErrors.name = 'Name is required'
213
+ setErrors(newErrors)
214
+ return Object.keys(newErrors).length === 0
215
+ }, [values])
216
+
217
+ const handleChange = useCallback((field: string, value: any) => {
218
+ setValues(prev => ({ ...prev, [field]: value }))
219
+ }, [])
220
+
221
+ const handleSubmit = useCallback(async (onSubmit: (values: ConfigFormValues) => Promise<void>) => {
222
+ if (!validate()) return
223
+ setIsSubmitting(true)
224
+ try {
225
+ await onSubmit(values)
226
+ } finally {
227
+ setIsSubmitting(false)
228
+ }
229
+ }, [values, validate])
230
+
231
+ return { values, errors, isSubmitting, handleChange, handleSubmit }
232
+ }
233
+ ```
234
+
235
+ ### 3. Modal State Hook
236
+
237
+ ```typescript
238
+ // Pattern: Multiple modal management
239
+ type ModalType = 'edit' | 'delete' | 'duplicate' | null
240
+
241
+ export const useModalState = () => {
242
+ const [activeModal, setActiveModal] = useState<ModalType>(null)
243
+ const [modalData, setModalData] = useState<any>(null)
244
+
245
+ const openModal = useCallback((type: ModalType, data?: any) => {
246
+ setActiveModal(type)
247
+ setModalData(data)
248
+ }, [])
249
+
250
+ const closeModal = useCallback(() => {
251
+ setActiveModal(null)
252
+ setModalData(null)
253
+ }, [])
254
+
255
+ return {
256
+ activeModal,
257
+ modalData,
258
+ openModal,
259
+ closeModal,
260
+ isOpen: useCallback((type: ModalType) => activeModal === type, [activeModal]),
261
+ }
262
+ }
263
+ ```
264
+
265
+ ### 4. Toggle/Boolean Hook
266
+
267
+ ```typescript
268
+ // Pattern: Boolean state with convenience methods
269
+ export const useToggle = (initialValue = false) => {
270
+ const [value, setValue] = useState(initialValue)
271
+
272
+ const toggle = useCallback(() => setValue(v => !v), [])
273
+ const setTrue = useCallback(() => setValue(true), [])
274
+ const setFalse = useCallback(() => setValue(false), [])
275
+
276
+ return [value, { toggle, setTrue, setFalse, set: setValue }] as const
277
+ }
278
+
279
+ // Usage
280
+ const [isExpanded, { toggle, setTrue: expand, setFalse: collapse }] = useToggle()
281
+ ```
282
+
283
+ ## Testing Extracted Hooks
284
+
285
+ After extraction, test hooks in isolation:
286
+
287
+ ```typescript
288
+ // use-model-config.spec.ts
289
+ import { renderHook, act } from '@testing-library/react'
290
+ import { useModelConfig } from './use-model-config'
291
+
292
+ describe('useModelConfig', () => {
293
+ it('should initialize with default values', () => {
294
+ const { result } = renderHook(() => useModelConfig({
295
+ hasFetchedDetail: false,
296
+ }))
297
+
298
+ expect(result.current.modelConfig.provider).toBe('langgenius/openai/openai')
299
+ expect(result.current.modelModeType).toBe(ModelModeType.unset)
300
+ })
301
+
302
+ it('should update model config', () => {
303
+ const { result } = renderHook(() => useModelConfig({
304
+ hasFetchedDetail: true,
305
+ }))
306
+
307
+ act(() => {
308
+ result.current.setModelConfig({
309
+ ...result.current.modelConfig,
310
+ model_id: 'gpt-4',
311
+ })
312
+ })
313
+
314
+ expect(result.current.modelConfig.model_id).toBe('gpt-4')
315
+ })
316
+ })
317
+ ```
@@ -0,0 +1,375 @@
1
+ ---
2
+ name: doc-coauthoring
3
+ description: Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
4
+ ---
5
+
6
+ # Doc Co-Authoring Workflow
7
+
8
+ This skill provides a structured workflow for guiding users through collaborative document creation. Act as an active guide, walking users through three stages: Context Gathering, Refinement & Structure, and Reader Testing.
9
+
10
+ ## When to Offer This Workflow
11
+
12
+ **Trigger conditions:**
13
+ - User mentions writing documentation: "write a doc", "draft a proposal", "create a spec", "write up"
14
+ - User mentions specific doc types: "PRD", "design doc", "decision doc", "RFC"
15
+ - User seems to be starting a substantial writing task
16
+
17
+ **Initial offer:**
18
+ Offer the user a structured workflow for co-authoring the document. Explain the three stages:
19
+
20
+ 1. **Context Gathering**: User provides all relevant context while Codex asks clarifying questions
21
+ 2. **Refinement & Structure**: Iteratively build each section through brainstorming and editing
22
+ 3. **Reader Testing**: Test the doc with a fresh Codex (no context) to catch blind spots before others read it
23
+
24
+ Explain that this approach helps ensure the doc works well when others read it (including when they paste it into Codex). Ask if they want to try this workflow or prefer to work freeform.
25
+
26
+ If user declines, work freeform. If user accepts, proceed to Stage 1.
27
+
28
+ ## Stage 1: Context Gathering
29
+
30
+ **Goal:** Close the gap between what the user knows and what Codex knows, enabling smart guidance later.
31
+
32
+ ### Initial Questions
33
+
34
+ Start by asking the user for meta-context about the document:
35
+
36
+ 1. What type of document is this? (e.g., technical spec, decision doc, proposal)
37
+ 2. Who's the primary audience?
38
+ 3. What's the desired impact when someone reads this?
39
+ 4. Is there a template or specific format to follow?
40
+ 5. Any other constraints or context to know?
41
+
42
+ Inform them they can answer in shorthand or dump information however works best for them.
43
+
44
+ **If user provides a template or mentions a doc type:**
45
+ - Ask if they have a template document to share
46
+ - If they provide a link to a shared document, use the appropriate integration to fetch it
47
+ - If they provide a file, read it
48
+
49
+ **If user mentions editing an existing shared document:**
50
+ - Use the appropriate integration to read the current state
51
+ - Check for images without alt-text
52
+ - If images exist without alt-text, explain that when others use Codex to understand the doc, Codex won't be able to see them. Ask if they want alt-text generated. If so, request they paste each image into chat for descriptive alt-text generation.
53
+
54
+ ### Info Dumping
55
+
56
+ Once initial questions are answered, encourage the user to dump all the context they have. Request information such as:
57
+ - Background on the project/problem
58
+ - Related team discussions or shared documents
59
+ - Why alternative solutions aren't being used
60
+ - Organizational context (team dynamics, past incidents, politics)
61
+ - Timeline pressures or constraints
62
+ - Technical architecture or dependencies
63
+ - Stakeholder concerns
64
+
65
+ Advise them not to worry about organizing it - just get it all out. Offer multiple ways to provide context:
66
+ - Info dump stream-of-consciousness
67
+ - Point to team channels or threads to read
68
+ - Link to shared documents
69
+
70
+ **If integrations are available** (e.g., Slack, Teams, Google Drive, SharePoint, or other MCP servers), mention that these can be used to pull in context directly.
71
+
72
+ **If no integrations are detected and in Codex.ai or Codex app:** Suggest they can enable connectors in their Codex settings to allow pulling context from messaging apps and document storage directly.
73
+
74
+ Inform them clarifying questions will be asked once they've done their initial dump.
75
+
76
+ **During context gathering:**
77
+
78
+ - If user mentions team channels or shared documents:
79
+ - If integrations available: Inform them the content will be read now, then use the appropriate integration
80
+ - If integrations not available: Explain lack of access. Suggest they enable connectors in Codex settings, or paste the relevant content directly.
81
+
82
+ - If user mentions entities/projects that are unknown:
83
+ - Ask if connected tools should be searched to learn more
84
+ - Wait for user confirmation before searching
85
+
86
+ - As user provides context, track what's being learned and what's still unclear
87
+
88
+ **Asking clarifying questions:**
89
+
90
+ When user signals they've done their initial dump (or after substantial context provided), ask clarifying questions to ensure understanding:
91
+
92
+ Generate 5-10 numbered questions based on gaps in the context.
93
+
94
+ Inform them they can use shorthand to answer (e.g., "1: yes, 2: see #channel, 3: no because backwards compat"), link to more docs, point to channels to read, or just keep info-dumping. Whatever's most efficient for them.
95
+
96
+ **Exit condition:**
97
+ Sufficient context has been gathered when questions show understanding - when edge cases and trade-offs can be asked about without needing basics explained.
98
+
99
+ **Transition:**
100
+ Ask if there's any more context they want to provide at this stage, or if it's time to move on to drafting the document.
101
+
102
+ If user wants to add more, let them. When ready, proceed to Stage 2.
103
+
104
+ ## Stage 2: Refinement & Structure
105
+
106
+ **Goal:** Build the document section by section through brainstorming, curation, and iterative refinement.
107
+
108
+ **Instructions to user:**
109
+ Explain that the document will be built section by section. For each section:
110
+ 1. Clarifying questions will be asked about what to include
111
+ 2. 5-20 options will be brainstormed
112
+ 3. User will indicate what to keep/remove/combine
113
+ 4. The section will be drafted
114
+ 5. It will be refined through surgical edits
115
+
116
+ Start with whichever section has the most unknowns (usually the core decision/proposal), then work through the rest.
117
+
118
+ **Section ordering:**
119
+
120
+ If the document structure is clear:
121
+ Ask which section they'd like to start with.
122
+
123
+ Suggest starting with whichever section has the most unknowns. For decision docs, that's usually the core proposal. For specs, it's typically the technical approach. Summary sections are best left for last.
124
+
125
+ If user doesn't know what sections they need:
126
+ Based on the type of document and template, suggest 3-5 sections appropriate for the doc type.
127
+
128
+ Ask if this structure works, or if they want to adjust it.
129
+
130
+ **Once structure is agreed:**
131
+
132
+ Create the initial document structure with placeholder text for all sections.
133
+
134
+ **If access to artifacts is available:**
135
+ Use `create_file` to create an artifact. This gives both Codex and the user a scaffold to work from.
136
+
137
+ Inform them that the initial structure with placeholders for all sections will be created.
138
+
139
+ Create artifact with all section headers and brief placeholder text like "[To be written]" or "[Content here]".
140
+
141
+ Provide the scaffold link and indicate it's time to fill in each section.
142
+
143
+ **If no access to artifacts:**
144
+ Create a markdown file in the working directory. Name it appropriately (e.g., `decision-doc.md`, `technical-spec.md`).
145
+
146
+ Inform them that the initial structure with placeholders for all sections will be created.
147
+
148
+ Create file with all section headers and placeholder text.
149
+
150
+ Confirm the filename has been created and indicate it's time to fill in each section.
151
+
152
+ **For each section:**
153
+
154
+ ### Step 1: Clarifying Questions
155
+
156
+ Announce work will begin on the [SECTION NAME] section. Ask 5-10 clarifying questions about what should be included:
157
+
158
+ Generate 5-10 specific questions based on context and section purpose.
159
+
160
+ Inform them they can answer in shorthand or just indicate what's important to cover.
161
+
162
+ ### Step 2: Brainstorming
163
+
164
+ For the [SECTION NAME] section, brainstorm [5-20] things that might be included, depending on the section's complexity. Look for:
165
+ - Context shared that might have been forgotten
166
+ - Angles or considerations not yet mentioned
167
+
168
+ Generate 5-20 numbered options based on section complexity. At the end, offer to brainstorm more if they want additional options.
169
+
170
+ ### Step 3: Curation
171
+
172
+ Ask which points should be kept, removed, or combined. Request brief justifications to help learn priorities for the next sections.
173
+
174
+ Provide examples:
175
+ - "Keep 1,4,7,9"
176
+ - "Remove 3 (duplicates 1)"
177
+ - "Remove 6 (audience already knows this)"
178
+ - "Combine 11 and 12"
179
+
180
+ **If user gives freeform feedback** (e.g., "looks good" or "I like most of it but...") instead of numbered selections, extract their preferences and proceed. Parse what they want kept/removed/changed and apply it.
181
+
182
+ ### Step 4: Gap Check
183
+
184
+ Based on what they've selected, ask if there's anything important missing for the [SECTION NAME] section.
185
+
186
+ ### Step 5: Drafting
187
+
188
+ Use `str_replace` to replace the placeholder text for this section with the actual drafted content.
189
+
190
+ Announce the [SECTION NAME] section will be drafted now based on what they've selected.
191
+
192
+ **If using artifacts:**
193
+ After drafting, provide a link to the artifact.
194
+
195
+ Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
196
+
197
+ **If using a file (no artifacts):**
198
+ After drafting, confirm completion.
199
+
200
+ Inform them the [SECTION NAME] section has been drafted in [filename]. Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
201
+
202
+ **Key instruction for user (include when drafting the first section):**
203
+ Provide a note: Instead of editing the doc directly, ask them to indicate what to change. This helps learning of their style for future sections. For example: "Remove the X bullet - already covered by Y" or "Make the third paragraph more concise".
204
+
205
+ ### Step 6: Iterative Refinement
206
+
207
+ As user provides feedback:
208
+ - Use `str_replace` to make edits (never reprint the whole doc)
209
+ - **If using artifacts:** Provide link to artifact after each edit
210
+ - **If using files:** Just confirm edits are complete
211
+ - If user edits doc directly and asks to read it: mentally note the changes they made and keep them in mind for future sections (this shows their preferences)
212
+
213
+ **Continue iterating** until user is satisfied with the section.
214
+
215
+ ### Quality Checking
216
+
217
+ After 3 consecutive iterations with no substantial changes, ask if anything can be removed without losing important information.
218
+
219
+ When section is done, confirm [SECTION NAME] is complete. Ask if ready to move to the next section.
220
+
221
+ **Repeat for all sections.**
222
+
223
+ ### Near Completion
224
+
225
+ As approaching completion (80%+ of sections done), announce intention to re-read the entire document and check for:
226
+ - Flow and consistency across sections
227
+ - Redundancy or contradictions
228
+ - Anything that feels like "slop" or generic filler
229
+ - Whether every sentence carries weight
230
+
231
+ Read entire document and provide feedback.
232
+
233
+ **When all sections are drafted and refined:**
234
+ Announce all sections are drafted. Indicate intention to review the complete document one more time.
235
+
236
+ Review for overall coherence, flow, completeness.
237
+
238
+ Provide any final suggestions.
239
+
240
+ Ask if ready to move to Reader Testing, or if they want to refine anything else.
241
+
242
+ ## Stage 3: Reader Testing
243
+
244
+ **Goal:** Test the document with a fresh Codex (no context bleed) to verify it works for readers.
245
+
246
+ **Instructions to user:**
247
+ Explain that testing will now occur to see if the document actually works for readers. This catches blind spots - things that make sense to the authors but might confuse others.
248
+
249
+ ### Testing Approach
250
+
251
+ **If access to sub-agents is available (e.g., in Codex):**
252
+
253
+ Perform the testing directly without user involvement.
254
+
255
+ ### Step 1: Predict Reader Questions
256
+
257
+ Announce intention to predict what questions readers might ask when trying to discover this document.
258
+
259
+ Generate 5-10 questions that readers would realistically ask.
260
+
261
+ ### Step 2: Test with Sub-Agent
262
+
263
+ Announce that these questions will be tested with a fresh Codex instance (no context from this conversation).
264
+
265
+ For each question, invoke a sub-agent with just the document content and the question.
266
+
267
+ Summarize what Reader Codex got right/wrong for each question.
268
+
269
+ ### Step 3: Run Additional Checks
270
+
271
+ Announce additional checks will be performed.
272
+
273
+ Invoke sub-agent to check for ambiguity, false assumptions, contradictions.
274
+
275
+ Summarize any issues found.
276
+
277
+ ### Step 4: Report and Fix
278
+
279
+ If issues found:
280
+ Report that Reader Codex struggled with specific issues.
281
+
282
+ List the specific issues.
283
+
284
+ Indicate intention to fix these gaps.
285
+
286
+ Loop back to refinement for problematic sections.
287
+
288
+ ---
289
+
290
+ **If no access to sub-agents (e.g., Codex.ai web interface):**
291
+
292
+ The user will need to do the testing manually.
293
+
294
+ ### Step 1: Predict Reader Questions
295
+
296
+ Ask what questions people might ask when trying to discover this document. What would they type into Codex.ai?
297
+
298
+ Generate 5-10 questions that readers would realistically ask.
299
+
300
+ ### Step 2: Setup Testing
301
+
302
+ Provide testing instructions:
303
+ 1. Open a fresh Codex conversation: https://Codex.ai
304
+ 2. Paste or share the document content (if using a shared doc platform with connectors enabled, provide the link)
305
+ 3. Ask Reader Codex the generated questions
306
+
307
+ For each question, instruct Reader Codex to provide:
308
+ - The answer
309
+ - Whether anything was ambiguous or unclear
310
+ - What knowledge/context the doc assumes is already known
311
+
312
+ Check if Reader Codex gives correct answers or misinterprets anything.
313
+
314
+ ### Step 3: Additional Checks
315
+
316
+ Also ask Reader Codex:
317
+ - "What in this doc might be ambiguous or unclear to readers?"
318
+ - "What knowledge or context does this doc assume readers already have?"
319
+ - "Are there any internal contradictions or inconsistencies?"
320
+
321
+ ### Step 4: Iterate Based on Results
322
+
323
+ Ask what Reader Codex got wrong or struggled with. Indicate intention to fix those gaps.
324
+
325
+ Loop back to refinement for any problematic sections.
326
+
327
+ ---
328
+
329
+ ### Exit Condition (Both Approaches)
330
+
331
+ When Reader Codex consistently answers questions correctly and doesn't surface new gaps or ambiguities, the doc is ready.
332
+
333
+ ## Final Review
334
+
335
+ When Reader Testing passes:
336
+ Announce the doc has passed Reader Codex testing. Before completion:
337
+
338
+ 1. Recommend they do a final read-through themselves - they own this document and are responsible for its quality
339
+ 2. Suggest double-checking any facts, links, or technical details
340
+ 3. Ask them to verify it achieves the impact they wanted
341
+
342
+ Ask if they want one more review, or if the work is done.
343
+
344
+ **If user wants final review, provide it. Otherwise:**
345
+ Announce document completion. Provide a few final tips:
346
+ - Consider linking this conversation in an appendix so readers can see how the doc was developed
347
+ - Use appendices to provide depth without bloating the main doc
348
+ - Update the doc as feedback is received from real readers
349
+
350
+ ## Tips for Effective Guidance
351
+
352
+ **Tone:**
353
+ - Be direct and procedural
354
+ - Explain rationale briefly when it affects user behavior
355
+ - Don't try to "sell" the approach - just execute it
356
+
357
+ **Handling Deviations:**
358
+ - If user wants to skip a stage: Ask if they want to skip this and write freeform
359
+ - If user seems frustrated: Acknowledge this is taking longer than expected. Suggest ways to move faster
360
+ - Always give user agency to adjust the process
361
+
362
+ **Context Management:**
363
+ - Throughout, if context is missing on something mentioned, proactively ask
364
+ - Don't let gaps accumulate - address them as they come up
365
+
366
+ **Artifact Management:**
367
+ - Use `create_file` for drafting full sections
368
+ - Use `str_replace` for all edits
369
+ - Provide artifact link after every change
370
+ - Never use artifacts for brainstorming lists - that's just conversation
371
+
372
+ **Quality over Speed:**
373
+ - Don't rush through stages
374
+ - Each iteration should make meaningful improvements
375
+ - The goal is a document that actually works for readers