buildanything 1.8.0 → 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 +3 -3
- package/.claude-plugin/plugin.json +9 -3
- package/CHANGELOG.md +57 -0
- package/README.md +2 -2
- package/agents/a11y-architect.md +166 -0
- package/agents/business-model.md +80 -29
- package/agents/code-architect.md +75 -0
- package/agents/code-reviewer.md +255 -0
- package/agents/code-simplifier.md +64 -0
- package/agents/design-brand-guardian.md +293 -53
- package/agents/design-critic.md +139 -0
- package/agents/design-inclusive-visuals-specialist.md +6 -19
- package/agents/design-ui-designer.md +335 -56
- package/agents/design-ux-architect.md +403 -55
- package/agents/design-ux-researcher.md +264 -49
- package/agents/engineering-ai-engineer.md +26 -36
- package/agents/engineering-backend-architect.md +185 -36
- package/agents/engineering-data-engineer.md +225 -43
- package/agents/engineering-devops-automator.md +227 -74
- package/agents/engineering-frontend-developer.md +210 -34
- package/agents/engineering-mobile-app-builder.md +6 -1
- package/agents/engineering-rapid-prototyper.md +30 -9
- package/agents/engineering-security-engineer.md +263 -61
- package/agents/engineering-senior-developer.md +128 -19
- package/agents/engineering-sre.md +84 -0
- package/agents/engineering-technical-writer.md +285 -41
- package/agents/feature-intel.md +110 -0
- package/agents/ios-app-review-guardian.md +19 -2
- package/agents/ios-foundation-models-specialist.md +20 -2
- package/agents/ios-storekit-specialist.md +9 -2
- package/agents/ios-swift-architect.md +28 -1
- package/agents/ios-swift-search.md +8 -1
- package/agents/ios-swift-ui-design.md +33 -1
- package/agents/marketing-app-store-optimizer.md +246 -64
- package/agents/planner.md +216 -0
- package/agents/pr-test-analyzer.md +63 -0
- package/agents/product-feedback-synthesizer.md +8 -2
- package/agents/refactor-cleaner.md +102 -0
- package/agents/security-reviewer.md +128 -0
- package/agents/silent-failure-hunter.md +54 -0
- package/agents/swift-build-resolver.md +119 -0
- package/agents/swift-reviewer.md +112 -0
- package/agents/tech-feasibility.md +21 -1
- package/agents/testing-api-tester.md +236 -59
- package/agents/testing-evidence-collector.md +26 -1
- package/agents/testing-performance-benchmarker.md +21 -1
- package/agents/testing-reality-checker.md +6 -1
- package/agents/visual-research.md +116 -0
- package/bin/adapters/cycle-counter-tool.ts +155 -0
- package/bin/adapters/scribe-tool.ts +71 -0
- package/bin/adapters/state-save-tool.ts +130 -0
- package/bin/adapters/write-lease-tool.ts +127 -0
- package/bin/buildanything-runtime.js +15 -0
- package/bin/buildanything-runtime.ts +328 -0
- package/bin/setup.js +83 -8
- package/commands/add-feature.md +2 -0
- package/commands/build.md +782 -266
- package/commands/fix.md +1 -1
- package/commands/self-check.md +121 -0
- package/commands/setup.md +50 -9
- package/commands/ux-review.md +2 -2
- package/commands/verify.md +6 -9
- package/docs/migration/agents.yaml +729 -0
- package/docs/migration/phase-graph.yaml +1088 -0
- package/docs/migration/sdk-host-compat.md +18 -0
- package/hooks/compile-writer-owner-cache.ts +171 -0
- package/hooks/hooks.json +36 -0
- package/hooks/pre-tool-use +19 -0
- package/hooks/pre-tool-use.ts +776 -0
- package/hooks/record-mode-transitions.ts +178 -0
- package/hooks/session-start +71 -1
- package/hooks/subagent-start +17 -0
- package/hooks/subagent-start.ts +471 -0
- package/hooks/subagent-stop +17 -0
- package/hooks/subagent-stop.ts +153 -0
- package/package.json +24 -4
- package/protocols/architecture-schema.md +171 -0
- package/protocols/decision-log.md +131 -0
- package/protocols/ios-context.md +10 -11
- package/protocols/ios-phase-branches.md +208 -33
- package/protocols/launch-readiness.md +258 -0
- package/protocols/metric-loop.md +62 -2
- package/protocols/smoke-test.md +9 -1
- package/protocols/state-schema.json +388 -0
- package/protocols/state-schema.md +172 -0
- package/protocols/verify.md +62 -2
- package/protocols/visual-dna.md +185 -0
- package/protocols/web-phase-branches.md +222 -72
- package/skills/ios/_VENDORED.md +2 -0
- package/skills/ios/app-store-connect-metadata/SKILL.md +148 -0
- package/skills/ios/asc-privacy-manifest/SKILL.md +350 -0
- package/skills/ios/hig-components-content/SKILL.md +86 -0
- package/skills/ios/hig-components-content/references/activity-views.md +79 -0
- package/skills/ios/hig-components-content/references/charts.md +180 -0
- package/skills/ios/hig-components-content/references/collections.md +48 -0
- package/skills/ios/hig-components-content/references/color-wells.md +42 -0
- package/skills/ios/hig-components-content/references/image-views.md +82 -0
- package/skills/ios/hig-components-content/references/image-wells.md +34 -0
- package/skills/ios/hig-components-content/references/lockups.md +78 -0
- package/skills/ios/hig-components-content/references/web-views.md +36 -0
- package/skills/ios/hig-components-controls/SKILL.md +88 -0
- package/skills/ios/hig-components-controls/references/combo-boxes.md +40 -0
- package/skills/ios/hig-components-controls/references/controls.md +112 -0
- package/skills/ios/hig-components-controls/references/gauges.md +74 -0
- package/skills/ios/hig-components-controls/references/labels.md +92 -0
- package/skills/ios/hig-components-controls/references/pickers.md +128 -0
- package/skills/ios/hig-components-controls/references/rating-indicators.md +38 -0
- package/skills/ios/hig-components-controls/references/segmented-controls.md +94 -0
- package/skills/ios/hig-components-controls/references/sliders.md +92 -0
- package/skills/ios/hig-components-controls/references/steppers.md +40 -0
- package/skills/ios/hig-components-controls/references/text-fields.md +88 -0
- package/skills/ios/hig-components-controls/references/text-views.md +56 -0
- package/skills/ios/hig-components-controls/references/toggles.md +127 -0
- package/skills/ios/hig-components-controls/references/token-fields.md +48 -0
- package/skills/ios/hig-components-controls/references/virtual-keyboards.md +156 -0
- package/skills/ios/hig-components-dialogs/SKILL.md +76 -0
- package/skills/ios/hig-components-dialogs/references/action-sheets.md +74 -0
- package/skills/ios/hig-components-dialogs/references/alerts.md +158 -0
- package/skills/ios/hig-components-dialogs/references/digit-entry-views.md +32 -0
- package/skills/ios/hig-components-dialogs/references/popovers.md +81 -0
- package/skills/ios/hig-components-dialogs/references/sheets.md +157 -0
- package/skills/ios/hig-components-layout/SKILL.md +99 -0
- package/skills/ios/hig-components-layout/references/boxes.md +48 -0
- package/skills/ios/hig-components-layout/references/column-views.md +44 -0
- package/skills/ios/hig-components-layout/references/lists-and-tables.md +99 -0
- package/skills/ios/hig-components-layout/references/ornaments.md +56 -0
- package/skills/ios/hig-components-layout/references/outline-views.md +64 -0
- package/skills/ios/hig-components-layout/references/panels.md +75 -0
- package/skills/ios/hig-components-layout/references/scroll-views.md +123 -0
- package/skills/ios/hig-components-layout/references/sidebars.md +109 -0
- package/skills/ios/hig-components-layout/references/split-views.md +110 -0
- package/skills/ios/hig-components-layout/references/tab-bars.md +173 -0
- package/skills/ios/hig-components-layout/references/tab-views.md +68 -0
- package/skills/ios/hig-components-layout/references/windows.md +188 -0
- package/skills/ios/hig-components-menus/SKILL.md +81 -0
- package/skills/ios/hig-components-menus/references/action-button.md +61 -0
- package/skills/ios/hig-components-menus/references/buttons.md +261 -0
- package/skills/ios/hig-components-menus/references/context-menus.md +105 -0
- package/skills/ios/hig-components-menus/references/disclosure-controls.md +84 -0
- package/skills/ios/hig-components-menus/references/dock-menus.md +40 -0
- package/skills/ios/hig-components-menus/references/edit-menus.md +88 -0
- package/skills/ios/hig-components-menus/references/menus.md +171 -0
- package/skills/ios/hig-components-menus/references/pop-up-buttons.md +70 -0
- package/skills/ios/hig-components-menus/references/pull-down-buttons.md +77 -0
- package/skills/ios/hig-components-menus/references/the-menu-bar.md +303 -0
- package/skills/ios/hig-components-menus/references/toolbars.md +256 -0
- package/skills/ios/hig-components-search/SKILL.md +68 -0
- package/skills/ios/hig-components-search/references/page-controls.md +120 -0
- package/skills/ios/hig-components-search/references/path-controls.md +40 -0
- package/skills/ios/hig-components-search/references/search-fields.md +189 -0
- package/skills/ios/hig-components-status/SKILL.md +80 -0
- package/skills/ios/hig-components-status/references/activity-rings.md +105 -0
- package/skills/ios/hig-components-status/references/progress-indicators.md +116 -0
- package/skills/ios/hig-components-status/references/status-bars.md +38 -0
- package/skills/ios/hig-components-system/SKILL.md +88 -0
- package/skills/ios/hig-components-system/references/app-clips.md +387 -0
- package/skills/ios/hig-components-system/references/app-shortcuts.md +114 -0
- package/skills/ios/hig-components-system/references/complications.md +425 -0
- package/skills/ios/hig-components-system/references/home-screen-quick-actions.md +42 -0
- package/skills/ios/hig-components-system/references/live-activities.md +442 -0
- package/skills/ios/hig-components-system/references/notifications.md +153 -0
- package/skills/ios/hig-components-system/references/top-shelf.md +135 -0
- package/skills/ios/hig-components-system/references/watch-faces.md +40 -0
- package/skills/ios/hig-components-system/references/widgets.md +517 -0
- package/skills/ios/hig-foundations/SKILL.md +98 -0
- package/skills/ios/hig-foundations/references/accessibility.md +291 -0
- package/skills/ios/hig-foundations/references/app-icons.md +210 -0
- package/skills/ios/hig-foundations/references/branding.md +44 -0
- package/skills/ios/hig-foundations/references/color.md +274 -0
- package/skills/ios/hig-foundations/references/dark-mode.md +116 -0
- package/skills/ios/hig-foundations/references/icons.md +263 -0
- package/skills/ios/hig-foundations/references/images.md +176 -0
- package/skills/ios/hig-foundations/references/immersive-experiences.md +174 -0
- package/skills/ios/hig-foundations/references/inclusion.md +189 -0
- package/skills/ios/hig-foundations/references/layout.md +425 -0
- package/skills/ios/hig-foundations/references/materials.md +238 -0
- package/skills/ios/hig-foundations/references/motion.md +103 -0
- package/skills/ios/hig-foundations/references/privacy.md +231 -0
- package/skills/ios/hig-foundations/references/right-to-left.md +206 -0
- package/skills/ios/hig-foundations/references/sf-symbols.md +310 -0
- package/skills/ios/hig-foundations/references/spatial-layout.md +142 -0
- package/skills/ios/hig-foundations/references/typography.md +1146 -0
- package/skills/ios/hig-foundations/references/writing.md +91 -0
- package/skills/ios/hig-inputs/SKILL.md +94 -0
- package/skills/ios/hig-inputs/references/apple-pencil-and-scribble.md +148 -0
- package/skills/ios/hig-inputs/references/camera-control.md +107 -0
- package/skills/ios/hig-inputs/references/digital-crown.md +83 -0
- package/skills/ios/hig-inputs/references/eyes.md +120 -0
- package/skills/ios/hig-inputs/references/focus-and-selection.md +120 -0
- package/skills/ios/hig-inputs/references/game-controls.md +156 -0
- package/skills/ios/hig-inputs/references/gestures.md +208 -0
- package/skills/ios/hig-inputs/references/gyro-and-accelerometer.md +40 -0
- package/skills/ios/hig-inputs/references/keyboards.md +234 -0
- package/skills/ios/hig-inputs/references/nearby-interactions.md +70 -0
- package/skills/ios/hig-inputs/references/pointing-devices.md +237 -0
- package/skills/ios/hig-inputs/references/remotes.md +67 -0
- package/skills/ios/hig-inputs/references/spatial-interactions.md +70 -0
- package/skills/ios/hig-patterns/SKILL.md +104 -0
- package/skills/ios/hig-patterns/references/charting-data.md +81 -0
- package/skills/ios/hig-patterns/references/collaboration-and-sharing.md +86 -0
- package/skills/ios/hig-patterns/references/drag-and-drop.md +134 -0
- package/skills/ios/hig-patterns/references/entering-data.md +69 -0
- package/skills/ios/hig-patterns/references/feedback.md +67 -0
- package/skills/ios/hig-patterns/references/file-management.md +135 -0
- package/skills/ios/hig-patterns/references/going-full-screen.md +79 -0
- package/skills/ios/hig-patterns/references/launching.md +81 -0
- package/skills/ios/hig-patterns/references/live-viewing-apps.md +79 -0
- package/skills/ios/hig-patterns/references/loading.md +59 -0
- package/skills/ios/hig-patterns/references/managing-accounts.md +107 -0
- package/skills/ios/hig-patterns/references/managing-notifications.md +99 -0
- package/skills/ios/hig-patterns/references/modality.md +82 -0
- package/skills/ios/hig-patterns/references/multitasking.md +131 -0
- package/skills/ios/hig-patterns/references/offering-help.md +117 -0
- package/skills/ios/hig-patterns/references/onboarding.md +69 -0
- package/skills/ios/hig-patterns/references/playing-audio.md +124 -0
- package/skills/ios/hig-patterns/references/playing-haptics.md +280 -0
- package/skills/ios/hig-patterns/references/playing-video.md +180 -0
- package/skills/ios/hig-patterns/references/printing.md +50 -0
- package/skills/ios/hig-patterns/references/ratings-and-reviews.md +48 -0
- package/skills/ios/hig-patterns/references/searching.md +70 -0
- package/skills/ios/hig-patterns/references/settings.md +84 -0
- package/skills/ios/hig-patterns/references/undo-and-redo.md +58 -0
- package/skills/ios/hig-patterns/references/workouts.md +76 -0
- package/skills/ios/hig-platforms/SKILL.md +84 -0
- package/skills/ios/hig-platforms/references/designing-for-games.md +159 -0
- package/skills/ios/hig-platforms/references/designing-for-ios.md +66 -0
- package/skills/ios/hig-platforms/references/designing-for-ipados.md +64 -0
- package/skills/ios/hig-platforms/references/designing-for-macos.md +70 -0
- package/skills/ios/hig-platforms/references/designing-for-tvos.md +68 -0
- package/skills/ios/hig-platforms/references/designing-for-visionos.md +85 -0
- package/skills/ios/hig-platforms/references/designing-for-watchos.md +74 -0
- package/skills/ios/hig-project-context/SKILL.md +133 -0
- package/skills/ios/hig-technologies/SKILL.md +107 -0
- package/skills/ios/hig-technologies/references/airplay.md +125 -0
- package/skills/ios/hig-technologies/references/always-on.md +62 -0
- package/skills/ios/hig-technologies/references/apple-pay.md +441 -0
- package/skills/ios/hig-technologies/references/augmented-reality.md +247 -0
- package/skills/ios/hig-technologies/references/carekit.md +224 -0
- package/skills/ios/hig-technologies/references/carplay.md +119 -0
- package/skills/ios/hig-technologies/references/game-center.md +343 -0
- package/skills/ios/hig-technologies/references/generative-ai.md +110 -0
- package/skills/ios/hig-technologies/references/healthkit.md +120 -0
- package/skills/ios/hig-technologies/references/homekit.md +343 -0
- package/skills/ios/hig-technologies/references/icloud.md +52 -0
- package/skills/ios/hig-technologies/references/id-verifier.md +73 -0
- package/skills/ios/hig-technologies/references/imessage-apps-and-stickers.md +105 -0
- package/skills/ios/hig-technologies/references/in-app-purchase.md +263 -0
- package/skills/ios/hig-technologies/references/live-photos.md +54 -0
- package/skills/ios/hig-technologies/references/mac-catalyst.md +216 -0
- package/skills/ios/hig-technologies/references/machine-learning.md +394 -0
- package/skills/ios/hig-technologies/references/maps.md +221 -0
- package/skills/ios/hig-technologies/references/nfc.md +51 -0
- package/skills/ios/hig-technologies/references/photo-editing.md +40 -0
- package/skills/ios/hig-technologies/references/researchkit.md +134 -0
- package/skills/ios/hig-technologies/references/shareplay.md +142 -0
- package/skills/ios/hig-technologies/references/shazamkit.md +47 -0
- package/skills/ios/hig-technologies/references/sign-in-with-apple.md +288 -0
- package/skills/ios/hig-technologies/references/siri.md +523 -0
- package/skills/ios/hig-technologies/references/tap-to-pay-on-iphone.md +208 -0
- package/skills/ios/hig-technologies/references/voiceover.md +90 -0
- package/skills/ios/hig-technologies/references/wallet.md +420 -0
- package/skills/ios/ios-bootstrap/SKILL.md +16 -7
- package/skills/ios/swift-actor-persistence/SKILL.md +143 -0
- package/skills/ios/swift-concurrency-6-2/SKILL.md +216 -0
- package/skills/ios/swift-protocol-di-testing/SKILL.md +190 -0
- package/skills/ios/swiftui-design-tokens/SKILL.md +475 -0
- package/skills/ios/writing-for-interfaces/SKILL.md +75 -0
- package/skills/web/accessibility/SKILL.md +146 -0
- package/skills/web/aceternity-ui/SKILL.md +719 -0
- package/skills/web/aceternity-ui/metadata.json +10 -0
- package/skills/web/api-design/SKILL.md +523 -0
- package/skills/web/chart-accessibility/SKILL.md +332 -0
- package/skills/web/composition-patterns/AGENTS.md +946 -0
- package/skills/web/composition-patterns/README.md +60 -0
- package/skills/web/composition-patterns/SKILL.md +89 -0
- package/skills/web/composition-patterns/metadata.json +11 -0
- package/skills/web/composition-patterns/rules/_sections.md +29 -0
- package/skills/web/composition-patterns/rules/_template.md +24 -0
- package/skills/web/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/skills/web/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/skills/web/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/skills/web/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/skills/web/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/skills/web/composition-patterns/rules/state-context-interface.md +191 -0
- package/skills/web/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/skills/web/composition-patterns/rules/state-lift-state.md +125 -0
- package/skills/web/cost-aware-llm-pipeline/SKILL.md +183 -0
- package/skills/web/database-migrations/SKILL.md +429 -0
- package/skills/web/deployment-patterns/SKILL.md +427 -0
- package/skills/web/docker-patterns/SKILL.md +364 -0
- package/skills/web/e2e-testing/SKILL.md +326 -0
- package/skills/web/lighthouse-ci/SKILL.md +361 -0
- package/skills/web/mcp-server-patterns/SKILL.md +69 -0
- package/skills/web/next-best-practices/SKILL.md +153 -0
- package/skills/web/next-best-practices/async-patterns.md +87 -0
- package/skills/web/next-best-practices/bundling.md +180 -0
- package/skills/web/next-best-practices/data-patterns.md +297 -0
- package/skills/web/next-best-practices/debug-tricks.md +105 -0
- package/skills/web/next-best-practices/directives.md +73 -0
- package/skills/web/next-best-practices/error-handling.md +227 -0
- package/skills/web/next-best-practices/file-conventions.md +140 -0
- package/skills/web/next-best-practices/font.md +245 -0
- package/skills/web/next-best-practices/functions.md +108 -0
- package/skills/web/next-best-practices/hydration-error.md +91 -0
- package/skills/web/next-best-practices/image.md +173 -0
- package/skills/web/next-best-practices/metadata.md +301 -0
- package/skills/web/next-best-practices/parallel-routes.md +287 -0
- package/skills/web/next-best-practices/route-handlers.md +146 -0
- package/skills/web/next-best-practices/rsc-boundaries.md +159 -0
- package/skills/web/next-best-practices/runtime-selection.md +39 -0
- package/skills/web/next-best-practices/scripts.md +141 -0
- package/skills/web/next-best-practices/self-hosting.md +371 -0
- package/skills/web/next-best-practices/suspense-boundaries.md +67 -0
- package/skills/web/next-cache-components/SKILL.md +411 -0
- package/skills/web/postgres-best-practices/SKILL.md +14 -0
- package/skills/web/postgres-best-practices/references/schema-design.md +9 -0
- package/skills/web/react-best-practices/AGENTS.md +3810 -0
- package/skills/web/react-best-practices/README.md +123 -0
- package/skills/web/react-best-practices/SKILL.md +149 -0
- package/skills/web/react-best-practices/metadata.json +15 -0
- package/skills/web/react-best-practices/rules/_sections.md +46 -0
- package/skills/web/react-best-practices/rules/_template.md +28 -0
- package/skills/web/react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/skills/web/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/skills/web/react-best-practices/rules/advanced-init-once.md +42 -0
- package/skills/web/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/skills/web/react-best-practices/rules/async-api-routes.md +38 -0
- package/skills/web/react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/skills/web/react-best-practices/rules/async-defer-await.md +82 -0
- package/skills/web/react-best-practices/rules/async-dependencies.md +51 -0
- package/skills/web/react-best-practices/rules/async-parallel.md +28 -0
- package/skills/web/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/skills/web/react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/skills/web/react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/skills/web/react-best-practices/rules/bundle-conditional.md +31 -0
- package/skills/web/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/skills/web/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/skills/web/react-best-practices/rules/bundle-preload.md +50 -0
- package/skills/web/react-best-practices/rules/client-event-listeners.md +74 -0
- package/skills/web/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/skills/web/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/skills/web/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/skills/web/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/skills/web/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/skills/web/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/skills/web/react-best-practices/rules/js-cache-storage.md +70 -0
- package/skills/web/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/skills/web/react-best-practices/rules/js-early-exit.md +50 -0
- package/skills/web/react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/skills/web/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/skills/web/react-best-practices/rules/js-index-maps.md +37 -0
- package/skills/web/react-best-practices/rules/js-length-check-first.md +49 -0
- package/skills/web/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/skills/web/react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/skills/web/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/skills/web/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/skills/web/react-best-practices/rules/rendering-activity.md +26 -0
- package/skills/web/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/skills/web/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/skills/web/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/skills/web/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/skills/web/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/skills/web/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/skills/web/react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/skills/web/react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/skills/web/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/skills/web/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/skills/web/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/skills/web/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/skills/web/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/skills/web/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/skills/web/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/skills/web/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/skills/web/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/skills/web/react-best-practices/rules/rerender-memo.md +44 -0
- package/skills/web/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/skills/web/react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/skills/web/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/skills/web/react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/skills/web/react-best-practices/rules/rerender-transitions.md +40 -0
- package/skills/web/react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/skills/web/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/skills/web/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/skills/web/react-best-practices/rules/server-auth-actions.md +96 -0
- package/skills/web/react-best-practices/rules/server-cache-lru.md +41 -0
- package/skills/web/react-best-practices/rules/server-cache-react.md +76 -0
- package/skills/web/react-best-practices/rules/server-dedup-props.md +65 -0
- package/skills/web/react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/skills/web/react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/skills/web/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/skills/web/react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/skills/web/react-best-practices/rules/server-serialization.md +38 -0
- package/skills/web/seo/SKILL.md +154 -0
- package/skills/web/web-design-guidelines/SKILL.md +39 -0
- package/skills/web/zap-scan-config/SKILL.md +444 -0
- package/skills/web/zap-scan-config/assets/.gitkeep +9 -0
- package/skills/web/zap-scan-config/assets/github_action.yml +207 -0
- package/skills/web/zap-scan-config/assets/gitlab_ci.yml +226 -0
- package/skills/web/zap-scan-config/assets/zap_automation.yaml +196 -0
- package/skills/web/zap-scan-config/assets/zap_context.xml +192 -0
- package/skills/web/zap-scan-config/references/EXAMPLE.md +40 -0
- package/skills/web/zap-scan-config/references/api_testing_guide.md +475 -0
- package/skills/web/zap-scan-config/references/authentication_guide.md +431 -0
- package/skills/web/zap-scan-config/references/false_positive_handling.md +427 -0
- package/skills/web/zap-scan-config/references/owasp_mapping.md +255 -0
- package/src/lrr/aggregator.ts +80 -0
- package/src/orchestrator/hooks/context-header.ts +95 -0
- package/src/orchestrator/hooks/token-accounting-emitter.ts +77 -0
- package/src/orchestrator/hooks/token-accounting.ts +101 -0
- package/src/orchestrator/mcp/cycle-counter.ts +129 -0
- package/src/orchestrator/mcp/scribe.ts +283 -0
- package/src/orchestrator/mcp/state-save.ts +149 -0
- package/src/orchestrator/mcp/write-lease.ts +167 -0
- package/src/orchestrator/phase4-shared-context.ts +41 -0
- package/src/orchestrator/schemas/backward-edge.ts +46 -0
- package/agents/agentic-identity-trust.md +0 -121
- package/agents/data-consolidation-agent.md +0 -39
- package/agents/design-image-prompt-engineer.md +0 -105
- package/agents/design-visual-storyteller.md +0 -147
- package/agents/design-whimsy-injector.md +0 -89
- package/agents/engineering-autonomous-optimization-architect.md +0 -105
- package/agents/market-intel.md +0 -35
- package/agents/marketing-instagram-curator.md +0 -111
- package/agents/marketing-reddit-community-builder.md +0 -121
- package/agents/marketing-social-media-strategist.md +0 -74
- package/agents/marketing-tiktok-strategist.md +0 -123
- package/agents/marketing-twitter-engager.md +0 -124
- package/agents/marketing-wechat-official-account.md +0 -143
- package/agents/marketing-xiaohongshu-specialist.md +0 -136
- package/agents/marketing-zhihu-strategist.md +0 -160
- package/agents/product-behavioral-nudge-engine.md +0 -78
- package/agents/project-management-experiment-tracker.md +0 -102
- package/agents/report-distribution-agent.md +0 -43
- package/agents/risk-analysis.md +0 -45
- package/agents/sales-data-extraction-agent.md +0 -46
- package/agents/specialized-cultural-intelligence-strategist.md +0 -65
- package/agents/specialized-developer-advocate.md +0 -146
- package/agents/support-analytics-reporter.md +0 -133
- package/agents/support-executive-summary-generator.md +0 -64
- package/agents/support-finance-tracker.md +0 -145
- package/agents/support-legal-compliance-checker.md +0 -129
- package/agents/support-support-responder.md +0 -91
- package/agents/testing-accessibility-auditor.md +0 -110
- package/agents/testing-test-results-analyzer.md +0 -97
- package/agents/testing-tool-evaluator.md +0 -76
- package/agents/testing-workflow-optimizer.md +0 -99
- package/agents/user-research.md +0 -40
- package/protocols/brainstorm.md +0 -99
- package/protocols/design.md +0 -269
- package/protocols/planning.md +0 -87
- package/skills/ios/ios-hig/SKILL.md +0 -41
- package/skills/ios/ios-hig/references/accessibility.md +0 -81
- package/skills/ios/ios-hig/references/content.md +0 -142
- package/skills/ios/ios-hig/references/feedback.md +0 -123
- package/skills/ios/ios-hig/references/interaction.md +0 -199
- package/skills/ios/ios-hig/references/performance-platform.md +0 -129
- package/skills/ios/ios-hig/references/privacy-permissions.md +0 -181
- package/skills/ios/ios-hig/references/visual-design.md +0 -84
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance
|
|
3
|
+
description: Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: web-quality-skills
|
|
7
|
+
version: "1.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Performance optimization
|
|
11
|
+
|
|
12
|
+
Deep performance optimization based on Lighthouse performance audits. Focuses on loading speed, runtime efficiency, and resource optimization.
|
|
13
|
+
|
|
14
|
+
## How it works
|
|
15
|
+
|
|
16
|
+
1. Identify performance bottlenecks in code and assets
|
|
17
|
+
2. Prioritize by impact on Core Web Vitals
|
|
18
|
+
3. Provide specific optimizations with code examples
|
|
19
|
+
4. Measure improvement with before/after metrics
|
|
20
|
+
|
|
21
|
+
## Performance budget
|
|
22
|
+
|
|
23
|
+
| Resource | Budget | Rationale |
|
|
24
|
+
|----------|--------|-----------|
|
|
25
|
+
| Total page weight | < 1.5 MB | 3G loads in ~4s |
|
|
26
|
+
| JavaScript (compressed) | < 300 KB | Parsing + execution time |
|
|
27
|
+
| CSS (compressed) | < 100 KB | Render blocking |
|
|
28
|
+
| Images (above-fold) | < 500 KB | LCP impact |
|
|
29
|
+
| Fonts | < 100 KB | FOIT/FOUT prevention |
|
|
30
|
+
| Third-party | < 200 KB | Uncontrolled latency |
|
|
31
|
+
|
|
32
|
+
## Critical rendering path
|
|
33
|
+
|
|
34
|
+
### Server response
|
|
35
|
+
* **TTFB < 800ms.** Time to First Byte should be fast. Use CDN, caching, and efficient backends.
|
|
36
|
+
* **Enable compression.** Gzip or Brotli for text assets. Brotli preferred (15-20% smaller).
|
|
37
|
+
* **HTTP/2 or HTTP/3.** Multiplexing reduces connection overhead.
|
|
38
|
+
* **Edge caching.** Cache HTML at CDN edge when possible.
|
|
39
|
+
|
|
40
|
+
### Resource loading
|
|
41
|
+
|
|
42
|
+
**Preconnect to required origins:**
|
|
43
|
+
```html
|
|
44
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
45
|
+
<link rel="preconnect" href="https://cdn.example.com" crossorigin>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Preload critical resources:**
|
|
49
|
+
```html
|
|
50
|
+
<!-- LCP image -->
|
|
51
|
+
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">
|
|
52
|
+
|
|
53
|
+
<!-- Critical font -->
|
|
54
|
+
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Defer non-critical CSS:**
|
|
58
|
+
```html
|
|
59
|
+
<!-- Critical CSS inlined -->
|
|
60
|
+
<style>/* Above-fold styles */</style>
|
|
61
|
+
|
|
62
|
+
<!-- Non-critical CSS -->
|
|
63
|
+
<link rel="preload" href="/styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
|
64
|
+
<noscript><link rel="stylesheet" href="/styles.css"></noscript>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### JavaScript optimization
|
|
68
|
+
|
|
69
|
+
**Defer non-essential scripts:**
|
|
70
|
+
```html
|
|
71
|
+
<!-- Parser-blocking (avoid) -->
|
|
72
|
+
<script src="/critical.js"></script>
|
|
73
|
+
|
|
74
|
+
<!-- Deferred (preferred) -->
|
|
75
|
+
<script defer src="/app.js"></script>
|
|
76
|
+
|
|
77
|
+
<!-- Async (for independent scripts) -->
|
|
78
|
+
<script async src="/analytics.js"></script>
|
|
79
|
+
|
|
80
|
+
<!-- Module (deferred by default) -->
|
|
81
|
+
<script type="module" src="/app.mjs"></script>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Code splitting patterns:**
|
|
85
|
+
```javascript
|
|
86
|
+
// Route-based splitting
|
|
87
|
+
const Dashboard = lazy(() => import('./Dashboard'));
|
|
88
|
+
|
|
89
|
+
// Component-based splitting
|
|
90
|
+
const HeavyChart = lazy(() => import('./HeavyChart'));
|
|
91
|
+
|
|
92
|
+
// Feature-based splitting
|
|
93
|
+
if (user.isPremium) {
|
|
94
|
+
const PremiumFeatures = await import('./PremiumFeatures');
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Tree shaking best practices:**
|
|
99
|
+
```javascript
|
|
100
|
+
// ❌ Imports entire library
|
|
101
|
+
import _ from 'lodash';
|
|
102
|
+
_.debounce(fn, 300);
|
|
103
|
+
|
|
104
|
+
// ✅ Imports only what's needed
|
|
105
|
+
import debounce from 'lodash/debounce';
|
|
106
|
+
debounce(fn, 300);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Image optimization
|
|
110
|
+
|
|
111
|
+
### Format selection
|
|
112
|
+
| Format | Use case | Browser support |
|
|
113
|
+
|--------|----------|-----------------|
|
|
114
|
+
| AVIF | Photos, best compression | 92%+ |
|
|
115
|
+
| WebP | Photos, good fallback | 97%+ |
|
|
116
|
+
| PNG | Graphics with transparency | Universal |
|
|
117
|
+
| SVG | Icons, logos, illustrations | Universal |
|
|
118
|
+
|
|
119
|
+
### Responsive images
|
|
120
|
+
```html
|
|
121
|
+
<picture>
|
|
122
|
+
<!-- AVIF for modern browsers -->
|
|
123
|
+
<source
|
|
124
|
+
type="image/avif"
|
|
125
|
+
srcset="hero-400.avif 400w,
|
|
126
|
+
hero-800.avif 800w,
|
|
127
|
+
hero-1200.avif 1200w"
|
|
128
|
+
sizes="(max-width: 600px) 100vw, 50vw">
|
|
129
|
+
|
|
130
|
+
<!-- WebP fallback -->
|
|
131
|
+
<source
|
|
132
|
+
type="image/webp"
|
|
133
|
+
srcset="hero-400.webp 400w,
|
|
134
|
+
hero-800.webp 800w,
|
|
135
|
+
hero-1200.webp 1200w"
|
|
136
|
+
sizes="(max-width: 600px) 100vw, 50vw">
|
|
137
|
+
|
|
138
|
+
<!-- JPEG fallback -->
|
|
139
|
+
<img
|
|
140
|
+
src="hero-800.jpg"
|
|
141
|
+
srcset="hero-400.jpg 400w,
|
|
142
|
+
hero-800.jpg 800w,
|
|
143
|
+
hero-1200.jpg 1200w"
|
|
144
|
+
sizes="(max-width: 600px) 100vw, 50vw"
|
|
145
|
+
width="1200"
|
|
146
|
+
height="600"
|
|
147
|
+
alt="Hero image"
|
|
148
|
+
loading="lazy"
|
|
149
|
+
decoding="async">
|
|
150
|
+
</picture>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### LCP image priority
|
|
154
|
+
```html
|
|
155
|
+
<!-- Above-fold LCP image: eager loading, high priority -->
|
|
156
|
+
<img
|
|
157
|
+
src="hero.webp"
|
|
158
|
+
fetchpriority="high"
|
|
159
|
+
loading="eager"
|
|
160
|
+
decoding="sync"
|
|
161
|
+
alt="Hero">
|
|
162
|
+
|
|
163
|
+
<!-- Below-fold images: lazy loading -->
|
|
164
|
+
<img
|
|
165
|
+
src="product.webp"
|
|
166
|
+
loading="lazy"
|
|
167
|
+
decoding="async"
|
|
168
|
+
alt="Product">
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Font optimization
|
|
172
|
+
|
|
173
|
+
### Loading strategy
|
|
174
|
+
```css
|
|
175
|
+
/* System font stack as fallback */
|
|
176
|
+
body {
|
|
177
|
+
font-family: 'Custom Font', -apple-system, BlinkMacSystemFont,
|
|
178
|
+
'Segoe UI', Roboto, sans-serif;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Prevent invisible text */
|
|
182
|
+
@font-face {
|
|
183
|
+
font-family: 'Custom Font';
|
|
184
|
+
src: url('/fonts/custom.woff2') format('woff2');
|
|
185
|
+
font-display: swap; /* or optional for non-critical */
|
|
186
|
+
font-weight: 400;
|
|
187
|
+
font-style: normal;
|
|
188
|
+
unicode-range: U+0000-00FF; /* Subset to Latin */
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Preloading critical fonts
|
|
193
|
+
```html
|
|
194
|
+
<link rel="preload" href="/fonts/heading.woff2" as="font" type="font/woff2" crossorigin>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Variable fonts
|
|
198
|
+
```css
|
|
199
|
+
/* One file instead of multiple weights */
|
|
200
|
+
@font-face {
|
|
201
|
+
font-family: 'Inter';
|
|
202
|
+
src: url('/fonts/Inter-Variable.woff2') format('woff2-variations');
|
|
203
|
+
font-weight: 100 900;
|
|
204
|
+
font-display: swap;
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Caching strategy
|
|
209
|
+
|
|
210
|
+
### Cache-Control headers
|
|
211
|
+
```
|
|
212
|
+
# HTML (short or no cache)
|
|
213
|
+
Cache-Control: no-cache, must-revalidate
|
|
214
|
+
|
|
215
|
+
# Static assets with hash (immutable)
|
|
216
|
+
Cache-Control: public, max-age=31536000, immutable
|
|
217
|
+
|
|
218
|
+
# Static assets without hash
|
|
219
|
+
Cache-Control: public, max-age=86400, stale-while-revalidate=604800
|
|
220
|
+
|
|
221
|
+
# API responses
|
|
222
|
+
Cache-Control: private, max-age=0, must-revalidate
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Service worker caching
|
|
226
|
+
```javascript
|
|
227
|
+
// Cache-first for static assets
|
|
228
|
+
self.addEventListener('fetch', (event) => {
|
|
229
|
+
if (event.request.destination === 'image' ||
|
|
230
|
+
event.request.destination === 'style' ||
|
|
231
|
+
event.request.destination === 'script') {
|
|
232
|
+
event.respondWith(
|
|
233
|
+
caches.match(event.request).then((cached) => {
|
|
234
|
+
return cached || fetch(event.request).then((response) => {
|
|
235
|
+
const clone = response.clone();
|
|
236
|
+
caches.open('static-v1').then((cache) => cache.put(event.request, clone));
|
|
237
|
+
return response;
|
|
238
|
+
});
|
|
239
|
+
})
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Runtime performance
|
|
246
|
+
|
|
247
|
+
### Avoid layout thrashing
|
|
248
|
+
```javascript
|
|
249
|
+
// ❌ Forces multiple reflows
|
|
250
|
+
elements.forEach(el => {
|
|
251
|
+
const height = el.offsetHeight; // Read
|
|
252
|
+
el.style.height = height + 10 + 'px'; // Write
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// ✅ Batch reads, then batch writes
|
|
256
|
+
const heights = elements.map(el => el.offsetHeight); // All reads
|
|
257
|
+
elements.forEach((el, i) => {
|
|
258
|
+
el.style.height = heights[i] + 10 + 'px'; // All writes
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Debounce expensive operations
|
|
263
|
+
```javascript
|
|
264
|
+
function debounce(fn, delay) {
|
|
265
|
+
let timeout;
|
|
266
|
+
return (...args) => {
|
|
267
|
+
clearTimeout(timeout);
|
|
268
|
+
timeout = setTimeout(() => fn(...args), delay);
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Debounce scroll/resize handlers
|
|
273
|
+
window.addEventListener('scroll', debounce(handleScroll, 100));
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Use requestAnimationFrame
|
|
277
|
+
```javascript
|
|
278
|
+
// ❌ May cause jank
|
|
279
|
+
setInterval(animate, 16);
|
|
280
|
+
|
|
281
|
+
// ✅ Synced with display refresh
|
|
282
|
+
function animate() {
|
|
283
|
+
// Animation logic
|
|
284
|
+
requestAnimationFrame(animate);
|
|
285
|
+
}
|
|
286
|
+
requestAnimationFrame(animate);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Virtualize long lists
|
|
290
|
+
```javascript
|
|
291
|
+
// For lists > 100 items, render only visible items
|
|
292
|
+
// Use libraries like react-window, vue-virtual-scroller, or native CSS:
|
|
293
|
+
.virtual-list {
|
|
294
|
+
content-visibility: auto;
|
|
295
|
+
contain-intrinsic-size: 0 50px; /* Estimated item height */
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Third-party scripts
|
|
300
|
+
|
|
301
|
+
### Load strategies
|
|
302
|
+
```javascript
|
|
303
|
+
// ❌ Blocks main thread
|
|
304
|
+
<script src="https://analytics.example.com/script.js"></script>
|
|
305
|
+
|
|
306
|
+
// ✅ Async loading
|
|
307
|
+
<script async src="https://analytics.example.com/script.js"></script>
|
|
308
|
+
|
|
309
|
+
// ✅ Delay until interaction
|
|
310
|
+
<script>
|
|
311
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
312
|
+
const observer = new IntersectionObserver((entries) => {
|
|
313
|
+
if (entries[0].isIntersecting) {
|
|
314
|
+
const script = document.createElement('script');
|
|
315
|
+
script.src = 'https://widget.example.com/embed.js';
|
|
316
|
+
document.body.appendChild(script);
|
|
317
|
+
observer.disconnect();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
observer.observe(document.querySelector('#widget-container'));
|
|
321
|
+
});
|
|
322
|
+
</script>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Facade pattern
|
|
326
|
+
```html
|
|
327
|
+
<!-- Show static placeholder until interaction -->
|
|
328
|
+
<div class="youtube-facade"
|
|
329
|
+
data-video-id="abc123"
|
|
330
|
+
onclick="loadYouTube(this)">
|
|
331
|
+
<img src="/thumbnails/abc123.jpg" alt="Video title">
|
|
332
|
+
<button aria-label="Play video">▶</button>
|
|
333
|
+
</div>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Measurement
|
|
337
|
+
|
|
338
|
+
### Key metrics
|
|
339
|
+
| Metric | Target | Tool |
|
|
340
|
+
|--------|--------|------|
|
|
341
|
+
| LCP | < 2.5s | Lighthouse, CrUX |
|
|
342
|
+
| FCP | < 1.8s | Lighthouse |
|
|
343
|
+
| Speed Index | < 3.4s | Lighthouse |
|
|
344
|
+
| TBT | < 200ms | Lighthouse |
|
|
345
|
+
| TTI | < 3.8s | Lighthouse |
|
|
346
|
+
|
|
347
|
+
### Testing commands
|
|
348
|
+
```bash
|
|
349
|
+
# Lighthouse CLI
|
|
350
|
+
npx lighthouse https://example.com --output html --output-path report.html
|
|
351
|
+
|
|
352
|
+
# Web Vitals library
|
|
353
|
+
import {onLCP, onINP, onCLS} from 'web-vitals';
|
|
354
|
+
onLCP(console.log);
|
|
355
|
+
onINP(console.log);
|
|
356
|
+
onCLS(console.log);
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## References
|
|
360
|
+
|
|
361
|
+
For Core Web Vitals specific optimizations, see [Core Web Vitals](../core-web-vitals/SKILL.md).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-server-patterns
|
|
3
|
+
description: Build MCP servers with Node/TypeScript SDK — tools, resources, prompts, Zod validation, stdio vs Streamable HTTP. Use Context7 or official MCP docs for latest API.
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCP Server Patterns
|
|
8
|
+
|
|
9
|
+
The Model Context Protocol (MCP) lets AI assistants call tools, read resources, and use prompts from your server. Use this skill when building or maintaining MCP servers. The SDK API evolves; check Context7 (query-docs for "MCP") or the official MCP documentation for current method names and signatures.
|
|
10
|
+
|
|
11
|
+
For the broader routing decision of when a capability should be a rule, a skill, MCP, or a plain CLI/API workflow, see [docs/capability-surface-selection.md](../../docs/capability-surface-selection.md).
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
Use when: implementing a new MCP server, adding tools or resources, choosing stdio vs HTTP, upgrading the SDK, or debugging MCP registration and transport issues.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
### Core concepts
|
|
20
|
+
|
|
21
|
+
- **Tools**: Actions the model can invoke (e.g. search, run a command). Register with `registerTool()` or `tool()` depending on SDK version.
|
|
22
|
+
- **Resources**: Read-only data the model can fetch (e.g. file contents, API responses). Register with `registerResource()` or `resource()`. Handlers typically receive a `uri` argument.
|
|
23
|
+
- **Prompts**: Reusable, parameterised prompt templates the client can surface (e.g. in Claude Desktop). Register with `registerPrompt()` or equivalent.
|
|
24
|
+
- **Transport**: stdio for local clients (e.g. Claude Desktop); Streamable HTTP is preferred for remote (Cursor, cloud). Legacy HTTP/SSE is for backward compatibility.
|
|
25
|
+
|
|
26
|
+
The Node/TypeScript SDK may expose `tool()` / `resource()` or `registerTool()` / `registerResource()`; the official SDK has changed over time. Always verify against the current [MCP docs](https://modelcontextprotocol.io) or Context7.
|
|
27
|
+
|
|
28
|
+
### Connecting with stdio
|
|
29
|
+
|
|
30
|
+
For local clients, create a stdio transport and pass it to your server’s connect method. The exact API varies by SDK version (e.g. constructor vs factory). See the official MCP documentation or query Context7 for "MCP stdio server" for the current pattern.
|
|
31
|
+
|
|
32
|
+
Keep server logic (tools + resources) independent of transport so you can plug in stdio or HTTP in the entrypoint.
|
|
33
|
+
|
|
34
|
+
### Remote (Streamable HTTP)
|
|
35
|
+
|
|
36
|
+
For Cursor, cloud, or other remote clients, use **Streamable HTTP** (single MCP HTTP endpoint per current spec). Support legacy HTTP/SSE only when backward compatibility is required.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Install and server setup
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install @modelcontextprotocol/sdk zod
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
48
|
+
import { z } from "zod";
|
|
49
|
+
|
|
50
|
+
const server = new McpServer({ name: "my-server", version: "1.0.0" });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Register tools and resources using the API your SDK version provides: some versions use `server.tool(name, description, schema, handler)` (positional args), others use `server.tool({ name, description, inputSchema }, handler)` or `registerTool()`. Same for resources — include a `uri` in the handler when the API provides it. Check the official MCP docs or Context7 for the current `@modelcontextprotocol/sdk` signatures to avoid copy-paste errors.
|
|
54
|
+
|
|
55
|
+
Use **Zod** (or the SDK’s preferred schema format) for input validation.
|
|
56
|
+
|
|
57
|
+
## Best Practices
|
|
58
|
+
|
|
59
|
+
- **Schema first**: Define input schemas for every tool; document parameters and return shape.
|
|
60
|
+
- **Errors**: Return structured errors or messages the model can interpret; avoid raw stack traces.
|
|
61
|
+
- **Idempotency**: Prefer idempotent tools where possible so retries are safe.
|
|
62
|
+
- **Rate and cost**: For tools that call external APIs, consider rate limits and cost; document in the tool description.
|
|
63
|
+
- **Versioning**: Pin SDK version in package.json; check release notes when upgrading.
|
|
64
|
+
|
|
65
|
+
## Official SDKs and Docs
|
|
66
|
+
|
|
67
|
+
- **JavaScript/TypeScript**: `@modelcontextprotocol/sdk` (npm). Use Context7 with library name "MCP" for current registration and transport patterns.
|
|
68
|
+
- **Go**: Official Go SDK on GitHub (`modelcontextprotocol/go-sdk`).
|
|
69
|
+
- **C#**: Official C# SDK for .NET.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: next-best-practices
|
|
3
|
+
description: Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Next.js Best Practices
|
|
8
|
+
|
|
9
|
+
Apply these rules when writing or reviewing Next.js code.
|
|
10
|
+
|
|
11
|
+
## File Conventions
|
|
12
|
+
|
|
13
|
+
See [file-conventions.md](./file-conventions.md) for:
|
|
14
|
+
- Project structure and special files
|
|
15
|
+
- Route segments (dynamic, catch-all, groups)
|
|
16
|
+
- Parallel and intercepting routes
|
|
17
|
+
- Middleware rename in v16 (middleware → proxy)
|
|
18
|
+
|
|
19
|
+
## RSC Boundaries
|
|
20
|
+
|
|
21
|
+
Detect invalid React Server Component patterns.
|
|
22
|
+
|
|
23
|
+
See [rsc-boundaries.md](./rsc-boundaries.md) for:
|
|
24
|
+
- Async client component detection (invalid)
|
|
25
|
+
- Non-serializable props detection
|
|
26
|
+
- Server Action exceptions
|
|
27
|
+
|
|
28
|
+
## Async Patterns
|
|
29
|
+
|
|
30
|
+
Next.js 15+ async API changes.
|
|
31
|
+
|
|
32
|
+
See [async-patterns.md](./async-patterns.md) for:
|
|
33
|
+
- Async `params` and `searchParams`
|
|
34
|
+
- Async `cookies()` and `headers()`
|
|
35
|
+
- Migration codemod
|
|
36
|
+
|
|
37
|
+
## Runtime Selection
|
|
38
|
+
|
|
39
|
+
See [runtime-selection.md](./runtime-selection.md) for:
|
|
40
|
+
- Default to Node.js runtime
|
|
41
|
+
- When Edge runtime is appropriate
|
|
42
|
+
|
|
43
|
+
## Directives
|
|
44
|
+
|
|
45
|
+
See [directives.md](./directives.md) for:
|
|
46
|
+
- `'use client'`, `'use server'` (React)
|
|
47
|
+
- `'use cache'` (Next.js)
|
|
48
|
+
|
|
49
|
+
## Functions
|
|
50
|
+
|
|
51
|
+
See [functions.md](./functions.md) for:
|
|
52
|
+
- Navigation hooks: `useRouter`, `usePathname`, `useSearchParams`, `useParams`
|
|
53
|
+
- Server functions: `cookies`, `headers`, `draftMode`, `after`
|
|
54
|
+
- Generate functions: `generateStaticParams`, `generateMetadata`
|
|
55
|
+
|
|
56
|
+
## Error Handling
|
|
57
|
+
|
|
58
|
+
See [error-handling.md](./error-handling.md) for:
|
|
59
|
+
- `error.tsx`, `global-error.tsx`, `not-found.tsx`
|
|
60
|
+
- `redirect`, `permanentRedirect`, `notFound`
|
|
61
|
+
- `forbidden`, `unauthorized` (auth errors)
|
|
62
|
+
- `unstable_rethrow` for catch blocks
|
|
63
|
+
|
|
64
|
+
## Data Patterns
|
|
65
|
+
|
|
66
|
+
See [data-patterns.md](./data-patterns.md) for:
|
|
67
|
+
- Server Components vs Server Actions vs Route Handlers
|
|
68
|
+
- Avoiding data waterfalls (`Promise.all`, Suspense, preload)
|
|
69
|
+
- Client component data fetching
|
|
70
|
+
|
|
71
|
+
## Route Handlers
|
|
72
|
+
|
|
73
|
+
See [route-handlers.md](./route-handlers.md) for:
|
|
74
|
+
- `route.ts` basics
|
|
75
|
+
- GET handler conflicts with `page.tsx`
|
|
76
|
+
- Environment behavior (no React DOM)
|
|
77
|
+
- When to use vs Server Actions
|
|
78
|
+
|
|
79
|
+
## Metadata & OG Images
|
|
80
|
+
|
|
81
|
+
See [metadata.md](./metadata.md) for:
|
|
82
|
+
- Static and dynamic metadata
|
|
83
|
+
- `generateMetadata` function
|
|
84
|
+
- OG image generation with `next/og`
|
|
85
|
+
- File-based metadata conventions
|
|
86
|
+
|
|
87
|
+
## Image Optimization
|
|
88
|
+
|
|
89
|
+
See [image.md](./image.md) for:
|
|
90
|
+
- Always use `next/image` over `<img>`
|
|
91
|
+
- Remote images configuration
|
|
92
|
+
- Responsive `sizes` attribute
|
|
93
|
+
- Blur placeholders
|
|
94
|
+
- Priority loading for LCP
|
|
95
|
+
|
|
96
|
+
## Font Optimization
|
|
97
|
+
|
|
98
|
+
See [font.md](./font.md) for:
|
|
99
|
+
- `next/font` setup
|
|
100
|
+
- Google Fonts, local fonts
|
|
101
|
+
- Tailwind CSS integration
|
|
102
|
+
- Preloading subsets
|
|
103
|
+
|
|
104
|
+
## Bundling
|
|
105
|
+
|
|
106
|
+
See [bundling.md](./bundling.md) for:
|
|
107
|
+
- Server-incompatible packages
|
|
108
|
+
- CSS imports (not link tags)
|
|
109
|
+
- Polyfills (already included)
|
|
110
|
+
- ESM/CommonJS issues
|
|
111
|
+
- Bundle analysis
|
|
112
|
+
|
|
113
|
+
## Scripts
|
|
114
|
+
|
|
115
|
+
See [scripts.md](./scripts.md) for:
|
|
116
|
+
- `next/script` vs native script tags
|
|
117
|
+
- Inline scripts need `id`
|
|
118
|
+
- Loading strategies
|
|
119
|
+
- Google Analytics with `@next/third-parties`
|
|
120
|
+
|
|
121
|
+
## Hydration Errors
|
|
122
|
+
|
|
123
|
+
See [hydration-error.md](./hydration-error.md) for:
|
|
124
|
+
- Common causes (browser APIs, dates, invalid HTML)
|
|
125
|
+
- Debugging with error overlay
|
|
126
|
+
- Fixes for each cause
|
|
127
|
+
|
|
128
|
+
## Suspense Boundaries
|
|
129
|
+
|
|
130
|
+
See [suspense-boundaries.md](./suspense-boundaries.md) for:
|
|
131
|
+
- CSR bailout with `useSearchParams` and `usePathname`
|
|
132
|
+
- Which hooks require Suspense boundaries
|
|
133
|
+
|
|
134
|
+
## Parallel & Intercepting Routes
|
|
135
|
+
|
|
136
|
+
See [parallel-routes.md](./parallel-routes.md) for:
|
|
137
|
+
- Modal patterns with `@slot` and `(.)` interceptors
|
|
138
|
+
- `default.tsx` for fallbacks
|
|
139
|
+
- Closing modals correctly with `router.back()`
|
|
140
|
+
|
|
141
|
+
## Self-Hosting
|
|
142
|
+
|
|
143
|
+
See [self-hosting.md](./self-hosting.md) for:
|
|
144
|
+
- `output: 'standalone'` for Docker
|
|
145
|
+
- Cache handlers for multi-instance ISR
|
|
146
|
+
- What works vs needs extra setup
|
|
147
|
+
|
|
148
|
+
## Debug Tricks
|
|
149
|
+
|
|
150
|
+
See [debug-tricks.md](./debug-tricks.md) for:
|
|
151
|
+
- MCP endpoint for AI-assisted debugging
|
|
152
|
+
- Rebuild specific routes with `--debug-build-paths`
|
|
153
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Async Patterns
|
|
2
|
+
|
|
3
|
+
In Next.js 15+, `params`, `searchParams`, `cookies()`, and `headers()` are asynchronous.
|
|
4
|
+
|
|
5
|
+
## Async Params and SearchParams
|
|
6
|
+
|
|
7
|
+
Always type them as `Promise<...>` and await them.
|
|
8
|
+
|
|
9
|
+
### Pages and Layouts
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
type Props = { params: Promise<{ slug: string }> }
|
|
13
|
+
|
|
14
|
+
export default async function Page({ params }: Props) {
|
|
15
|
+
const { slug } = await params
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Route Handlers
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
export async function GET(
|
|
23
|
+
request: Request,
|
|
24
|
+
{ params }: { params: Promise<{ id: string }> }
|
|
25
|
+
) {
|
|
26
|
+
const { id } = await params
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### SearchParams
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
type Props = {
|
|
34
|
+
params: Promise<{ slug: string }>
|
|
35
|
+
searchParams: Promise<{ query?: string }>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default async function Page({ params, searchParams }: Props) {
|
|
39
|
+
const { slug } = await params
|
|
40
|
+
const { query } = await searchParams
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Synchronous Components
|
|
45
|
+
|
|
46
|
+
Use `React.use()` for non-async components:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { use } from 'react'
|
|
50
|
+
|
|
51
|
+
type Props = { params: Promise<{ slug: string }> }
|
|
52
|
+
|
|
53
|
+
export default function Page({ params }: Props) {
|
|
54
|
+
const { slug } = use(params)
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### generateMetadata
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
type Props = { params: Promise<{ slug: string }> }
|
|
62
|
+
|
|
63
|
+
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
64
|
+
const { slug } = await params
|
|
65
|
+
return { title: slug }
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Async Cookies and Headers
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { cookies, headers } from 'next/headers'
|
|
73
|
+
|
|
74
|
+
export default async function Page() {
|
|
75
|
+
const cookieStore = await cookies()
|
|
76
|
+
const headersList = await headers()
|
|
77
|
+
|
|
78
|
+
const theme = cookieStore.get('theme')
|
|
79
|
+
const userAgent = headersList.get('user-agent')
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Migration Codemod
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx @next/codemod@latest next-async-request-api .
|
|
87
|
+
```
|