@kensaurus/skills 0.0.0-stage → 2.0.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/.claude-plugin/marketplace.json +53 -0
- package/.claude-plugin/plugin.json +40 -0
- package/.cursor-plugin/plugin.json +38 -0
- package/.mcp.json +28 -0
- package/CHANGELOG.md +1761 -0
- package/LICENSE +21 -0
- package/NOTICE +13 -0
- package/README.md +820 -2
- package/SECURITY.md +55 -0
- package/agents/code-reviewer.md +60 -0
- package/agents/completion-judge.md +89 -0
- package/agents/db-migrator.md +125 -0
- package/agents/debugger.md +47 -0
- package/agents/deploy-checker.md +100 -0
- package/agents/perf-monitor.md +74 -0
- package/assets/favicon.png +0 -0
- package/assets/logo-light.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +6 -0
- package/assets/og.png +0 -0
- package/bin/install.mjs +1127 -0
- package/bin/kenji.js +2 -0
- package/commands/adr.md +17 -0
- package/commands/aeo-plan.md +18 -0
- package/commands/arch-boundaries.md +17 -0
- package/commands/aso-plan.md +18 -0
- package/commands/auth-flows.md +19 -0
- package/commands/backup-plan.md +17 -0
- package/commands/burndown-full.md +25 -0
- package/commands/capacitor-plan.md +18 -0
- package/commands/codemod-safety.md +22 -0
- package/commands/commit.md +18 -0
- package/commands/complete-everything.md +40 -0
- package/commands/cost-plan.md +19 -0
- package/commands/deadcode-plan.md +26 -0
- package/commands/deadcode.md +32 -0
- package/commands/debug-issue.md +17 -0
- package/commands/deps-plan.md +18 -0
- package/commands/docs-plan.md +17 -0
- package/commands/doctrine.md +19 -0
- package/commands/error-plan.md +19 -0
- package/commands/feedback-to-closure.md +36 -0
- package/commands/fix-issue.md +76 -0
- package/commands/gate-logic.md +26 -0
- package/commands/green-repo.md +36 -0
- package/commands/grill-me.md +19 -0
- package/commands/gtm-plan.md +21 -0
- package/commands/gtm-weekly.md +17 -0
- package/commands/gtm.md +22 -0
- package/commands/handoff.md +15 -0
- package/commands/housekeep-backlog.md +18 -0
- package/commands/housekeep-files.md +22 -0
- package/commands/housekeep-gates.md +18 -0
- package/commands/instant-nav.md +11 -0
- package/commands/integrity-plan.md +19 -0
- package/commands/launch-kit.md +16 -0
- package/commands/mcp-guide.md +40 -0
- package/commands/mobile-plan.md +19 -0
- package/commands/native-rn-monorepo/README.md +78 -0
- package/commands/native-rn-monorepo/android-build.md +26 -0
- package/commands/native-rn-monorepo/android-install.md +32 -0
- package/commands/native-rn-monorepo/android-logcat.md +37 -0
- package/commands/native-rn-monorepo/ios-ci-logs.md +56 -0
- package/commands/native-rn-monorepo/ios-ci-status.md +52 -0
- package/commands/native-rn-monorepo/ios-ci-trigger.md +59 -0
- package/commands/native-rn-monorepo/rn-reset.md +50 -0
- package/commands/native-rn-monorepo/rn-ship-ios.md +67 -0
- package/commands/native-rn-monorepo/rn-verify.md +53 -0
- package/commands/perf-plan.md +18 -0
- package/commands/plan-mode.md +74 -0
- package/commands/pr.md +16 -0
- package/commands/pricing-plan.md +20 -0
- package/commands/privacy-plan.md +18 -0
- package/commands/readability.md +12 -0
- package/commands/readme.md +15 -0
- package/commands/refactor.md +15 -0
- package/commands/release-prep.md +17 -0
- package/commands/research.md +25 -0
- package/commands/responsive-audit.md +21 -0
- package/commands/review-code.md +18 -0
- package/commands/rls-plan.md +18 -0
- package/commands/secrets-plan.md +18 -0
- package/commands/security-plan.md +19 -0
- package/commands/ship-and-observe.md +36 -0
- package/commands/skill-conflicts.md +19 -0
- package/commands/slop-plan.md +18 -0
- package/commands/stub-plan.md +18 -0
- package/commands/test-mutation.md +16 -0
- package/commands/test-plan.md +17 -0
- package/commands/test.md +29 -0
- package/commands/thirdparty-web-interface-guidelines.md +185 -0
- package/commands/uiux-plan.md +18 -0
- package/commands/uiux.md +45 -0
- package/commands/update-deps.md +21 -0
- package/commands/validation-plan.md +19 -0
- package/commands-portable/fix-issue.md +72 -0
- package/commands-portable/plan-mode.md +92 -0
- package/commands-portable/research.md +91 -0
- package/docs/screenshots/README.md +5 -0
- package/docs/screenshots/audit-dark.png +0 -0
- package/docs/screenshots/build-dark.png +0 -0
- package/docs/screenshots/grill-dark.png +0 -0
- package/docs/screenshots/hero-dark.png +0 -0
- package/docs/screenshots/hero-light.png +0 -0
- package/docs/screenshots/ship-dark.png +0 -0
- package/docs/screenshots/src/showcase.html +320 -0
- package/hooks/completion-gate.mjs +258 -0
- package/hooks/cursor-hooks.json +13 -0
- package/hooks/hooks.json +15 -0
- package/install.sh +21 -0
- package/llms.txt +40 -0
- package/mcp/README.md +266 -0
- package/mcp/VERSIONS.md +41 -0
- package/mcp/mcp-full.json.template +124 -0
- package/mcp/mcp.json.template +29 -0
- package/mcp/pinned-versions.json +27 -0
- package/package.json +93 -4
- package/rules/approved-plan-execution.mdc +65 -0
- package/rules/full-stack-ship-discipline.mdc +37 -0
- package/rules/native-rn-monorepo/README.md +63 -0
- package/rules/native-rn-monorepo/_project.mdc +69 -0
- package/rules/native-rn-monorepo/native-android.mdc +72 -0
- package/rules/native-rn-monorepo/native-ios.mdc +61 -0
- package/rules/native-rn-monorepo/react-native-js.mdc +78 -0
- package/rules/native-rn-monorepo/web.mdc +60 -0
- package/rules/project-starter/components.mdc +54 -0
- package/rules/project-starter/data-fetching.mdc +77 -0
- package/rules/project-starter/git.mdc +41 -0
- package/rules/project-starter/supabase.mdc +37 -0
- package/rules/project-starter/tailwind.mdc +48 -0
- package/rules/project-starter/typescript.mdc +36 -0
- package/rules/project-starter/web-performance.mdc +42 -0
- package/rules/senior-engineer.mdc +30 -0
- package/rules/shell-first-search.mdc +19 -0
- package/rules/skill-workflows.mdc +35 -0
- package/rules/verification-before-completion.mdc +57 -0
- package/skills/audit-accessibility/SKILL.md +441 -0
- package/skills/audit-agent-speed/SKILL.md +181 -0
- package/skills/audit-agent-speed/scripts/stop-typecheck.mjs +151 -0
- package/skills/audit-analytics/SKILL.md +138 -0
- package/skills/audit-auth-flows/SKILL.md +267 -0
- package/skills/audit-backend-architecture/SKILL.md +266 -0
- package/skills/audit-backend-architecture/references/patterns.md +386 -0
- package/skills/audit-bundle-size/SKILL.md +296 -0
- package/skills/audit-cicd/SKILL.md +218 -0
- package/skills/audit-code-quality/SKILL.md +314 -0
- package/skills/audit-code-review/SKILL.md +289 -0
- package/skills/audit-codemod-safety/SKILL.md +159 -0
- package/skills/audit-db-schema/SKILL.md +465 -0
- package/skills/audit-db-schema/references/details.md +110 -0
- package/skills/audit-doctrine/SKILL.md +189 -0
- package/skills/audit-env-parity/SKILL.md +133 -0
- package/skills/audit-fe-api/SKILL.md +458 -0
- package/skills/audit-gate-logic/SKILL.md +219 -0
- package/skills/audit-i18n/SKILL.md +339 -0
- package/skills/audit-infra-cost/SKILL.md +142 -0
- package/skills/audit-langfuse-llm/SKILL.md +468 -0
- package/skills/audit-langfuse-llm/references/details.md +226 -0
- package/skills/audit-llm-security/SKILL.md +147 -0
- package/skills/audit-monetization-iap/SKILL.md +137 -0
- package/skills/audit-payment-system/SKILL.md +268 -0
- package/skills/audit-payment-system/references/checklist.md +283 -0
- package/skills/audit-performance/SKILL.md +383 -0
- package/skills/audit-performance/references/loading-priority-2026.md +81 -0
- package/skills/audit-realworld/SKILL.md +287 -0
- package/skills/audit-registry-listing/SKILL.md +122 -0
- package/skills/audit-resilience/SKILL.md +154 -0
- package/skills/audit-responsive/SKILL.md +221 -0
- package/skills/audit-responsive/references/checklist.md +166 -0
- package/skills/audit-security/SKILL.md +289 -0
- package/skills/audit-skill-conflicts/SKILL.md +178 -0
- package/skills/audit-ui-states/SKILL.md +146 -0
- package/skills/audit-uiux-design-system/SKILL.md +475 -0
- package/skills/audit-uiux-design-system/references/details.md +71 -0
- package/skills/audit-ux/SKILL.md +379 -0
- package/skills/audit-ux/references/details.md +245 -0
- package/skills/audit-ux-journeys/SKILL.md +215 -0
- package/skills/audit-ux-journeys/references/checklist.md +179 -0
- package/skills/backend-db-performance/SKILL.md +441 -0
- package/skills/backend-error-handling/SKILL.md +489 -0
- package/skills/backend-error-handling/references/details.md +58 -0
- package/skills/backend-observability/SKILL.md +88 -0
- package/skills/backend-patterns/SKILL.md +499 -0
- package/skills/backend-patterns/references/architecture-patterns.md +298 -0
- package/skills/backend-realtime/SKILL.md +403 -0
- package/skills/backend-realtime/references/patterns.md +74 -0
- package/skills/burndown-full/SKILL.md +174 -0
- package/skills/complete-everything/SKILL.md +295 -0
- package/skills/data-pipeline/SKILL.md +109 -0
- package/skills/data-visualization/SKILL.md +488 -0
- package/skills/debug-error/SKILL.md +322 -0
- package/skills/debug-fe-be-integration/SKILL.md +459 -0
- package/skills/debug-sentry-monitor/SKILL.md +497 -0
- package/skills/debug-sentry-monitor/references/details.md +165 -0
- package/skills/deploy-npm/SKILL.md +394 -0
- package/skills/deploy-npm/references/example-mushi-mushi.md +52 -0
- package/skills/deploy-verify/SKILL.md +489 -0
- package/skills/design-api/SKILL.md +379 -0
- package/skills/design-canvas/SKILL.md +155 -0
- package/skills/design-email/SKILL.md +370 -0
- package/skills/design-frontend/SKILL.md +143 -0
- package/skills/design-generative-art/SKILL.md +474 -0
- package/skills/design-mobile-first/SKILL.md +506 -0
- package/skills/design-motion/SKILL.md +333 -0
- package/skills/design-motion/references/delight-interactions.md +191 -0
- package/skills/design-prd/SKILL.md +443 -0
- package/skills/design-system/SKILL.md +457 -0
- package/skills/design-theme/SKILL.md +226 -0
- package/skills/design-theme/themes/tsumagoi-ranch.md +150 -0
- package/skills/docs-adr/SKILL.md +168 -0
- package/skills/docs-coauthor/SKILL.md +368 -0
- package/skills/docs-comparison-pages/SKILL.md +117 -0
- package/skills/docs-domain-modeling/SKILL.md +97 -0
- package/skills/docs-launch-kit/SKILL.md +139 -0
- package/skills/docs-writer/SKILL.md +469 -0
- package/skills/enhance-agent-guardrails/SKILL.md +164 -0
- package/skills/enhance-arch-boundaries/SKILL.md +154 -0
- package/skills/enhance-capacitor-ui/SKILL.md +463 -0
- package/skills/enhance-capacitor-ui/references/details.md +750 -0
- package/skills/enhance-email-deliverability/SKILL.md +143 -0
- package/skills/enhance-growth-loops/SKILL.md +122 -0
- package/skills/enhance-lifecycle-email/SKILL.md +130 -0
- package/skills/enhance-motion/SKILL.md +193 -0
- package/skills/enhance-onboarding/SKILL.md +148 -0
- package/skills/enhance-pwa/SKILL.md +304 -0
- package/skills/enhance-readability/SKILL.md +146 -0
- package/skills/enhance-readme/SKILL.md +496 -0
- package/skills/enhance-readme/package-lock.json +187 -0
- package/skills/enhance-readme/package.json +17 -0
- package/skills/enhance-readme/scripts/generate-readme-blocks.mjs +199 -0
- package/skills/enhance-readme/scripts/record-readme-tour.mjs +442 -0
- package/skills/enhance-skill-prompts/SKILL.md +167 -0
- package/skills/enhance-skill-prompts/references/exemplar-audit-auth-flows.md +311 -0
- package/skills/enhance-web-conversion/SKILL.md +155 -0
- package/skills/enhance-web-forms/SKILL.md +154 -0
- package/skills/enhance-web-instant-nav/SKILL.md +138 -0
- package/skills/enhance-web-instant-nav/references/bfcache-blockers.md +23 -0
- package/skills/enhance-web-instant-nav/references/early-hints.md +33 -0
- package/skills/enhance-web-instant-nav/references/speculation-rules.md +44 -0
- package/skills/enhance-web-landing/SKILL.md +459 -0
- package/skills/enhance-web-landing/references/details.md +773 -0
- package/skills/enhance-web-redesign/SKILL.md +228 -0
- package/skills/enhance-web-seo/SKILL.md +276 -0
- package/skills/enhance-web-ui/SKILL.md +473 -0
- package/skills/enhance-web-ui/references/details.md +674 -0
- package/skills/enhance-web-ux/HEURISTICS.md +242 -0
- package/skills/enhance-web-ux/PATTERNS.md +375 -0
- package/skills/enhance-web-ux/SKILL.md +464 -0
- package/skills/enhance-web-ux/examples.md +222 -0
- package/skills/enhance-web-ux/references/details.md +406 -0
- package/skills/enhance-web-web3d/SKILL.md +397 -0
- package/skills/enhance-web-web3d/references/css-canvas-effects.md +180 -0
- package/skills/handoff/SKILL.md +66 -0
- package/skills/housekeep-backlog/SKILL.md +149 -0
- package/skills/housekeep-dead-code/SKILL.md +387 -0
- package/skills/housekeep-dead-code/references/ratchet-ci.md +205 -0
- package/skills/housekeep-dead-code/references/supabase-hygiene.md +152 -0
- package/skills/housekeep-design/SKILL.md +207 -0
- package/skills/housekeep-files/SKILL.md +220 -0
- package/skills/housekeep-files/references/naming-and-catalog.md +86 -0
- package/skills/housekeep-files/scripts/housekeep-files.ps1 +360 -0
- package/skills/housekeep-files/scripts/housekeep-files.sh +238 -0
- package/skills/housekeep-gates/SKILL.md +174 -0
- package/skills/iterate-agent-harness/SKILL.md +137 -0
- package/skills/iterate-gtm-weekly/SKILL.md +103 -0
- package/skills/iterate-post-launch/SKILL.md +292 -0
- package/skills/meta-mcp-builder/SKILL.md +313 -0
- package/skills/meta-skill-creator/SKILL.md +304 -0
- package/skills/mobile-capacitor-platform/SKILL.md +104 -0
- package/skills/mobile-emulator-start/SKILL.md +296 -0
- package/skills/mobile-emulator-test/SKILL.md +491 -0
- package/skills/mobile-emulator-test/references/details.md +478 -0
- package/skills/mobile-rn-performance/SKILL.md +107 -0
- package/skills/mobile-rn-screen/SKILL.md +476 -0
- package/skills/mobile-rn-screen/references/details.md +785 -0
- package/skills/mushi-health/SKILL.md +206 -0
- package/skills/mushi-integration/SKILL.md +257 -0
- package/skills/plan-aeo-readiness/SKILL.md +166 -0
- package/skills/plan-antislop/SKILL.md +281 -0
- package/skills/plan-aso/SKILL.md +149 -0
- package/skills/plan-backup-dr/SKILL.md +131 -0
- package/skills/plan-capacitor-hardening/SKILL.md +217 -0
- package/skills/plan-data-integrity/SKILL.md +187 -0
- package/skills/plan-dead-code/SKILL.md +386 -0
- package/skills/plan-dead-code/references/knip-config.md +214 -0
- package/skills/plan-dead-code/references/output-templates.md +133 -0
- package/skills/plan-dead-code/references/preservation-contract.md +50 -0
- package/skills/plan-dead-code/references/residue-greps.md +84 -0
- package/skills/plan-dependency-provenance/SKILL.md +200 -0
- package/skills/plan-docs-sync/SKILL.md +143 -0
- package/skills/plan-docs-sync/references/drift-taxonomy.md +43 -0
- package/skills/plan-docs-sync/references/output-templates.md +33 -0
- package/skills/plan-docs-sync/references/preservation-contract.md +17 -0
- package/skills/plan-error-handling/SKILL.md +205 -0
- package/skills/plan-gtm/SKILL.md +276 -0
- package/skills/plan-gtm/references/benchmarks-2026.md +183 -0
- package/skills/plan-input-validation/SKILL.md +179 -0
- package/skills/plan-llm-cost-guardrails/SKILL.md +176 -0
- package/skills/plan-mobile-readiness/SKILL.md +171 -0
- package/skills/plan-perf-audit/SKILL.md +145 -0
- package/skills/plan-perf-audit/references/audit-scope.md +51 -0
- package/skills/plan-perf-audit/references/output-templates.md +33 -0
- package/skills/plan-perf-audit/references/preservation-contract.md +13 -0
- package/skills/plan-pricing/SKILL.md +173 -0
- package/skills/plan-privacy-compliance/SKILL.md +148 -0
- package/skills/plan-rls-audit/SKILL.md +231 -0
- package/skills/plan-secrets-audit/SKILL.md +181 -0
- package/skills/plan-security-audit/SKILL.md +168 -0
- package/skills/plan-security-audit/references/output-templates.md +36 -0
- package/skills/plan-security-audit/references/owasp-supabase-scope.md +55 -0
- package/skills/plan-security-audit/references/preservation-contract.md +18 -0
- package/skills/plan-stub-checker/SKILL.md +216 -0
- package/skills/plan-stub-checker/references/detection-methodology.md +75 -0
- package/skills/plan-stub-checker/references/detection-taxonomy.md +34 -0
- package/skills/plan-stub-checker/references/output-templates.md +63 -0
- package/skills/plan-stub-checker/references/preservation-contract.md +24 -0
- package/skills/plan-test-coverage/SKILL.md +170 -0
- package/skills/plan-test-coverage/references/methodology.md +54 -0
- package/skills/plan-test-coverage/references/output-templates.md +34 -0
- package/skills/plan-test-coverage/references/preservation-contract.md +15 -0
- package/skills/plan-uiux-unification/SKILL.md +230 -0
- package/skills/plan-uiux-unification/references/output-templates.md +67 -0
- package/skills/plan-uiux-unification/references/phase-workbook.md +85 -0
- package/skills/plan-uiux-unification/references/preservation-contract.md +24 -0
- package/skills/protocol-browser-anti-stall/SKILL.md +211 -0
- package/skills/protocol-browser-anti-stall/references/mcp-to-cli-map.md +113 -0
- package/skills/protocol-browser-anti-stall/references/playwright-session-coordination.md +170 -0
- package/skills/research/SKILL.md +422 -0
- package/skills/test-exploratory/SKILL.md +165 -0
- package/skills/test-exploratory/references/charter-template.md +29 -0
- package/skills/test-load/SKILL.md +126 -0
- package/skills/test-mutation/SKILL.md +160 -0
- package/skills/test-playwright/SKILL.md +354 -0
- package/skills/test-qa/SKILL.md +364 -0
- package/skills/test-qa/references/details.md +268 -0
- package/skills/test-red-team/SKILL.md +387 -0
- package/skills/test-red-team/references/owasp-attack-checklist.md +193 -0
- package/skills/test-unit/SKILL.md +259 -0
- package/skills/test-unit/references/details.md +267 -0
- package/skills/test-visual-regression/SKILL.md +132 -0
- package/skills/thirdparty-emil-design-eng/ATTRIBUTION.md +20 -0
- package/skills/thirdparty-emil-design-eng/SKILL.md +21 -0
- package/skills/thirdparty-emil-design-eng/references/emil-design-eng.md +676 -0
- package/skills/thirdparty-ui-ux-pro-max/ATTRIBUTION.md +22 -0
- package/skills/thirdparty-ui-ux-pro-max/SKILL.md +304 -0
- package/skills/thirdparty-ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/thirdparty-ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/thirdparty-ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/thirdparty-ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/thirdparty-ui-ux-pro-max/data/products.csv +97 -0
- package/skills/thirdparty-ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/thirdparty-ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/thirdparty-ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/thirdparty-ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/thirdparty-ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/thirdparty-ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/thirdparty-ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/thirdparty-ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/thirdparty-ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/thirdparty-ui-ux-pro-max/scripts/search.py +114 -0
- package/skills/thirdparty-web-interface-guidelines/ATTRIBUTION.md +23 -0
- package/skills/thirdparty-web-interface-guidelines/SKILL.md +190 -0
- package/skills/workflow-build-feature/SKILL.md +118 -0
- package/skills/workflow-coding-discipline/SKILL.md +140 -0
- package/skills/workflow-environment-ready/SKILL.md +128 -0
- package/skills/workflow-feature-flag/SKILL.md +262 -0
- package/skills/workflow-feedback-to-closure/SKILL.md +165 -0
- package/skills/workflow-fix-and-ship/SKILL.md +136 -0
- package/skills/workflow-git-commit/SKILL.md +200 -0
- package/skills/workflow-green-repo/SKILL.md +166 -0
- package/skills/workflow-grilling/SKILL.md +73 -0
- package/skills/workflow-gtm/SKILL.md +153 -0
- package/skills/workflow-housekeep/SKILL.md +453 -0
- package/skills/workflow-housekeep/references/templates.md +109 -0
- package/skills/workflow-launch-ready/SKILL.md +145 -0
- package/skills/workflow-merge-conflicts/SKILL.md +62 -0
- package/skills/workflow-onboard/SKILL.md +99 -0
- package/skills/workflow-parallel-agents/SKILL.md +164 -0
- package/skills/workflow-pr/SKILL.md +197 -0
- package/skills/workflow-quality-gate/SKILL.md +147 -0
- package/skills/workflow-refactor/SKILL.md +274 -0
- package/skills/workflow-release-prep/SKILL.md +207 -0
- package/skills/workflow-ship-and-observe/SKILL.md +164 -0
- package/skills/workflow-spec-tdd/SKILL.md +141 -0
- package/skills/workflow-spec-tdd/references/spec-template.md +126 -0
- package/skills/workflow-spec-tdd/references/tdd-patterns.md +167 -0
- package/skills-cursor/babysit/SKILL.md +17 -0
- package/skills-cursor/canvas/SKILL.md +142 -0
- package/skills-cursor/canvas/sdk/canvas-tokens.d.ts +235 -0
- package/skills-cursor/canvas/sdk/chart-primitives.d.ts +200 -0
- package/skills-cursor/canvas/sdk/dag-layout.d.ts +102 -0
- package/skills-cursor/canvas/sdk/diff-view.d.ts +130 -0
- package/skills-cursor/canvas/sdk/form-primitives.d.ts +194 -0
- package/skills-cursor/canvas/sdk/hooks.d.ts +117 -0
- package/skills-cursor/canvas/sdk/index.d.ts +47 -0
- package/skills-cursor/canvas/sdk/theme.d.ts +61 -0
- package/skills-cursor/canvas/sdk/todo-list.d.ts +49 -0
- package/skills-cursor/canvas/sdk/ui-primitives.d.ts +549 -0
- package/skills-cursor/canvas/sdk/ui-primitives.test.d.ts +2 -0
- package/skills-cursor/create-hook/SKILL.md +238 -0
- package/skills-cursor/create-rule/SKILL.md +185 -0
- package/skills-cursor/create-skill/SKILL.md +269 -0
- package/skills-cursor/create-skill/references/authoring-guide.md +182 -0
- package/skills-cursor/create-subagent/SKILL.md +228 -0
- package/skills-cursor/migrate-to-skills/SKILL.md +121 -0
- package/skills-cursor/shell/SKILL.md +22 -0
- package/skills-cursor/split-to-prs/SKILL.md +47 -0
- package/skills-cursor/statusline/SKILL.md +193 -0
- package/skills-cursor/update-cli-config/SKILL.md +85 -0
- package/skills-cursor/update-cursor-settings/SKILL.md +137 -0
- package/skills.sh.json +296 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Payment system audit — detection commands & signals
|
|
2
|
+
|
|
3
|
+
Per-control detection for `audit-payment-system` Phase 2. Each entry: **what**, **detect** (commands),
|
|
4
|
+
**good signal**, **red flag**, **fix via**. Amounts are always integer **minor units** (cents) as
|
|
5
|
+
strings across boundaries — never floats. Run only the groups in scope for the detected tier (P0/P1/P2).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## A. Money-movement correctness
|
|
10
|
+
|
|
11
|
+
### A1 — Idempotency on every mutation
|
|
12
|
+
- **What:** charge/capture/refund/void accept a business-intent idempotency key, enforced at the API
|
|
13
|
+
edge **and** by a DB **unique constraint** (the last line of defense against a double charge).
|
|
14
|
+
- **Detect:**
|
|
15
|
+
```bash
|
|
16
|
+
rg -n -i "idempotency[-_]?key|Idempotency-Key|idempotenc" -g '*.{ts,js,py,go,java,rb,cs}'
|
|
17
|
+
rg -n -i "unique|UNIQUE|createIndex.*unique|@@unique|add_index.*unique" -g '*.{sql,prisma,rb,ts}' | rg -i "idempot|payment|charge|event"
|
|
18
|
+
rg -n -i "\.(create|charge|capture|refund|cancel|void)\b" -g '*.{ts,js,py,go}' # do these calls pass a key?
|
|
19
|
+
```
|
|
20
|
+
- **Good:** every mutating call passes a key derived from business identity (order id + action), and a
|
|
21
|
+
`UNIQUE(idempotency_key)` (or `UNIQUE(order_id, action)`) exists in the schema.
|
|
22
|
+
- **Red flag:** key generated from a timestamp/UUID at call time (defeats dedup on retry); key only at
|
|
23
|
+
the app layer with no DB constraint; some mutations keyed and others not.
|
|
24
|
+
- **Fix via:** `audit-resilience`, `backend-patterns`.
|
|
25
|
+
|
|
26
|
+
### A2 — Dedup / stored result & payload guard
|
|
27
|
+
- **What:** a reused key returns the *prior* result (or a "processing" status); a reused key with a
|
|
28
|
+
**different** payload is rejected, not silently run.
|
|
29
|
+
- **Detect:** `rg -n -i "already.?processed|existing.?result|payload.?hash|conflict|409" -g '*.{ts,js,py,go}'`
|
|
30
|
+
- **Good:** persist the key + payload hash + response before calling the PSP; on reuse compare hash and
|
|
31
|
+
return the cached response.
|
|
32
|
+
- **Red flag:** key accepted but result not stored; different payloads accepted under the same key.
|
|
33
|
+
- **Fix via:** `audit-resilience`.
|
|
34
|
+
|
|
35
|
+
### A3 — Payment state machine
|
|
36
|
+
- **What:** explicit permitted/prohibited transitions; `capture` twice is idempotent (2nd call returns
|
|
37
|
+
success without re-processing); no `SETTLED→AUTHORIZED`, no re-capture of `REFUNDED`.
|
|
38
|
+
- **Detect:**
|
|
39
|
+
```bash
|
|
40
|
+
rg -n -i "state|status|transition|PENDING|AUTHORIZED|CAPTURED|SETTLED|REFUNDED|FAILED|CHECK constraint" -g '*.{ts,js,py,go,sql}'
|
|
41
|
+
```
|
|
42
|
+
- **Good:** a defined transition graph (enum + guard, DB `CHECK`, or state-machine lib); capture/refund
|
|
43
|
+
are guarded and idempotent; a background worker resolves stuck transitional states (see C5).
|
|
44
|
+
- **Red flag:** free-form status string set anywhere; capture with no "already captured" guard; no
|
|
45
|
+
prohibited-transition checks.
|
|
46
|
+
- **Fix via:** `backend-patterns`.
|
|
47
|
+
|
|
48
|
+
### A4 — Money as integer minor units
|
|
49
|
+
- **What:** amounts are integers (cents), currency carried alongside; no float arithmetic on money.
|
|
50
|
+
- **Detect:** `rg -n -i "float|double|parseFloat|Number\(|decimal|BigDecimal|toFixed|amount\s*[*/]" -g '*.{ts,js,py,go,java,sql}'`
|
|
51
|
+
- **Good:** `amount_minor int` / `bigint` + `currency char(3)`; money math in integer or a decimal type;
|
|
52
|
+
amounts crossing boundaries as strings in minor units.
|
|
53
|
+
- **Red flag:** `float`/`double`/`parseFloat` on money; `toFixed(2)` as the storage strategy; summing
|
|
54
|
+
across currencies.
|
|
55
|
+
- **Fix via:** `audit-db-schema`.
|
|
56
|
+
|
|
57
|
+
### A5 — Multi-currency & FX
|
|
58
|
+
- **What:** no cross-currency arithmetic; FX rate captured at posting time and stored with the entry;
|
|
59
|
+
explicit rounding policy (e.g. bankers'/half-even).
|
|
60
|
+
- **Detect:** `rg -n -i "currency|fx|exchange.?rate|convert|round|banker" -g '*.{ts,js,py,go,sql}'`
|
|
61
|
+
- **Good:** each ledger entry stores currency + fx rate used; conversions produce a recorded FX entry;
|
|
62
|
+
documented rounding.
|
|
63
|
+
- **Red flag:** adding amounts of different currencies; FX rate re-fetched at read time; unspecified
|
|
64
|
+
rounding.
|
|
65
|
+
- **Fix via:** `backend-patterns`.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## B. Ledger & data integrity *(P1 internal balances · P2 full ledger — `N/A` for P0)*
|
|
70
|
+
|
|
71
|
+
### B1 — Double-entry
|
|
72
|
+
- **What:** every movement writes a balanced debit **and** credit; the sum of all ledger entries = 0.
|
|
73
|
+
- **Detect:** `rg -n -i "debit|credit|double|balanced|journal|posting|sum.*zero" -g '*.{ts,js,py,go,sql}'`
|
|
74
|
+
- **Good:** a `ledger_entries` table with `direction (debit|credit)`, entries grouped by a
|
|
75
|
+
transaction/journal id, and an invariant/test asserting per-transaction debits == credits.
|
|
76
|
+
- **Red flag:** a single "amount +/-" column; balances mutated directly without paired entries.
|
|
77
|
+
- **Fix via:** `audit-db-schema`, `backend-patterns`.
|
|
78
|
+
|
|
79
|
+
### B2 — Append-only / immutable
|
|
80
|
+
- **What:** transaction & ledger tables are insert-only; corrections are **reversing entries**, never
|
|
81
|
+
`UPDATE`/`DELETE`.
|
|
82
|
+
- **Detect:**
|
|
83
|
+
```bash
|
|
84
|
+
rg -n -i "UPDATE (ledger|transactions|journal|entries)|DELETE FROM (ledger|transactions|journal)" -g '*.{sql,ts,js,py,go,rb}'
|
|
85
|
+
rg -n -i "\.update\(|\.destroy\(|\.delete\(" -g '*.{ts,js,py,go,rb}' | rg -i "ledger|transaction|journal|entry"
|
|
86
|
+
```
|
|
87
|
+
- **Good:** no update/delete on financial tables; DB trigger/grant prevents it; reversals are new rows.
|
|
88
|
+
- **Red flag:** any `UPDATE`/`DELETE` against ledger/transaction rows.
|
|
89
|
+
- **Fix via:** `plan-data-integrity`, `audit-db-schema`.
|
|
90
|
+
|
|
91
|
+
### B3 — Balance derived & snapshotted separately
|
|
92
|
+
- **What:** current balance is a materialized snapshot of ledger entries, not a hand-updated column.
|
|
93
|
+
- **Detect:** `rg -n -i "balance|snapshot|materialized|SUM\(|running.?total" -g '*.{ts,js,py,go,sql}'`
|
|
94
|
+
- **Good:** balance = periodic snapshot + entries since; snapshot table separate from ledger.
|
|
95
|
+
- **Red flag:** `balance = balance + x` UPDATE alongside (or instead of) ledger entries.
|
|
96
|
+
- **Fix via:** `audit-db-schema`.
|
|
97
|
+
|
|
98
|
+
### B4 — Auditability
|
|
99
|
+
- **What:** immutable/event-sourced history reconstructs any transaction; access to txn/PII data logged.
|
|
100
|
+
- **Detect:** `rg -n -i "audit|event.?source|history|append|access.?log|who|actor" -g '*.{ts,js,py,go,sql}'`
|
|
101
|
+
- **Good:** every state change emits an immutable event; reads/writes of payment data are attributable.
|
|
102
|
+
- **Red flag:** no history table; no access logging on payment/PII reads.
|
|
103
|
+
- **Fix via:** `backend-observability`, `audit-security`.
|
|
104
|
+
|
|
105
|
+
### B5 — Schema for scale
|
|
106
|
+
- **What:** time-partitioned transaction/ledger tables (manageable rows/day); indexes for recon queries.
|
|
107
|
+
- **Detect:** `rg -n -i "PARTITION|partition by|created_at.*index|BRIN|shard" -g '*.{sql,prisma}'`
|
|
108
|
+
- **Good:** partition by date; indexes on `(created_at)`, `(idempotency_key)`, `(status)`.
|
|
109
|
+
- **Red flag:** one unbounded hot table; recon full-scans.
|
|
110
|
+
- **Fix via:** `audit-db-schema`.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## C. Async orchestration & webhook delivery
|
|
115
|
+
|
|
116
|
+
### C1 — Sync-auth vs async-everything
|
|
117
|
+
- **What:** authorization is synchronous (caller waits); settlement, webhooks, reporting, recon are async.
|
|
118
|
+
- **Detect:** `rg -n -i "await.*capture|await.*settle|await.*reconcil|await.*notify|await.*email" -g '*.{ts,js,py,go}'`
|
|
119
|
+
- **Good:** only auth/confirm is on the request path; the rest is queued.
|
|
120
|
+
- **Red flag:** blocking on settlement/reporting/email inside the checkout request.
|
|
121
|
+
- **Fix via:** `audit-backend-architecture`.
|
|
122
|
+
|
|
123
|
+
### C2 — Webhook signature verified before processing
|
|
124
|
+
- **What:** HMAC / provider `constructEvent` verification happens **before** any state change.
|
|
125
|
+
- **Detect:**
|
|
126
|
+
```bash
|
|
127
|
+
rg -n -i "constructEvent|verifyHeader|Stripe-Signature|hmac|createHmac|timingSafeEqual|verify.*signature|x-.*-signature" -g '*.{ts,js,py,go,rb}'
|
|
128
|
+
rg -n -i "app\.(post|put)\(.*webhook|@app.route.*webhook|/webhook" -g '*.{ts,js,py,go,rb}' # then check each verifies
|
|
129
|
+
```
|
|
130
|
+
- **Good:** every webhook route verifies the signature with the raw body and a constant-time compare.
|
|
131
|
+
- **Red flag:** webhook handler parses/acts on the body with no verification; signature compared with `==`.
|
|
132
|
+
- **Fix via:** `audit-security`.
|
|
133
|
+
|
|
134
|
+
### C3 — Event-id dedup + 200-then-process
|
|
135
|
+
- **What:** processed event ids are recorded; the endpoint acks **200 immediately** then processes async.
|
|
136
|
+
- **Detect:** `rg -n -i "event\.id|processed.?event|already.?seen|enqueue|queue|200|res\.(send|status)" -g '*.{ts,js,py,go}'`
|
|
137
|
+
- **Good:** insert event id into a `processed_events` table (unique); return 200 fast; process on a worker.
|
|
138
|
+
- **Red flag:** synchronous heavy processing inside the webhook (PSP retries on timeout → double process);
|
|
139
|
+
no event-id dedup.
|
|
140
|
+
- **Fix via:** `audit-resilience`.
|
|
141
|
+
|
|
142
|
+
### C4 — Atomic state + ledger + outbox
|
|
143
|
+
- **What:** the state transition, ledger posting, and outbound event are committed in **one** DB
|
|
144
|
+
transaction; a relay publishes from the outbox.
|
|
145
|
+
- **Detect:** `rg -n -i "transaction|BEGIN|commit|outbox|\.\$transaction|unit.?of.?work" -g '*.{ts,js,py,go,sql}'`
|
|
146
|
+
- **Good:** single DB txn wraps state+ledger+outbox insert; separate relay/CDC publishes events.
|
|
147
|
+
- **Red flag:** DB write then a separate `publish()`/HTTP call (dual-write — crash between = inconsistency).
|
|
148
|
+
- **Fix via:** `audit-backend-architecture`, `backend-patterns`.
|
|
149
|
+
|
|
150
|
+
### C5 — Pull-based recovery for stuck payments
|
|
151
|
+
- **What:** a worker scans transitional states past a timeout and queries the PSP as the source of truth.
|
|
152
|
+
- **Detect:** `rg -n -i "cron|scheduler|worker|poll|stuck|reconcile.*status|retrieve.*payment|pull" -g '*.{ts,js,py,go}'`
|
|
153
|
+
- **Good:** periodic sweep of `PENDING`/`PROCESSING` older than N minutes → PSP status API drives the transition.
|
|
154
|
+
- **Red flag:** state advanced **only** by inbound webhooks (a lost webhook = stuck forever → user retries → double charge).
|
|
155
|
+
- **Fix via:** `backend-patterns`.
|
|
156
|
+
|
|
157
|
+
### C6 — Refund/dispute/payout as saga
|
|
158
|
+
- **What:** multi-service flows use local steps + **compensations** (reverse auth, negative ledger entry,
|
|
159
|
+
payout clawback, notify), driven by a durable workflow.
|
|
160
|
+
- **Detect:** `rg -n -i "saga|compensat|workflow|temporal|step.?function|rollback|clawback" -g '*.{ts,js,py,go}'`
|
|
161
|
+
- **Good:** each step has a compensating action; a durable engine won't lose an in-flight saga on crash.
|
|
162
|
+
- **Red flag:** a refund that reverses money but can fail before notifying/booking, with no compensation.
|
|
163
|
+
- **Fix via:** `backend-patterns`.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## D. Reconciliation & settlement *(P1/P2 — `N/A` for P0 beyond PSP-dashboard spot checks)*
|
|
168
|
+
|
|
169
|
+
### D1 — Automated daily reconciliation
|
|
170
|
+
- **Detect:** `rg -n -i "reconcil|settlement|balance_transaction|payout.?report|settle.*file|EOD|end.?of.?day" -g '*.{ts,js,py,go}'`
|
|
171
|
+
- **Good:** a scheduled job ingests the PSP settlement file and matches every line to a ledger entry.
|
|
172
|
+
- **Red flag:** no reconciliation job at all (ledger and PSP diverge silently).
|
|
173
|
+
- **Fix via:** `backend-patterns`, `data-pipeline`.
|
|
174
|
+
|
|
175
|
+
### D2 — 3-way match + break report
|
|
176
|
+
- **What:** internal ledger ↔ card-network/PSP ↔ bank statement; output a break report for ops.
|
|
177
|
+
- **Detect:** `rg -n -i "three.?way|3.?way|match|discrepanc|break.?report|mismatch|unmatched" -g '*.{ts,js,py,go}'`
|
|
178
|
+
- **Good:** all three sources compared; matched/unmatched/mismatched categorized daily.
|
|
179
|
+
- **Red flag:** only ledger-vs-PSP (bank ignored); no break report.
|
|
180
|
+
- **Fix via:** `data-pipeline`.
|
|
181
|
+
|
|
182
|
+
### D3 — Discrepancy handling
|
|
183
|
+
- **What:** missing txn escalated; extra bank txn found-in-records or reversed; amount mismatch checks FX;
|
|
184
|
+
rounding-only differences auto-resolved.
|
|
185
|
+
- **Detect:** `rg -n -i "escalat|alert|missing|extra|amount.?mismatch|fx|rounding|auto.?resolve" -g '*.{ts,js,py,go}'`
|
|
186
|
+
- **Good:** typed discrepancy handlers with thresholds; rounding auto-resolved, real breaks escalated.
|
|
187
|
+
- **Red flag:** breaks logged and ignored, or every break requires manual triage.
|
|
188
|
+
- **Fix via:** `backend-patterns`.
|
|
189
|
+
|
|
190
|
+
### D4 — Safety brake
|
|
191
|
+
- **What:** unreconciled balance over a threshold halts new captures / pages on-call.
|
|
192
|
+
- **Detect:** `rg -n -i "halt|threshold|circuit|stop.*capture|alert|pager|page" -g '*.{ts,js,py,go}'`
|
|
193
|
+
- **Red flag:** losses can accumulate indefinitely with no automated stop.
|
|
194
|
+
- **Fix via:** `audit-resilience`.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## E. Fraud, risk & SCA
|
|
199
|
+
|
|
200
|
+
### E1 — Risk scoring pre-auth
|
|
201
|
+
- **Detect:** `rg -n -i "fraud|risk|velocity|geolocat|device.?fingerprint|rules?.?engine|ml|score|radar|sift" -g '*.{ts,js,py,go}'`
|
|
202
|
+
- **Good:** velocity/geo/amount/device signals feed a rules engine (+ ML score if present) before auth.
|
|
203
|
+
- **Red flag:** no pre-auth screening (card-testing/stolen-card attacks land as chargebacks).
|
|
204
|
+
- **Fix via:** `backend-patterns` (P0: delegate to the PSP's built-in, e.g. Stripe Radar).
|
|
205
|
+
|
|
206
|
+
### E2 — 3DS2 / SCA step-up
|
|
207
|
+
- **Detect:** `rg -n -i "3ds|3-?d.?secure|sca|strong.?customer|psd2|challenge|exempt|frictionless" -g '*.{ts,js,py,go}'`
|
|
208
|
+
- **Good:** high-risk / PSD2-region → 3DS challenge; low-risk → frictionless via exemptions; PaymentIntents
|
|
209
|
+
(which handles SCA) not the legacy Charges API.
|
|
210
|
+
- **Red flag:** no SCA for EU cards (declines); or challenge on everything (lost conversion).
|
|
211
|
+
- **Fix via:** provider docs / `backend-patterns`.
|
|
212
|
+
|
|
213
|
+
### E3 — Fraud-service failure policy
|
|
214
|
+
- **Detect:** `rg -n -i "fail.?open|fail.?closed|fallback|circuit|degrade|timeout" -g '*.{ts,js,py,go}' | rg -i "fraud|risk"`
|
|
215
|
+
- **Good:** an explicit, documented fail-open **or** fail-closed decision behind a breaker.
|
|
216
|
+
- **Red flag:** undefined behavior when the risk service is down (blocks all revenue, or waves all fraud through).
|
|
217
|
+
- **Fix via:** `audit-resilience`.
|
|
218
|
+
|
|
219
|
+
### E4 — Chargeback / dispute monitoring
|
|
220
|
+
- **Detect:** `rg -n -i "chargeback|dispute|VAMP|VDMP|ratio|watchlist" -g '*.{ts,js,py,go}'`
|
|
221
|
+
- **Good:** dispute ratio tracked with alerting well below acquirer thresholds.
|
|
222
|
+
- **Red flag:** no visibility into dispute rate.
|
|
223
|
+
- **Fix via:** `backend-observability`.
|
|
224
|
+
|
|
225
|
+
### E5 — AML / sanctions *(P2 / regulated)*
|
|
226
|
+
- **Detect:** `rg -n -i "aml|kyc|sanction|ofac|watchlist|screening" -g '*.{ts,js,py,go}'`
|
|
227
|
+
- **Fix via:** `/research` + human review (regulatory).
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## F. Compliance & security — PCI DSS v4.0.1 (all tiers)
|
|
232
|
+
|
|
233
|
+
### F1 — Never store/log PAN or CVV
|
|
234
|
+
- **Detect (should find nothing raw):**
|
|
235
|
+
```bash
|
|
236
|
+
rg -n -i "card[-_ ]?number|\bpan\b|cvv|cvc|card\.number|primary_account|expiry|exp_month|exp_year" -g '*.{ts,js,py,go,java,rb,cs,sql,log}'
|
|
237
|
+
rg -n -i "console\.log|logger\.(info|debug)|print\(|fmt\.Print" -g '*.{ts,js,py,go}' | rg -i "card|pan|cvv|token|amount|payment"
|
|
238
|
+
```
|
|
239
|
+
- **Good:** raw card data never reaches your servers (hosted fields / Elements); only tokens stored/logged.
|
|
240
|
+
- **Red flag (Critical):** any PAN/CVV in code, DB columns, or logs. CVV storage is flatly prohibited.
|
|
241
|
+
- **Fix via:** `audit-security`.
|
|
242
|
+
|
|
243
|
+
### F2 — Tokenization
|
|
244
|
+
- **Detect:** `rg -n -i "token|payment_method|setup_intent|hosted.?field|elements|vault" -g '*.{ts,js,py,go}'`
|
|
245
|
+
- **Good:** PaymentIntents / hosted fields keep card data out of scope (SAQ-A).
|
|
246
|
+
- **Red flag:** card data posted to your backend then forwarded (full PCI scope).
|
|
247
|
+
- **Fix via:** provider docs.
|
|
248
|
+
|
|
249
|
+
### F3 — Key rotation & secret handling
|
|
250
|
+
- **Detect:** `rg -n -i "sk_live|sk_test|api.?key|secret|whsec_|signing.?secret|rotate" -g '*.{ts,js,py,go,env,yml,yaml}'`
|
|
251
|
+
- **Good:** keys in a secret manager, rotated; webhook signing secret not in code.
|
|
252
|
+
- **Red flag (Critical):** live secret keys committed; no rotation.
|
|
253
|
+
- **Fix via:** `audit-security`, `plan-secrets-audit`.
|
|
254
|
+
|
|
255
|
+
### F4 — Access audit
|
|
256
|
+
- **Detect:** `rg -n -i "audit.?log|access.?log|who|actor|user_id.*read|trace" -g '*.{ts,js,py,go}' | rg -i "payment|transaction|card|ledger"`
|
|
257
|
+
- **Good:** every read/write of payment/PII data is attributable.
|
|
258
|
+
- **Red flag:** no access trail on payment data.
|
|
259
|
+
- **Fix via:** `audit-security`, `backend-observability`.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## G. Error handling & resilience
|
|
264
|
+
|
|
265
|
+
- **G1 timeout + backoff + breaker on PSP/bank calls:** `rg -n -i "timeout|retry|backoff|jitter|circuit|breaker|opossum|resilience4j|polly|tenacity" -g '*.{ts,js,py,go}'` → every external call has a timeout and a breaker. Red flag: bare `await fetch(psp)` with no timeout. Fix via `audit-resilience`.
|
|
266
|
+
- **G2 bulkhead / pool isolation:** `rg -n -i "pool|semaphore|bulkhead|max.?concurren|limit" -g '*.{ts,js,py,go}'` → PSP calls can't starve the DB pool. Fix via `audit-backend-architecture`.
|
|
267
|
+
- **G3 partial-write safety:** covered by C4 (state + ledger commit atomically). Red flag: "charged but not booked" possible. Fix via `backend-patterns`.
|
|
268
|
+
- **G4 graceful degradation:** `rg -n -i "degrade|fallback|optional|non.?critical|best.?effort" -g '*.{ts,js,py,go}'` → fraud/notification down ≠ block auth, per an explicit policy. Fix via `audit-resilience`.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Delegation map (don't double-count)
|
|
273
|
+
| Concern | Owner skill |
|
|
274
|
+
|---|---|
|
|
275
|
+
| Per-call timeout/retry/backoff/breaker/idempotency-key mechanics | `audit-resilience` |
|
|
276
|
+
| PAN/CVV handling, webhook auth, secrets, key rotation, access logging, injection | `audit-security` |
|
|
277
|
+
| Ledger schema, money types, append-only constraints, partitioning | `audit-db-schema` |
|
|
278
|
+
| Outbox/saga/breaker *structure* & topology fit | `audit-backend-architecture` |
|
|
279
|
+
| Append-only/immutability & destructive-op safety | `plan-data-integrity` |
|
|
280
|
+
| Rotate-vs-relocate provider keys | `plan-secrets-audit` |
|
|
281
|
+
| Implementation of idempotency/outbox/saga/state machine | `backend-patterns` |
|
|
282
|
+
| Reconciliation/settlement ingestion pipelines | `data-pipeline` |
|
|
283
|
+
| Stripe-specific integration detail | Stripe plugin skills + Stripe MCP |
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit-performance
|
|
3
|
+
description: >
|
|
4
|
+
Audit and fix runtime performance (Core Web Vitals, load priority). Use when
|
|
5
|
+
"slow page", "LCP/INP/CLS", "fetchpriority", "long tasks", or "bfcache". JS
|
|
6
|
+
payload → audit-bundle-size. Instant nav → enhance-web-instant-nav. Load
|
|
7
|
+
limits → test-load.
|
|
8
|
+
license: MIT
|
|
9
|
+
effort: high
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Performance Audit Skill
|
|
13
|
+
|
|
14
|
+
**Degree of freedom: MIXED** — what to optimize `[HIGH freedom]`;
|
|
15
|
+
measure-first Sentry/vitals and `EXPLAIN` `[LOW freedom — run exactly]`.
|
|
16
|
+
|
|
17
|
+
> **Audit-and-fix exception.** Measure, then optimize. JS payload → `audit-bundle-size`. Instant navigations → `enhance-web-instant-nav`. Breaking point → `test-load`. Timeouts/retries → `audit-resilience`.
|
|
18
|
+
> When fixing: change only the measured bottleneck and re-measure it; log other slow paths you notice as follow-ups, not fixes. Edit the existing file in place rather than rewriting it. Add a perf test only where the repo already keeps them or the task asks; scratch measurements stay out of the repo.
|
|
19
|
+
|
|
20
|
+
## How to reason
|
|
21
|
+
|
|
22
|
+
1. **Observe** — quote LCP/INP/CLS, p95, or `EXPLAIN` / N+1 loop (`file:line`)
|
|
23
|
+
2. **Interpret** — is the user waiting on bytes, a query, or main-thread work?
|
|
24
|
+
3. **Classify** — vital-miss / N+1 / missing-index / bundle / image / re-render
|
|
25
|
+
4. **Severity** — poor LCP/INP or p95 >> target on a live path = Critical
|
|
26
|
+
|
|
27
|
+
## Worked example
|
|
28
|
+
|
|
29
|
+
> **Observe:** Sentry p95 `/users` = 2.3s; handler `findAll` then per-user
|
|
30
|
+
> `Order.findByUserId` (`app/api/users/route.ts:31`).
|
|
31
|
+
> **Interpret:** N+1; TTFB/LCP suffer on that page.
|
|
32
|
+
> **Classify:** N+1.
|
|
33
|
+
> **Severity:** Critical (p95 far over 200ms).
|
|
34
|
+
> **Finding:** `/users` | N+1 | eager-load orders | then re-measure
|
|
35
|
+
|
|
36
|
+
## Step 0: Gather Performance Data [LOW freedom — run exactly]
|
|
37
|
+
|
|
38
|
+
Before optimizing, measure. Collect data from multiple sources.
|
|
39
|
+
|
|
40
|
+
### Production Data (Sentry)
|
|
41
|
+
|
|
42
|
+
If Sentry performance monitoring is enabled, fetch real production metrics:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
sentry:search_events
|
|
46
|
+
{
|
|
47
|
+
"organizationSlug": "<ORG_SLUG>",
|
|
48
|
+
"projectSlug": "<PROJECT_SLUG>",
|
|
49
|
+
"regionUrl": "<REGION_URL>",
|
|
50
|
+
"query": "slowest transactions by p95 duration in last 7 days",
|
|
51
|
+
"limit": 20
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
sentry:search_events
|
|
57
|
+
{
|
|
58
|
+
"organizationSlug": "<ORG_SLUG>",
|
|
59
|
+
"projectSlug": "<PROJECT_SLUG>",
|
|
60
|
+
"regionUrl": "<REGION_URL>",
|
|
61
|
+
"query": "web vitals LCP INP CLS performance scores in last 7 days",
|
|
62
|
+
"limit": 20
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Check for performance-related issues:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
sentry:search_issues
|
|
70
|
+
{
|
|
71
|
+
"organizationSlug": "<ORG_SLUG>",
|
|
72
|
+
"projectSlugOrId": "<PROJECT_SLUG>",
|
|
73
|
+
"regionUrl": "<REGION_URL>",
|
|
74
|
+
"query": "performance issues slow queries N+1 in last 30 days",
|
|
75
|
+
"limit": 20
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Research Current Benchmarks
|
|
80
|
+
|
|
81
|
+
Fetch current performance targets:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
firecrawl:firecrawl_search
|
|
85
|
+
{
|
|
86
|
+
"query": "web vitals thresholds good score <current year>",
|
|
87
|
+
"limit": 3,
|
|
88
|
+
"sources": [{ "type": "web" }]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Field Data (source of truth) [LOW freedom — run exactly]
|
|
93
|
+
|
|
94
|
+
Lab (Lighthouse) is for diagnosis; **field** decides pass/fail.
|
|
95
|
+
|
|
96
|
+
1. CrUX / PageSpeed Insights field tab for the origin and top 5 URLs by
|
|
97
|
+
traffic — record p75 LCP / INP / CLS (mobile first).
|
|
98
|
+
2. `web-vitals/attribution` in the app (not the base build): it names the
|
|
99
|
+
LCP element, the INP interaction target, and the CLS-shifting node.
|
|
100
|
+
3. Lighthouse CI with a `budget.json` (see `references/loading-priority-2026.md`
|
|
101
|
+
§Budgets). Fail the PR on regression, not on absolute score.
|
|
102
|
+
|
|
103
|
+
Record all three in the report's "Production Metrics" block before touching code.
|
|
104
|
+
|
|
105
|
+
### Verification protocol [LOW freedom — run exactly]
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Field (source of truth): CrUX / PSI field tab → p75 LCP, INP, CLS
|
|
109
|
+
# Lab, repeatable, budgeted:
|
|
110
|
+
npx @lhci/cli autorun --config=lighthouserc.json
|
|
111
|
+
# Early Hints present?
|
|
112
|
+
curl -sv https://example.com/ 2>&1 | grep -E "< HTTP/.* 103"
|
|
113
|
+
# Speculation: DevTools → Application → Speculative loads
|
|
114
|
+
# bfcache: DevTools → Application → Back/forward cache → Test
|
|
115
|
+
# LCP element: web-vitals/attribution → onLCP(({attribution}) => attribution.element)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Performance Targets
|
|
121
|
+
|
|
122
|
+
### Core Web Vitals
|
|
123
|
+
|
|
124
|
+
| Metric | Good | Needs Work | Poor |
|
|
125
|
+
|--------|------|------------|------|
|
|
126
|
+
| **LCP** (Largest Contentful Paint) | <2.5s | 2.5-4s | >4s |
|
|
127
|
+
| **INP** (Interaction to Next Paint) | <200ms | 200-500ms | >500ms |
|
|
128
|
+
| **CLS** (Cumulative Layout Shift) | <0.1 | 0.1-0.25 | >0.25 |
|
|
129
|
+
|
|
130
|
+
### Other Key Metrics
|
|
131
|
+
|
|
132
|
+
- **TTFB**: <800ms field p75 (Google threshold); aim <200ms at the edge
|
|
133
|
+
- **FCP**: <1.8s
|
|
134
|
+
- **Long tasks**: none >50ms on the critical interaction path (INP driver)
|
|
135
|
+
- **LCP resource load delay**: <100ms (gap between TTFB and the LCP image request starting — usually "image not discoverable / not preloaded")
|
|
136
|
+
- **bfcache**: eligible on every content page (DevTools → Application → Back/forward cache)
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Frontend Performance Audit [HIGH freedom]
|
|
141
|
+
|
|
142
|
+
### Bundle Size Analysis
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm run build -- --analyze # framework-specific
|
|
146
|
+
npx source-map-explorer 'dist/**/*.js'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Checklist:**
|
|
150
|
+
- [ ] Total bundle <200KB gzipped
|
|
151
|
+
- [ ] No single chunk >100KB gzipped
|
|
152
|
+
- [ ] Tree shaking working (no unused exports in bundle)
|
|
153
|
+
- [ ] Heavy libraries lazy-loaded (charts, editors, maps)
|
|
154
|
+
- [ ] No moment.js (use date-fns or dayjs)
|
|
155
|
+
- [ ] No lodash full import (use lodash-es or specific imports)
|
|
156
|
+
|
|
157
|
+
### Code Splitting
|
|
158
|
+
|
|
159
|
+
- [ ] Route-based splitting (each page loads its own chunk)
|
|
160
|
+
- [ ] Component-level splitting for heavy components (`lazy()` / `dynamic()`)
|
|
161
|
+
- [ ] Below-fold content deferred
|
|
162
|
+
|
|
163
|
+
### Image Optimization
|
|
164
|
+
|
|
165
|
+
- [ ] WebP/AVIF format used (not PNG/JPEG for photos)
|
|
166
|
+
- [ ] Images sized appropriately (not serving 4K to mobile)
|
|
167
|
+
- [ ] `loading="lazy"` on below-fold images
|
|
168
|
+
- [ ] Responsive `srcSet` for different screen sizes
|
|
169
|
+
- [ ] Image CDN used (Cloudinary, imgix, Vercel Image Optimization)
|
|
170
|
+
|
|
171
|
+
### Loading Priority & Speculation [HIGH freedom on which to apply, LOW freedom on the LCP rules]
|
|
172
|
+
|
|
173
|
+
Deep syntax: `references/loading-priority-2026.md`. Instant-nav implementation → `enhance-web-instant-nav`.
|
|
174
|
+
|
|
175
|
+
**LCP element (find it first with `web-vitals/attribution` or DevTools → Performance → LCP)**
|
|
176
|
+
- [ ] LCP image is **not** `loading="lazy"` — lazy on the LCP image is an automatic Critical finding
|
|
177
|
+
- [ ] LCP image has `fetchpriority="high"` (Next.js: `<Image priority />`, which also injects the preload)
|
|
178
|
+
- [ ] LCP image is discoverable from HTML — not a CSS `background-image`, not injected by client JS, not behind a hydration boundary
|
|
179
|
+
- [ ] `<link rel="preload" as="image" imagesrcset imagesizes>` when the LCP image is responsive and not already preloaded by the framework
|
|
180
|
+
- [ ] Non-critical images: `loading="lazy" decoding="async"`; `<picture>` AVIF → WebP → JPEG fallback
|
|
181
|
+
|
|
182
|
+
**Fonts**
|
|
183
|
+
- [ ] `font-display: swap` (or `optional` for non-brand text); fallback metrics set (`size-adjust`, `ascent-override`) so swap causes no CLS — `next/font` does this automatically, verify it's actually used
|
|
184
|
+
- [ ] Preload only the above-fold weight(s); subset to used unicode ranges; self-host
|
|
185
|
+
|
|
186
|
+
**Early Hints (103)**
|
|
187
|
+
- [ ] Origin/CDN sends `103 Early Hints` with `preconnect` for the image/font CDN and `preload` for the LCP image + critical CSS. Verify: `curl -sv https://site/ 2>&1 | grep -i "< HTTP/.* 103"`
|
|
188
|
+
- [ ] Node: `res.writeEarlyHints({ link: [...] })`; otherwise configure at the CDN
|
|
189
|
+
|
|
190
|
+
**Speculation Rules (next-navigation speed)**
|
|
191
|
+
- [ ] `<script type="speculationrules">` present with `prefetch` document rules at `moderate` eagerness for in-site links
|
|
192
|
+
- [ ] `prerender` only for high-probability next pages (pagination, "next article", product detail); eagerness `moderate`/`conservative`
|
|
193
|
+
- [ ] Excluded from speculation: logout, cart/checkout, auth, anything with side effects on GET, URLs with `?` unless `expects_no_vary_search` is set
|
|
194
|
+
- [ ] Server ignores side-effects when `Sec-Purpose: prefetch;prerender` is present; analytics/ads guarded by `document.prerendering` + `prerenderingchange`
|
|
195
|
+
- [ ] Full implementation → `enhance-web-instant-nav`
|
|
196
|
+
|
|
197
|
+
**bfcache**
|
|
198
|
+
- [ ] No `unload` listeners (use `pagehide`); no `Cache-Control: no-store` on HTML; no open WebSocket / IndexedDB transaction at `pagehide`
|
|
199
|
+
- [ ] Verified green in DevTools → Application → Back/forward cache → "Test back/forward cache"
|
|
200
|
+
|
|
201
|
+
**Render strategy (Next.js 16 / React 19)**
|
|
202
|
+
- [ ] Server Components by default; `'use client'` only at interactive leaves
|
|
203
|
+
- [ ] Slow data wrapped in `<Suspense>` so the shell streams; static shell + dynamic holes (`cacheComponents` / `'use cache'`) instead of blocking the whole route
|
|
204
|
+
- [ ] React Compiler enabled (`reactCompiler: true`) **before** any manual `memo`/`useMemo`/`useCallback` — manual memo only where Profiler proves the Compiler missed it
|
|
205
|
+
|
|
206
|
+
**INP (responsiveness)**
|
|
207
|
+
- [ ] No task >50ms on tap/click/keypress paths; break work with `scheduler.yield()` (fallback `setTimeout(0)`) or `startTransition`
|
|
208
|
+
- [ ] No synchronous layout reads (`offsetHeight`, `getBoundingClientRect`) inside input handlers
|
|
209
|
+
- [ ] `content-visibility: auto` + `contain-intrinsic-size` on long off-screen sections
|
|
210
|
+
- [ ] Third-party scripts: `async`/`defer`, Next `<Script strategy="lazyOnload">` (or `"worker"` via Partytown where safe), consent-gated, facades for embeds (lite-youtube, static map image → iframe on click)
|
|
211
|
+
|
|
212
|
+
**CLS**
|
|
213
|
+
- [ ] Every `<img>`, `<video>`, `<iframe>`, ad slot has `width`/`height` or `aspect-ratio`
|
|
214
|
+
- [ ] Late-arriving UI (banners, toasts, cookie bars) reserves space or overlays — never pushes content
|
|
215
|
+
|
|
216
|
+
### React Performance (if applicable)
|
|
217
|
+
|
|
218
|
+
- [ ] React Compiler on; manual memo only with Profiler evidence (see Loading Priority & Speculation)
|
|
219
|
+
- [ ] No unnecessary re-renders (React DevTools Profiler)
|
|
220
|
+
- [ ] Long lists virtualized (react-window, @tanstack/react-virtual)
|
|
221
|
+
- [ ] No inline object/array creation in JSX props
|
|
222
|
+
- [ ] Context providers scoped narrowly (not wrapping entire app for local state)
|
|
223
|
+
|
|
224
|
+
### CSS Performance
|
|
225
|
+
|
|
226
|
+
- [ ] No layout thrashing (reads before writes)
|
|
227
|
+
- [ ] Animations use `transform`/`opacity` (GPU-accelerated)
|
|
228
|
+
- [ ] No `@import` chains (bundled instead)
|
|
229
|
+
- [ ] Critical CSS inlined for above-fold content
|
|
230
|
+
- [ ] Fonts subset and preloaded (`<link rel="preload">`)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Backend Performance Audit [HIGH freedom]
|
|
235
|
+
|
|
236
|
+
### Database Queries
|
|
237
|
+
|
|
238
|
+
**N+1 Detection:**
|
|
239
|
+
```typescript
|
|
240
|
+
// BAD: N+1
|
|
241
|
+
const users = await User.findAll();
|
|
242
|
+
for (const user of users) {
|
|
243
|
+
const orders = await Order.findByUserId(user.id);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// GOOD: eager loading
|
|
247
|
+
const users = await User.findAll({ include: [Order] });
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Checklist:**
|
|
251
|
+
- [ ] N+1 queries eliminated (eager loading, joins, batch loading)
|
|
252
|
+
- [ ] Indexes on frequently queried columns (WHERE, JOIN, ORDER BY)
|
|
253
|
+
- [ ] SELECT only needed columns (no `SELECT *`)
|
|
254
|
+
- [ ] Pagination on all list endpoints
|
|
255
|
+
- [ ] Connection pooling configured
|
|
256
|
+
- [ ] Slow query logging enabled
|
|
257
|
+
|
|
258
|
+
**Index verification:** [LOW freedom — run exactly]
|
|
259
|
+
```sql
|
|
260
|
+
EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = '123';
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### API Response Optimization
|
|
264
|
+
|
|
265
|
+
- [ ] Response compression enabled (gzip/brotli)
|
|
266
|
+
- [ ] Appropriate cache headers (`Cache-Control`, `ETag`)
|
|
267
|
+
- [ ] No over-fetching (return only what the client needs)
|
|
268
|
+
- [ ] Pagination for list endpoints
|
|
269
|
+
- [ ] Response time <200ms for p95
|
|
270
|
+
|
|
271
|
+
### Caching Strategy
|
|
272
|
+
|
|
273
|
+
| Layer | Tool | TTL | Use For |
|
|
274
|
+
|-------|------|-----|---------|
|
|
275
|
+
| Browser | Cache-Control headers | Varies | Static assets, API responses |
|
|
276
|
+
| CDN | Vercel/CloudFront/Cloudflare | 1h-1d | Static pages, images |
|
|
277
|
+
| API | Redis/Memcached | 5m-1h | Expensive queries, computed data |
|
|
278
|
+
| ORM | Query cache | 1m-5m | Repeated identical queries |
|
|
279
|
+
|
|
280
|
+
### Network Optimization
|
|
281
|
+
|
|
282
|
+
- [ ] CDN for static assets
|
|
283
|
+
- [ ] HTTP/2 or HTTP/3 enabled
|
|
284
|
+
- [ ] Preconnect to critical origins (`<link rel="preconnect">`)
|
|
285
|
+
- [ ] DNS prefetch for third-party domains
|
|
286
|
+
- [ ] API calls batched where possible (GraphQL, DataLoader)
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Research-Driven Optimization [HIGH freedom]
|
|
291
|
+
|
|
292
|
+
For specific performance bottlenecks, research current solutions:
|
|
293
|
+
|
|
294
|
+
```json
|
|
295
|
+
firecrawl:firecrawl_search
|
|
296
|
+
{
|
|
297
|
+
"query": "<framework> <specific bottleneck> performance optimization <current year>",
|
|
298
|
+
"limit": 5,
|
|
299
|
+
"sources": [{ "type": "web" }]
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Then deep-read the best result:
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
firecrawl:firecrawl_scrape
|
|
307
|
+
{
|
|
308
|
+
"url": "<best-result-url>",
|
|
309
|
+
"formats": ["markdown"],
|
|
310
|
+
"onlyMainContent": true
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Check official framework docs via Context7:
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
context7:resolve-library-id
|
|
318
|
+
{
|
|
319
|
+
"libraryName": "<framework>",
|
|
320
|
+
"query": "performance optimization"
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Quick Wins (Highest Impact, Lowest Effort)
|
|
327
|
+
|
|
328
|
+
| Issue | Solution | Impact |
|
|
329
|
+
|-------|----------|--------|
|
|
330
|
+
| LCP image lazy / not prioritized | `fetchpriority="high"` + preload; remove `loading="lazy"` from LCP | High (−300 to −800 ms LCP) |
|
|
331
|
+
| Fast first page, slow second | Speculation Rules `prefetch` (moderate) | High (next-nav TTFB ≈ 0) |
|
|
332
|
+
| Manual memo everywhere | Enable React Compiler | High (INP; delete redundant memo) |
|
|
333
|
+
| Large bundle | Code split routes, lazy load heavy libs | High |
|
|
334
|
+
| Slow images | WebP + lazy load + responsive | High |
|
|
335
|
+
| No caching | Add Cache-Control headers | High |
|
|
336
|
+
| N+1 queries | Eager load / batch | High |
|
|
337
|
+
| Missing indexes | Add database indexes | High |
|
|
338
|
+
| Unoptimized fonts | Subset + preload + font-display:swap | Medium |
|
|
339
|
+
| No compression | Enable gzip/brotli | Medium |
|
|
340
|
+
| Expensive re-renders | React Compiler first; manual memo only with Profiler evidence | Medium |
|
|
341
|
+
| Layout shifts | Set explicit width/height on images/embeds | Medium |
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Self-critique before applying fixes [LOW freedom — do not skip]
|
|
346
|
+
|
|
347
|
+
1. **Evidenced** — a measured vital, p95, or `EXPLAIN`, not "this looks slow"
|
|
348
|
+
2. **Reproducible** — same path still exceeds the target table
|
|
349
|
+
3. **Severity justified** — Critical = poor vital or live-path p95
|
|
350
|
+
4. **Right owner** — JS payload → `audit-bundle-size`; breaking point → `test-load`; timeouts → `audit-resilience`
|
|
351
|
+
5. **No-false-safety** — no `memo`/`useMemo` without a measured re-render; measure again after the fix
|
|
352
|
+
6. **LCP named** — prove which element is LCP before recommending image fixes (no attribution data = guess, not audit)
|
|
353
|
+
|
|
354
|
+
## Output: Performance Audit Report
|
|
355
|
+
|
|
356
|
+
```markdown
|
|
357
|
+
## Performance Audit: [Project Name]
|
|
358
|
+
|
|
359
|
+
### Production Metrics (from Sentry)
|
|
360
|
+
- LCP: [value] — [good/needs work/poor]
|
|
361
|
+
- INP: [value] — [good/needs work/poor]
|
|
362
|
+
- CLS: [value] — [good/needs work/poor]
|
|
363
|
+
- Slowest transactions: [list with p95 times]
|
|
364
|
+
|
|
365
|
+
### Critical Issues (fix immediately)
|
|
366
|
+
| # | Area | Issue | Impact | Fix |
|
|
367
|
+
|---|------|-------|--------|-----|
|
|
368
|
+
| 1 | DB | N+1 on /users endpoint | p95 = 2.3s | Eager load orders relation |
|
|
369
|
+
|
|
370
|
+
### Optimizations (prioritized)
|
|
371
|
+
| # | Area | Issue | Impact | Effort | Fix |
|
|
372
|
+
|---|------|-------|--------|--------|-----|
|
|
373
|
+
| 1 | FE | Bundle 450KB gzipped | High | Low | Code split routes |
|
|
374
|
+
|
|
375
|
+
### Already Optimized
|
|
376
|
+
- [list of performance areas that are well-implemented]
|
|
377
|
+
|
|
378
|
+
### Monitoring Recommendations
|
|
379
|
+
- [what to add to track performance over time]
|
|
380
|
+
|
|
381
|
+
### Research Sources
|
|
382
|
+
- [URL] — [what optimization pattern it provided]
|
|
383
|
+
```
|