@caddis/cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/bundles/antigravity-plugin-extras/plugin.json +5 -0
- package/bundles/antigravity-plugin-extras/skills/_registry.md +154 -0
- package/bundles/antigravity-plugin-extras/skills/agent-md-refactor/SKILL.md +356 -0
- package/bundles/antigravity-plugin-extras/skills/agent-orchestration/SKILL.md +517 -0
- package/bundles/antigravity-plugin-extras/skills/algorithmic-art/SKILL.md +293 -0
- package/bundles/antigravity-plugin-extras/skills/anchor-review/SKILL.md +135 -0
- package/bundles/antigravity-plugin-extras/skills/api-client-patterns/SKILL.md +367 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-design/SKILL.md +244 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-diagram/SKILL.md +156 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-document/SKILL.md +321 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/SKILL.md +74 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/init-artifact.sh +322 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/bundles/antigravity-plugin-extras/skills/ascii-art/SKILL.md +144 -0
- package/bundles/antigravity-plugin-extras/skills/asking-questions/SKILL.md +81 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/SKILL.md +118 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/cross-service/credential-management.md +450 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/browser/README.md +363 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/code-interpreter/README.md +232 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/README.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/deploy-template.sh +117 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/deployment-strategies.md +416 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/troubleshooting-guide.md +384 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/validate-deployment.sh +186 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/identity/README.md +186 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/memory/README.md +253 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/observability/README.md +517 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/runtime/README.md +215 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/SKILL.md +279 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/references/cdk-patterns.md +431 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/scripts/validate-stack.sh +240 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/SKILL.md +318 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/references/cloudwatch-alarms.md +567 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/references/operations-patterns.md +394 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/SKILL.md +758 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/deployment-best-practices.md +830 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/eda-patterns.md +1002 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/observability-best-practices.md +770 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/performance-optimization.md +671 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/security-best-practices.md +625 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/serverless-patterns.md +838 -0
- package/bundles/antigravity-plugin-extras/skills/backend-to-frontend-handoff/SKILL.md +139 -0
- package/bundles/antigravity-plugin-extras/skills/banner-design/SKILL.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/brand-design/SKILL.md +298 -0
- package/bundles/antigravity-plugin-extras/skills/brand-guidelines/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/brand-guidelines/SKILL.md +118 -0
- package/bundles/antigravity-plugin-extras/skills/brand-voice/SKILL.md +93 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/SKILL.md +392 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/agent-patterns.md +461 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/examples.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/state-patterns.md +360 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/troubleshooting.md +362 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/SKILL.md +266 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/examples.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/oauth-setup.md +338 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/troubleshooting.md +317 -0
- package/bundles/antigravity-plugin-extras/skills/caching-patterns/SKILL.md +385 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/SKILL.md +91 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/changelog-generator/SKILL.md +105 -0
- package/bundles/antigravity-plugin-extras/skills/code-explainer/SKILL.md +91 -0
- package/bundles/antigravity-plugin-extras/skills/competitive-ads-extractor/SKILL.md +294 -0
- package/bundles/antigravity-plugin-extras/skills/component-testing/SKILL.md +310 -0
- package/bundles/antigravity-plugin-extras/skills/content-research-writer/SKILL.md +539 -0
- package/bundles/antigravity-plugin-extras/skills/cross-review/SKILL.md +51 -0
- package/bundles/antigravity-plugin-extras/skills/data-analysis/SKILL.md +111 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/README.md +248 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/SKILL.md +203 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/adapter.py.template +44 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/api-router.py.template +43 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/contract-test.py.template +384 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/display-dto.py.template +39 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/frontend-service.ts.template +46 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/frontend-types.ts.template +38 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/ingestion-model.py.template +42 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/mapping-doc.md.template +46 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/normalizer.py.template +48 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/extract_requirements.md +36 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/extract_ui_demand.md +35 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/reconcile_mapping.md +66 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/query-catalog.md.template +62 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/consumer-driven-contracts.md +131 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/drift-check-catalog.md +305 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/layer-responsibilities.md +333 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/discover_connections.py +170 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/discover_sources.py +161 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/drift_check.py +171 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/extract_schema.py +1363 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/generate_gap_report.py +81 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/generate_mapping_doc.py +294 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/ts_dto_compare.py +214 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/validate_lineage.py +51 -0
- package/bundles/antigravity-plugin-extras/skills/data-loader/SKILL.md +753 -0
- package/bundles/antigravity-plugin-extras/skills/data-validation/SKILL.md +220 -0
- package/bundles/antigravity-plugin-extras/skills/db-testing/SKILL.md +117 -0
- package/bundles/antigravity-plugin-extras/skills/deploy-local/SKILL.md +259 -0
- package/bundles/antigravity-plugin-extras/skills/design-md/SKILL.md +167 -0
- package/bundles/antigravity-plugin-extras/skills/design-system-tokens/SKILL.md +240 -0
- package/bundles/antigravity-plugin-extras/skills/design-system-tokens/references/DESIGN-SYSTEM-TEMPLATE.md +577 -0
- package/bundles/antigravity-plugin-extras/skills/developer-growth-analysis/SKILL.md +323 -0
- package/bundles/antigravity-plugin-extras/skills/doc-coauthoring/SKILL.md +378 -0
- package/bundles/antigravity-plugin-extras/skills/documentation-analyzer/SKILL.md +78 -0
- package/bundles/antigravity-plugin-extras/skills/domain-name-brainstormer/SKILL.md +213 -0
- package/bundles/antigravity-plugin-extras/skills/enterprise-dashboard-aesthetic-system/SKILL.md +120 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/SKILL.md +193 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/element-types.md +497 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/excalidraw-schema.md +356 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/reliable-diagrams.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/README.md +60 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/add-arrow.py +354 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/add-icon-to-diagram.py +412 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/split-excalidraw-library.py +183 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/business-flow-swimlane-template.excalidraw +334 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/class-diagram-template.excalidraw +558 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/data-flow-diagram-template.excalidraw +279 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/er-diagram-template.excalidraw +662 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/flowchart-template.excalidraw +179 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/mindmap-template.excalidraw +244 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/relationship-template.excalidraw +145 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/reliable-flowchart.excalidraw +1 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/sequence-diagram-template.excalidraw +509 -0
- package/bundles/antigravity-plugin-extras/skills/file-organizer/SKILL.md +434 -0
- package/bundles/antigravity-plugin-extras/skills/game-changing-features/README.md +221 -0
- package/bundles/antigravity-plugin-extras/skills/game-changing-features/SKILL.md +265 -0
- package/bundles/antigravity-plugin-extras/skills/github-issues/SKILL.md +359 -0
- package/bundles/antigravity-plugin-extras/skills/github-issues/references/templates.md +90 -0
- package/bundles/antigravity-plugin-extras/skills/golden-nuggets/SKILL.md +192 -0
- package/bundles/antigravity-plugin-extras/skills/humanizer/SKILL.md +194 -0
- package/bundles/antigravity-plugin-extras/skills/image-enhancer/SKILL.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/intent-writer/SKILL.md +201 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/SKILL.md +124 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/3p-updates.md +47 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/faq-answers.md +30 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/general-comms.md +16 -0
- package/bundles/antigravity-plugin-extras/skills/invoice-organizer/SKILL.md +447 -0
- package/bundles/antigravity-plugin-extras/skills/jira-issues/SKILL.md +182 -0
- package/bundles/antigravity-plugin-extras/skills/job-application/SKILL.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/lead-research-assistant/SKILL.md +200 -0
- package/bundles/antigravity-plugin-extras/skills/llm-application-dev/SKILL.md +217 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/SKILL.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/evaluation.md +602 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/mcp_best_practices.md +915 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/node_mcp_server.md +916 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/python_mcp_server.md +752 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/connections.py +151 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/bundles/antigravity-plugin-extras/skills/meeting-insights-analyzer/SKILL.md +328 -0
- package/bundles/antigravity-plugin-extras/skills/monorepo/SKILL.md +267 -0
- package/bundles/antigravity-plugin-extras/skills/naming-analyzer/SKILL.md +376 -0
- package/bundles/antigravity-plugin-extras/skills/nextjs-app-router/SKILL.md +271 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/AUTHENTICATION.md +154 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/SKILL.md +270 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/api_reference.md +309 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/troubleshooting.md +376 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/usage_patterns.md +338 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/__init__.py +81 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/ask_question.py +256 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/auth_manager.py +358 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_session.py +255 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_utils.py +107 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/cleanup_manager.py +302 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/config.py +44 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/notebook_manager.py +410 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/run.py +102 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/setup_environment.py +204 -0
- package/bundles/antigravity-plugin-extras/skills/observability/SKILL.md +371 -0
- package/bundles/antigravity-plugin-extras/skills/onboard-project/SKILL.md +192 -0
- package/bundles/antigravity-plugin-extras/skills/performance-testing/SKILL.md +226 -0
- package/bundles/antigravity-plugin-extras/skills/pipeline-state/SKILL.md +208 -0
- package/bundles/antigravity-plugin-extras/skills/plantuml/SKILL.md +228 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/SKILL.md +142 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/linear.app.md +196 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/stripe.md +214 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/vercel.md +218 -0
- package/bundles/antigravity-plugin-extras/skills/prd-to-code/SKILL.md +127 -0
- package/bundles/antigravity-plugin-extras/skills/raffle-winner-picker/SKILL.md +159 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/README.md +320 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/SKILL.md +53 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/alternatives.md +258 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/anti-patterns.md +290 -0
- package/bundles/antigravity-plugin-extras/skills/receiving-code-review/SKILL.md +213 -0
- package/bundles/antigravity-plugin-extras/skills/relay/SKILL.md +246 -0
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/SKILL.md +105 -0
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/code-reviewer.md +146 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/SKILL.md +350 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/pwa-checklist.md +226 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/touch-and-interaction.md +265 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/transformation-catalogue.md +326 -0
- package/bundles/antigravity-plugin-extras/skills/schema-migration/SKILL.md +275 -0
- package/bundles/antigravity-plugin-extras/skills/setup-project-ai/SKILL.md +120 -0
- package/bundles/antigravity-plugin-extras/skills/shadcn-radix/SKILL.md +330 -0
- package/bundles/antigravity-plugin-extras/skills/sketch/SKILL.md +104 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/SKILL.md +646 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/color_palettes.py +302 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/easing.py +230 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/frame_composer.py +469 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/gif_builder.py +246 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/typography.py +357 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/validators.py +264 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/visual_effects.py +494 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/requirements.txt +4 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/bounce.py +106 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/explode.py +331 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/fade.py +329 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/flip.py +291 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/kaleidoscope.py +211 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/morph.py +329 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/move.py +293 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/pulse.py +268 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/shake.py +127 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/slide.py +291 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/spin.py +269 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/wiggle.py +300 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/zoom.py +312 -0
- package/bundles/antigravity-plugin-extras/skills/slides/SKILL.md +38 -0
- package/bundles/antigravity-plugin-extras/skills/state-tracking/SKILL.md +131 -0
- package/bundles/antigravity-plugin-extras/skills/streamlit-dev/SKILL.md +268 -0
- package/bundles/antigravity-plugin-extras/skills/svg-create/SKILL.md +251 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/SKILL.md +59 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/theme-showcase.pdf +0 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/desert-rose.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/golden-hour.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/ui-styling-patterns/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/ui-styling-patterns/SKILL.md +320 -0
- package/bundles/antigravity-plugin-extras/skills/ui-testing/SKILL.md +660 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/SKILL.md +660 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/_sync_all.py +414 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/app-interface.csv +31 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/charts.csv +26 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/colors.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/design.csv +1776 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/draft.csv +1779 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/google-fonts.csv +1924 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/icons.csv +106 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/landing.csv +35 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/products.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/react-performance.csv +45 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/styles.csv +85 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/typography.csv +74 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/ui-reasoning.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/ux-guidelines.csv +100 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/core.py +247 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/design_system.py +1067 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/search.py +114 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/SKILL.md +140 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/commands.md +252 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/graph-schema.md +116 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/pipeline.md +331 -0
- package/bundles/antigravity-plugin-extras/skills/update-readme/SKILL.md +74 -0
- package/bundles/antigravity-plugin-extras/skills/verification-loop/SKILL.md +209 -0
- package/bundles/antigravity-plugin-extras/skills/video-downloader/SKILL.md +107 -0
- package/bundles/antigravity-plugin-extras/skills/webapp-development/SKILL.md +288 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/SKILL.md +339 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/agents/agent-interface.md +175 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/html.md +384 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/nlp-keywords.md +127 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/palettes.md +149 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/python.md +249 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/react.md +427 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/shapes.md +135 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/stopwords.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/youtube-transcript/SKILL.md +416 -0
- package/bundles/manifest.json +2 -1
- package/dist/cli.js +166 -37
- package/package.json +1 -1
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: naming-analyzer
|
|
3
|
+
context: fork
|
|
4
|
+
description: Suggest better variable, function, and class names based on context and conventions.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Naming Analyzer Skill
|
|
8
|
+
|
|
9
|
+
Suggest better variable, function, and class names based on context and conventions.
|
|
10
|
+
|
|
11
|
+
**Works with:** Any AI coding agent (Claude, Cursor, GitHub Copilot, Windsurf, etc.)
|
|
12
|
+
|
|
13
|
+
## Instructions
|
|
14
|
+
|
|
15
|
+
You are a naming convention expert. When invoked:
|
|
16
|
+
|
|
17
|
+
1. **Analyze Existing Names**:
|
|
18
|
+
- Variables, constants, functions, methods
|
|
19
|
+
- Classes, interfaces, types
|
|
20
|
+
- Files and directories
|
|
21
|
+
- Database tables and columns
|
|
22
|
+
- API endpoints
|
|
23
|
+
|
|
24
|
+
2. **Identify Issues**:
|
|
25
|
+
- Unclear or vague names
|
|
26
|
+
- Abbreviations that obscure meaning
|
|
27
|
+
- Inconsistent naming conventions
|
|
28
|
+
- Misleading names (name doesn't match behavior)
|
|
29
|
+
- Too short or too long names
|
|
30
|
+
- Hungarian notation misuse
|
|
31
|
+
- Single-letter variables outside loops
|
|
32
|
+
|
|
33
|
+
3. **Check Conventions**:
|
|
34
|
+
- Language-specific conventions (camelCase, snake_case, PascalCase)
|
|
35
|
+
- Framework conventions (React components, Vue props)
|
|
36
|
+
- Project-specific patterns
|
|
37
|
+
- Industry standards
|
|
38
|
+
|
|
39
|
+
4. **Provide Suggestions**:
|
|
40
|
+
- Better alternative names
|
|
41
|
+
- Reasoning for each suggestion
|
|
42
|
+
- Consistency improvements
|
|
43
|
+
- Contextual appropriateness
|
|
44
|
+
|
|
45
|
+
## Triggers
|
|
46
|
+
|
|
47
|
+
Use this skill when:
|
|
48
|
+
- "analyze naming in [file/directory]"
|
|
49
|
+
- "suggest better names for this code"
|
|
50
|
+
- "check naming conventions"
|
|
51
|
+
- "review variable names"
|
|
52
|
+
- "find naming issues"
|
|
53
|
+
- "improve naming consistency"
|
|
54
|
+
|
|
55
|
+
## Naming Conventions by Language
|
|
56
|
+
|
|
57
|
+
### JavaScript/TypeScript
|
|
58
|
+
- Variables/functions: `camelCase`
|
|
59
|
+
- Classes/interfaces: `PascalCase`
|
|
60
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
61
|
+
- Private fields: `_prefixUnderscore` or `#privateField`
|
|
62
|
+
- Boolean: `is`, `has`, `can`, `should` prefixes
|
|
63
|
+
|
|
64
|
+
### Python
|
|
65
|
+
- Variables/functions: `snake_case`
|
|
66
|
+
- Classes: `PascalCase`
|
|
67
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
68
|
+
- Private: `_prefix_underscore`
|
|
69
|
+
- Boolean: `is_`, `has_`, `can_` prefixes
|
|
70
|
+
|
|
71
|
+
### Java
|
|
72
|
+
- Variables/methods: `camelCase`
|
|
73
|
+
- Classes/interfaces: `PascalCase`
|
|
74
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
75
|
+
- Packages: `lowercase`
|
|
76
|
+
|
|
77
|
+
### Go
|
|
78
|
+
- Exported: `PascalCase`
|
|
79
|
+
- Unexported: `camelCase`
|
|
80
|
+
- Acronyms: All caps (`HTTPServer`, not `HttpServer`)
|
|
81
|
+
|
|
82
|
+
### C#
|
|
83
|
+
- Public members: `PascalCase`
|
|
84
|
+
- Private fields: `_camelCase` or `camelCase`
|
|
85
|
+
- Constants: `PascalCase` or `UPPER_SNAKE_CASE`
|
|
86
|
+
- Interfaces: `IPascalCase` (I prefix)
|
|
87
|
+
|
|
88
|
+
### Ruby
|
|
89
|
+
- Variables/methods: `snake_case`
|
|
90
|
+
- Classes/modules: `PascalCase`
|
|
91
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
92
|
+
- Predicate methods: `?` suffix (e.g., `valid?`)
|
|
93
|
+
|
|
94
|
+
### Rust
|
|
95
|
+
- Variables/functions: `snake_case`
|
|
96
|
+
- Types/traits: `PascalCase`
|
|
97
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
98
|
+
- Macros: `snake_case!`
|
|
99
|
+
|
|
100
|
+
## Common Naming Issues
|
|
101
|
+
|
|
102
|
+
### Too Vague
|
|
103
|
+
```javascript
|
|
104
|
+
// ❌ Bad - Too generic
|
|
105
|
+
function process(data) { }
|
|
106
|
+
const info = getData();
|
|
107
|
+
let temp = x;
|
|
108
|
+
|
|
109
|
+
// ✓ Good - Specific and clear
|
|
110
|
+
function processPayment(transaction) { }
|
|
111
|
+
const userProfile = getUserProfile();
|
|
112
|
+
let previousValue = x;
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Misleading Names
|
|
116
|
+
```javascript
|
|
117
|
+
// ❌ Bad - Name doesn't match behavior
|
|
118
|
+
function getUser(id) {
|
|
119
|
+
const user = fetchUser(id);
|
|
120
|
+
user.lastLogin = Date.now();
|
|
121
|
+
saveUser(user); // Side effect! Not just "getting"
|
|
122
|
+
return user;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ✓ Good - Name reflects actual behavior
|
|
126
|
+
function fetchAndUpdateUserLogin(id) {
|
|
127
|
+
const user = fetchUser(id);
|
|
128
|
+
user.lastLogin = Date.now();
|
|
129
|
+
saveUser(user);
|
|
130
|
+
return user;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Abbreviations
|
|
135
|
+
```javascript
|
|
136
|
+
// ❌ Bad - Unclear abbreviations
|
|
137
|
+
const usrCfg = loadConfig();
|
|
138
|
+
function calcTtl(arr) { }
|
|
139
|
+
|
|
140
|
+
// ✓ Good - Clear and readable
|
|
141
|
+
const userConfig = loadConfig();
|
|
142
|
+
function calculateTotal(amounts) { }
|
|
143
|
+
|
|
144
|
+
// ✓ Acceptable - Well-known abbreviations
|
|
145
|
+
const htmlElement = document.getElementById('main');
|
|
146
|
+
const apiUrl = process.env.API_URL;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Boolean Naming
|
|
150
|
+
```javascript
|
|
151
|
+
// ❌ Bad - Unclear state
|
|
152
|
+
const login = user.authenticated;
|
|
153
|
+
const status = checkUser();
|
|
154
|
+
|
|
155
|
+
// ✓ Good - Clear boolean intent
|
|
156
|
+
const isLoggedIn = user.authenticated;
|
|
157
|
+
const isUserValid = checkUser();
|
|
158
|
+
const hasPermission = user.roles.includes('admin');
|
|
159
|
+
const canEditPost = isOwner || isAdmin;
|
|
160
|
+
const shouldShowNotification = isEnabled && hasUnread;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Magic Numbers
|
|
164
|
+
```javascript
|
|
165
|
+
// ❌ Bad - Unnamed constants
|
|
166
|
+
if (age > 18) { }
|
|
167
|
+
setTimeout(callback, 3600000);
|
|
168
|
+
|
|
169
|
+
// ✓ Good - Named constants
|
|
170
|
+
const LEGAL_AGE = 18;
|
|
171
|
+
const ONE_HOUR_IN_MS = 60 * 60 * 1000;
|
|
172
|
+
|
|
173
|
+
if (age > LEGAL_AGE) { }
|
|
174
|
+
setTimeout(callback, ONE_HOUR_IN_MS);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Report Format
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
# Naming Analysis Report
|
|
181
|
+
|
|
182
|
+
## Summary
|
|
183
|
+
- Items analyzed: 156
|
|
184
|
+
- Issues found: 23
|
|
185
|
+
- Critical: 5 (misleading names)
|
|
186
|
+
- Major: 12 (unclear/vague)
|
|
187
|
+
- Minor: 6 (convention violations)
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Critical Issues (5)
|
|
192
|
+
|
|
193
|
+
### src/services/UserService.js:45
|
|
194
|
+
**Current**: `getUser(id)`
|
|
195
|
+
**Issue**: Function name implies read-only but has side effects (updates lastLogin)
|
|
196
|
+
**Severity**: Critical - Misleading
|
|
197
|
+
**Suggestion**: `fetchAndUpdateUserLogin(id)`
|
|
198
|
+
**Reason**: Name should reflect the mutation
|
|
199
|
+
|
|
200
|
+
### src/utils/helpers.js:23
|
|
201
|
+
**Current**: `validate(x)`
|
|
202
|
+
**Issue**: Generic parameter name, unclear what's being validated
|
|
203
|
+
**Severity**: Critical - Too vague
|
|
204
|
+
**Suggestion**: `validateEmail(emailAddress)`
|
|
205
|
+
**Reason**: Specific names improve clarity
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Major Issues (12)
|
|
210
|
+
|
|
211
|
+
### src/components/DataList.jsx:12
|
|
212
|
+
**Current**: `const d = new Date()`
|
|
213
|
+
**Issue**: Single-letter variable in large scope
|
|
214
|
+
**Severity**: Major
|
|
215
|
+
**Suggestion**: `const currentDate = new Date()`
|
|
216
|
+
**Reason**: Clarity and searchability
|
|
217
|
+
|
|
218
|
+
### src/api/client.js:67
|
|
219
|
+
**Current**: `function proc(data) {}`
|
|
220
|
+
**Issue**: Abbreviated function name
|
|
221
|
+
**Severity**: Major
|
|
222
|
+
**Suggestion**: `function processApiResponse(data) {}`
|
|
223
|
+
**Reason**: Full words are more readable
|
|
224
|
+
|
|
225
|
+
### src/models/User.js:34
|
|
226
|
+
**Current**: `user.active`
|
|
227
|
+
**Issue**: Boolean property without prefix
|
|
228
|
+
**Severity**: Major
|
|
229
|
+
**Suggestion**: `user.isActive`
|
|
230
|
+
**Reason**: Follow boolean naming convention
|
|
231
|
+
|
|
232
|
+
### src/utils/format.js:89
|
|
233
|
+
**Current**: `const MAX = 100`
|
|
234
|
+
**Issue**: Generic constant name
|
|
235
|
+
**Severity**: Major
|
|
236
|
+
**Suggestion**: `const MAX_RETRY_ATTEMPTS = 100`
|
|
237
|
+
**Reason**: Specific purpose is clearer
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Minor Issues (6)
|
|
242
|
+
|
|
243
|
+
### src/config/settings.js:12
|
|
244
|
+
**Current**: `const API_url = '...'`
|
|
245
|
+
**Issue**: Inconsistent casing (mixing UPPER and lower)
|
|
246
|
+
**Severity**: Minor
|
|
247
|
+
**Suggestion**: `const API_URL = '...'` or `const apiUrl = '...'`
|
|
248
|
+
**Reason**: Consistency in convention
|
|
249
|
+
|
|
250
|
+
### src/helpers/string.js:45
|
|
251
|
+
**Current**: `function strToNum(s) {}`
|
|
252
|
+
**Issue**: Abbreviated function and parameter
|
|
253
|
+
**Severity**: Minor
|
|
254
|
+
**Suggestion**: `function stringToNumber(value) {}`
|
|
255
|
+
**Reason**: Clarity over brevity
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Convention Violations
|
|
260
|
+
|
|
261
|
+
### Inconsistent Boolean Prefixes
|
|
262
|
+
**Locations**: 8 files
|
|
263
|
+
**Issue**: Mixed use of `is`, `has`, `can` vs no prefix
|
|
264
|
+
**Recommendation**: Standardize on boolean prefixes
|
|
265
|
+
- Use `is` for state: `isActive`, `isVisible`
|
|
266
|
+
- Use `has` for possession: `hasPermission`, `hasError`
|
|
267
|
+
- Use `can` for ability: `canEdit`, `canDelete`
|
|
268
|
+
- Use `should` for decisions: `shouldRender`, `shouldValidate`
|
|
269
|
+
|
|
270
|
+
### Mixed Naming Conventions
|
|
271
|
+
**Location**: src/legacy/
|
|
272
|
+
**Issue**: Mix of camelCase and snake_case in JavaScript
|
|
273
|
+
**Recommendation**: Convert all to camelCase for consistency
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Suggested Renaming
|
|
278
|
+
|
|
279
|
+
### High Priority (Misleading or Critical)
|
|
280
|
+
1. `getUser` → `fetchAndUpdateUserLogin` (src/services/UserService.js:45)
|
|
281
|
+
2. `validate` → `validateEmail` (src/utils/helpers.js:23)
|
|
282
|
+
3. `process` → `processPaymentTransaction` (src/payment/processor.js:67)
|
|
283
|
+
|
|
284
|
+
### Medium Priority (Clarity)
|
|
285
|
+
1. `d` → `currentDate` (7 locations)
|
|
286
|
+
2. `temp` → `previousValue` (4 locations)
|
|
287
|
+
3. `data` → `apiResponse` or more specific (12 locations)
|
|
288
|
+
4. `arr` → `items`, `values`, or more specific (8 locations)
|
|
289
|
+
|
|
290
|
+
### Low Priority (Convention)
|
|
291
|
+
1. `active` → `isActive` (12 locations)
|
|
292
|
+
2. `error` → `hasError` (6 locations)
|
|
293
|
+
3. `API_url` → `API_URL` (3 locations)
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Naming Patterns to Follow
|
|
298
|
+
|
|
299
|
+
### Functions/Methods
|
|
300
|
+
- Verbs: `get`, `set`, `create`, `update`, `delete`, `fetch`, `calculate`, `validate`
|
|
301
|
+
- Clear action: `sendEmail()`, `parseJSON()`, `formatCurrency()`
|
|
302
|
+
|
|
303
|
+
### Classes
|
|
304
|
+
- Nouns: `UserService`, `PaymentProcessor`, `EmailValidator`
|
|
305
|
+
- Avoid generic: Don't use `Manager`, `Helper`, `Utility` unless necessary
|
|
306
|
+
|
|
307
|
+
### Variables
|
|
308
|
+
- Nouns or noun phrases: `user`, `emailAddress`, `totalAmount`
|
|
309
|
+
- Descriptive: `userList` not `list`, `activeUsers` not `users2`
|
|
310
|
+
|
|
311
|
+
### Constants
|
|
312
|
+
- All caps with underscores: `MAX_RETRY_ATTEMPTS`, `DEFAULT_TIMEOUT`
|
|
313
|
+
- Include units: `CACHE_DURATION_MS`, `MAX_FILE_SIZE_MB`
|
|
314
|
+
|
|
315
|
+
### Booleans
|
|
316
|
+
- Question form: `isValid`, `hasPermission`, `canEdit`
|
|
317
|
+
- Affirmative: `isEnabled` not `isDisabled` (prefer positive)
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Refactoring Options
|
|
322
|
+
|
|
323
|
+
Would you like me to:
|
|
324
|
+
1. **Generate a refactoring script** to apply these changes automatically
|
|
325
|
+
2. **Create a migration guide** with step-by-step manual instructions
|
|
326
|
+
3. **Apply changes directly** using your agent's refactoring capabilities
|
|
327
|
+
|
|
328
|
+
This will:
|
|
329
|
+
- Rename all suggested items
|
|
330
|
+
- Update all references
|
|
331
|
+
- Maintain git history (if applicable)
|
|
332
|
+
- Ensure no breaking changes
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Best Practices
|
|
337
|
+
|
|
338
|
+
✓ **DO**:
|
|
339
|
+
- Use full words over abbreviations
|
|
340
|
+
- Be specific and descriptive
|
|
341
|
+
- Follow language conventions
|
|
342
|
+
- Use consistent patterns
|
|
343
|
+
- Make booleans obvious
|
|
344
|
+
- Include units in constants
|
|
345
|
+
|
|
346
|
+
✗ **DON'T**:
|
|
347
|
+
- Use single letters (except in loops: i, j, k)
|
|
348
|
+
- Use vague names (data, info, temp, x)
|
|
349
|
+
- Mix naming conventions
|
|
350
|
+
- Use misleading names
|
|
351
|
+
- Over-abbreviate
|
|
352
|
+
- Use Hungarian notation in modern code
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Naming Decision Tree
|
|
356
|
+
|
|
357
|
+
```
|
|
358
|
+
Is it a boolean?
|
|
359
|
+
├─ Yes → Use is/has/can/should prefix
|
|
360
|
+
└─ No → Is it a function?
|
|
361
|
+
├─ Yes → Use verb phrase (action)
|
|
362
|
+
└─ No → Is it a class?
|
|
363
|
+
├─ Yes → Use noun (PascalCase)
|
|
364
|
+
└─ No → Is it a constant?
|
|
365
|
+
├─ Yes → Use UPPER_SNAKE_CASE
|
|
366
|
+
└─ No → Use descriptive noun (camelCase/snake_case)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Notes
|
|
370
|
+
|
|
371
|
+
- Prioritize clarity over brevity
|
|
372
|
+
- Context matters (loop counters can be `i`, `j`)
|
|
373
|
+
- Well-known abbreviations are okay (`html`, `api`, `url`, `id`)
|
|
374
|
+
- Consistency within a project is more important than perfect naming
|
|
375
|
+
- Refactor names as understanding improves
|
|
376
|
+
- Use your agent's rename refactoring to safely update all references
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nextjs-app-router
|
|
3
|
+
description: Next.js 13+ App Router conventions, Server vs Client Components, Server Actions, Middleware, data fetching, Metadata API, and route handlers. Use for Next.js App Router directory structure, Server Actions, SSR/RSC patterns, generateMetadata, layout/page/error/loading.tsx conventions, route groups, parallel routes, or hydration issues. Companion to react-dev and react-best-practices.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Next.js App Router Skill
|
|
7
|
+
|
|
8
|
+
Covers Next.js 13+ App Router conventions. Companion to `react-dev` (typing) and `react-best-practices` (patterns). Always read those for React-level decisions.
|
|
9
|
+
|
|
10
|
+
## 1. File Conventions
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
app/
|
|
14
|
+
├── layout.tsx # Root shell — fonts, providers, global nav. Always present.
|
|
15
|
+
├── page.tsx # Default route segment UI
|
|
16
|
+
├── loading.tsx # Suspense boundary UI while segment loads
|
|
17
|
+
├── error.tsx # Error boundary ('use client' required)
|
|
18
|
+
├── not-found.tsx # 404 for segment
|
|
19
|
+
├── template.tsx # Re-mounts on navigation (vs layout which persists)
|
|
20
|
+
├── (marketing)/ # Route group — no URL segment, just org
|
|
21
|
+
│ ├── about/page.tsx
|
|
22
|
+
│ └── pricing/page.tsx
|
|
23
|
+
├── dashboard/
|
|
24
|
+
│ ├── layout.tsx # Nested layout (persists across dashboard routes)
|
|
25
|
+
│ └── settings/page.tsx
|
|
26
|
+
└── api/
|
|
27
|
+
└── webhook/route.ts # Route handler
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Key Rules
|
|
31
|
+
- `error.tsx` **must** be `'use client'` — React error boundaries require it.
|
|
32
|
+
- `loading.tsx` wraps the segment's `page.tsx` in `<Suspense>` automatically.
|
|
33
|
+
- `template.tsx` re-mounts children on every navigation; use only when fresh mount is needed.
|
|
34
|
+
- Route groups `(group)` do not affect URL paths — use for layout isolation or code organisation.
|
|
35
|
+
|
|
36
|
+
## 2. Server vs Client Components — Decision Tree
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Does this component need:
|
|
40
|
+
- useState / useReducer? → 'use client'
|
|
41
|
+
- useEffect? → 'use client'
|
|
42
|
+
- Browser APIs (window, document)? → 'use client'
|
|
43
|
+
- Event listeners? → 'use client'
|
|
44
|
+
- Framer Motion / animation libs? → 'use client'
|
|
45
|
+
- Third-party client-side context? → 'use client'
|
|
46
|
+
Otherwise: → Server Component (default)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Composition Pattern
|
|
50
|
+
```tsx
|
|
51
|
+
// ✅ GOOD: Push 'use client' to the leaf
|
|
52
|
+
// app/dashboard/page.tsx — Server Component
|
|
53
|
+
import { InteractiveChart } from './interactive-chart'
|
|
54
|
+
|
|
55
|
+
export default async function DashboardPage() {
|
|
56
|
+
const data = await fetchData() // Direct async/await — no useEffect needed
|
|
57
|
+
return <InteractiveChart initialData={data} />
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// interactive-chart.tsx
|
|
61
|
+
'use client'
|
|
62
|
+
export function InteractiveChart({ initialData }: { initialData: Data }) {
|
|
63
|
+
const [filter, setFilter] = useState('all')
|
|
64
|
+
// ...
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// ❌ BAD: Marking the whole page client just for one button
|
|
70
|
+
'use client'
|
|
71
|
+
export default async function Page() { // 'async' is invalid in client components
|
|
72
|
+
const data = await fetchData() // This won't work in client components
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 3. Server Actions
|
|
77
|
+
|
|
78
|
+
Server Actions are async functions that run on the server, callable from Client Components.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
// app/actions/user.ts
|
|
82
|
+
'use server'
|
|
83
|
+
|
|
84
|
+
import { revalidatePath, revalidateTag } from 'next/cache'
|
|
85
|
+
|
|
86
|
+
export async function updateUser(userId: string, formData: FormData) {
|
|
87
|
+
const name = formData.get('name') as string
|
|
88
|
+
await db.user.update({ where: { id: userId }, data: { name } })
|
|
89
|
+
revalidatePath('/dashboard/profile') // Revalidate specific path
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export async function deletePost(postId: string) {
|
|
93
|
+
await db.post.delete({ where: { id: postId } })
|
|
94
|
+
revalidateTag('posts') // Revalidate by cache tag
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `useActionState` (React 19 / Next.js 14+)
|
|
99
|
+
```tsx
|
|
100
|
+
'use client'
|
|
101
|
+
import { useActionState } from 'react'
|
|
102
|
+
import { updateUser } from '@/app/actions/user'
|
|
103
|
+
|
|
104
|
+
type State = { error?: string; success?: boolean }
|
|
105
|
+
|
|
106
|
+
export function ProfileForm({ userId }: { userId: string }) {
|
|
107
|
+
const [state, action, isPending] = useActionState<State, FormData>(
|
|
108
|
+
async (_, formData) => {
|
|
109
|
+
try {
|
|
110
|
+
await updateUser(userId, formData)
|
|
111
|
+
return { success: true }
|
|
112
|
+
} catch {
|
|
113
|
+
return { error: 'Update failed' }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{}
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<form action={action}>
|
|
121
|
+
<input name="name" disabled={isPending} />
|
|
122
|
+
{state.error && <p role="alert">{state.error}</p>}
|
|
123
|
+
<button type="submit" disabled={isPending}>{isPending ? 'Saving…' : 'Save'}</button>
|
|
124
|
+
</form>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 4. Middleware
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
// middleware.ts (at project root, NOT in app/)
|
|
133
|
+
import { NextResponse } from 'next/server'
|
|
134
|
+
import type { NextRequest } from 'next/server'
|
|
135
|
+
|
|
136
|
+
export function middleware(request: NextRequest) {
|
|
137
|
+
const { pathname } = request.nextUrl
|
|
138
|
+
|
|
139
|
+
// Auth guard
|
|
140
|
+
const token = request.cookies.get('auth-token')?.value
|
|
141
|
+
if (pathname.startsWith('/dashboard') && !token) {
|
|
142
|
+
return NextResponse.redirect(new URL('/login', request.url))
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// A/B test header
|
|
146
|
+
const response = NextResponse.next()
|
|
147
|
+
response.headers.set('x-variant', 'control')
|
|
148
|
+
return response
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const config = {
|
|
152
|
+
matcher: ['/dashboard/:path*', '/api/:path*'],
|
|
153
|
+
// Use edge runtime for simple string ops — avoids cold start
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 5. Data Fetching
|
|
158
|
+
|
|
159
|
+
### Server Component Fetch with Caching
|
|
160
|
+
```tsx
|
|
161
|
+
// Cached fetch: deduplicated across the request lifecycle
|
|
162
|
+
async function getUser(id: string) {
|
|
163
|
+
const res = await fetch(`https://api.example.com/users/${id}`, {
|
|
164
|
+
next: { revalidate: 3600 }, // ISR: revalidate every hour
|
|
165
|
+
// next: { tags: ['user'] }, // Tag-based revalidation
|
|
166
|
+
// cache: 'no-store', // Dynamic — no cache
|
|
167
|
+
})
|
|
168
|
+
if (!res.ok) throw new Error('Failed to fetch')
|
|
169
|
+
return res.json()
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Parallel Data Fetching
|
|
174
|
+
```tsx
|
|
175
|
+
// ✅ GOOD: Parallel — not waterfall
|
|
176
|
+
export default async function Page({ params }: { params: { id: string } }) {
|
|
177
|
+
const [user, posts, analytics] = await Promise.all([
|
|
178
|
+
getUser(params.id),
|
|
179
|
+
getPosts(params.id),
|
|
180
|
+
getAnalytics(params.id),
|
|
181
|
+
])
|
|
182
|
+
return <Dashboard user={user} posts={posts} analytics={analytics} />
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Suspense Streaming
|
|
187
|
+
```tsx
|
|
188
|
+
import { Suspense } from 'react'
|
|
189
|
+
|
|
190
|
+
export default function Page() {
|
|
191
|
+
return (
|
|
192
|
+
<>
|
|
193
|
+
<Header />
|
|
194
|
+
<Suspense fallback={<Skeleton />}>
|
|
195
|
+
<AsyncDataTable /> {/* Streams in when ready */}
|
|
196
|
+
</Suspense>
|
|
197
|
+
<Suspense fallback={<ChartSkeleton />}>
|
|
198
|
+
<AsyncChart />
|
|
199
|
+
</Suspense>
|
|
200
|
+
</>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 6. Metadata API
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
// Static metadata
|
|
209
|
+
export const metadata = {
|
|
210
|
+
title: 'Dashboard',
|
|
211
|
+
description: 'Your personalised dashboard',
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Dynamic metadata
|
|
215
|
+
export async function generateMetadata({ params }: { params: { slug: string } }) {
|
|
216
|
+
const post = await getPost(params.slug)
|
|
217
|
+
return {
|
|
218
|
+
title: post.title,
|
|
219
|
+
description: post.excerpt,
|
|
220
|
+
openGraph: {
|
|
221
|
+
title: post.title,
|
|
222
|
+
images: [{ url: post.coverImage, width: 1200, height: 630 }],
|
|
223
|
+
},
|
|
224
|
+
twitter: { card: 'summary_large_image', title: post.title },
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## 7. Route Handlers
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
// app/api/users/route.ts
|
|
233
|
+
import { NextRequest, NextResponse } from 'next/server'
|
|
234
|
+
|
|
235
|
+
export async function GET(request: NextRequest) {
|
|
236
|
+
const { searchParams } = new URL(request.url)
|
|
237
|
+
const page = Number(searchParams.get('page') ?? '1')
|
|
238
|
+
const users = await db.user.findMany({ skip: (page - 1) * 20, take: 20 })
|
|
239
|
+
return NextResponse.json({ users, page })
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export async function POST(request: NextRequest) {
|
|
243
|
+
const body = await request.json()
|
|
244
|
+
// Validate with zod before DB write
|
|
245
|
+
const parsed = CreateUserSchema.safeParse(body)
|
|
246
|
+
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 422 })
|
|
247
|
+
const user = await db.user.create({ data: parsed.data })
|
|
248
|
+
return NextResponse.json(user, { status: 201 })
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 8. Common Pitfalls
|
|
253
|
+
|
|
254
|
+
| Pitfall | Cause | Fix |
|
|
255
|
+
|---------|-------|-----|
|
|
256
|
+
| Hydration mismatch | Server HTML ≠ client render (dates, random IDs, browser-only APIs) | Wrap in `<ClientOnly>` component or use `useEffect` for client-only values |
|
|
257
|
+
| `'use client'` creep | Adding hooks to parent forces entire tree client | Push boundary to leaf — pass serialisable data as props |
|
|
258
|
+
| Nested layout confusion | Inner `layout.tsx` doesn't wrap sibling `page.tsx` at same level | Layouts only wrap children segments, not siblings |
|
|
259
|
+
| Stale cache | `fetch` cached too aggressively | Use `revalidateTag` on mutation, or `cache: 'no-store'` for real-time data |
|
|
260
|
+
| Server Action in Server Component | Calling a Server Action from a Server Component via form is fine; importing into client requires `'use server'` import | Declare `'use server'` at top of action file, not per-function |
|
|
261
|
+
| Missing error handling in route handler | Unhandled error returns 500 with Next.js HTML error page | Always return `NextResponse.json({ error: ... }, { status })` |
|
|
262
|
+
|
|
263
|
+
## 9. Quick Reference Checklist
|
|
264
|
+
|
|
265
|
+
- [ ] `error.tsx` has `'use client'` directive
|
|
266
|
+
- [ ] No `async`/`await` inside Client Components — lift to Server Component or Server Action
|
|
267
|
+
- [ ] Parallel fetches use `Promise.all`, not sequential `await`
|
|
268
|
+
- [ ] `revalidatePath` or `revalidateTag` called after every mutating Server Action
|
|
269
|
+
- [ ] Middleware `matcher` is as specific as possible — avoid `'/'` matching everything
|
|
270
|
+
- [ ] `generateMetadata` defined for every public-facing page
|
|
271
|
+
- [ ] Route handlers validate input with zod before touching the database
|