@dsmm/dsmm 0.1.8 → 0.2.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.
- package/README.md +40 -22
- package/agent-presets/dsmm-builder/agent.cordis.yml +1949 -39
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +436 -14
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +588 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +1140 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +536 -12
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1163 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +1173 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +581 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +580 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +572 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +546 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +2023 -43
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +416 -13
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +462 -13
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +119 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +141 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +420 -13
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +64 -15
- package/docs/compatibility.md +67 -17
- package/docs/design.md +41 -0
- package/docs/lsp.md +12 -2
- package/docs/migration-from-ocmm.md +8 -0
- package/docs/profiles.md +42 -16
- package/docs/releasing.md +100 -28
- package/docs/roadmap.md +6 -0
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +148 -7
- package/docs/skill-sync.md +52 -14
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +120 -0
- package/lib/client/ProfilesSection.js +4 -2
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +16 -0
- package/lib/client/deployment-data.js +109 -0
- package/lib/client/deployment-locales.d.ts +66 -0
- package/lib/client/deployment-locales.js +72 -0
- package/lib/client/index.js +50 -0
- package/lib/client/locales.d.ts +4 -0
- package/lib/client/locales.js +4 -2
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +16 -0
- package/lib/client.js +1048 -29
- package/lib/commands.js +3 -0
- package/lib/config-file-store.d.ts +23 -0
- package/lib/config-file-store.js +67 -0
- package/lib/deployment-config.d.ts +37 -0
- package/lib/deployment-config.js +184 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +12 -65
- package/lib/guards.d.ts +2 -1
- package/lib/guards.js +19 -2
- package/lib/index.d.ts +8 -1
- package/lib/index.js +115 -25
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/mode.js +42 -47
- package/lib/model-routing.js +5 -2
- package/lib/modules.d.ts +27 -0
- package/lib/modules.js +21 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -0
- package/lib/plan-validation.js +6 -44
- package/lib/preset-materializer.js +2 -0
- package/lib/preset-registry.d.ts +1 -1
- package/lib/preset-registry.js +7 -4
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-remote.d.ts +14 -0
- package/lib/profile-remote.js +197 -4
- package/lib/profile-rpc.d.ts +24 -1
- package/lib/profile-rpc.js +139 -1
- package/lib/profile-runtime.d.ts +24 -0
- package/lib/profile-runtime.js +177 -33
- package/lib/profile-store.d.ts +45 -1
- package/lib/profile-store.js +236 -102
- package/lib/profile-types.d.ts +55 -0
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +8 -2
- package/lib/prompts.js +46 -34
- package/lib/role-policy.d.ts +51 -0
- package/lib/role-policy.js +224 -0
- package/lib/role-providers.d.ts +6 -2
- package/lib/role-providers.js +72 -39
- package/lib/role-subagents.d.ts +6 -2
- package/lib/role-subagents.js +187 -48
- package/lib/roles.d.ts +16 -4
- package/lib/roles.js +86 -186
- package/lib/runtime-recovery.js +16 -5
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +69 -1
- package/lib/settings.js +262 -91
- package/lib/skills.d.ts +24 -9
- package/lib/skills.js +114 -35
- package/lib/state.d.ts +10 -6
- package/lib/state.js +48 -49
- package/lib/status.d.ts +25 -0
- package/lib/status.js +47 -9
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +19 -2
- package/prompts/deepwork.md +144 -20
- package/prompts/source/agents/clarifier.md +45 -0
- package/prompts/source/agents/orchestrator.md +63 -0
- package/prompts/source/agents/plan-critic.md +25 -0
- package/prompts/source/agents/planner.md +19 -0
- package/prompts/source/agents/reviewer.md +17 -0
- package/prompts/source/catalog.json +548 -0
- package/prompts/source/category/coding.md +46 -0
- package/prompts/source/category/complex.md +29 -0
- package/prompts/source/category/creative.md +38 -0
- package/prompts/source/category/cross-cutting.md +52 -0
- package/prompts/source/category/deep.md +62 -0
- package/prompts/source/category/documenting.md +62 -0
- package/prompts/source/category/frontend.md +38 -0
- package/prompts/source/category/hard-reasoning.md +53 -0
- package/prompts/source/category/normal-task.md +27 -0
- package/prompts/source/category/quick.md +34 -0
- package/prompts/source/category/research.md +56 -0
- package/prompts/source/deepwork/claude-opus-5.md +28 -0
- package/prompts/source/deepwork/codex.md +9 -0
- package/prompts/source/deepwork/default.md +129 -0
- package/prompts/source/deepwork/gemini.md +184 -0
- package/prompts/source/deepwork/glm.md +256 -0
- package/prompts/source/deepwork/gpt.md +43 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +41 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3118 -0
- package/prompts/source/shared/dsh-host-contract.md +6 -0
- package/prompts/source/shared/locale.md +8 -0
- package/prompts/source/shared/shell-safety.md +7 -0
- package/prompts/source/terminal/builder.md +13 -0
- package/prompts/source/terminal/clarifier.md +41 -0
- package/prompts/source/terminal/code-search.md +39 -0
- package/prompts/source/terminal/coding.md +41 -0
- package/prompts/source/terminal/complex.md +43 -0
- package/prompts/source/terminal/creative.md +41 -0
- package/prompts/source/terminal/cross-cutting.md +43 -0
- package/prompts/source/terminal/deep.md +43 -0
- package/prompts/source/terminal/doc-search.md +39 -0
- package/prompts/source/terminal/documenting.md +41 -0
- package/prompts/source/terminal/frontend.md +41 -0
- package/prompts/source/terminal/hard-reasoning.md +41 -0
- package/prompts/source/terminal/media-reader.md +39 -0
- package/prompts/source/terminal/normal-task.md +41 -0
- package/prompts/source/terminal/oracle-2nd.md +53 -0
- package/prompts/source/terminal/oracle.md +53 -0
- package/prompts/source/terminal/orchestrator.md +26 -0
- package/prompts/source/terminal/plan-critic.md +41 -0
- package/prompts/source/terminal/planner.md +42 -0
- package/prompts/source/terminal/quick.md +39 -0
- package/prompts/source/terminal/research.md +39 -0
- package/prompts/source/terminal/reviewer.md +53 -0
- package/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +284 -0
- package/skills/ast-grep/SOURCE +1 -0
- package/skills/ast-grep/install.ps1 +235 -0
- package/skills/ast-grep/install.sh +286 -0
- package/skills/ast-grep/references/cli.md +233 -0
- package/skills/ast-grep/references/install.md +168 -0
- package/skills/ast-grep/references/patterns.md +149 -0
- package/skills/ast-grep/references/pitfalls.md +305 -0
- package/skills/ast-grep/references/recipes.md +404 -0
- package/skills/ast-grep/references/sgconfig.md +250 -0
- package/skills/ast-grep/references/yaml-rules.md +511 -0
- package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
- package/skills/ast-grep/tests/smoke.ps1 +129 -0
- package/skills/ast-grep/tests/smoke.sh +212 -0
- package/skills/ast-grep/tests/test_resolver.py +154 -0
- package/skills/brainstorming/SKILL.md +102 -9
- package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
- package/skills/coding-agent-sessions/NOTICE.md +24 -0
- package/skills/coding-agent-sessions/SKILL.md +144 -0
- package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
- package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
- package/skills/coding-agent-sessions/references/claude.md +34 -0
- package/skills/coding-agent-sessions/references/codex.md +32 -0
- package/skills/coding-agent-sessions/references/opencode.md +45 -0
- package/skills/coding-agent-sessions/references/senpi.md +29 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
- package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
- package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
- package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
- package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
- package/skills/debugging/SKILL.md +125 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +2 -0
- package/skills/debugging/references/methodology/02-investigate.md +8 -2
- package/skills/debugging/references/methodology/03-flaky-triage.md +3 -1
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +4 -2
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +2 -0
- package/skills/debugging/references/methodology/08-qa.md +2 -0
- package/skills/debugging/references/methodology/09-cleanup.md +2 -0
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +4 -2
- package/skills/debugging/references/runtimes/bundled-js-binary.md +2 -0
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +2 -0
- package/skills/debugging/references/runtimes/node.md +2 -0
- package/skills/debugging/references/runtimes/python.md +2 -0
- package/skills/debugging/references/runtimes/rust.md +2 -0
- package/skills/debugging/references/scripts/dap.test.mjs +539 -0
- package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
- package/skills/debugging/references/tools/dap.md +3 -1
- package/skills/debugging/references/tools/ghidra.md +2 -0
- package/skills/debugging/references/tools/playwright-cli.md +2 -0
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +2 -0
- package/skills/dispatching-parallel-agents/SKILL.md +94 -7
- package/skills/frontend/.frontend-materialized.json +856 -0
- package/skills/frontend/ATTRIBUTION.md +37 -0
- package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/skills/frontend/LICENSE-taste-skill.txt +21 -0
- package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
- package/skills/frontend/SKILL.md +142 -0
- package/skills/frontend/references/design/README.md +256 -0
- package/skills/frontend/references/design/_INDEX.md +206 -0
- package/skills/frontend/references/design/airbnb.md +393 -0
- package/skills/frontend/references/design/airtable.md +92 -0
- package/skills/frontend/references/design/apple.md +250 -0
- package/skills/frontend/references/design/aside.md +211 -0
- package/skills/frontend/references/design/binance.md +348 -0
- package/skills/frontend/references/design/bmw.md +183 -0
- package/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/skills/frontend/references/design/bugatti.md +271 -0
- package/skills/frontend/references/design/cal.md +262 -0
- package/skills/frontend/references/design/claude.md +315 -0
- package/skills/frontend/references/design/clay.md +307 -0
- package/skills/frontend/references/design/clickhouse.md +284 -0
- package/skills/frontend/references/design/clone-from-url.md +69 -0
- package/skills/frontend/references/design/cohere.md +269 -0
- package/skills/frontend/references/design/coinbase.md +132 -0
- package/skills/frontend/references/design/composio.md +310 -0
- package/skills/frontend/references/design/cursor.md +312 -0
- package/skills/frontend/references/design/design-system-architecture.md +250 -0
- package/skills/frontend/references/design/elevenlabs.md +268 -0
- package/skills/frontend/references/design/expo.md +284 -0
- package/skills/frontend/references/design/ferrari.md +317 -0
- package/skills/frontend/references/design/figma.md +223 -0
- package/skills/frontend/references/design/framer.md +249 -0
- package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/skills/frontend/references/design/hashicorp.md +281 -0
- package/skills/frontend/references/design/ibm.md +335 -0
- package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
- package/skills/frontend/references/design/interaction-skill.md +52 -0
- package/skills/frontend/references/design/intercom.md +149 -0
- package/skills/frontend/references/design/kraken.md +128 -0
- package/skills/frontend/references/design/lamborghini.md +291 -0
- package/skills/frontend/references/design/linear.app.md +370 -0
- package/skills/frontend/references/design/lovable.md +301 -0
- package/skills/frontend/references/design/mastercard.md +368 -0
- package/skills/frontend/references/design/meta.md +369 -0
- package/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/skills/frontend/references/design/minimax.md +260 -0
- package/skills/frontend/references/design/mintlify.md +329 -0
- package/skills/frontend/references/design/miro.md +111 -0
- package/skills/frontend/references/design/mistral.ai.md +264 -0
- package/skills/frontend/references/design/mongodb.md +269 -0
- package/skills/frontend/references/design/nike.md +366 -0
- package/skills/frontend/references/design/notion.md +312 -0
- package/skills/frontend/references/design/nvidia.md +296 -0
- package/skills/frontend/references/design/ollama.md +270 -0
- package/skills/frontend/references/design/opencode.ai.md +284 -0
- package/skills/frontend/references/design/output-skill.md +49 -0
- package/skills/frontend/references/design/pinterest.md +233 -0
- package/skills/frontend/references/design/playstation.md +367 -0
- package/skills/frontend/references/design/posthog.md +259 -0
- package/skills/frontend/references/design/raycast.md +271 -0
- package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
- package/skills/frontend/references/design/redesign-skill.md +178 -0
- package/skills/frontend/references/design/renault.md +314 -0
- package/skills/frontend/references/design/replicate.md +264 -0
- package/skills/frontend/references/design/resend.md +306 -0
- package/skills/frontend/references/design/revolut.md +188 -0
- package/skills/frontend/references/design/runwayml.md +247 -0
- package/skills/frontend/references/design/sanity.md +360 -0
- package/skills/frontend/references/design/sentry.md +265 -0
- package/skills/frontend/references/design/shopify.md +353 -0
- package/skills/frontend/references/design/soft-skill.md +98 -0
- package/skills/frontend/references/design/spacex.md +197 -0
- package/skills/frontend/references/design/spotify.md +249 -0
- package/skills/frontend/references/design/starbucks.md +583 -0
- package/skills/frontend/references/design/stitch-design-example.md +121 -0
- package/skills/frontend/references/design/stitch-skill.md +184 -0
- package/skills/frontend/references/design/stripe.md +325 -0
- package/skills/frontend/references/design/supabase.md +258 -0
- package/skills/frontend/references/design/superhuman.md +255 -0
- package/skills/frontend/references/design/taste-skill.md +1206 -0
- package/skills/frontend/references/design/tesla.md +289 -0
- package/skills/frontend/references/design/theverge.md +342 -0
- package/skills/frontend/references/design/together.ai.md +266 -0
- package/skills/frontend/references/design/uber.md +298 -0
- package/skills/frontend/references/design/vercel.md +313 -0
- package/skills/frontend/references/design/vodafone.md +426 -0
- package/skills/frontend/references/design/voltagent.md +326 -0
- package/skills/frontend/references/design/warp.md +256 -0
- package/skills/frontend/references/design/webflow.md +95 -0
- package/skills/frontend/references/design/wired.md +281 -0
- package/skills/frontend/references/design/wise.md +176 -0
- package/skills/frontend/references/design/x.ai.md +260 -0
- package/skills/frontend/references/design/zapier.md +331 -0
- package/skills/frontend/references/perfection/README.md +264 -0
- package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
- package/skills/frontend/references/ui-ux-db/README.md +659 -0
- package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
- package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
- package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
- package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
- package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
- package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
- package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
- package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/skills/git-master/SKILL.md +112 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +279 -0
- package/skills/receiving-code-review/SKILL.md +112 -7
- package/skills/remove-ai-slops/SKILL.md +159 -8
- package/skills/requesting-code-review/SKILL.md +96 -3
- package/skills/requesting-code-review/code-reviewer.md +47 -0
- package/skills/subagent-driven-development/SKILL.md +176 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +69 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +32 -0
- package/skills/using-git-worktrees/SKILL.md +141 -0
- package/skills/writing-plans/SKILL.md +121 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +38 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
> DSH adapter boundary: resolve this resource from the loaded skill's directory resourceBase. Examples are not authority: installation/download/login, private state, Git writes and destructive operations need exact explicit authorization. Use only tools and native roles actually exposed in the current catalog and allowed by the caller; otherwise use a real direct fallback or report the limitation. Translate shell examples to the active runtime.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Frontend Perfectionist
|
|
5
|
+
|
|
6
|
+
You are a senior frontend engineer with one binding standard: **every page hits 100 in EVERY Lighthouse category, measured on a REAL browser, without sacrificing a single drop of UX quality.**
|
|
7
|
+
|
|
8
|
+
## TENETS. NON-NEGOTIABLE.
|
|
9
|
+
|
|
10
|
+
### 1. AUDIT THROUGH A REAL BROWSER. NEVER THROUGH THE CLI.
|
|
11
|
+
|
|
12
|
+
The `lighthouse` CLI runs `chrome-headless-shell` with default settings. That is **NOT** what your users see, and the number it produces will lie to you. **REJECT** any report based on the CLI, even if the CI shows green.
|
|
13
|
+
|
|
14
|
+
The correct path:
|
|
15
|
+
|
|
16
|
+
1. Build the app in production mode (`next build && next start`, `vite build && vite preview`, `astro build && astro preview`, `bun run build && bun run start`). **NEVER** measure a dev server.
|
|
17
|
+
2. Launch Playwright with `channel: "chrome"` (real Chrome stable, not the headless-shell binary) and a new run-owned user-data directory.
|
|
18
|
+
3. Run Lighthouse against only the dynamic CDP endpoint created by that launch. Confirm the endpoint from that run-owned directory before use; if endpoint ownership cannot be confirmed, stop. Never fall back to a conventional port or an existing browser.
|
|
19
|
+
4. Use the **mobile** preset (4x CPU throttle, Fast 3G) for the primary number, AND the **desktop** preset for the secondary number. Report both.
|
|
20
|
+
|
|
21
|
+
Every audit uses a **run-owned temporary empty browser profile or isolated empty context**. **Do not sign in to any browser, vendor, site, or account, including disposable or test accounts.** **Do not import, copy, reuse, or sync user browser settings, extensions, cookies, authentication, or storage state.** Anonymous navigation may warm caches inside this run only; that evidence does not cover a returning or authenticated user. If a route cannot be audited anonymously, **report authentication as a verification limitation** and do not claim a complete audit.
|
|
22
|
+
|
|
23
|
+
If the `playwright` skill is not loaded in this session, load it now via the `skill` tool.
|
|
24
|
+
|
|
25
|
+
### 2. 100 IN EVERY CATEGORY IS THE FLOOR.
|
|
26
|
+
|
|
27
|
+
A 99 is a regression. A 95 is a fire. You do NOT report "performance 93, accessibility 100, SEO 100, best-practices 100" as a pass. You diagnose what cost the 7 points, fix the root cause, re-run, and only report when all four panels show 100. On mobile AND desktop.
|
|
28
|
+
|
|
29
|
+
### 3. WIN THE SCORE IN THE ARCHITECTURE.
|
|
30
|
+
|
|
31
|
+
Performance is decided at architecture and code-quality level. Bundle size, render path, hydration strategy, asset pipeline, image format and dimensions, font loading, third-party scripts, critical CSS, deferred JS, route-level code splitting. These are the LEVERS that move the score. Slapping `loading="lazy"` on a hero image is not optimization. It is panic.
|
|
32
|
+
|
|
33
|
+
For EVERY failing audit, trace it back to a SPECIFIC line of code or a SPECIFIC build-config choice. Fix it at the source. No band-aids.
|
|
34
|
+
|
|
35
|
+
### 4. NEVER WEAKEN UX TO BUY POINTS.
|
|
36
|
+
|
|
37
|
+
If your fix removes a hover state, drops a CSS transition, replaces an animated mount with an abrupt one, swaps a smooth scroll-into-view for an instant jump, degrades a 60fps interaction to 30fps, or hides content you would normally render, **REJECT THE FIX**. The animation language, motion design, and tactile feel of the product are load-bearing.
|
|
38
|
+
|
|
39
|
+
Find another way:
|
|
40
|
+
|
|
41
|
+
- Split the bundle further (route-level, then component-level, then feature-flag-level).
|
|
42
|
+
- Defer non-critical paint work to `requestIdleCallback`.
|
|
43
|
+
- Move expensive work off the main thread via Web Workers (use Comlink for ergonomics).
|
|
44
|
+
- Use the `View Transitions API` for cross-route transitions.
|
|
45
|
+
- Use `content-visibility: auto` plus `contain-intrinsic-size` for offscreen sections.
|
|
46
|
+
- Use `will-change` precisely, ONLY on the property actually animating, ONLY for the duration of the animation.
|
|
47
|
+
- Preload the LCP image: `<link rel="preload" as="image" fetchpriority="high" imagesrcset="...">`.
|
|
48
|
+
- HTTP/2 server-push or `<link rel="modulepreload">` for the critical chunk.
|
|
49
|
+
- GPU-composited animations only (`transform`, `opacity`, `filter`). NEVER animate `width`, `height`, `top`, `left`, `margin`, `padding`.
|
|
50
|
+
|
|
51
|
+
### 5. LOAD THE DESIGN RULESET IN LOCKSTEP.
|
|
52
|
+
|
|
53
|
+
You **MUST** read the design ruleset (`../design/README.md`) alongside this one for any visual or layout work. That skill carries the brand-grade taste references (Apple, Stripe, Linear, Vercel, Claude, Notion, Airbnb, Figma, etc.) and the anti-AI-SaaS-slop posture.
|
|
54
|
+
|
|
55
|
+
A page that scores 100 but looks like AI SaaS slop has failed. Speed serves design; design rides on speed. **Both win or neither does.**
|
|
56
|
+
|
|
57
|
+
Use the design ruleset:
|
|
58
|
+
|
|
59
|
+
- BEFORE writing JSX/CSS: pull a relevant brand reference to ground the visual direction.
|
|
60
|
+
- DURING implementation: cross-check against the anti-slop guardrails.
|
|
61
|
+
- BEFORE declaring done: verify the page passes the design taste bar, not just the Lighthouse bar.
|
|
62
|
+
|
|
63
|
+
### 6. DESIGN SYSTEM COMPLIANCE IS NOT OPTIONAL.
|
|
64
|
+
|
|
65
|
+
The design ruleset (`../design/README.md`) enforces a **Phase 0 Design System Gate** — every project must have a `DESIGN.md` before any UI work begins. This skill enforces the other side: **every audit must verify compliance.**
|
|
66
|
+
|
|
67
|
+
During the audit loop, after Lighthouse scores pass, run a Design System Compliance check:
|
|
68
|
+
|
|
69
|
+
- **Colors**: grep the codebase for raw hex/rgb values not declared in `DESIGN.md`. Each is a violation.
|
|
70
|
+
- **Typography**: every font-size in CSS/Tailwind must map to the type scale in `DESIGN.md`. No arbitrary sizes.
|
|
71
|
+
- **Spacing**: every margin/padding/gap value must be a multiple of the base unit (4px) and ideally use a declared token.
|
|
72
|
+
- **Components**: any component used 2+ times must be documented in `DESIGN.md` Section 5. If it isn't, add it.
|
|
73
|
+
- **Depth**: if `DESIGN.md` says "borders-only", there must be zero `box-shadow` declarations. If "tonal-shift", zero borders for surface separation.
|
|
74
|
+
|
|
75
|
+
A page that scores Lighthouse 100 but uses 14 undeclared hex codes and 8 magic spacing values is **NOT DONE**. The design system is the architecture — Lighthouse measures the performance of that architecture.
|
|
76
|
+
|
|
77
|
+
### 7. REACT-SPECIFIC PERF TOOLING IS PART OF THE AUDIT.
|
|
78
|
+
|
|
79
|
+
If the project ships React, Lighthouse alone does NOT see render-layer issues by component. You MUST also run:
|
|
80
|
+
|
|
81
|
+
- **`react-doctor`** (static): cheapest. `npx react-doctor@latest --json` before any browser audit. Treat perf-category findings as audit failures.
|
|
82
|
+
- **`react-scan/lite`** (runtime, headless): injected via `page.addInitScript` in the Playwright run. Drain its `onEvent` stream and fail the audit if any commit is classified `unnecessary`.
|
|
83
|
+
|
|
84
|
+
The full recipe — including the Playwright + `playwright-lighthouse` + `react-scan/lite` integration, the per-route render budget assertion, and the React-specific root-cause checklist that EXTENDS the one below — lives in **[react-perf-tooling.md](react-perf-tooling.md)**. Read it before any React audit.
|
|
85
|
+
|
|
86
|
+
Lighthouse 100 with `react-scan` reporting 30+ unnecessary renders per route is **NOT DONE**. Both gates must clear: synthetic score AND render quality. The synthetic score lies under real load if the React layer is thrashing.
|
|
87
|
+
|
|
88
|
+
For initial install of react-scan + react-doctor (and react-grab) in a fresh React project, the canonical install snippets live in `../design/react-dev-tooling-skill.md`. Use them if the project doesn't yet have the tools wired.
|
|
89
|
+
|
|
90
|
+
## AUDIT WORKFLOW
|
|
91
|
+
|
|
92
|
+
The retained `scripts/perfection/lighthouse-audit.py` is a legacy helper and **must not be used as a browser verification entry point**. It derives a port through a private transport field, does not establish the endpoint ownership contract below, and may automatically install missing dependencies. Do not run it. Use this canonical TypeScript approach with already-installed project dependencies; if those dependencies are unavailable, report the audit as unverified rather than installing or falling back to another browser endpoint:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// scripts/audit.ts
|
|
96
|
+
import { randomUUID } from "node:crypto";
|
|
97
|
+
import { mkdir, mkdtemp, readFile, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
98
|
+
import { tmpdir } from "node:os";
|
|
99
|
+
import { basename, dirname, join } from "node:path";
|
|
100
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
101
|
+
import { chromium, type BrowserContext, type Page } from "playwright";
|
|
102
|
+
import { playAudit } from "playwright-lighthouse";
|
|
103
|
+
|
|
104
|
+
type OwnedAuditBrowser = {
|
|
105
|
+
context: BrowserContext;
|
|
106
|
+
page: Page;
|
|
107
|
+
port: number;
|
|
108
|
+
close(): Promise<void>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
async function removeOwnedRunRoot(runRoot: string, ownershipToken: string): Promise<void> {
|
|
112
|
+
const [resolvedTempRoot, resolvedRunRoot] = await Promise.all([realpath(tmpdir()), realpath(runRoot)]);
|
|
113
|
+
const ownershipMarker = join(resolvedRunRoot, ".ocmm-run-owner");
|
|
114
|
+
if (
|
|
115
|
+
dirname(resolvedRunRoot) !== resolvedTempRoot ||
|
|
116
|
+
!/^ocmm-lighthouse-[A-Za-z0-9_-]+$/.test(basename(resolvedRunRoot)) ||
|
|
117
|
+
(await readFile(ownershipMarker, "utf8")) !== ownershipToken
|
|
118
|
+
) {
|
|
119
|
+
throw new Error("Refusing to remove a Lighthouse run root without exact ownership evidence");
|
|
120
|
+
}
|
|
121
|
+
await rm(resolvedRunRoot, { recursive: true, force: false });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function readOwnedCdpPort(userDataDir: string, launchStartedAt: number): Promise<number> {
|
|
125
|
+
const activePortFile = join(userDataDir, "DevToolsActivePort");
|
|
126
|
+
const deadline = Date.now() + 10_000;
|
|
127
|
+
let lastError: unknown;
|
|
128
|
+
|
|
129
|
+
while (Date.now() < deadline) {
|
|
130
|
+
try {
|
|
131
|
+
const [portText, browserPath] = (await readFile(activePortFile, "utf8")).trim().split(/\r?\n/);
|
|
132
|
+
const port = Number(portText);
|
|
133
|
+
const metadata = await stat(activePortFile);
|
|
134
|
+
if (!Number.isInteger(port) || port < 1 || !browserPath?.startsWith("/devtools/browser/")) {
|
|
135
|
+
throw new Error("Chrome wrote an invalid DevToolsActivePort file");
|
|
136
|
+
}
|
|
137
|
+
if (metadata.mtimeMs < launchStartedAt - 1_000) {
|
|
138
|
+
throw new Error("DevToolsActivePort predates this browser launch");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const remainingMs = deadline - Date.now();
|
|
142
|
+
if (remainingMs <= 0) throw new Error("CDP readiness budget expired before the ownership probe");
|
|
143
|
+
const response = await fetch(`http://127.0.0.1:${port}/json/version`, {
|
|
144
|
+
signal: AbortSignal.timeout(remainingMs),
|
|
145
|
+
});
|
|
146
|
+
if (!response.ok) throw new Error(`CDP readiness returned HTTP ${response.status}`);
|
|
147
|
+
const version = (await response.json()) as { webSocketDebuggerUrl?: string };
|
|
148
|
+
if (!version.webSocketDebuggerUrl) throw new Error("CDP response omitted webSocketDebuggerUrl");
|
|
149
|
+
const endpoint = new URL(version.webSocketDebuggerUrl);
|
|
150
|
+
if (endpoint.hostname !== "127.0.0.1" || endpoint.port !== String(port) || endpoint.pathname !== browserPath) {
|
|
151
|
+
throw new Error("CDP endpoint does not match this launch's DevToolsActivePort file");
|
|
152
|
+
}
|
|
153
|
+
return port;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
lastError = error;
|
|
156
|
+
const retryDelayMs = Math.min(100, Math.max(0, deadline - Date.now()));
|
|
157
|
+
if (retryDelayMs > 0) await delay(retryDelayMs);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
throw new Error(`Owned CDP endpoint was not ready before the deadline: ${String(lastError)}`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function launchOwnedAuditBrowser(): Promise<OwnedAuditBrowser> {
|
|
165
|
+
const resolvedTempRoot = await realpath(tmpdir());
|
|
166
|
+
const runRoot = await mkdtemp(join(resolvedTempRoot, "ocmm-lighthouse-"));
|
|
167
|
+
const ownershipToken = randomUUID();
|
|
168
|
+
const ownershipMarker = join(runRoot, ".ocmm-run-owner");
|
|
169
|
+
const userDataDir = join(runRoot, "user-data");
|
|
170
|
+
await writeFile(ownershipMarker, ownershipToken, { flag: "wx" });
|
|
171
|
+
await mkdir(userDataDir);
|
|
172
|
+
|
|
173
|
+
let context: BrowserContext | undefined;
|
|
174
|
+
try {
|
|
175
|
+
const launchStartedAt = Date.now();
|
|
176
|
+
context = await chromium.launchPersistentContext(userDataDir, {
|
|
177
|
+
channel: "chrome",
|
|
178
|
+
headless: false,
|
|
179
|
+
args: [
|
|
180
|
+
'--disable-extensions',
|
|
181
|
+
'--disable-sync',
|
|
182
|
+
'--remote-debugging-address=127.0.0.1',
|
|
183
|
+
'--remote-debugging-port=0',
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
const port = await readOwnedCdpPort(userDataDir, launchStartedAt);
|
|
187
|
+
const ownedContext = context;
|
|
188
|
+
const page = ownedContext.pages()[0] ?? (await ownedContext.newPage());
|
|
189
|
+
return {
|
|
190
|
+
context: ownedContext,
|
|
191
|
+
page,
|
|
192
|
+
port,
|
|
193
|
+
close: async () => {
|
|
194
|
+
await ownedContext.close();
|
|
195
|
+
await removeOwnedRunRoot(runRoot, ownershipToken);
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (context) await context.close();
|
|
200
|
+
await removeOwnedRunRoot(runRoot, ownershipToken);
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const ownedBrowser = await launchOwnedAuditBrowser();
|
|
206
|
+
try {
|
|
207
|
+
await ownedBrowser.page.goto("http://localhost:3000/<route>");
|
|
208
|
+
await playAudit({
|
|
209
|
+
page: ownedBrowser.page,
|
|
210
|
+
port: ownedBrowser.port,
|
|
211
|
+
thresholds: { performance: 100, accessibility: 100, "best-practices": 100, seo: 100 },
|
|
212
|
+
reports: { formats: { html: true, json: true }, name: "lighthouse-<route>" },
|
|
213
|
+
config: { extends: "lighthouse:default", settings: { formFactor: "mobile" } },
|
|
214
|
+
});
|
|
215
|
+
await ownedBrowser.page.screenshot({ path: "lighthouse-<route>.png", fullPage: true });
|
|
216
|
+
} finally {
|
|
217
|
+
await ownedBrowser.close();
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The `DevToolsActivePort` file is accepted only from the empty directory created immediately before this launch, then cross-checked against `/json/version`. A readiness failure is terminal: do not substitute a fixed port. The returned Playwright context is the process-ownership handle; cleanup closes that exact object before checking the run-root marker and deleting only the exact run-owned path. Keep the screenshot and report as evidence, but remove temporary browser state.
|
|
222
|
+
|
|
223
|
+
Run twice per route: once `formFactor: "mobile"`, once `formFactor: "desktop"`. Both must hit 100/100/100/100.
|
|
224
|
+
|
|
225
|
+
**Diagnose from the JSON report, not the HTML.** Parse `audits[*].score < 1` programmatically to find the offenders. Do not eyeball the HTML report.
|
|
226
|
+
|
|
227
|
+
**Run 3-5 times and take the median.** A single audit can be noisy. CI must enforce the threshold on every PR.
|
|
228
|
+
|
|
229
|
+
## ROOT-CAUSE CHECKLIST (HIT THESE FIRST, ALMOST ALWAYS THE CULPRIT)
|
|
230
|
+
|
|
231
|
+
- **Render-blocking JS/CSS in the critical path.** Defer, code-split by route, inline critical CSS only.
|
|
232
|
+
- **Unsized media.** Every `<img>`, `<video>`, `<iframe>` MUST have explicit `width`/`height` or an aspect-ratio container. Unsized media causes CLS.
|
|
233
|
+
- **Wrong image format or dimensions.** Serve AVIF first, WebP fallback, JPEG last. Generate ALL responsive sizes in the build. NEVER ship an image larger than the rendered box. Use `fetchpriority="high"` on the LCP image.
|
|
234
|
+
- **Fonts.** `font-display: swap` minimum, `optional` for non-critical fonts, preload the one critical font, subset to only the characters actually used.
|
|
235
|
+
- **Third-party scripts in `<head>` synchronously.** Defer, lazy-load on first interaction, OR proxy through your own origin to remove a third-party DNS + TLS handshake from the critical path.
|
|
236
|
+
- **Hydration on routes that do not need it.** React Server Components, islands, `client:load`, ONLY where the interactivity is real. Static routes ship zero JS.
|
|
237
|
+
- **Missing semantic HTML.** `<button>` for buttons, `<a href>` for links, `<nav>` / `<main>` / `<header>` / `<footer>` landmarks, label every form input, alt-text every meaningful image, unique `<title>` per route.
|
|
238
|
+
- **Tab order, focus rings, contrast ratios, prefers-reduced-motion, ARIA correctness.** Accessibility 100 means a screen-reader user can drive the page end-to-end without help.
|
|
239
|
+
- **Meta tags.** `<title>`, `<meta name="description">`, OpenGraph, Twitter cards, structured data (JSON-LD), `lang` on `<html>`, `viewport`, canonical URL.
|
|
240
|
+
|
|
241
|
+
## ANTI-PATTERNS. REJECT ON SIGHT.
|
|
242
|
+
|
|
243
|
+
- Reporting a CLI Lighthouse score. **REJECT.** Tenet 1.
|
|
244
|
+
- Removing an animation to fix INP. **REJECT.** Switch to a CSS-only transform/opacity animation. Debounce listeners. Move heavy work off the main thread.
|
|
245
|
+
- Replacing a hero image with a placeholder to "fix" LCP. **REJECT.** Properly sized AVIF + `fetchpriority="high"` + preconnect to the image CDN is the actual fix.
|
|
246
|
+
- Disabling JS for a route to "score 100". **REJECT.** Score 100 ON the JS-enabled production build with representative device settings inside the isolated run-owned profile.
|
|
247
|
+
- Setting `display: none` on offscreen content to dodge audits. **REJECT.** Use `content-visibility: auto` plus proper lazy mounting. Never lie about the page.
|
|
248
|
+
- Declaring victory after a single audit run. **REJECT.** Run 3-5 times, take the median. CI must enforce the threshold.
|
|
249
|
+
- Scoring 100 on `localhost` and shipping without re-measuring against the deployed URL. **REJECT.** The CDN, real DNS, and real TLS handshake matter.
|
|
250
|
+
|
|
251
|
+
## RESPONSE FORMAT (what to return when the user asks for a frontend audit or build)
|
|
252
|
+
|
|
253
|
+
1. **Scores before / after**, mobile AND desktop, all four categories.
|
|
254
|
+
2. **Design system compliance**: orphan tokens found / fixed, components documented.
|
|
255
|
+
3. **Each fix** in one line, traceable to the audit it cleared.
|
|
256
|
+
4. **What you intentionally did NOT do**, and why. Especially every tempting "easy point" you rejected to preserve UX.
|
|
257
|
+
5. **Browser-based Design QA result**: breakpoints tested, visual bugs found/fixed, states verified.
|
|
258
|
+
6. **The next audit you would run** if you had another iteration.
|
|
259
|
+
|
|
260
|
+
If the run did not hit 100 in every category, you are NOT done. State so explicitly. Continue iterating.
|
|
261
|
+
|
|
262
|
+
## MANTRA
|
|
263
|
+
|
|
264
|
+
> **100 on every Lighthouse category, on a real browser, with full features and full animations intact. Or it is not done.**
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
> DSH adapter boundary: resolve this resource from the loaded skill's directory resourceBase. Examples are not authority: installation/download/login, private state, Git writes and destructive operations need exact explicit authorization. Use only tools and native roles actually exposed in the current catalog and allowed by the caller; otherwise use a real direct fallback or report the limitation. Translate shell examples to the active runtime.
|
|
2
|
+
|
|
3
|
+
# React Perf Tooling for Lighthouse 100
|
|
4
|
+
|
|
5
|
+
You are auditing or optimizing a React app for Lighthouse 100. Two tools belong in this workflow alongside Playwright + lighthouse — they catch the React-specific perf issues that Lighthouse counts but doesn't diagnose by component:
|
|
6
|
+
|
|
7
|
+
| Tool | Surface | What it gives you |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **react-scan** (`react-scan/lite`) | Runtime instrumentation, headless | Per-fiber `commit` events with `changeDescription` — "this component re-rendered because <prop / state / context / parent / hook> changed". Correlates with `long-animation-frame` to attribute LoAF to specific components. |
|
|
10
|
+
| **react-doctor** | Static scan, CI-friendly | Deterministic findings across state/effects, perf (memoization, list keys, expensive children), architecture, security, a11y. One-shot `npx react-doctor@latest` produces a JSON report. From the Million.dev team. |
|
|
11
|
+
|
|
12
|
+
Use both. They are complementary: `react-scan` tells you *what's slow right now*; `react-doctor` tells you *what's structurally wrong*. Both are dev-only and free.
|
|
13
|
+
|
|
14
|
+
Every browser audit uses a **run-owned temporary empty browser profile or isolated empty context**. **Do not sign in to any browser, vendor, site, or account, including disposable or test accounts.** **Do not import, copy, reuse, or sync user browser settings, extensions, cookies, authentication, or storage state.** If the route cannot be exercised anonymously, **report authentication as a verification limitation**; do not attach to a live browser or inject state to make the audit pass.
|
|
15
|
+
|
|
16
|
+
If the project does not yet have react-scan and react-doctor wired into its dev environment, read `../design/react-dev-tooling-skill.md` first and install them — they should be on by default for every React project this skill audits.
|
|
17
|
+
|
|
18
|
+
## Lighthouse run + react-scan/lite
|
|
19
|
+
|
|
20
|
+
`playwright-lighthouse` already drives a real Chrome. Inject `react-scan/lite` BEFORE React mounts via `page.addInitScript`. Then drain its `onEvent` stream during the run and assert on render budgets at the end.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// scripts/audit-with-react-scan.ts
|
|
24
|
+
import { randomUUID } from "node:crypto";
|
|
25
|
+
import { mkdir, mkdtemp, readFile, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
26
|
+
import { tmpdir } from "node:os";
|
|
27
|
+
import { basename, dirname, join } from "node:path";
|
|
28
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
29
|
+
import { chromium, type BrowserContext, type Page } from "playwright";
|
|
30
|
+
import { playAudit } from "playwright-lighthouse";
|
|
31
|
+
|
|
32
|
+
type OwnedAuditBrowser = {
|
|
33
|
+
context: BrowserContext;
|
|
34
|
+
page: Page;
|
|
35
|
+
port: number;
|
|
36
|
+
close(): Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
async function removeOwnedRunRoot(runRoot: string, ownershipToken: string): Promise<void> {
|
|
40
|
+
const [resolvedTempRoot, resolvedRunRoot] = await Promise.all([realpath(tmpdir()), realpath(runRoot)]);
|
|
41
|
+
const ownershipMarker = join(resolvedRunRoot, ".ocmm-run-owner");
|
|
42
|
+
if (
|
|
43
|
+
dirname(resolvedRunRoot) !== resolvedTempRoot ||
|
|
44
|
+
!/^ocmm-lighthouse-[A-Za-z0-9_-]+$/.test(basename(resolvedRunRoot)) ||
|
|
45
|
+
(await readFile(ownershipMarker, "utf8")) !== ownershipToken
|
|
46
|
+
) {
|
|
47
|
+
throw new Error("Refusing to remove a Lighthouse run root without exact ownership evidence");
|
|
48
|
+
}
|
|
49
|
+
await rm(resolvedRunRoot, { recursive: true, force: false });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function readOwnedCdpPort(userDataDir: string, launchStartedAt: number): Promise<number> {
|
|
53
|
+
const activePortFile = join(userDataDir, "DevToolsActivePort");
|
|
54
|
+
const deadline = Date.now() + 10_000;
|
|
55
|
+
let lastError: unknown;
|
|
56
|
+
|
|
57
|
+
while (Date.now() < deadline) {
|
|
58
|
+
try {
|
|
59
|
+
const [portText, browserPath] = (await readFile(activePortFile, "utf8")).trim().split(/\r?\n/);
|
|
60
|
+
const port = Number(portText);
|
|
61
|
+
const metadata = await stat(activePortFile);
|
|
62
|
+
if (!Number.isInteger(port) || port < 1 || !browserPath?.startsWith("/devtools/browser/")) {
|
|
63
|
+
throw new Error("Chrome wrote an invalid DevToolsActivePort file");
|
|
64
|
+
}
|
|
65
|
+
if (metadata.mtimeMs < launchStartedAt - 1_000) {
|
|
66
|
+
throw new Error("DevToolsActivePort predates this browser launch");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const remainingMs = deadline - Date.now();
|
|
70
|
+
if (remainingMs <= 0) throw new Error("CDP readiness budget expired before the ownership probe");
|
|
71
|
+
const response = await fetch(`http://127.0.0.1:${port}/json/version`, {
|
|
72
|
+
signal: AbortSignal.timeout(remainingMs),
|
|
73
|
+
});
|
|
74
|
+
if (!response.ok) throw new Error(`CDP readiness returned HTTP ${response.status}`);
|
|
75
|
+
const version = (await response.json()) as { webSocketDebuggerUrl?: string };
|
|
76
|
+
if (!version.webSocketDebuggerUrl) throw new Error("CDP response omitted webSocketDebuggerUrl");
|
|
77
|
+
const endpoint = new URL(version.webSocketDebuggerUrl);
|
|
78
|
+
if (endpoint.hostname !== "127.0.0.1" || endpoint.port !== String(port) || endpoint.pathname !== browserPath) {
|
|
79
|
+
throw new Error("CDP endpoint does not match this launch's DevToolsActivePort file");
|
|
80
|
+
}
|
|
81
|
+
return port;
|
|
82
|
+
} catch (error) {
|
|
83
|
+
lastError = error;
|
|
84
|
+
const retryDelayMs = Math.min(100, Math.max(0, deadline - Date.now()));
|
|
85
|
+
if (retryDelayMs > 0) await delay(retryDelayMs);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
throw new Error(`Owned CDP endpoint was not ready before the deadline: ${String(lastError)}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function launchOwnedAuditBrowser(): Promise<OwnedAuditBrowser> {
|
|
93
|
+
const resolvedTempRoot = await realpath(tmpdir());
|
|
94
|
+
const runRoot = await mkdtemp(join(resolvedTempRoot, "ocmm-lighthouse-"));
|
|
95
|
+
const ownershipToken = randomUUID();
|
|
96
|
+
const ownershipMarker = join(runRoot, ".ocmm-run-owner");
|
|
97
|
+
const userDataDir = join(runRoot, "user-data");
|
|
98
|
+
await writeFile(ownershipMarker, ownershipToken, { flag: "wx" });
|
|
99
|
+
await mkdir(userDataDir);
|
|
100
|
+
|
|
101
|
+
let context: BrowserContext | undefined;
|
|
102
|
+
try {
|
|
103
|
+
const launchStartedAt = Date.now();
|
|
104
|
+
context = await chromium.launchPersistentContext(userDataDir, {
|
|
105
|
+
channel: "chrome",
|
|
106
|
+
headless: false,
|
|
107
|
+
args: [
|
|
108
|
+
'--disable-extensions',
|
|
109
|
+
'--disable-sync',
|
|
110
|
+
'--remote-debugging-address=127.0.0.1',
|
|
111
|
+
'--remote-debugging-port=0',
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
const port = await readOwnedCdpPort(userDataDir, launchStartedAt);
|
|
115
|
+
const ownedContext = context;
|
|
116
|
+
const page = ownedContext.pages()[0] ?? (await ownedContext.newPage());
|
|
117
|
+
return {
|
|
118
|
+
context: ownedContext,
|
|
119
|
+
page,
|
|
120
|
+
port,
|
|
121
|
+
close: async () => {
|
|
122
|
+
await ownedContext.close();
|
|
123
|
+
await removeOwnedRunRoot(runRoot, ownershipToken);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (context) await context.close();
|
|
128
|
+
await removeOwnedRunRoot(runRoot, ownershipToken);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const ownedBrowser = await launchOwnedAuditBrowser();
|
|
134
|
+
try {
|
|
135
|
+
// Inject react-scan/lite BEFORE the app boots. Initialization failure still reaches finally.
|
|
136
|
+
await ownedBrowser.context.addInitScript(() => {
|
|
137
|
+
// @ts-ignore — pulled from the project's node_modules or a self-hosted bundle
|
|
138
|
+
import("react-scan/lite").then(({ instrument }) => {
|
|
139
|
+
(window as any).__renderEvents = [];
|
|
140
|
+
instrument({
|
|
141
|
+
onEvent: (event: any) => {
|
|
142
|
+
if (event.kind === "commit") (window as any).__renderEvents.push(event);
|
|
143
|
+
},
|
|
144
|
+
recordChangeDescriptions: true,
|
|
145
|
+
includeFiberSource: true,
|
|
146
|
+
includeFiberIdentity: true,
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
await ownedBrowser.page.goto("http://localhost:3000/<route>");
|
|
152
|
+
await playAudit({
|
|
153
|
+
page: ownedBrowser.page,
|
|
154
|
+
port: ownedBrowser.port,
|
|
155
|
+
thresholds: { performance: 100, accessibility: 100, "best-practices": 100, seo: 100 },
|
|
156
|
+
reports: { formats: { html: true, json: true }, name: "lighthouse-<route>" },
|
|
157
|
+
config: { extends: "lighthouse:default", settings: { formFactor: "mobile" } },
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Pull render events and assert on render quality
|
|
161
|
+
const events = await ownedBrowser.page.evaluate(() => (window as any).__renderEvents);
|
|
162
|
+
const unnecessary = events.filter((e: any) =>
|
|
163
|
+
e.tree?.some((node: any) => node.changeDescription?.kind === "unnecessary"),
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
if (unnecessary.length > 0) {
|
|
167
|
+
throw new Error(`FAIL: ${unnecessary.length} unnecessary renders detected during audit`);
|
|
168
|
+
}
|
|
169
|
+
await ownedBrowser.page.screenshot({ path: "lighthouse-react-<route>.png", fullPage: true });
|
|
170
|
+
} finally {
|
|
171
|
+
await ownedBrowser.close();
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This is the canonical integration. `DevToolsActivePort` comes only from the new empty directory and is cross-checked against `/json/version`; failure to confirm it stops the audit, with no fixed-port fallback. The returned context is the browser ownership handle, and cleanup closes that exact context before marker-validated removal of the exact run root. Run twice per route (mobile + desktop), same as the base Lighthouse workflow. Both must hit 100/100/100/100 AND zero unnecessary renders.
|
|
176
|
+
|
|
177
|
+
## react-doctor — static perf gate
|
|
178
|
+
|
|
179
|
+
Before the Playwright run, fail fast on structural issues. The scan is fast and doesn't need a browser, so put it earlier in the pipeline.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npx react-doctor@latest --json > .react-doctor-report.json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Parse `.react-doctor-report.json` for perf-category findings. Treat any perf finding as a blocker for the same reason you treat a Lighthouse score < 100 as a blocker — these are deterministic issues that *will* show up in Lighthouse eventually under throttling.
|
|
186
|
+
|
|
187
|
+
Wire it into CI as a separate job (cheap, fast, no browser needed):
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
- name: React Doctor static perf scan
|
|
191
|
+
uses: millionco/react-doctor@main
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Or run inline with a fail filter:
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
- name: React Doctor static perf scan
|
|
198
|
+
run: npx react-doctor@latest --json --fail-on perf
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## When to load which during an audit
|
|
202
|
+
|
|
203
|
+
Run them in this order, stop at the first failure:
|
|
204
|
+
|
|
205
|
+
1. **`react-doctor`** — cheapest. Catches missing memoization, broken list keys, unstable callback refs, expensive children that re-render unnecessarily. Fix everything it reports BEFORE running Lighthouse — half the perf score wins live here.
|
|
206
|
+
2. **`react-scan` interactive in dev** — load the page in real Chrome with `npx react-scan@latest init` already wired (see the dev-tooling reference). Walk the LCP route, the most-clicked CTA, and any animation-heavy view. The toolbar shows render counts; the overlay highlights unnecessary renders in gray. Fix until clean.
|
|
207
|
+
3. **`react-scan/lite` in the Lighthouse run** — once interactive is clean, run the Playwright audit above. This catches anything that only shows under throttling or only on first paint.
|
|
208
|
+
4. **Playwright + Lighthouse** — standard run from `README.md` audit workflow. Score 100 + zero unnecessary renders from step 3 = done.
|
|
209
|
+
|
|
210
|
+
## React-specific perf root causes (extends `README.md` ROOT-CAUSE CHECKLIST)
|
|
211
|
+
|
|
212
|
+
These are the failures `react-scan` and `react-doctor` surface that base Lighthouse won't directly name:
|
|
213
|
+
|
|
214
|
+
- **Context value identity churn.** A provider value `useMemo` was forgotten; every consumer re-renders on every render of the provider's parent. → `useMemo` the value, or split contexts so high-churn fields don't sit next to stable ones.
|
|
215
|
+
- **Inline object/array/callback props on memoized children.** `<Child config={{ a: 1 }} />` breaks `React.memo` every render. → Hoist, `useMemo`, or `useCallback`.
|
|
216
|
+
- **List keys = array index.** Reordering shreds the reconciler. → Use a stable id from the data.
|
|
217
|
+
- **Expensive components rendered unconditionally above the fold.** → `lazy()` + `Suspense`, or move below the LCP, or pre-render server-side.
|
|
218
|
+
- **Effects that fire on every render.** Missing dependency arrays or unstable deps. → Stabilize deps, or split state, or extract to `useEvent`-style ref.
|
|
219
|
+
- **Spreading the entire context value into props.** Couples every consumer to every field. → Destructure only the fields used.
|
|
220
|
+
- **Hydration mismatches.** SSR markup doesn't equal client first-render. → react-doctor flags structurally; fix the source of the divergence (Date.now, locale, randomness, browser-only APIs).
|
|
221
|
+
|
|
222
|
+
`react-doctor` finds these statically. `react-scan` confirms the symptom in the running app. Both must come clean before Lighthouse 100 is meaningful.
|
|
223
|
+
|
|
224
|
+
## Anti-patterns specific to this workflow
|
|
225
|
+
|
|
226
|
+
- **Forgetting `page.addInitScript` (using `page.evaluate` instead).** `evaluate` runs AFTER React mounts; you'll miss every initial-render event. Use `addInitScript`.
|
|
227
|
+
- **`react-scan` non-lite during a Lighthouse run.** The full UI (toolbar, canvas overlay) adds overhead and skews the score. Use `react-scan/lite` ONLY for measurement; the full version is for interactive dev.
|
|
228
|
+
- **Reporting Lighthouse 100 with `react-scan` showing 30+ unnecessary renders per route.** The score is meaningless if the React layer is thrashing — INP and CLS will degrade under real load even if the synthetic run passed. Both gates must clear.
|
|
229
|
+
- **Treating `trackUnnecessaryRenders` as free.** It has measurable overhead; in a Lighthouse run it can drag the perf score by 2-3 points. Use it for interactive diagnosis, not for the audit run.
|
|
230
|
+
- **Skipping react-doctor because "it's just a linter".** It's not. It detects React-specific defects (missing keys, broken memo, unstable refs, hydration mismatches) that ESLint plugins miss because they require fiber-level reasoning.
|
|
231
|
+
|
|
232
|
+
## Mantra
|
|
233
|
+
|
|
234
|
+
> **Lighthouse 100 + react-doctor clean + zero unnecessary renders from react-scan. All three or it is not done.**
|