qualia-framework 2.1.0

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 (261) hide show
  1. package/README.md +50 -0
  2. package/bin/cli.js +519 -0
  3. package/framework/agents/architecture-strategist.md +53 -0
  4. package/framework/agents/backend-agent.md +150 -0
  5. package/framework/agents/code-simplicity-reviewer.md +86 -0
  6. package/framework/agents/frontend-agent.md +111 -0
  7. package/framework/agents/kieran-typescript-reviewer.md +96 -0
  8. package/framework/agents/performance-oracle.md +111 -0
  9. package/framework/agents/qualia-codebase-mapper.md +760 -0
  10. package/framework/agents/qualia-debugger.md +1203 -0
  11. package/framework/agents/qualia-executor.md +881 -0
  12. package/framework/agents/qualia-integration-checker.md +423 -0
  13. package/framework/agents/qualia-phase-researcher.md +453 -0
  14. package/framework/agents/qualia-plan-checker.md +699 -0
  15. package/framework/agents/qualia-planner.md +1241 -0
  16. package/framework/agents/qualia-project-researcher.md +602 -0
  17. package/framework/agents/qualia-research-synthesizer.md +236 -0
  18. package/framework/agents/qualia-roadmapper.md +605 -0
  19. package/framework/agents/qualia-verifier.md +685 -0
  20. package/framework/agents/team-orchestrator.md +228 -0
  21. package/framework/agents/teams/full-stack-team.md +48 -0
  22. package/framework/agents/teams/optimize-team.md +53 -0
  23. package/framework/agents/teams/review-team.md +62 -0
  24. package/framework/agents/teams/ship-team.md +86 -0
  25. package/framework/agents/test-agent.md +182 -0
  26. package/framework/askpass.sh +2 -0
  27. package/framework/commands/design.md +53 -0
  28. package/framework/commands/quick-db.md +22 -0
  29. package/framework/config/retention.json +35 -0
  30. package/framework/core/PRINCIPLES.md +77 -0
  31. package/framework/hooks/auto-format.sh +45 -0
  32. package/framework/hooks/block-env-edit.sh +42 -0
  33. package/framework/hooks/branch-guard.sh +46 -0
  34. package/framework/hooks/confirm-delete.sh +56 -0
  35. package/framework/hooks/migration-validate.sh +68 -0
  36. package/framework/hooks/notification-speak.sh +15 -0
  37. package/framework/hooks/pre-commit.sh +80 -0
  38. package/framework/hooks/pre-compact.sh +55 -0
  39. package/framework/hooks/pre-deploy-gate.sh +151 -0
  40. package/framework/hooks/qualia-colors.sh +32 -0
  41. package/framework/hooks/retention-cleanup.sh +43 -0
  42. package/framework/hooks/save-session-state.sh +153 -0
  43. package/framework/hooks/session-context-loader.sh +28 -0
  44. package/framework/hooks/session-learn.sh +30 -0
  45. package/framework/knowledge/claudecode-bible.md +1384 -0
  46. package/framework/knowledge/client-prefs.md +22 -0
  47. package/framework/knowledge/common-fixes.md +25 -0
  48. package/framework/knowledge/deployment-map.md +35 -0
  49. package/framework/knowledge/email-signature.html +1 -0
  50. package/framework/knowledge/employees.md +8 -0
  51. package/framework/knowledge/learned-patterns.md +51 -0
  52. package/framework/knowledge/optimization-research-2026.md +137 -0
  53. package/framework/knowledge/qualia-context.md +67 -0
  54. package/framework/knowledge/supabase-patterns.md +50 -0
  55. package/framework/knowledge/voice-agent-patterns.md +46 -0
  56. package/framework/qualia-engine/VERSION +1 -0
  57. package/framework/qualia-engine/bin/qualia-tools.js +2160 -0
  58. package/framework/qualia-engine/bin/qualia-tools.test.js +1054 -0
  59. package/framework/qualia-engine/references/checkpoints.md +775 -0
  60. package/framework/qualia-engine/references/continuation-format.md +249 -0
  61. package/framework/qualia-engine/references/decimal-phase-calculation.md +65 -0
  62. package/framework/qualia-engine/references/design-quality.md +56 -0
  63. package/framework/qualia-engine/references/git-integration.md +254 -0
  64. package/framework/qualia-engine/references/git-planning-commit.md +50 -0
  65. package/framework/qualia-engine/references/model-profile-resolution.md +32 -0
  66. package/framework/qualia-engine/references/model-profiles.md +73 -0
  67. package/framework/qualia-engine/references/phase-argument-parsing.md +61 -0
  68. package/framework/qualia-engine/references/planning-config.md +195 -0
  69. package/framework/qualia-engine/references/questioning.md +141 -0
  70. package/framework/qualia-engine/references/tdd.md +263 -0
  71. package/framework/qualia-engine/references/ui-brand.md +160 -0
  72. package/framework/qualia-engine/references/verification-patterns.md +612 -0
  73. package/framework/qualia-engine/templates/DEBUG.md +159 -0
  74. package/framework/qualia-engine/templates/DESIGN.md +81 -0
  75. package/framework/qualia-engine/templates/UAT.md +247 -0
  76. package/framework/qualia-engine/templates/codebase/architecture.md +255 -0
  77. package/framework/qualia-engine/templates/codebase/concerns.md +310 -0
  78. package/framework/qualia-engine/templates/codebase/conventions.md +307 -0
  79. package/framework/qualia-engine/templates/codebase/integrations.md +280 -0
  80. package/framework/qualia-engine/templates/codebase/stack.md +186 -0
  81. package/framework/qualia-engine/templates/codebase/structure.md +285 -0
  82. package/framework/qualia-engine/templates/codebase/testing.md +480 -0
  83. package/framework/qualia-engine/templates/config.json +35 -0
  84. package/framework/qualia-engine/templates/context.md +283 -0
  85. package/framework/qualia-engine/templates/continue-here.md +78 -0
  86. package/framework/qualia-engine/templates/debug-subagent-prompt.md +91 -0
  87. package/framework/qualia-engine/templates/discovery.md +146 -0
  88. package/framework/qualia-engine/templates/milestone-archive.md +123 -0
  89. package/framework/qualia-engine/templates/milestone.md +115 -0
  90. package/framework/qualia-engine/templates/phase-prompt.md +567 -0
  91. package/framework/qualia-engine/templates/planner-subagent-prompt.md +117 -0
  92. package/framework/qualia-engine/templates/project.md +184 -0
  93. package/framework/qualia-engine/templates/projects/ai-agent.md +156 -0
  94. package/framework/qualia-engine/templates/projects/mobile-app.md +181 -0
  95. package/framework/qualia-engine/templates/projects/voice-agent.md +134 -0
  96. package/framework/qualia-engine/templates/projects/website.md +137 -0
  97. package/framework/qualia-engine/templates/requirements.md +231 -0
  98. package/framework/qualia-engine/templates/research-project/ARCHITECTURE.md +204 -0
  99. package/framework/qualia-engine/templates/research-project/FEATURES.md +147 -0
  100. package/framework/qualia-engine/templates/research-project/PITFALLS.md +200 -0
  101. package/framework/qualia-engine/templates/research-project/STACK.md +120 -0
  102. package/framework/qualia-engine/templates/research-project/SUMMARY.md +170 -0
  103. package/framework/qualia-engine/templates/research.md +552 -0
  104. package/framework/qualia-engine/templates/roadmap.md +202 -0
  105. package/framework/qualia-engine/templates/state.md +176 -0
  106. package/framework/qualia-engine/templates/summary-complex.md +59 -0
  107. package/framework/qualia-engine/templates/summary-minimal.md +41 -0
  108. package/framework/qualia-engine/templates/summary-standard.md +48 -0
  109. package/framework/qualia-engine/templates/summary.md +246 -0
  110. package/framework/qualia-engine/templates/user-setup.md +311 -0
  111. package/framework/qualia-engine/templates/verification-report.md +322 -0
  112. package/framework/qualia-engine/workflows/add-phase.md +179 -0
  113. package/framework/qualia-engine/workflows/add-todo.md +157 -0
  114. package/framework/qualia-engine/workflows/audit-milestone.md +241 -0
  115. package/framework/qualia-engine/workflows/check-todos.md +176 -0
  116. package/framework/qualia-engine/workflows/complete-milestone.md +858 -0
  117. package/framework/qualia-engine/workflows/diagnose-issues.md +219 -0
  118. package/framework/qualia-engine/workflows/discovery-phase.md +289 -0
  119. package/framework/qualia-engine/workflows/discuss-phase.md +534 -0
  120. package/framework/qualia-engine/workflows/execute-phase.md +559 -0
  121. package/framework/qualia-engine/workflows/execute-plan.md +438 -0
  122. package/framework/qualia-engine/workflows/help.md +470 -0
  123. package/framework/qualia-engine/workflows/insert-phase.md +220 -0
  124. package/framework/qualia-engine/workflows/list-phase-assumptions.md +178 -0
  125. package/framework/qualia-engine/workflows/map-codebase.md +327 -0
  126. package/framework/qualia-engine/workflows/new-milestone.md +363 -0
  127. package/framework/qualia-engine/workflows/new-project.md +1037 -0
  128. package/framework/qualia-engine/workflows/pause-work.md +122 -0
  129. package/framework/qualia-engine/workflows/plan-milestone-gaps.md +256 -0
  130. package/framework/qualia-engine/workflows/plan-phase.md +422 -0
  131. package/framework/qualia-engine/workflows/progress.md +354 -0
  132. package/framework/qualia-engine/workflows/quick.md +252 -0
  133. package/framework/qualia-engine/workflows/remove-phase.md +326 -0
  134. package/framework/qualia-engine/workflows/research-phase.md +74 -0
  135. package/framework/qualia-engine/workflows/resume-project.md +306 -0
  136. package/framework/qualia-engine/workflows/set-profile.md +80 -0
  137. package/framework/qualia-engine/workflows/settings.md +145 -0
  138. package/framework/qualia-engine/workflows/transition.md +556 -0
  139. package/framework/qualia-engine/workflows/update.md +197 -0
  140. package/framework/qualia-engine/workflows/verify-phase.md +195 -0
  141. package/framework/qualia-engine/workflows/verify-work.md +625 -0
  142. package/framework/rules/context7.md +11 -0
  143. package/framework/rules/deployment.md +29 -0
  144. package/framework/rules/frontend.md +33 -0
  145. package/framework/rules/security.md +12 -0
  146. package/framework/rules/speed.md +20 -0
  147. package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
  148. package/framework/scripts/apply-retention.sh +120 -0
  149. package/framework/scripts/bootstrap-pop-os.sh +354 -0
  150. package/framework/scripts/claude-voice +13 -0
  151. package/framework/scripts/cleanup.sh +131 -0
  152. package/framework/scripts/cowork-mode.sh +141 -0
  153. package/framework/scripts/generate-project-claude-md.sh +153 -0
  154. package/framework/scripts/load-test-webhook.js +172 -0
  155. package/framework/scripts/say.py +236 -0
  156. package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +167 -0
  157. package/framework/scripts/showcase-video-recorder/playwright-helpers.js +216 -0
  158. package/framework/scripts/speak.py +55 -0
  159. package/framework/scripts/speak.sh +18 -0
  160. package/framework/scripts/status.sh +138 -0
  161. package/framework/scripts/sync-to-framework.sh +65 -0
  162. package/framework/scripts/voice-hotkey.py +227 -0
  163. package/framework/scripts/voice-input.sh +51 -0
  164. package/framework/skills/animate/SKILL.md +202 -0
  165. package/framework/skills/bolder/SKILL.md +144 -0
  166. package/framework/skills/browser-qa/SKILL.md +536 -0
  167. package/framework/skills/clarify/SKILL.md +179 -0
  168. package/framework/skills/colorize/SKILL.md +170 -0
  169. package/framework/skills/critique/SKILL.md +126 -0
  170. package/framework/skills/deep-research/SKILL.md +271 -0
  171. package/framework/skills/delight/SKILL.md +329 -0
  172. package/framework/skills/deploy/SKILL.md +261 -0
  173. package/framework/skills/deploy-verify/SKILL.md +377 -0
  174. package/framework/skills/deploy-verify/scripts/canary-check.sh +206 -0
  175. package/framework/skills/deploy-verify/scripts/check-console-errors.js +147 -0
  176. package/framework/skills/deploy-verify/scripts/check-cwv.js +139 -0
  177. package/framework/skills/deploy-verify/scripts/project-detect.sh +84 -0
  178. package/framework/skills/deploy-verify/scripts/verify.sh +548 -0
  179. package/framework/skills/design-quieter/SKILL.md +130 -0
  180. package/framework/skills/distill/SKILL.md +149 -0
  181. package/framework/skills/docs-lookup/SKILL.md +78 -0
  182. package/framework/skills/fcm-notifications/SKILL.md +125 -0
  183. package/framework/skills/financial-ledger/SKILL.md +1039 -0
  184. package/framework/skills/frontend-master/NOTICE.md +4 -0
  185. package/framework/skills/frontend-master/SKILL.md +127 -0
  186. package/framework/skills/frontend-master/reference/color-and-contrast.md +132 -0
  187. package/framework/skills/frontend-master/reference/interaction-design.md +123 -0
  188. package/framework/skills/frontend-master/reference/motion-design.md +99 -0
  189. package/framework/skills/frontend-master/reference/responsive-design.md +114 -0
  190. package/framework/skills/frontend-master/reference/spatial-design.md +100 -0
  191. package/framework/skills/frontend-master/reference/typography.md +131 -0
  192. package/framework/skills/frontend-master/reference/ux-writing.md +107 -0
  193. package/framework/skills/harden/SKILL.md +357 -0
  194. package/framework/skills/i18n-rtl/SKILL.md +752 -0
  195. package/framework/skills/learn/SKILL.md +71 -0
  196. package/framework/skills/memory/SKILL.md +50 -0
  197. package/framework/skills/mobile-expo/SKILL.md +864 -0
  198. package/framework/skills/mobile-expo/references/store-checklist.md +550 -0
  199. package/framework/skills/nestjs-backend/README.md +73 -0
  200. package/framework/skills/nestjs-backend/SKILL.md +446 -0
  201. package/framework/skills/nestjs-backend/references/templates.md +1173 -0
  202. package/framework/skills/normalize/SKILL.md +79 -0
  203. package/framework/skills/onboard/SKILL.md +242 -0
  204. package/framework/skills/polish/SKILL.md +209 -0
  205. package/framework/skills/pr/SKILL.md +66 -0
  206. package/framework/skills/qualia/SKILL.md +153 -0
  207. package/framework/skills/qualia-add-todo/SKILL.md +68 -0
  208. package/framework/skills/qualia-audit-milestone/SKILL.md +92 -0
  209. package/framework/skills/qualia-check-todos/SKILL.md +55 -0
  210. package/framework/skills/qualia-complete-milestone/SKILL.md +108 -0
  211. package/framework/skills/qualia-debug/SKILL.md +149 -0
  212. package/framework/skills/qualia-design/SKILL.md +203 -0
  213. package/framework/skills/qualia-discuss-phase/SKILL.md +72 -0
  214. package/framework/skills/qualia-execute-phase/SKILL.md +86 -0
  215. package/framework/skills/qualia-help/SKILL.md +67 -0
  216. package/framework/skills/qualia-idk/SKILL.md +352 -0
  217. package/framework/skills/qualia-list-phase-assumptions/SKILL.md +67 -0
  218. package/framework/skills/qualia-new-milestone/SKILL.md +72 -0
  219. package/framework/skills/qualia-new-project/SKILL.md +92 -0
  220. package/framework/skills/qualia-optimize/SKILL.md +417 -0
  221. package/framework/skills/qualia-pause-work/SKILL.md +96 -0
  222. package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +57 -0
  223. package/framework/skills/qualia-plan-phase/SKILL.md +101 -0
  224. package/framework/skills/qualia-progress/SKILL.md +53 -0
  225. package/framework/skills/qualia-quick/SKILL.md +89 -0
  226. package/framework/skills/qualia-research-phase/SKILL.md +88 -0
  227. package/framework/skills/qualia-resume-work/SKILL.md +62 -0
  228. package/framework/skills/qualia-review/SKILL.md +263 -0
  229. package/framework/skills/qualia-start/SKILL.md +182 -0
  230. package/framework/skills/qualia-verify-work/SKILL.md +105 -0
  231. package/framework/skills/qualia-workflow/SKILL.md +130 -0
  232. package/framework/skills/rag/SKILL.md +750 -0
  233. package/framework/skills/responsive/SKILL.md +231 -0
  234. package/framework/skills/retro/SKILL.md +284 -0
  235. package/framework/skills/sakani-conventions/SKILL.md +136 -0
  236. package/framework/skills/sakani-conventions/evals/evals.json +23 -0
  237. package/framework/skills/sakani-conventions/references/entities.md +365 -0
  238. package/framework/skills/sakani-conventions/references/error-codes.md +95 -0
  239. package/framework/skills/seo-master/SKILL.md +490 -0
  240. package/framework/skills/seo-master/references/checklist.md +199 -0
  241. package/framework/skills/seo-master/references/structured-data.md +609 -0
  242. package/framework/skills/ship/SKILL.md +202 -0
  243. package/framework/skills/stack-researcher/SKILL.md +215 -0
  244. package/framework/skills/status/SKILL.md +154 -0
  245. package/framework/skills/status/scripts/health-check.sh +562 -0
  246. package/framework/skills/subscription-payments/SKILL.md +250 -0
  247. package/framework/skills/supabase/SKILL.md +973 -0
  248. package/framework/skills/supabase/references/templates.md +159 -0
  249. package/framework/skills/team/SKILL.md +67 -0
  250. package/framework/skills/test-runner/SKILL.md +202 -0
  251. package/framework/skills/voice-agent/SKILL.md +407 -0
  252. package/framework/skills/zoho-workflow/SKILL.md +51 -0
  253. package/framework/statusline-command.sh +117 -0
  254. package/package.json +24 -0
  255. package/profiles/fawzi.json +16 -0
  256. package/profiles/hasan.json +16 -0
  257. package/profiles/moayad.json +16 -0
  258. package/templates/CLAUDE-owner.md +52 -0
  259. package/templates/CLAUDE.md.hbs +58 -0
  260. package/templates/env.claude.template +12 -0
  261. package/templates/settings.json +141 -0
