workspace-architect 1.3.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/.env.example +1 -0
- package/.gitattributes +1 -0
- package/.github/workflows/manual-publish.yml +36 -0
- package/.github/workflows/sync-and-publish.yml +58 -0
- package/.release-it.json +20 -0
- package/CHANGELOG.md +43 -0
- package/README.md +62 -0
- package/assets/chatmodes/4.1-Beast.chatmode.md +152 -0
- package/assets/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- package/assets/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- package/assets/chatmodes/accessibility.chatmode.md +298 -0
- package/assets/chatmodes/address-comments.chatmode.md +59 -0
- package/assets/chatmodes/aem-frontend-specialist.chatmode.md +385 -0
- package/assets/chatmodes/api-architect.chatmode.md +40 -0
- package/assets/chatmodes/atlassian-requirements-to-jira.chatmode.md +444 -0
- package/assets/chatmodes/azure-logic-apps-expert.chatmode.md +100 -0
- package/assets/chatmodes/azure-principal-architect.chatmode.md +58 -0
- package/assets/chatmodes/azure-saas-architect.chatmode.md +118 -0
- package/assets/chatmodes/azure-verified-modules-bicep.chatmode.md +44 -0
- package/assets/chatmodes/azure-verified-modules-terraform.chatmode.md +58 -0
- package/assets/chatmodes/bicep-implement.chatmode.md +40 -0
- package/assets/chatmodes/bicep-plan.chatmode.md +112 -0
- package/assets/chatmodes/blueprint-mode-codex.chatmode.md +110 -0
- package/assets/chatmodes/blueprint-mode.chatmode.md +171 -0
- package/assets/chatmodes/clojure-interactive-programming.chatmode.md +174 -0
- package/assets/chatmodes/code-tour.chatmode.md +205 -0
- package/assets/chatmodes/critical-thinking.chatmode.md +23 -0
- package/assets/chatmodes/csharp-dotnet-janitor.chatmode.md +83 -0
- package/assets/chatmodes/csharp-mcp-expert.chatmode.md +69 -0
- package/assets/chatmodes/debug.chatmode.md +79 -0
- package/assets/chatmodes/declarative-agents-architect.chatmode.md +76 -0
- package/assets/chatmodes/demonstrate-understanding.chatmode.md +60 -0
- package/assets/chatmodes/dotnet-upgrade.chatmode.md +222 -0
- package/assets/chatmodes/drupal-expert.chatmode.md +687 -0
- package/assets/chatmodes/electron-angular-native.chatmode.md +285 -0
- package/assets/chatmodes/expert-cpp-software-engineer.chatmode.md +27 -0
- package/assets/chatmodes/expert-dotnet-software-engineer.chatmode.md +22 -0
- package/assets/chatmodes/expert-nextjs-developer.chatmode.md +477 -0
- package/assets/chatmodes/expert-react-frontend-engineer.chatmode.md +738 -0
- package/assets/chatmodes/gilfoyle.chatmode.md +66 -0
- package/assets/chatmodes/go-mcp-expert.chatmode.md +122 -0
- package/assets/chatmodes/gpt-5-beast-mode.chatmode.md +109 -0
- package/assets/chatmodes/hlbpa.chatmode.md +232 -0
- package/assets/chatmodes/implementation-plan.chatmode.md +159 -0
- package/assets/chatmodes/janitor.chatmode.md +89 -0
- package/assets/chatmodes/java-mcp-expert.chatmode.md +325 -0
- package/assets/chatmodes/kotlin-mcp-expert.chatmode.md +181 -0
- package/assets/chatmodes/kusto-assistant.chatmode.md +143 -0
- package/assets/chatmodes/laravel-expert-agent.chatmode.md +628 -0
- package/assets/chatmodes/mentor.chatmode.md +32 -0
- package/assets/chatmodes/meta-agentic-project-scaffold.chatmode.md +15 -0
- package/assets/chatmodes/microsoft-agent-framework-dotnet.chatmode.md +62 -0
- package/assets/chatmodes/microsoft-agent-framework-python.chatmode.md +62 -0
- package/assets/chatmodes/microsoft-study-mode.chatmode.md +32 -0
- package/assets/chatmodes/microsoft_learn_contributor.chatmode.md +388 -0
- package/assets/chatmodes/ms-sql-dba.chatmode.md +25 -0
- package/assets/chatmodes/php-mcp-expert.chatmode.md +498 -0
- package/assets/chatmodes/pimcore-expert.chatmode.md +869 -0
- package/assets/chatmodes/plan.chatmode.md +114 -0
- package/assets/chatmodes/planner.chatmode.md +14 -0
- package/assets/chatmodes/playwright-tester.chatmode.md +13 -0
- package/assets/chatmodes/postgresql-dba.chatmode.md +17 -0
- package/assets/chatmodes/power-bi-data-modeling-expert.chatmode.md +319 -0
- package/assets/chatmodes/power-bi-dax-expert.chatmode.md +334 -0
- package/assets/chatmodes/power-bi-performance-expert.chatmode.md +533 -0
- package/assets/chatmodes/power-bi-visualization-expert.chatmode.md +549 -0
- package/assets/chatmodes/power-platform-expert.chatmode.md +116 -0
- package/assets/chatmodes/power-platform-mcp-integration-expert.chatmode.md +149 -0
- package/assets/chatmodes/prd.chatmode.md +201 -0
- package/assets/chatmodes/principal-software-engineer.chatmode.md +41 -0
- package/assets/chatmodes/prompt-builder.chatmode.md +352 -0
- package/assets/chatmodes/prompt-engineer.chatmode.md +72 -0
- package/assets/chatmodes/python-mcp-expert.chatmode.md +99 -0
- package/assets/chatmodes/refine-issue.chatmode.md +34 -0
- package/assets/chatmodes/research-technical-spike.chatmode.md +169 -0
- package/assets/chatmodes/ruby-mcp-expert.chatmode.md +346 -0
- package/assets/chatmodes/rust-gpt-4.1-beast-mode.chatmode.md +197 -0
- package/assets/chatmodes/rust-mcp-expert.chatmode.md +465 -0
- package/assets/chatmodes/search-ai-optimization-expert.chatmode.md +227 -0
- package/assets/chatmodes/semantic-kernel-dotnet.chatmode.md +31 -0
- package/assets/chatmodes/semantic-kernel-python.chatmode.md +28 -0
- package/assets/chatmodes/shopify-expert.chatmode.md +681 -0
- package/assets/chatmodes/simple-app-idea-generator.chatmode.md +134 -0
- package/assets/chatmodes/software-engineer-agent-v1.chatmode.md +164 -0
- package/assets/chatmodes/specification.chatmode.md +127 -0
- package/assets/chatmodes/swift-mcp-expert.chatmode.md +240 -0
- package/assets/chatmodes/task-planner.chatmode.md +374 -0
- package/assets/chatmodes/task-researcher.chatmode.md +254 -0
- package/assets/chatmodes/tdd-green.chatmode.md +59 -0
- package/assets/chatmodes/tdd-red.chatmode.md +59 -0
- package/assets/chatmodes/tdd-refactor.chatmode.md +84 -0
- package/assets/chatmodes/tech-debt-remediation-plan.chatmode.md +49 -0
- package/assets/chatmodes/terraform-azure-implement.chatmode.md +104 -0
- package/assets/chatmodes/terraform-azure-planning.chatmode.md +157 -0
- package/assets/chatmodes/typescript-mcp-expert.chatmode.md +91 -0
- package/assets/chatmodes/voidbeast-gpt41enhanced.chatmode.md +230 -0
- package/assets/chatmodes/wg-code-alchemist.chatmode.md +61 -0
- package/assets/chatmodes/wg-code-sentinel.chatmode.md +55 -0
- package/assets/collections/ai-prompt-engineering.json +18 -0
- package/assets/collections/angular-development.json +7 -0
- package/assets/collections/azure-cloud-architect.json +29 -0
- package/assets/collections/cpp-development.json +6 -0
- package/assets/collections/database-administration.json +8 -0
- package/assets/collections/devops-sre.json +11 -0
- package/assets/collections/dotnet-development.json +22 -0
- package/assets/collections/general-productivity.json +9 -0
- package/assets/collections/go-development.json +7 -0
- package/assets/collections/java-spring-developer.json +26 -0
- package/assets/collections/learning-mentoring.json +10 -0
- package/assets/collections/legacy-migration.json +4 -0
- package/assets/collections/mcp-specialist.json +41 -0
- package/assets/collections/mobile-development.json +4 -0
- package/assets/collections/php-cms-development.json +11 -0
- package/assets/collections/power-platform-specialist.json +31 -0
- package/assets/collections/project-management.json +12 -0
- package/assets/collections/python-development.json +13 -0
- package/assets/collections/quality-assurance.json +13 -0
- package/assets/collections/ruby-development.json +9 -0
- package/assets/collections/rust-development.json +10 -0
- package/assets/collections/security-specialist.json +8 -0
- package/assets/collections/software-architect.json +25 -0
- package/assets/collections/technical-writing.json +9 -0
- package/assets/collections/web-frontend-development.json +14 -0
- package/assets/instructions/a11y.instructions.md +369 -0
- package/assets/instructions/ai-prompt-engineering-safety-best-practices.instructions.md +867 -0
- package/assets/instructions/angular.instructions.md +104 -0
- package/assets/instructions/ansible.instructions.md +88 -0
- package/assets/instructions/aspnet-rest-apis.instructions.md +110 -0
- package/assets/instructions/astro.instructions.md +182 -0
- package/assets/instructions/azure-devops-pipelines.instructions.md +185 -0
- package/assets/instructions/azure-functions-typescript.instructions.md +14 -0
- package/assets/instructions/azure-logic-apps-power-automate.instructions.md +1943 -0
- package/assets/instructions/azure-verified-modules-terraform.instructions.md +229 -0
- package/assets/instructions/bicep-code-best-practices.instructions.md +54 -0
- package/assets/instructions/blazor.instructions.md +77 -0
- package/assets/instructions/clojure.instructions.md +349 -0
- package/assets/instructions/cmake-vcpkg.instructions.md +10 -0
- package/assets/instructions/codexer.instructions.md +428 -0
- package/assets/instructions/coldfusion-cfc.instructions.md +30 -0
- package/assets/instructions/coldfusion-cfm.instructions.md +28 -0
- package/assets/instructions/collections.instructions.md +54 -0
- package/assets/instructions/containerization-docker-best-practices.instructions.md +681 -0
- package/assets/instructions/convert-jpa-to-spring-data-cosmos.instructions.md +949 -0
- package/assets/instructions/copilot-thought-logging.instructions.md +62 -0
- package/assets/instructions/csharp-ja.instructions.md +114 -0
- package/assets/instructions/csharp-ko.instructions.md +77 -0
- package/assets/instructions/csharp-mcp-server.instructions.md +95 -0
- package/assets/instructions/csharp.instructions.md +114 -0
- package/assets/instructions/dart-n-flutter.instructions.md +447 -0
- package/assets/instructions/declarative-agents-microsoft365.instructions.md +316 -0
- package/assets/instructions/devbox-image-definition.instructions.md +302 -0
- package/assets/instructions/devops-core-principles.instructions.md +167 -0
- package/assets/instructions/dotnet-architecture-good-practices.instructions.md +279 -0
- package/assets/instructions/dotnet-framework.instructions.md +113 -0
- package/assets/instructions/dotnet-maui-9-to-dotnet-maui-10-upgrade.instructions.md +1922 -0
- package/assets/instructions/dotnet-maui.instructions.md +69 -0
- package/assets/instructions/dotnet-upgrade.instructions.md +287 -0
- package/assets/instructions/dotnet-wpf.instructions.md +79 -0
- package/assets/instructions/genaiscript.instructions.md +21 -0
- package/assets/instructions/generate-modern-terraform-code-for-azure.instructions.md +82 -0
- package/assets/instructions/gilfoyle-code-review.instructions.md +114 -0
- package/assets/instructions/github-actions-ci-cd-best-practices.instructions.md +607 -0
- package/assets/instructions/go-mcp-server.instructions.md +346 -0
- package/assets/instructions/go.instructions.md +373 -0
- package/assets/instructions/instructions.instructions.md +256 -0
- package/assets/instructions/java-11-to-java-17-upgrade.instructions.md +793 -0
- package/assets/instructions/java-17-to-java-21-upgrade.instructions.md +464 -0
- package/assets/instructions/java-21-to-java-25-upgrade.instructions.md +311 -0
- package/assets/instructions/java-mcp-server.instructions.md +553 -0
- package/assets/instructions/java.instructions.md +81 -0
- package/assets/instructions/joyride-user-project.instructions.md +206 -0
- package/assets/instructions/joyride-workspace-automation.instructions.md +46 -0
- package/assets/instructions/kotlin-mcp-server.instructions.md +481 -0
- package/assets/instructions/kubernetes-deployment-best-practices.instructions.md +307 -0
- package/assets/instructions/langchain-python.instructions.md +229 -0
- package/assets/instructions/localization.instructions.md +39 -0
- package/assets/instructions/makefile.instructions.md +410 -0
- package/assets/instructions/markdown.instructions.md +52 -0
- package/assets/instructions/memory-bank.instructions.md +299 -0
- package/assets/instructions/mongo-dba.instructions.md +25 -0
- package/assets/instructions/ms-sql-dba.instructions.md +25 -0
- package/assets/instructions/nestjs.instructions.md +406 -0
- package/assets/instructions/nextjs-tailwind.instructions.md +72 -0
- package/assets/instructions/nextjs.instructions.md +143 -0
- package/assets/instructions/nodejs-javascript-vitest.instructions.md +30 -0
- package/assets/instructions/object-calisthenics.instructions.md +302 -0
- package/assets/instructions/oqtane.instructions.md +86 -0
- package/assets/instructions/performance-optimization.instructions.md +420 -0
- package/assets/instructions/php-mcp-server.instructions.md +809 -0
- package/assets/instructions/playwright-dotnet.instructions.md +101 -0
- package/assets/instructions/playwright-python.instructions.md +62 -0
- package/assets/instructions/playwright-typescript.instructions.md +86 -0
- package/assets/instructions/power-apps-canvas-yaml.instructions.md +827 -0
- package/assets/instructions/power-apps-code-apps.instructions.md +601 -0
- package/assets/instructions/power-bi-custom-visuals-development.instructions.md +810 -0
- package/assets/instructions/power-bi-data-modeling-best-practices.instructions.md +639 -0
- package/assets/instructions/power-bi-dax-best-practices.instructions.md +795 -0
- package/assets/instructions/power-bi-devops-alm-best-practices.instructions.md +623 -0
- package/assets/instructions/power-bi-report-design-best-practices.instructions.md +752 -0
- package/assets/instructions/power-bi-security-rls-best-practices.instructions.md +504 -0
- package/assets/instructions/power-platform-connector.instructions.md +430 -0
- package/assets/instructions/power-platform-mcp-development.instructions.md +88 -0
- package/assets/instructions/powershell-pester-5.instructions.md +197 -0
- package/assets/instructions/powershell.instructions.md +356 -0
- package/assets/instructions/prompt.instructions.md +73 -0
- package/assets/instructions/python-mcp-server.instructions.md +204 -0
- package/assets/instructions/python.instructions.md +56 -0
- package/assets/instructions/quarkus-mcp-server-sse.instructions.md +49 -0
- package/assets/instructions/quarkus.instructions.md +98 -0
- package/assets/instructions/r.instructions.md +116 -0
- package/assets/instructions/reactjs.instructions.md +162 -0
- package/assets/instructions/ruby-mcp-server.instructions.md +629 -0
- package/assets/instructions/ruby-on-rails.instructions.md +124 -0
- package/assets/instructions/rust-mcp-server.instructions.md +715 -0
- package/assets/instructions/rust.instructions.md +135 -0
- package/assets/instructions/security-and-owasp.instructions.md +51 -0
- package/assets/instructions/self-explanatory-code-commenting.instructions.md +162 -0
- package/assets/instructions/shell.instructions.md +132 -0
- package/assets/instructions/spec-driven-workflow-v1.instructions.md +323 -0
- package/assets/instructions/springboot.instructions.md +68 -0
- package/assets/instructions/sql-sp-generation.instructions.md +74 -0
- package/assets/instructions/svelte.instructions.md +161 -0
- package/assets/instructions/swift-mcp-server.instructions.md +498 -0
- package/assets/instructions/taming-copilot.instructions.md +40 -0
- package/assets/instructions/tanstack-start-shadcn-tailwind.instructions.md +212 -0
- package/assets/instructions/task-implementation.instructions.md +190 -0
- package/assets/instructions/tasksync.instructions.md +352 -0
- package/assets/instructions/terraform-azure.instructions.md +254 -0
- package/assets/instructions/terraform-sap-btp.instructions.md +195 -0
- package/assets/instructions/terraform.instructions.md +113 -0
- package/assets/instructions/typescript-5-es2022.instructions.md +114 -0
- package/assets/instructions/typescript-mcp-server.instructions.md +228 -0
- package/assets/instructions/update-code-from-shorthand.instructions.md +130 -0
- package/assets/instructions/vuejs3.instructions.md +153 -0
- package/assets/instructions/wordpress.instructions.md +186 -0
- package/assets/prompts/add-educational-comments.prompt.md +129 -0
- package/assets/prompts/ai-prompt-engineering-safety-review.prompt.md +230 -0
- package/assets/prompts/architecture-blueprint-generator.prompt.md +322 -0
- package/assets/prompts/aspnet-minimal-api-openapi.prompt.md +42 -0
- package/assets/prompts/az-cost-optimize.prompt.md +305 -0
- package/assets/prompts/azure-resource-health-diagnose.prompt.md +290 -0
- package/assets/prompts/boost-prompt.prompt.md +25 -0
- package/assets/prompts/breakdown-epic-arch.prompt.md +66 -0
- package/assets/prompts/breakdown-epic-pm.prompt.md +58 -0
- package/assets/prompts/breakdown-feature-implementation.prompt.md +128 -0
- package/assets/prompts/breakdown-feature-prd.prompt.md +61 -0
- package/assets/prompts/breakdown-plan.prompt.md +509 -0
- package/assets/prompts/breakdown-test.prompt.md +365 -0
- package/assets/prompts/code-exemplars-blueprint-generator.prompt.md +126 -0
- package/assets/prompts/comment-code-generate-a-tutorial.prompt.md +26 -0
- package/assets/prompts/containerize-aspnet-framework.prompt.md +455 -0
- package/assets/prompts/containerize-aspnetcore.prompt.md +393 -0
- package/assets/prompts/conventional-commit.prompt.md +73 -0
- package/assets/prompts/copilot-instructions-blueprint-generator.prompt.md +294 -0
- package/assets/prompts/cosmosdb-datamodeling.prompt.md +1045 -0
- package/assets/prompts/create-agentsmd.prompt.md +249 -0
- package/assets/prompts/create-architectural-decision-record.prompt.md +97 -0
- package/assets/prompts/create-github-action-workflow-specification.prompt.md +276 -0
- package/assets/prompts/create-github-issue-feature-from-specification.prompt.md +28 -0
- package/assets/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +28 -0
- package/assets/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +35 -0
- package/assets/prompts/create-github-pull-request-from-specification.prompt.md +24 -0
- package/assets/prompts/create-implementation-plan.prompt.md +157 -0
- package/assets/prompts/create-llms.prompt.md +210 -0
- package/assets/prompts/create-oo-component-documentation.prompt.md +193 -0
- package/assets/prompts/create-readme.prompt.md +21 -0
- package/assets/prompts/create-specification.prompt.md +127 -0
- package/assets/prompts/create-spring-boot-java-project.prompt.md +163 -0
- package/assets/prompts/create-spring-boot-kotlin-project.prompt.md +147 -0
- package/assets/prompts/create-technical-spike.prompt.md +231 -0
- package/assets/prompts/csharp-async.prompt.md +50 -0
- package/assets/prompts/csharp-docs.prompt.md +63 -0
- package/assets/prompts/csharp-mcp-server-generator.prompt.md +59 -0
- package/assets/prompts/csharp-mstest.prompt.md +67 -0
- package/assets/prompts/csharp-nunit.prompt.md +72 -0
- package/assets/prompts/csharp-tunit.prompt.md +101 -0
- package/assets/prompts/csharp-xunit.prompt.md +69 -0
- package/assets/prompts/declarative-agents.prompt.md +93 -0
- package/assets/prompts/documentation-writer.prompt.md +46 -0
- package/assets/prompts/dotnet-best-practices.prompt.md +84 -0
- package/assets/prompts/dotnet-design-pattern-review.prompt.md +41 -0
- package/assets/prompts/dotnet-upgrade.prompt.md +116 -0
- package/assets/prompts/editorconfig.prompt.md +64 -0
- package/assets/prompts/ef-core.prompt.md +76 -0
- package/assets/prompts/finalize-agent-prompt.prompt.md +27 -0
- package/assets/prompts/first-ask.prompt.md +29 -0
- package/assets/prompts/folder-structure-blueprint-generator.prompt.md +405 -0
- package/assets/prompts/gen-specs-as-issues.prompt.md +165 -0
- package/assets/prompts/generate-custom-instructions-from-codebase.prompt.md +240 -0
- package/assets/prompts/git-flow-branch-creator.prompt.md +293 -0
- package/assets/prompts/github-copilot-starter.prompt.md +372 -0
- package/assets/prompts/go-mcp-server-generator.prompt.md +334 -0
- package/assets/prompts/java-docs.prompt.md +24 -0
- package/assets/prompts/java-junit.prompt.md +64 -0
- package/assets/prompts/java-mcp-server-generator.prompt.md +756 -0
- package/assets/prompts/java-refactoring-extract-method.prompt.md +105 -0
- package/assets/prompts/java-refactoring-remove-parameter.prompt.md +85 -0
- package/assets/prompts/java-springboot.prompt.md +66 -0
- package/assets/prompts/javascript-typescript-jest.prompt.md +44 -0
- package/assets/prompts/kotlin-mcp-server-generator.prompt.md +449 -0
- package/assets/prompts/kotlin-springboot.prompt.md +71 -0
- package/assets/prompts/mcp-copilot-studio-server-generator.prompt.md +118 -0
- package/assets/prompts/memory-merger.prompt.md +107 -0
- package/assets/prompts/mkdocs-translations.prompt.md +110 -0
- package/assets/prompts/model-recommendation.prompt.md +677 -0
- package/assets/prompts/multi-stage-dockerfile.prompt.md +47 -0
- package/assets/prompts/my-issues.prompt.md +9 -0
- package/assets/prompts/my-pull-requests.prompt.md +15 -0
- package/assets/prompts/next-intl-add-language.prompt.md +20 -0
- package/assets/prompts/php-mcp-server-generator.prompt.md +522 -0
- package/assets/prompts/playwright-automation-fill-in-form.prompt.md +30 -0
- package/assets/prompts/playwright-explore-website.prompt.md +19 -0
- package/assets/prompts/playwright-generate-test.prompt.md +19 -0
- package/assets/prompts/postgresql-code-review.prompt.md +214 -0
- package/assets/prompts/postgresql-optimization.prompt.md +406 -0
- package/assets/prompts/power-apps-code-app-scaffold.prompt.md +150 -0
- package/assets/prompts/power-bi-dax-optimization.prompt.md +175 -0
- package/assets/prompts/power-bi-model-design-review.prompt.md +405 -0
- package/assets/prompts/power-bi-performance-troubleshooting.prompt.md +384 -0
- package/assets/prompts/power-bi-report-design-consultation.prompt.md +353 -0
- package/assets/prompts/power-platform-mcp-connector-suite.prompt.md +156 -0
- package/assets/prompts/project-workflow-analysis-blueprint-generator.prompt.md +294 -0
- package/assets/prompts/prompt-builder.prompt.md +142 -0
- package/assets/prompts/pytest-coverage.prompt.md +28 -0
- package/assets/prompts/python-mcp-server-generator.prompt.md +105 -0
- package/assets/prompts/readme-blueprint-generator.prompt.md +79 -0
- package/assets/prompts/remember-interactive-programming.prompt.md +13 -0
- package/assets/prompts/remember.prompt.md +125 -0
- package/assets/prompts/repo-story-time.prompt.md +156 -0
- package/assets/prompts/review-and-refactor.prompt.md +15 -0
- package/assets/prompts/ruby-mcp-server-generator.prompt.md +660 -0
- package/assets/prompts/rust-mcp-server-generator.prompt.md +578 -0
- package/assets/prompts/shuffle-json-data.prompt.md +151 -0
- package/assets/prompts/sql-code-review.prompt.md +303 -0
- package/assets/prompts/sql-optimization.prompt.md +298 -0
- package/assets/prompts/suggest-awesome-github-copilot-agents.prompt.md +72 -0
- package/assets/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +71 -0
- package/assets/prompts/suggest-awesome-github-copilot-collections.prompt.md +149 -0
- package/assets/prompts/suggest-awesome-github-copilot-instructions.prompt.md +88 -0
- package/assets/prompts/suggest-awesome-github-copilot-prompts.prompt.md +71 -0
- package/assets/prompts/swift-mcp-server-generator.prompt.md +669 -0
- package/assets/prompts/technology-stack-blueprint-generator.prompt.md +242 -0
- package/assets/prompts/typescript-mcp-server-generator.prompt.md +90 -0
- package/assets/prompts/update-avm-modules-in-bicep.prompt.md +60 -0
- package/assets/prompts/update-implementation-plan.prompt.md +157 -0
- package/assets/prompts/update-llms.prompt.md +216 -0
- package/assets/prompts/update-markdown-file-index.prompt.md +76 -0
- package/assets/prompts/update-oo-component-documentation.prompt.md +162 -0
- package/assets/prompts/update-specification.prompt.md +127 -0
- package/assets/prompts/write-coding-standards-from-file.prompt.md +316 -0
- package/bin/cli.js +200 -0
- package/package.json +53 -0
- package/scripts/sync.js +99 -0
- package/verdaccio/config.yaml +202 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: '**/*.ts, **/*.js, **/*.json, **/*.spec.ts, **/*.e2e-spec.ts'
|
|
3
|
+
description: 'NestJS development standards and best practices for building scalable Node.js server-side applications'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NestJS Development Best Practices
|
|
7
|
+
|
|
8
|
+
## Your Mission
|
|
9
|
+
|
|
10
|
+
As GitHub Copilot, you are an expert in NestJS development with deep knowledge of TypeScript, decorators, dependency injection, and modern Node.js patterns. Your goal is to guide developers in building scalable, maintainable, and well-architected server-side applications using NestJS framework principles and best practices.
|
|
11
|
+
|
|
12
|
+
## Core NestJS Principles
|
|
13
|
+
|
|
14
|
+
### **1. Dependency Injection (DI)**
|
|
15
|
+
- **Principle:** NestJS uses a powerful DI container that manages the instantiation and lifetime of providers.
|
|
16
|
+
- **Guidance for Copilot:**
|
|
17
|
+
- Use `@Injectable()` decorator for services, repositories, and other providers
|
|
18
|
+
- Inject dependencies through constructor parameters with proper typing
|
|
19
|
+
- Prefer interface-based dependency injection for better testability
|
|
20
|
+
- Use custom providers when you need specific instantiation logic
|
|
21
|
+
|
|
22
|
+
### **2. Modular Architecture**
|
|
23
|
+
- **Principle:** Organize code into feature modules that encapsulate related functionality.
|
|
24
|
+
- **Guidance for Copilot:**
|
|
25
|
+
- Create feature modules with `@Module()` decorator
|
|
26
|
+
- Import only necessary modules and avoid circular dependencies
|
|
27
|
+
- Use `forRoot()` and `forFeature()` patterns for configurable modules
|
|
28
|
+
- Implement shared modules for common functionality
|
|
29
|
+
|
|
30
|
+
### **3. Decorators and Metadata**
|
|
31
|
+
- **Principle:** Leverage decorators to define routes, middleware, guards, and other framework features.
|
|
32
|
+
- **Guidance for Copilot:**
|
|
33
|
+
- Use appropriate decorators: `@Controller()`, `@Get()`, `@Post()`, `@Injectable()`
|
|
34
|
+
- Apply validation decorators from `class-validator` library
|
|
35
|
+
- Use custom decorators for cross-cutting concerns
|
|
36
|
+
- Implement metadata reflection for advanced scenarios
|
|
37
|
+
|
|
38
|
+
## Project Structure Best Practices
|
|
39
|
+
|
|
40
|
+
### **Recommended Directory Structure**
|
|
41
|
+
```
|
|
42
|
+
src/
|
|
43
|
+
├── app.module.ts
|
|
44
|
+
├── main.ts
|
|
45
|
+
├── common/
|
|
46
|
+
│ ├── decorators/
|
|
47
|
+
│ ├── filters/
|
|
48
|
+
│ ├── guards/
|
|
49
|
+
│ ├── interceptors/
|
|
50
|
+
│ ├── pipes/
|
|
51
|
+
│ └── interfaces/
|
|
52
|
+
├── config/
|
|
53
|
+
├── modules/
|
|
54
|
+
│ ├── auth/
|
|
55
|
+
│ ├── users/
|
|
56
|
+
│ └── products/
|
|
57
|
+
└── shared/
|
|
58
|
+
├── services/
|
|
59
|
+
└── constants/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### **File Naming Conventions**
|
|
63
|
+
- **Controllers:** `*.controller.ts` (e.g., `users.controller.ts`)
|
|
64
|
+
- **Services:** `*.service.ts` (e.g., `users.service.ts`)
|
|
65
|
+
- **Modules:** `*.module.ts` (e.g., `users.module.ts`)
|
|
66
|
+
- **DTOs:** `*.dto.ts` (e.g., `create-user.dto.ts`)
|
|
67
|
+
- **Entities:** `*.entity.ts` (e.g., `user.entity.ts`)
|
|
68
|
+
- **Guards:** `*.guard.ts` (e.g., `auth.guard.ts`)
|
|
69
|
+
- **Interceptors:** `*.interceptor.ts` (e.g., `logging.interceptor.ts`)
|
|
70
|
+
- **Pipes:** `*.pipe.ts` (e.g., `validation.pipe.ts`)
|
|
71
|
+
- **Filters:** `*.filter.ts` (e.g., `http-exception.filter.ts`)
|
|
72
|
+
|
|
73
|
+
## API Development Patterns
|
|
74
|
+
|
|
75
|
+
### **1. Controllers**
|
|
76
|
+
- Keep controllers thin - delegate business logic to services
|
|
77
|
+
- Use proper HTTP methods and status codes
|
|
78
|
+
- Implement comprehensive input validation with DTOs
|
|
79
|
+
- Apply guards and interceptors at the appropriate level
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
@Controller('users')
|
|
83
|
+
@UseGuards(AuthGuard)
|
|
84
|
+
export class UsersController {
|
|
85
|
+
constructor(private readonly usersService: UsersService) {}
|
|
86
|
+
|
|
87
|
+
@Get()
|
|
88
|
+
@UseInterceptors(TransformInterceptor)
|
|
89
|
+
async findAll(@Query() query: GetUsersDto): Promise<User[]> {
|
|
90
|
+
return this.usersService.findAll(query);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@Post()
|
|
94
|
+
@UsePipes(ValidationPipe)
|
|
95
|
+
async create(@Body() createUserDto: CreateUserDto): Promise<User> {
|
|
96
|
+
return this.usersService.create(createUserDto);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### **2. Services**
|
|
102
|
+
- Implement business logic in services, not controllers
|
|
103
|
+
- Use constructor-based dependency injection
|
|
104
|
+
- Create focused, single-responsibility services
|
|
105
|
+
- Handle errors appropriately and let filters catch them
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
@Injectable()
|
|
109
|
+
export class UsersService {
|
|
110
|
+
constructor(
|
|
111
|
+
@InjectRepository(User)
|
|
112
|
+
private readonly userRepository: Repository<User>,
|
|
113
|
+
private readonly emailService: EmailService,
|
|
114
|
+
) {}
|
|
115
|
+
|
|
116
|
+
async create(createUserDto: CreateUserDto): Promise<User> {
|
|
117
|
+
const user = this.userRepository.create(createUserDto);
|
|
118
|
+
const savedUser = await this.userRepository.save(user);
|
|
119
|
+
await this.emailService.sendWelcomeEmail(savedUser.email);
|
|
120
|
+
return savedUser;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### **3. DTOs and Validation**
|
|
126
|
+
- Use class-validator decorators for input validation
|
|
127
|
+
- Create separate DTOs for different operations (create, update, query)
|
|
128
|
+
- Implement proper transformation with class-transformer
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
export class CreateUserDto {
|
|
132
|
+
@IsString()
|
|
133
|
+
@IsNotEmpty()
|
|
134
|
+
@Length(2, 50)
|
|
135
|
+
name: string;
|
|
136
|
+
|
|
137
|
+
@IsEmail()
|
|
138
|
+
email: string;
|
|
139
|
+
|
|
140
|
+
@IsString()
|
|
141
|
+
@MinLength(8)
|
|
142
|
+
@Matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/, {
|
|
143
|
+
message: 'Password must contain uppercase, lowercase and number',
|
|
144
|
+
})
|
|
145
|
+
password: string;
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Database Integration
|
|
150
|
+
|
|
151
|
+
### **TypeORM Integration**
|
|
152
|
+
- Use TypeORM as the primary ORM for database operations
|
|
153
|
+
- Define entities with proper decorators and relationships
|
|
154
|
+
- Implement repository pattern for data access
|
|
155
|
+
- Use migrations for database schema changes
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
@Entity('users')
|
|
159
|
+
export class User {
|
|
160
|
+
@PrimaryGeneratedColumn('uuid')
|
|
161
|
+
id: string;
|
|
162
|
+
|
|
163
|
+
@Column({ unique: true })
|
|
164
|
+
email: string;
|
|
165
|
+
|
|
166
|
+
@Column()
|
|
167
|
+
name: string;
|
|
168
|
+
|
|
169
|
+
@Column({ select: false })
|
|
170
|
+
password: string;
|
|
171
|
+
|
|
172
|
+
@OneToMany(() => Post, post => post.author)
|
|
173
|
+
posts: Post[];
|
|
174
|
+
|
|
175
|
+
@CreateDateColumn()
|
|
176
|
+
createdAt: Date;
|
|
177
|
+
|
|
178
|
+
@UpdateDateColumn()
|
|
179
|
+
updatedAt: Date;
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### **Custom Repositories**
|
|
184
|
+
- Extend base repository functionality when needed
|
|
185
|
+
- Implement complex queries in repository methods
|
|
186
|
+
- Use query builders for dynamic queries
|
|
187
|
+
|
|
188
|
+
## Authentication and Authorization
|
|
189
|
+
|
|
190
|
+
### **JWT Authentication**
|
|
191
|
+
- Implement JWT-based authentication with Passport
|
|
192
|
+
- Use guards to protect routes
|
|
193
|
+
- Create custom decorators for user context
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
@Injectable()
|
|
197
|
+
export class JwtAuthGuard extends AuthGuard('jwt') {
|
|
198
|
+
canActivate(context: ExecutionContext): boolean | Promise<boolean> {
|
|
199
|
+
return super.canActivate(context);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
handleRequest(err: any, user: any, info: any) {
|
|
203
|
+
if (err || !user) {
|
|
204
|
+
throw err || new UnauthorizedException();
|
|
205
|
+
}
|
|
206
|
+
return user;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### **Role-Based Access Control**
|
|
212
|
+
- Implement RBAC using custom guards and decorators
|
|
213
|
+
- Use metadata to define required roles
|
|
214
|
+
- Create flexible permission systems
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
@SetMetadata('roles', ['admin'])
|
|
218
|
+
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
219
|
+
@Delete(':id')
|
|
220
|
+
async remove(@Param('id') id: string): Promise<void> {
|
|
221
|
+
return this.usersService.remove(id);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Error Handling and Logging
|
|
226
|
+
|
|
227
|
+
### **Exception Filters**
|
|
228
|
+
- Create global exception filters for consistent error responses
|
|
229
|
+
- Handle different types of exceptions appropriately
|
|
230
|
+
- Log errors with proper context
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
@Catch()
|
|
234
|
+
export class AllExceptionsFilter implements ExceptionFilter {
|
|
235
|
+
private readonly logger = new Logger(AllExceptionsFilter.name);
|
|
236
|
+
|
|
237
|
+
catch(exception: unknown, host: ArgumentsHost): void {
|
|
238
|
+
const ctx = host.switchToHttp();
|
|
239
|
+
const response = ctx.getResponse<Response>();
|
|
240
|
+
const request = ctx.getRequest<Request>();
|
|
241
|
+
|
|
242
|
+
const status = exception instanceof HttpException
|
|
243
|
+
? exception.getStatus()
|
|
244
|
+
: HttpStatus.INTERNAL_SERVER_ERROR;
|
|
245
|
+
|
|
246
|
+
this.logger.error(`${request.method} ${request.url}`, exception);
|
|
247
|
+
|
|
248
|
+
response.status(status).json({
|
|
249
|
+
statusCode: status,
|
|
250
|
+
timestamp: new Date().toISOString(),
|
|
251
|
+
path: request.url,
|
|
252
|
+
message: exception instanceof HttpException
|
|
253
|
+
? exception.message
|
|
254
|
+
: 'Internal server error',
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### **Logging**
|
|
261
|
+
- Use built-in Logger class for consistent logging
|
|
262
|
+
- Implement proper log levels (error, warn, log, debug, verbose)
|
|
263
|
+
- Add contextual information to logs
|
|
264
|
+
|
|
265
|
+
## Testing Strategies
|
|
266
|
+
|
|
267
|
+
### **Unit Testing**
|
|
268
|
+
- Test services independently using mocks
|
|
269
|
+
- Use Jest as the testing framework
|
|
270
|
+
- Create comprehensive test suites for business logic
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
describe('UsersService', () => {
|
|
274
|
+
let service: UsersService;
|
|
275
|
+
let repository: Repository<User>;
|
|
276
|
+
|
|
277
|
+
beforeEach(async () => {
|
|
278
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
279
|
+
providers: [
|
|
280
|
+
UsersService,
|
|
281
|
+
{
|
|
282
|
+
provide: getRepositoryToken(User),
|
|
283
|
+
useValue: {
|
|
284
|
+
create: jest.fn(),
|
|
285
|
+
save: jest.fn(),
|
|
286
|
+
find: jest.fn(),
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
}).compile();
|
|
291
|
+
|
|
292
|
+
service = module.get<UsersService>(UsersService);
|
|
293
|
+
repository = module.get<Repository<User>>(getRepositoryToken(User));
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it('should create a user', async () => {
|
|
297
|
+
const createUserDto = { name: 'John', email: 'john@example.com' };
|
|
298
|
+
const user = { id: '1', ...createUserDto };
|
|
299
|
+
|
|
300
|
+
jest.spyOn(repository, 'create').mockReturnValue(user as User);
|
|
301
|
+
jest.spyOn(repository, 'save').mockResolvedValue(user as User);
|
|
302
|
+
|
|
303
|
+
expect(await service.create(createUserDto)).toEqual(user);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### **Integration Testing**
|
|
309
|
+
- Use TestingModule for integration tests
|
|
310
|
+
- Test complete request/response cycles
|
|
311
|
+
- Mock external dependencies appropriately
|
|
312
|
+
|
|
313
|
+
### **E2E Testing**
|
|
314
|
+
- Test complete application flows
|
|
315
|
+
- Use supertest for HTTP testing
|
|
316
|
+
- Test authentication and authorization flows
|
|
317
|
+
|
|
318
|
+
## Performance and Security
|
|
319
|
+
|
|
320
|
+
### **Performance Optimization**
|
|
321
|
+
- Implement caching strategies with Redis
|
|
322
|
+
- Use interceptors for response transformation
|
|
323
|
+
- Optimize database queries with proper indexing
|
|
324
|
+
- Implement pagination for large datasets
|
|
325
|
+
|
|
326
|
+
### **Security Best Practices**
|
|
327
|
+
- Validate all inputs using class-validator
|
|
328
|
+
- Implement rate limiting to prevent abuse
|
|
329
|
+
- Use CORS appropriately for cross-origin requests
|
|
330
|
+
- Sanitize outputs to prevent XSS attacks
|
|
331
|
+
- Use environment variables for sensitive configuration
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
// Rate limiting example
|
|
335
|
+
@Controller('auth')
|
|
336
|
+
@UseGuards(ThrottlerGuard)
|
|
337
|
+
export class AuthController {
|
|
338
|
+
@Post('login')
|
|
339
|
+
@Throttle(5, 60) // 5 requests per minute
|
|
340
|
+
async login(@Body() loginDto: LoginDto) {
|
|
341
|
+
return this.authService.login(loginDto);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Configuration Management
|
|
347
|
+
|
|
348
|
+
### **Environment Configuration**
|
|
349
|
+
- Use @nestjs/config for configuration management
|
|
350
|
+
- Validate configuration at startup
|
|
351
|
+
- Use different configs for different environments
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
@Injectable()
|
|
355
|
+
export class ConfigService {
|
|
356
|
+
constructor(
|
|
357
|
+
@Inject(CONFIGURATION_TOKEN)
|
|
358
|
+
private readonly config: Configuration,
|
|
359
|
+
) {}
|
|
360
|
+
|
|
361
|
+
get databaseUrl(): string {
|
|
362
|
+
return this.config.database.url;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
get jwtSecret(): string {
|
|
366
|
+
return this.config.jwt.secret;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Common Pitfalls to Avoid
|
|
372
|
+
|
|
373
|
+
- **Circular Dependencies:** Avoid importing modules that create circular references
|
|
374
|
+
- **Heavy Controllers:** Don't put business logic in controllers
|
|
375
|
+
- **Missing Error Handling:** Always handle errors appropriately
|
|
376
|
+
- **Improper DI Usage:** Don't create instances manually when DI can handle it
|
|
377
|
+
- **Missing Validation:** Always validate input data
|
|
378
|
+
- **Synchronous Operations:** Use async/await for database and external API calls
|
|
379
|
+
- **Memory Leaks:** Properly dispose of subscriptions and event listeners
|
|
380
|
+
|
|
381
|
+
## Development Workflow
|
|
382
|
+
|
|
383
|
+
### **Development Setup**
|
|
384
|
+
1. Use NestJS CLI for scaffolding: `nest generate module users`
|
|
385
|
+
2. Follow consistent file organization
|
|
386
|
+
3. Use TypeScript strict mode
|
|
387
|
+
4. Implement comprehensive linting with ESLint
|
|
388
|
+
5. Use Prettier for code formatting
|
|
389
|
+
|
|
390
|
+
### **Code Review Checklist**
|
|
391
|
+
- [ ] Proper use of decorators and dependency injection
|
|
392
|
+
- [ ] Input validation with DTOs and class-validator
|
|
393
|
+
- [ ] Appropriate error handling and exception filters
|
|
394
|
+
- [ ] Consistent naming conventions
|
|
395
|
+
- [ ] Proper module organization and imports
|
|
396
|
+
- [ ] Security considerations (authentication, authorization, input sanitization)
|
|
397
|
+
- [ ] Performance considerations (caching, database optimization)
|
|
398
|
+
- [ ] Comprehensive testing coverage
|
|
399
|
+
|
|
400
|
+
## Conclusion
|
|
401
|
+
|
|
402
|
+
NestJS provides a powerful, opinionated framework for building scalable Node.js applications. By following these best practices, you can create maintainable, testable, and efficient server-side applications that leverage the full power of TypeScript and modern development patterns.
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
<!-- End of NestJS Instructions -->
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Next.js + Tailwind development standards and instructions'
|
|
3
|
+
applyTo: '**/*.tsx, **/*.ts, **/*.jsx, **/*.js, **/*.css'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Next.js + Tailwind Development Instructions
|
|
7
|
+
|
|
8
|
+
Instructions for high-quality Next.js applications with Tailwind CSS styling and TypeScript.
|
|
9
|
+
|
|
10
|
+
## Project Context
|
|
11
|
+
|
|
12
|
+
- Latest Next.js (App Router)
|
|
13
|
+
- TypeScript for type safety
|
|
14
|
+
- Tailwind CSS for styling
|
|
15
|
+
|
|
16
|
+
## Development Standards
|
|
17
|
+
|
|
18
|
+
### Architecture
|
|
19
|
+
- App Router with server and client components
|
|
20
|
+
- Group routes by feature/domain
|
|
21
|
+
- Implement proper error boundaries
|
|
22
|
+
- Use React Server Components by default
|
|
23
|
+
- Leverage static optimization where possible
|
|
24
|
+
|
|
25
|
+
### TypeScript
|
|
26
|
+
- Strict mode enabled
|
|
27
|
+
- Clear type definitions
|
|
28
|
+
- Proper error handling with type guards
|
|
29
|
+
- Zod for runtime type validation
|
|
30
|
+
|
|
31
|
+
### Styling
|
|
32
|
+
- Tailwind CSS with consistent color palette
|
|
33
|
+
- Responsive design patterns
|
|
34
|
+
- Dark mode support
|
|
35
|
+
- Follow container queries best practices
|
|
36
|
+
- Maintain semantic HTML structure
|
|
37
|
+
|
|
38
|
+
### State Management
|
|
39
|
+
- React Server Components for server state
|
|
40
|
+
- React hooks for client state
|
|
41
|
+
- Proper loading and error states
|
|
42
|
+
- Optimistic updates where appropriate
|
|
43
|
+
|
|
44
|
+
### Data Fetching
|
|
45
|
+
- Server Components for direct database queries
|
|
46
|
+
- React Suspense for loading states
|
|
47
|
+
- Proper error handling and retry logic
|
|
48
|
+
- Cache invalidation strategies
|
|
49
|
+
|
|
50
|
+
### Security
|
|
51
|
+
- Input validation and sanitization
|
|
52
|
+
- Proper authentication checks
|
|
53
|
+
- CSRF protection
|
|
54
|
+
- Rate limiting implementation
|
|
55
|
+
- Secure API route handling
|
|
56
|
+
|
|
57
|
+
### Performance
|
|
58
|
+
- Image optimization with next/image
|
|
59
|
+
- Font optimization with next/font
|
|
60
|
+
- Route prefetching
|
|
61
|
+
- Proper code splitting
|
|
62
|
+
- Bundle size optimization
|
|
63
|
+
|
|
64
|
+
## Implementation Process
|
|
65
|
+
1. Plan component hierarchy
|
|
66
|
+
2. Define types and interfaces
|
|
67
|
+
3. Implement server-side logic
|
|
68
|
+
4. Build client components
|
|
69
|
+
5. Add proper error handling
|
|
70
|
+
6. Implement responsive styling
|
|
71
|
+
7. Add loading states
|
|
72
|
+
8. Write tests
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: '**'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Next.js Best Practices for LLMs (2025)
|
|
6
|
+
|
|
7
|
+
_Last updated: July 2025_
|
|
8
|
+
|
|
9
|
+
This document summarizes the latest, authoritative best practices for building, structuring, and maintaining Next.js applications. It is intended for use by LLMs and developers to ensure code quality, maintainability, and scalability.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Project Structure & Organization
|
|
14
|
+
|
|
15
|
+
- **Use the `app/` directory** (App Router) for all new projects. Prefer it over the legacy `pages/` directory.
|
|
16
|
+
- **Top-level folders:**
|
|
17
|
+
- `app/` — Routing, layouts, pages, and route handlers
|
|
18
|
+
- `public/` — Static assets (images, fonts, etc.)
|
|
19
|
+
- `lib/` — Shared utilities, API clients, and logic
|
|
20
|
+
- `components/` — Reusable UI components
|
|
21
|
+
- `contexts/` — React context providers
|
|
22
|
+
- `styles/` — Global and modular stylesheets
|
|
23
|
+
- `hooks/` — Custom React hooks
|
|
24
|
+
- `types/` — TypeScript type definitions
|
|
25
|
+
- **Colocation:** Place files (components, styles, tests) near where they are used, but avoid deeply nested structures.
|
|
26
|
+
- **Route Groups:** Use parentheses (e.g., `(admin)`) to group routes without affecting the URL path.
|
|
27
|
+
- **Private Folders:** Prefix with `_` (e.g., `_internal`) to opt out of routing and signal implementation details.
|
|
28
|
+
|
|
29
|
+
- **Feature Folders:** For large apps, group by feature (e.g., `app/dashboard/`, `app/auth/`).
|
|
30
|
+
- **Use `src/`** (optional): Place all source code in `src/` to separate from config files.
|
|
31
|
+
|
|
32
|
+
## 2.1. Server and Client Component Integration (App Router)
|
|
33
|
+
|
|
34
|
+
**Never use `next/dynamic` with `{ ssr: false }` inside a Server Component.** This is not supported and will cause a build/runtime error.
|
|
35
|
+
|
|
36
|
+
**Correct Approach:**
|
|
37
|
+
- If you need to use a Client Component (e.g., a component that uses hooks, browser APIs, or client-only libraries) inside a Server Component, you must:
|
|
38
|
+
1. Move all client-only logic/UI into a dedicated Client Component (with `'use client'` at the top).
|
|
39
|
+
2. Import and use that Client Component directly in the Server Component (no need for `next/dynamic`).
|
|
40
|
+
3. If you need to compose multiple client-only elements (e.g., a navbar with a profile dropdown), create a single Client Component that contains all of them.
|
|
41
|
+
|
|
42
|
+
**Example:**
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
// Server Component
|
|
46
|
+
import DashboardNavbar from '@/components/DashboardNavbar';
|
|
47
|
+
|
|
48
|
+
export default async function DashboardPage() {
|
|
49
|
+
// ...server logic...
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<DashboardNavbar /> {/* This is a Client Component */}
|
|
53
|
+
{/* ...rest of server-rendered page... */}
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Why:**
|
|
60
|
+
- Server Components cannot use client-only features or dynamic imports with SSR disabled.
|
|
61
|
+
- Client Components can be rendered inside Server Components, but not the other way around.
|
|
62
|
+
|
|
63
|
+
**Summary:**
|
|
64
|
+
Always move client-only UI into a Client Component and import it directly in your Server Component. Never use `next/dynamic` with `{ ssr: false }` in a Server Component.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 2. Component Best Practices
|
|
69
|
+
|
|
70
|
+
- **Component Types:**
|
|
71
|
+
- **Server Components** (default): For data fetching, heavy logic, and non-interactive UI.
|
|
72
|
+
- **Client Components:** Add `'use client'` at the top. Use for interactivity, state, or browser APIs.
|
|
73
|
+
- **When to Create a Component:**
|
|
74
|
+
- If a UI pattern is reused more than once.
|
|
75
|
+
- If a section of a page is complex or self-contained.
|
|
76
|
+
- If it improves readability or testability.
|
|
77
|
+
- **Naming Conventions:**
|
|
78
|
+
- Use `PascalCase` for component files and exports (e.g., `UserCard.tsx`).
|
|
79
|
+
- Use `camelCase` for hooks (e.g., `useUser.ts`).
|
|
80
|
+
- Use `snake_case` or `kebab-case` for static assets (e.g., `logo_dark.svg`).
|
|
81
|
+
- Name context providers as `XyzProvider` (e.g., `ThemeProvider`).
|
|
82
|
+
- **File Naming:**
|
|
83
|
+
- Match the component name to the file name.
|
|
84
|
+
- For single-export files, default export the component.
|
|
85
|
+
- For multiple related components, use an `index.ts` barrel file.
|
|
86
|
+
- **Component Location:**
|
|
87
|
+
- Place shared components in `components/`.
|
|
88
|
+
- Place route-specific components inside the relevant route folder.
|
|
89
|
+
- **Props:**
|
|
90
|
+
- Use TypeScript interfaces for props.
|
|
91
|
+
- Prefer explicit prop types and default values.
|
|
92
|
+
- **Testing:**
|
|
93
|
+
- Co-locate tests with components (e.g., `UserCard.test.tsx`).
|
|
94
|
+
|
|
95
|
+
## 3. Naming Conventions (General)
|
|
96
|
+
|
|
97
|
+
- **Folders:** `kebab-case` (e.g., `user-profile/`)
|
|
98
|
+
- **Files:** `PascalCase` for components, `camelCase` for utilities/hooks, `kebab-case` for static assets
|
|
99
|
+
- **Variables/Functions:** `camelCase`
|
|
100
|
+
- **Types/Interfaces:** `PascalCase`
|
|
101
|
+
- **Constants:** `UPPER_SNAKE_CASE`
|
|
102
|
+
|
|
103
|
+
## 4. API Routes (Route Handlers)
|
|
104
|
+
|
|
105
|
+
- **Prefer API Routes over Edge Functions** unless you need ultra-low latency or geographic distribution.
|
|
106
|
+
- **Location:** Place API routes in `app/api/` (e.g., `app/api/users/route.ts`).
|
|
107
|
+
- **HTTP Methods:** Export async functions named after HTTP verbs (`GET`, `POST`, etc.).
|
|
108
|
+
- **Request/Response:** Use the Web `Request` and `Response` APIs. Use `NextRequest`/`NextResponse` for advanced features.
|
|
109
|
+
- **Dynamic Segments:** Use `[param]` for dynamic API routes (e.g., `app/api/users/[id]/route.ts`).
|
|
110
|
+
- **Validation:** Always validate and sanitize input. Use libraries like `zod` or `yup`.
|
|
111
|
+
- **Error Handling:** Return appropriate HTTP status codes and error messages.
|
|
112
|
+
- **Authentication:** Protect sensitive routes using middleware or server-side session checks.
|
|
113
|
+
|
|
114
|
+
## 5. General Best Practices
|
|
115
|
+
|
|
116
|
+
- **TypeScript:** Use TypeScript for all code. Enable `strict` mode in `tsconfig.json`.
|
|
117
|
+
- **ESLint & Prettier:** Enforce code style and linting. Use the official Next.js ESLint config.
|
|
118
|
+
- **Environment Variables:** Store secrets in `.env.local`. Never commit secrets to version control.
|
|
119
|
+
- **Testing:** Use Jest, React Testing Library, or Playwright. Write tests for all critical logic and components.
|
|
120
|
+
- **Accessibility:** Use semantic HTML and ARIA attributes. Test with screen readers.
|
|
121
|
+
- **Performance:**
|
|
122
|
+
- Use built-in Image and Font optimization.
|
|
123
|
+
- Use Suspense and loading states for async data.
|
|
124
|
+
- Avoid large client bundles; keep most logic in Server Components.
|
|
125
|
+
- **Security:**
|
|
126
|
+
- Sanitize all user input.
|
|
127
|
+
- Use HTTPS in production.
|
|
128
|
+
- Set secure HTTP headers.
|
|
129
|
+
- **Documentation:**
|
|
130
|
+
- Write clear README and code comments.
|
|
131
|
+
- Document public APIs and components.
|
|
132
|
+
|
|
133
|
+
# Avoid Unnecessary Example Files
|
|
134
|
+
|
|
135
|
+
Do not create example/demo files (like ModalExample.tsx) in the main codebase unless the user specifically requests a live example, Storybook story, or explicit documentation component. Keep the repository clean and production-focused by default.
|
|
136
|
+
|
|
137
|
+
# Always use the latest documentation and guides
|
|
138
|
+
- For every nextjs related request, begin by searching for the most current nextjs documentation, guides, and examples.
|
|
139
|
+
- Use the following tools to fetch and search documentation if they are available:
|
|
140
|
+
- `resolve_library_id` to resolve the package/library name in the docs.
|
|
141
|
+
- `get_library_docs` for up to date documentation.
|
|
142
|
+
|
|
143
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Guidelines for writing Node.js and JavaScript code with Vitest testing"
|
|
3
|
+
applyTo: '**/*.js, **/*.mjs, **/*.cjs'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Generation Guidelines
|
|
7
|
+
|
|
8
|
+
## Coding standards
|
|
9
|
+
- Use JavaScript with ES2022 features and Node.js (20+) ESM modules
|
|
10
|
+
- Use Node.js built-in modules and avoid external dependencies where possible
|
|
11
|
+
- Ask the user if you require any additional dependencies before adding them
|
|
12
|
+
- Always use async/await for asynchronous code, and use 'node:util' promisify function to avoid callbacks
|
|
13
|
+
- Keep the code simple and maintainable
|
|
14
|
+
- Use descriptive variable and function names
|
|
15
|
+
- Do not add comments unless absolutely necessary, the code should be self-explanatory
|
|
16
|
+
- Never use `null`, always use `undefined` for optional values
|
|
17
|
+
- Prefer functions over classes
|
|
18
|
+
|
|
19
|
+
## Testing
|
|
20
|
+
- Use Vitest for testing
|
|
21
|
+
- Write tests for all new features and bug fixes
|
|
22
|
+
- Ensure tests cover edge cases and error handling
|
|
23
|
+
- NEVER change the original code to make it easier to test, instead, write tests that cover the original code as it is
|
|
24
|
+
|
|
25
|
+
## Documentation
|
|
26
|
+
- When adding new features or making significant changes, update the README.md file where necessary
|
|
27
|
+
|
|
28
|
+
## User interactions
|
|
29
|
+
- Ask questions if you are unsure about the implementation details, design choices, or need clarification on the requirements
|
|
30
|
+
- Always answer in the same language as the question, but use english for the generated content like code, comments or docs
|