@@ -0,0 +1,417 @@
1
+ ---
2
+ name: qualia-optimize
3
+ description: "Deep optimization pass — reads .planning/ AND codebase to find performance, design, UI, backend, and frontend issues. Spawns parallel specialist agents. Use this skill whenever the user says 'optimize', 'optimization pass', 'find issues', 'qualia-optimize', 'deep optimize', 'performance audit', 'design alignment check', 'speed up', 'slow', 'bundle size', or wants a comprehensive quality sweep. Supports --perf, --ui, --backend, --alignment, --fix flags."
4
+ ---
5
+
6
+ # Qualia Optimize — Deep Codebase + Planning Optimization
7
+
8
+ Comprehensive optimization that reads BOTH `.planning/` docs AND the actual codebase. Never analyze one without the other.
9
+
10
+ ## Usage
11
+
12
+ - `/qualia-optimize` — Full optimization (all 6 dimensions)
13
+ - `/qualia-optimize --perf` — Performance only (queries, bundle, render, latency)
14
+ - `/qualia-optimize --ui` — Frontend/design/UI only
15
+ - `/qualia-optimize --backend` — Backend only (RLS, auth, queries, edge functions)
16
+ - `/qualia-optimize --alignment` — Planning-code alignment check only
17
+ - `/qualia-optimize --fix` — Auto-fix LOW/MEDIUM findings from existing OPTIMIZE.md
18
+
19
+ ## Process
20
+
21
+ ### Step 1: Parse Arguments
22
+
23
+ Extract mode from $ARGUMENTS. Default to `full`.
24
+
25
+ Supported modes: `full`, `perf`, `ui`, `backend`, `alignment`, `fix`.
26
+
27
+ If `--fix`: skip to Step 9 (requires existing `.planning/OPTIMIZE.md`).
28
+
29
+ ### Step 2: Load Planning Context (MANDATORY — never skip)
30
+
31
+ Read ALL of these (skip silently if file doesn't exist, but always attempt):
32
+
33
+ ```bash
34
+ cat .planning/PROJECT.md 2>/dev/null || echo "NO_PROJECT"
35
+ ```
36
+
37
+ ```bash
38
+ cat .planning/REQUIREMENTS.md 2>/dev/null || echo "NO_REQUIREMENTS"
39
+ ```
40
+
41
+ ```bash
42
+ cat .planning/ROADMAP.md 2>/dev/null || echo "NO_ROADMAP"
43
+ ```
44
+
45
+ ```bash
46
+ cat .planning/STATE.md 2>/dev/null || echo "NO_STATE"
47
+ ```
48
+
49
+ ```bash
50
+ cat .planning/DESIGN.md 2>/dev/null || echo "NO_DESIGN"
51
+ ```
52
+
53
+ Also read the rules:
54
+ ```bash
55
+ cat ~/.claude/rules/frontend.md 2>/dev/null
56
+ cat ~/.claude/rules/security.md 2>/dev/null
57
+ ```
58
+
59
+ Store all content — you will inline it into agent prompts.
60
+
61
+ **If NO planning docs exist at all**: warn the user but proceed. The optimization still works on raw codebase — it just can't check alignment.
62
+
63
+ ### Step 3: Discover Codebase
64
+
65
+ ```bash
66
+ pwd && node -e "try{const p=require('./package.json');console.log(JSON.stringify({name:p.name,deps:Object.keys(p.dependencies||{}),devDeps:Object.keys(p.devDependencies||{})}))}catch(e){console.log('{}')}" 2>/dev/null
67
+ ```
68
+
69
+ ```bash
70
+ git log --oneline -15 2>/dev/null
71
+ ```
72
+
73
+ ```bash
74
+ git diff --stat HEAD~10..HEAD 2>/dev/null | tail -5
75
+ ```
76
+
77
+ ```bash
78
+ # Project structure
79
+ ls -d app/ src/ pages/ components/ lib/ actions/ hooks/ supabase/ types/ 2>/dev/null
80
+ ```
81
+
82
+ Classify project type: `web` | `voice` | `mobile` | `agent` | `edge-functions` | `unknown`
83
+
84
+ ### Step 4: Spawn Wave 1 Agents (parallel)
85
+
86
+ Based on mode, spawn agents in a **single message** with multiple Task() calls.
87
+
88
+ | Mode | Agents |
89
+ |------|--------|
90
+ | `full` | frontend-agent + backend-agent + performance-oracle (3 parallel) |
91
+ | `perf` | performance-oracle only |
92
+ | `ui` | frontend-agent only |
93
+ | `backend` | backend-agent only |
94
+ | `alignment` | general-purpose with alignment prompt |
95
+
96
+ **CRITICAL**: Inline ALL planning context into each agent prompt. `@` references don't work across Task() boundaries.
97
+
98
+ #### Frontend Agent Prompt
99
+
100
+ ```
101
+ Task(
102
+ prompt="You are optimizing a project's frontend. Read the planning docs and codebase rules below, then analyze the actual code.
103
+
104
+ <planning>
105
+ {PROJECT.md content}
106
+ {REQUIREMENTS.md content}
107
+ {DESIGN.md content}
108
+ </planning>
109
+
110
+ <rules>
111
+ {rules/frontend.md content}
112
+ </rules>
113
+
114
+ <task>
115
+ Analyze the frontend codebase for issues in these categories:
116
+
117
+ 1. **UI Quality**
118
+ - Loading states: every async operation should show a loading indicator
119
+ - Error states: every data-fetching component should handle errors gracefully
120
+ - Empty states: lists/tables should handle zero items with helpful messaging
121
+ - Responsive: check for fixed pixel widths on containers, missing breakpoint handling
122
+ - Accessibility: alt text on images, ARIA labels on interactive elements, keyboard navigation
123
+
124
+ 2. **Design Alignment**
125
+ - Compare actual components against DESIGN.md decisions (colors, typography, spacing)
126
+ - Check rules/frontend.md compliance: distinctive fonts? sharp accents? transitions? No card grids or blue-purple gradients?
127
+ - Consistency: are the same patterns used throughout? (button styles, spacing, color usage)
128
+
129
+ 3. **Frontend Performance**
130
+ - Bundle: large library imports that could be tree-shaken or dynamically imported
131
+ - Images: using next/image? width/height set? lazy loading below fold?
132
+ - Fonts: using next/font? No render-blocking font loads?
133
+ - CSS: unused Tailwind classes? conflicting styles?
134
+ - Rendering: unnecessary re-renders, missing React.memo on list items, heavy computations in render
135
+
136
+ For EVERY finding, output in this exact format:
137
+ - **What**: [description]
138
+ - **Where**: [file:line]
139
+ - **Why**: [impact on users/performance]
140
+ - **Fix**: [concrete fix suggestion]
141
+ - **Severity**: CRITICAL | HIGH | MEDIUM | LOW
142
+ </task>",
143
+ subagent_type="frontend-agent",
144
+ description="Frontend optimization analysis"
145
+ )
146
+ ```
147
+
148
+ #### Backend Agent Prompt
149
+
150
+ ```
151
+ Task(
152
+ prompt="You are optimizing a project's backend. Read the planning docs and security rules below, then analyze the actual code.
153
+
154
+ <planning>
155
+ {PROJECT.md content}
156
+ {REQUIREMENTS.md content}
157
+ </planning>
158
+
159
+ <rules>
160
+ {rules/security.md content}
161
+ </rules>
162
+
163
+ <task>
164
+ Analyze the backend codebase for issues:
165
+
166
+ 1. **Security**
167
+ - RLS: every Supabase table must have ROW LEVEL SECURITY enabled with policies
168
+ - Service role: grep for service_role key usage in client-side code (app/, components/, src/) — should be ZERO
169
+ - Auth: all mutations use server-side auth check (supabase.auth.getUser())
170
+ - Validation: input validated with Zod before database operations
171
+ - No dangerouslySetInnerHTML or eval()
172
+
173
+ 2. **Data Access Patterns**
174
+ - Server actions vs client mutations: data writes should use 'use server' actions, not direct Supabase client calls
175
+ - Proper error handling: try/catch with meaningful error messages
176
+ - Revalidation: revalidatePath/revalidateTag after mutations
177
+
178
+ 3. **Edge Functions** (if supabase/functions/ exists)
179
+ - Cold start optimization: bundle size, dependency count
180
+ - Error handling and logging
181
+ - CORS configuration
182
+ - Timeout protection (maxDuration)
183
+
184
+ 4. **API Quality**
185
+ - Rate limiting on public endpoints
186
+ - Proper HTTP status codes
187
+ - Consistent error response format
188
+
189
+ For EVERY finding, output:
190
+ - **What**: [description]
191
+ - **Where**: [file:line]
192
+ - **Why**: [impact]
193
+ - **Fix**: [concrete suggestion]
194
+ - **Severity**: CRITICAL | HIGH | MEDIUM | LOW
195
+ </task>",
196
+ subagent_type="backend-agent",
197
+ description="Backend optimization analysis"
198
+ )
199
+ ```
200
+
201
+ #### Performance Oracle Prompt
202
+
203
+ ```
204
+ Task(
205
+ prompt="You are analyzing cross-cutting performance issues. Read the project context, then analyze the codebase.
206
+
207
+ <planning>
208
+ {PROJECT.md content}
209
+ </planning>
210
+
211
+ <task>
212
+ Analyze for performance issues across the full stack:
213
+
214
+ 1. **Database Queries**
215
+ - N+1 queries: Supabase .from() calls inside loops or .map()
216
+ - Missing indexes: .eq()/.filter()/.order() columns without corresponding indexes in migrations
217
+ - Sequential queries that could be parallel (Promise.all)
218
+ - Over-fetching: SELECT * when only specific columns needed
219
+
220
+ 2. **API Latency**
221
+ - Sequential API calls from client that could be batched
222
+ - Missing caching (SWR/React Query stale times, HTTP cache headers)
223
+ - Large payloads without pagination
224
+
225
+ 3. **Bundle Size**
226
+ - Barrel exports (index.ts re-exporting everything) preventing tree-shaking
227
+ - Large libraries imported for single functions (lodash, moment)
228
+ - Missing dynamic imports for heavy components (charts, editors, maps)
229
+
230
+ 4. **Render Performance**
231
+ - Expensive computations in render path without useMemo
232
+ - Event handlers recreated on every render without useCallback
233
+ - Large lists without virtualization
234
+ - Context providers causing unnecessary re-renders
235
+
236
+ For EVERY finding, output:
237
+ - **What**: [description]
238
+ - **Where**: [file:line]
239
+ - **Why**: [performance impact, quantified if possible]
240
+ - **Fix**: [concrete suggestion]
241
+ - **Severity**: CRITICAL | HIGH | MEDIUM | LOW
242
+ </task>",
243
+ subagent_type="performance-oracle",
244
+ description="Performance optimization analysis"
245
+ )
246
+ ```
247
+
248
+ ### Step 5: Spawn Wave 2 Agent (after Wave 1 completes)
249
+
250
+ After all Wave 1 agents return, spawn the architecture strategist with their combined findings:
251
+
252
+ ```
253
+ Task(
254
+ prompt="You are synthesizing optimization findings from 3 specialist agents. Look for cross-cutting architectural issues.
255
+
256
+ <wave1_findings>
257
+ {All findings from frontend-agent, backend-agent, performance-oracle}
258
+ </wave1_findings>
259
+
260
+ <planning>
261
+ {PROJECT.md content}
262
+ {REQUIREMENTS.md content}
263
+ </planning>
264
+
265
+ <task>
266
+ 1. Identify patterns across findings — recurring issues that point to a structural problem
267
+ 2. Find coupling issues between frontend and backend
268
+ 3. Check for inconsistent patterns (e.g., some routes use server actions, others use API routes)
269
+ 4. Identify missing abstractions (same pattern repeated 3+ times)
270
+ 5. Check for dead code and unused exports
271
+
272
+ Output:
273
+ - **Structural findings** (architectural issues, not covered by Wave 1)
274
+ - **Pattern consolidation** (where Wave 1 findings share a root cause)
275
+ - Each finding in the same format: What/Where/Why/Fix/Severity
276
+ </task>",
277
+ subagent_type="architecture-strategist",
278
+ description="Architecture synthesis"
279
+ )
280
+ ```
281
+
282
+ **Skip Wave 2 for single-mode runs** (`--perf`, `--ui`, `--backend`). Only run for `full` mode.
283
+
284
+ ### Step 6: Alignment Check (always runs in `full` and `alignment` modes)
285
+
286
+ For `alignment` mode, this is the sole analysis. For `full` mode, run alongside Wave 1.
287
+
288
+ Read REQUIREMENTS.md and ROADMAP.md. For each requirement marked "Complete" or mapped to a completed phase:
289
+
290
+ ```bash
291
+ # Find completed requirements
292
+ grep -E "Complete|✓" .planning/REQUIREMENTS.md 2>/dev/null
293
+ ```
294
+
295
+ For each completed requirement:
296
+ - Grep the codebase for evidence it actually exists (routes, components, API endpoints)
297
+ - If not found: flag as "Claimed complete but not implemented"
298
+
299
+ Then scan for orphan features:
300
+ ```bash
301
+ # Find all routes/pages
302
+ find app -name "page.tsx" -o -name "route.ts" 2>/dev/null
303
+ # Find all API routes
304
+ find app/api -name "route.ts" 2>/dev/null
305
+ ```
306
+
307
+ Cross-reference with REQUIREMENTS.md — any route/feature NOT in requirements is flagged as "Undocumented feature".
308
+
309
+ ### Step 7: Collect and Score Findings
310
+
311
+ After all agents return:
312
+ 1. Deduplicate (same file:line from multiple agents → keep the most detailed one)
313
+ 2. Sort by severity: CRITICAL first
314
+ 3. Group by dimension: Performance, Design Alignment, UI Quality, Backend, Frontend, Planning-Code Alignment, Architecture
315
+
316
+ Count totals per severity.
317
+
318
+ ### Step 8: Write OPTIMIZE.md and Present Results
319
+
320
+ Write to `.planning/OPTIMIZE.md`:
321
+
322
+ ```markdown
323
+ ---
324
+ date: {YYYY-MM-DD HH:MM}
325
+ mode: {full|perf|ui|backend|alignment}
326
+ critical: {N}
327
+ high: {N}
328
+ medium: {N}
329
+ low: {N}
330
+ status: {clean|needs_attention|critical_issues}
331
+ ---
332
+
333
+ # Optimization Report
334
+
335
+ **Project:** {name} | **Mode:** {mode} | **Date:** {date}
336
+
337
+ ## Summary
338
+
339
+ {2-3 sentence overview}
340
+
341
+ {If status is clean: "No critical issues found. Project is in good shape."}
342
+
343
+ ## Critical Issues
344
+
345
+ | # | Dimension | Finding | Location | Fix |
346
+ |---|-----------|---------|----------|-----|
347
+ {findings}
348
+
349
+ ## High Priority
350
+
351
+ | # | Dimension | Finding | Location | Fix |
352
+ |---|-----------|---------|----------|-----|
353
+ {findings}
354
+
355
+ ## Medium Priority
356
+
357
+ | # | Dimension | Finding | Location | Fix |
358
+ |---|-----------|---------|----------|-----|
359
+ {findings}
360
+
361
+ ## Low Priority
362
+
363
+ | # | Dimension | Finding | Location | Fix |
364
+ |---|-----------|---------|----------|-----|
365
+ {findings}
366
+ ```
367
+
368
+ Commit:
369
+ ```bash
370
+ node ~/.claude/qualia-engine/bin/qualia-tools.js commit "docs: optimization report ({mode} mode, {critical} critical)" --files .planning/OPTIMIZE.md
371
+ ```
372
+
373
+ **Present results:**
374
+
375
+ If CRITICAL findings exist:
376
+ ```
377
+ {critical} critical issues found. Options:
378
+
379
+ 1. Create a fix phase in ROADMAP.md for critical + high findings
380
+ 2. Auto-fix LOW/MEDIUM findings: /qualia-optimize --fix
381
+ 3. Review full report: cat .planning/OPTIMIZE.md
382
+ ```
383
+
384
+ If no CRITICAL:
385
+ ```
386
+ Optimization complete. {total} findings ({high} high, {medium} medium, {low} low).
387
+ Report: .planning/OPTIMIZE.md
388
+
389
+ Run /qualia-optimize --fix to auto-fix LOW/MEDIUM findings.
390
+ ```
391
+
392
+ ### Step 9: --fix Mode
393
+
394
+ When `--fix` is provided:
395
+
396
+ 1. Read existing `.planning/OPTIMIZE.md` — if not found, error: "Run /qualia-optimize first"
397
+ 2. Filter to LOW and MEDIUM findings only
398
+ 3. For each finding with a clear, safe fix:
399
+ - Read the target file
400
+ - Apply the fix
401
+ - Verify it doesn't break (npx tsc --noEmit if TypeScript)
402
+ 4. Update OPTIMIZE.md: mark fixed findings, recount severities
403
+ 5. Commit changes
404
+ 6. Report what was fixed and what remains
405
+
406
+ **Never auto-fix CRITICAL or HIGH** — those require human judgment.
407
+
408
+ ### Step 10: Gap Phase Creation (if user selects option 1 from Step 8)
409
+
410
+ If user wants a fix phase for critical issues:
411
+
412
+ 1. Read ROADMAP.md, find current phase number
413
+ 2. Insert a decimal phase: `Phase {N}.1: Optimization Fixes (INSERTED)`
414
+ 3. Map CRITICAL and HIGH findings as success criteria
415
+ 4. Update STATE.md
416
+ 5. Commit
417
+ 6. Suggest: "Fix phase created. Run `/qualia-plan-phase {N}.1`"
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: qualia-pause-work
3
+ description: "Save session context for seamless handoff between Claude sessions. Use this skill whenever the user says 'pause', 'save progress', 'stop for now', 'pause work', 'handoff', 'save thoughts', or wants to preserve their current working state before ending a session. Also trigger when user mentions 'continue later', 'pick up tomorrow', or needs to create a checkpoint of current work. Supports both full project handoff and lightweight thoughts mode."
4
+ ---
5
+
6
+ # Qualia Pause Work — Session Handoff
7
+
8
+ Save current session context so the next session can pick up exactly where you left off.
9
+
10
+ ## Usage
11
+
12
+ `/qualia-pause-work` — Full project-aware handoff (creates `.continue-here.md`)
13
+ `/qualia-pause-work --thoughts` — Lightweight thought dump (saves to `~/.claude/thoughts/`)
14
+
15
+ ## Default Mode (Project Handoff)
16
+
17
+ ### 1. Read Current State
18
+
19
+ Load `.planning/STATE.md` and check current phase status.
20
+
21
+ Reference: `~/.claude/qualia-engine/workflows/pause-work.md`
22
+
23
+ ### 2. Create `.continue-here.md`
24
+
25
+ Write a handoff file at the project root with:
26
+
27
+ ```markdown
28
+ # Continue Here
29
+
30
+ ## Session Summary
31
+ What was accomplished this session.
32
+
33
+ ## Current Phase
34
+ Phase X: [name] — [status]
35
+
36
+ ## In Progress
37
+ - What's partially done
38
+ - Where exactly work stopped
39
+
40
+ ## Next Steps
41
+ 1. Immediate next action
42
+ 2. Following actions
43
+
44
+ ## Key Decisions Made
45
+ - Decision 1 and rationale
46
+ - Decision 2 and rationale
47
+
48
+ ## Blockers / Open Questions
49
+ - Any unresolved issues
50
+
51
+ ## Files Modified
52
+ - List of changed files with brief description
53
+ ```
54
+
55
+ ### 3. Git Commit
56
+
57
+ Stage and commit with a descriptive message:
58
+ ```bash
59
+ git add -A
60
+ git commit -m "WIP: [phase name] - [brief description of state]"
61
+ ```
62
+
63
+ ## Thoughts Mode (`--thoughts`)
64
+
65
+ Lightweight handoff for non-project work or quick brainstorming sessions.
66
+
67
+ ### Save Location
68
+ `~/.claude/thoughts/handoff-{timestamp}.md`
69
+
70
+ ### Structure
71
+ ```markdown
72
+ # Handoff — {date}
73
+
74
+ ## Accomplished
75
+ - What got done
76
+
77
+ ## Current State
78
+ - Where things stand
79
+
80
+ ## In Progress
81
+ - Partially complete work
82
+
83
+ ## Next Steps
84
+ 1. What to do next
85
+
86
+ ## Key Decisions
87
+ - Important choices made
88
+
89
+ ## Blockers
90
+ - What's stuck
91
+
92
+ ## Commands to Resume
93
+ - Specific commands or files to look at
94
+ ```
95
+
96
+ No git commit in thoughts mode — it's just a text dump for context restoration.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: qualia-plan-milestone-gaps
3
+ description: "Create fix phases from milestone audit gaps — reads the most recent audit report and generates ROADMAP.md entries for all identified gaps. Use this skill whenever the user says 'plan gaps', 'fix gaps', 'plan milestone gaps', 'create fix phases', or wants to turn audit findings into actionable phases. Also trigger after a milestone audit reveals gaps that need addressing."
4
+ ---
5
+
6
+ # Qualia Plan Milestone Gaps — Gap-to-Phase Conversion
7
+
8
+ Read the most recent milestone audit report and create ROADMAP.md phases to close all identified gaps.
9
+
10
+ ## Usage
11
+
12
+ `/qualia-plan-milestone-gaps` — Auto-detect latest audit, create fix phases
13
+
14
+ ## Process
15
+
16
+ ### 1. Find Latest Audit
17
+
18
+ ```bash
19
+ ls -t .planning/v*-MILESTONE-AUDIT.md | head -1
20
+ ```
21
+
22
+ Read the most recent `v*-MILESTONE-AUDIT.md` file.
23
+
24
+ Reference: `~/.claude/qualia-engine/workflows/plan-milestone-gaps.md`
25
+
26
+ ### 2. Load Project Context
27
+
28
+ Read these files for full context:
29
+ - `.planning/PROJECT.md`
30
+ - `.planning/REQUIREMENTS.md`
31
+ - `.planning/ROADMAP.md`
32
+ - `.planning/STATE.md`
33
+
34
+ ### 3. Extract and Group Gaps
35
+
36
+ From the audit report, extract all gaps (items marked as failing or incomplete). Group related gaps into logical phases:
37
+ - Group by feature area or component
38
+ - Keep phases small (completable in 1-2 sessions)
39
+ - Order by dependency — fix foundations before features
40
+
41
+ ### 4. Create ROADMAP.md Entries
42
+
43
+ Append new phases to ROADMAP.md. Each gap-fix phase should include:
44
+ - Phase number (continuing from existing phases)
45
+ - Name: `Fix: [area]`
46
+ - Description of what gaps it closes
47
+ - Status: `not started`
48
+ - Reference to specific audit gaps being addressed
49
+
50
+ ### 5. Update STATE.md
51
+
52
+ Update the phase table in STATE.md to reflect the new fix phases.
53
+
54
+ ### 6. Report
55
+
56
+ Tell the user how many gaps were found, how many fix phases were created, and suggest:
57
+ > "Fix phases created. Run `/qualia-plan-phase [next-phase-number]` to plan the first fix."
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: qualia-plan-phase
3
+ description: "Create detailed execution plans for a project phase with optional research and verification. Use this skill whenever the user says 'plan phase', 'plan next phase', 'create plan', or wants to plan out how a specific phase of work should be executed. Also trigger when user mentions 'PLAN.md', 'phase planning', or needs to break a roadmap phase into concrete implementation steps. Supports research integration, gap closure planning, and plan verification."
4
+ ---
5
+
6
+ # Qualia Plan Phase — Phase Planning
7
+
8
+ Create detailed PLAN.md files for a project phase, with optional research and verification loop.
9
+
10
+ ## Usage
11
+
12
+ `/qualia-plan-phase 3` — Plan phase 3
13
+ `/qualia-plan-phase` — Auto-detect next unplanned phase
14
+ `/qualia-plan-phase 3 --research` — Force research before planning
15
+ `/qualia-plan-phase 3 --skip-research` — Skip research even if recommended
16
+ `/qualia-plan-phase 3 --gaps` — Plan gap closure (after verify-work found issues)
17
+ `/qualia-plan-phase 3 --skip-verify` — Skip plan verification step
18
+
19
+ ## Process
20
+
21
+ ### 1. Identify Target Phase
22
+
23
+ If phase number provided, use it. Otherwise, scan ROADMAP.md for the first phase with status `not started` or `planned` without a PLAN.md.
24
+
25
+ Reference: `~/.claude/qualia-engine/workflows/plan-phase.md`
26
+
27
+ ### 2. Research (if needed)
28
+
29
+ Research is recommended when:
30
+ - Phase involves unfamiliar tech or APIs
31
+ - Phase has complex architectural decisions
32
+ - User passes `--research` flag
33
+
34
+ Skip if `--skip-research` is passed or if research already exists at `.planning/phases/{phase}-{slug}/{phase}-RESEARCH.md`.
35
+
36
+ If research is needed, use the qualia-research-phase skill first.
37
+
38
+ ### 3. Create PLAN.md
39
+
40
+ Write to `.planning/phases/{phase}-{slug}/PLAN.md`:
41
+
42
+ ```markdown
43
+ # Phase {N}: {Name} — Execution Plan
44
+
45
+ ## Objective
46
+ What this phase accomplishes.
47
+
48
+ ## Prerequisites
49
+ - What must be done/ready before starting
50
+
51
+ ## Implementation Steps
52
+
53
+ ### Step 1: {description}
54
+ - Files to create/modify
55
+ - Key implementation details
56
+ - Acceptance criteria
57
+
58
+ ### Step 2: {description}
59
+ ...
60
+
61
+ ## Verification Checklist
62
+ - [ ] Each testable outcome
63
+ - [ ] Integration points work
64
+ - [ ] No regressions
65
+
66
+ ## Risks & Mitigations
67
+ - Risk 1 → Mitigation
68
+ ```
69
+
70
+ For `--gaps` mode, the plan focuses specifically on closing gaps identified by verify-work, referencing the UAT.md findings.
71
+
72
+ ### 4. Verify Plan (unless --skip-verify)
73
+
74
+ Spawn the qualia-plan-checker agent to review the plan for:
75
+ - Completeness against requirements
76
+ - Realistic scope
77
+ - Clear acceptance criteria
78
+ - No missing dependencies
79
+
80
+ Reference: `~/.claude/agents/qualia-plan-checker.md`
81
+
82
+ If checker finds issues, revise the plan and re-verify.
83
+
84
+ ### 5. Update State
85
+
86
+ Update `.planning/STATE.md` to reflect the phase is now `planned`.
87
+
88
+ Reference UI/brand guidelines: `~/.claude/qualia-engine/references/ui-brand.md`
89
+
90
+ For complex phases touching multiple subsystems, consider `/deep-research` before phase research to establish architectural direction.
91
+
92
+ ### 6. Next Step
93
+
94
+ > "Phase {N} planned. Run `/qualia-execute-phase {N}` to begin execution."
95
+
96
+ ### Agents Used
97
+ | Agent | File | Role |
98
+ |-------|------|------|
99
+ | `qualia-planner` | `~/.claude/agents/qualia-planner.md` | Creates PLAN.md with goal-backward methodology |
100
+ | `qualia-plan-checker` | `~/.claude/agents/qualia-plan-checker.md` | Validates plan completeness |
101
+ | `qualia-phase-researcher` | `~/.claude/agents/qualia-phase-researcher.md` | Phase research (when --research) |