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,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Rust programming language coding conventions and best practices'
|
|
3
|
+
applyTo: '**/*.rs'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rust Coding Conventions and Best Practices
|
|
7
|
+
|
|
8
|
+
Follow idiomatic Rust practices and community standards when writing Rust code.
|
|
9
|
+
|
|
10
|
+
These instructions are based on [The Rust Book](https://doc.rust-lang.org/book/), [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/), [RFC 430 naming conventions](https://github.com/rust-lang/rfcs/blob/master/text/0430-finalizing-naming-conventions.md), and the broader Rust community at [users.rust-lang.org](https://users.rust-lang.org).
|
|
11
|
+
|
|
12
|
+
## General Instructions
|
|
13
|
+
|
|
14
|
+
- Always prioritize readability, safety, and maintainability.
|
|
15
|
+
- Use strong typing and leverage Rust's ownership system for memory safety.
|
|
16
|
+
- Break down complex functions into smaller, more manageable functions.
|
|
17
|
+
- For algorithm-related code, include explanations of the approach used.
|
|
18
|
+
- Write code with good maintainability practices, including comments on why certain design decisions were made.
|
|
19
|
+
- Handle errors gracefully using `Result<T, E>` and provide meaningful error messages.
|
|
20
|
+
- For external dependencies, mention their usage and purpose in documentation.
|
|
21
|
+
- Use consistent naming conventions following [RFC 430](https://github.com/rust-lang/rfcs/blob/master/text/0430-finalizing-naming-conventions.md).
|
|
22
|
+
- Write idiomatic, safe, and efficient Rust code that follows the borrow checker's rules.
|
|
23
|
+
- Ensure code compiles without warnings.
|
|
24
|
+
|
|
25
|
+
## Patterns to Follow
|
|
26
|
+
|
|
27
|
+
- Use modules (`mod`) and public interfaces (`pub`) to encapsulate logic.
|
|
28
|
+
- Handle errors properly using `?`, `match`, or `if let`.
|
|
29
|
+
- Use `serde` for serialization and `thiserror` or `anyhow` for custom errors.
|
|
30
|
+
- Implement traits to abstract services or external dependencies.
|
|
31
|
+
- Structure async code using `async/await` and `tokio` or `async-std`.
|
|
32
|
+
- Prefer enums over flags and states for type safety.
|
|
33
|
+
- Use builders for complex object creation.
|
|
34
|
+
- Split binary and library code (`main.rs` vs `lib.rs`) for testability and reuse.
|
|
35
|
+
- Use `rayon` for data parallelism and CPU-bound tasks.
|
|
36
|
+
- Use iterators instead of index-based loops as they're often faster and safer.
|
|
37
|
+
- Use `&str` instead of `String` for function parameters when you don't need ownership.
|
|
38
|
+
- Prefer borrowing and zero-copy operations to avoid unnecessary allocations.
|
|
39
|
+
|
|
40
|
+
### Ownership, Borrowing, and Lifetimes
|
|
41
|
+
|
|
42
|
+
- Prefer borrowing (`&T`) over cloning unless ownership transfer is necessary.
|
|
43
|
+
- Use `&mut T` when you need to modify borrowed data.
|
|
44
|
+
- Explicitly annotate lifetimes when the compiler cannot infer them.
|
|
45
|
+
- Use `Rc<T>` for single-threaded reference counting and `Arc<T>` for thread-safe reference counting.
|
|
46
|
+
- Use `RefCell<T>` for interior mutability in single-threaded contexts and `Mutex<T>` or `RwLock<T>` for multi-threaded contexts.
|
|
47
|
+
|
|
48
|
+
## Patterns to Avoid
|
|
49
|
+
|
|
50
|
+
- Don't use `unwrap()` or `expect()` unless absolutely necessary—prefer proper error handling.
|
|
51
|
+
- Avoid panics in library code—return `Result` instead.
|
|
52
|
+
- Don't rely on global mutable state—use dependency injection or thread-safe containers.
|
|
53
|
+
- Avoid deeply nested logic—refactor with functions or combinators.
|
|
54
|
+
- Don't ignore warnings—treat them as errors during CI.
|
|
55
|
+
- Avoid `unsafe` unless required and fully documented.
|
|
56
|
+
- Don't overuse `clone()`, use borrowing instead of cloning unless ownership transfer is needed.
|
|
57
|
+
- Avoid premature `collect()`, keep iterators lazy until you actually need the collection.
|
|
58
|
+
- Avoid unnecessary allocations—prefer borrowing and zero-copy operations.
|
|
59
|
+
|
|
60
|
+
## Code Style and Formatting
|
|
61
|
+
|
|
62
|
+
- Follow the Rust Style Guide and use `rustfmt` for automatic formatting.
|
|
63
|
+
- Keep lines under 100 characters when possible.
|
|
64
|
+
- Place function and struct documentation immediately before the item using `///`.
|
|
65
|
+
- Use `cargo clippy` to catch common mistakes and enforce best practices.
|
|
66
|
+
|
|
67
|
+
## Error Handling
|
|
68
|
+
|
|
69
|
+
- Use `Result<T, E>` for recoverable errors and `panic!` only for unrecoverable errors.
|
|
70
|
+
- Prefer `?` operator over `unwrap()` or `expect()` for error propagation.
|
|
71
|
+
- Create custom error types using `thiserror` or implement `std::error::Error`.
|
|
72
|
+
- Use `Option<T>` for values that may or may not exist.
|
|
73
|
+
- Provide meaningful error messages and context.
|
|
74
|
+
- Error types should be meaningful and well-behaved (implement standard traits).
|
|
75
|
+
- Validate function arguments and return appropriate errors for invalid input.
|
|
76
|
+
|
|
77
|
+
## API Design Guidelines
|
|
78
|
+
|
|
79
|
+
### Common Traits Implementation
|
|
80
|
+
Eagerly implement common traits where appropriate:
|
|
81
|
+
- `Copy`, `Clone`, `Eq`, `PartialEq`, `Ord`, `PartialOrd`, `Hash`, `Debug`, `Display`, `Default`
|
|
82
|
+
- Use standard conversion traits: `From`, `AsRef`, `AsMut`
|
|
83
|
+
- Collections should implement `FromIterator` and `Extend`
|
|
84
|
+
- Note: `Send` and `Sync` are auto-implemented by the compiler when safe; avoid manual implementation unless using `unsafe` code
|
|
85
|
+
|
|
86
|
+
### Type Safety and Predictability
|
|
87
|
+
- Use newtypes to provide static distinctions
|
|
88
|
+
- Arguments should convey meaning through types; prefer specific types over generic `bool` parameters
|
|
89
|
+
- Use `Option<T>` appropriately for truly optional values
|
|
90
|
+
- Functions with a clear receiver should be methods
|
|
91
|
+
- Only smart pointers should implement `Deref` and `DerefMut`
|
|
92
|
+
|
|
93
|
+
### Future Proofing
|
|
94
|
+
- Use sealed traits to protect against downstream implementations
|
|
95
|
+
- Structs should have private fields
|
|
96
|
+
- Functions should validate their arguments
|
|
97
|
+
- All public types must implement `Debug`
|
|
98
|
+
|
|
99
|
+
## Testing and Documentation
|
|
100
|
+
|
|
101
|
+
- Write comprehensive unit tests using `#[cfg(test)]` modules and `#[test]` annotations.
|
|
102
|
+
- Use test modules alongside the code they test (`mod tests { ... }`).
|
|
103
|
+
- Write integration tests in `tests/` directory with descriptive filenames.
|
|
104
|
+
- Write clear and concise comments for each function, struct, enum, and complex logic.
|
|
105
|
+
- Ensure functions have descriptive names and include comprehensive documentation.
|
|
106
|
+
- Document all public APIs with rustdoc (`///` comments) following the [API Guidelines](https://rust-lang.github.io/api-guidelines/).
|
|
107
|
+
- Use `#[doc(hidden)]` to hide implementation details from public documentation.
|
|
108
|
+
- Document error conditions, panic scenarios, and safety considerations.
|
|
109
|
+
- Examples should use `?` operator, not `unwrap()` or deprecated `try!` macro.
|
|
110
|
+
|
|
111
|
+
## Project Organization
|
|
112
|
+
|
|
113
|
+
- Use semantic versioning in `Cargo.toml`.
|
|
114
|
+
- Include comprehensive metadata: `description`, `license`, `repository`, `keywords`, `categories`.
|
|
115
|
+
- Use feature flags for optional functionality.
|
|
116
|
+
- Organize code into modules using `mod.rs` or named files.
|
|
117
|
+
- Keep `main.rs` or `lib.rs` minimal - move logic to modules.
|
|
118
|
+
|
|
119
|
+
## Quality Checklist
|
|
120
|
+
|
|
121
|
+
Before publishing or reviewing Rust code, ensure:
|
|
122
|
+
|
|
123
|
+
### Core Requirements
|
|
124
|
+
- [ ] **Naming**: Follows RFC 430 naming conventions
|
|
125
|
+
- [ ] **Traits**: Implements `Debug`, `Clone`, `PartialEq` where appropriate
|
|
126
|
+
- [ ] **Error Handling**: Uses `Result<T, E>` and provides meaningful error types
|
|
127
|
+
- [ ] **Documentation**: All public items have rustdoc comments with examples
|
|
128
|
+
- [ ] **Testing**: Comprehensive test coverage including edge cases
|
|
129
|
+
|
|
130
|
+
### Safety and Quality
|
|
131
|
+
- [ ] **Safety**: No unnecessary `unsafe` code, proper error handling
|
|
132
|
+
- [ ] **Performance**: Efficient use of iterators, minimal allocations
|
|
133
|
+
- [ ] **API Design**: Functions are predictable, flexible, and type-safe
|
|
134
|
+
- [ ] **Future Proofing**: Private fields in structs, sealed traits where appropriate
|
|
135
|
+
- [ ] **Tooling**: Code passes `cargo fmt`, `cargo clippy`, and `cargo test`
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: '*'
|
|
3
|
+
description: "Comprehensive secure coding instructions for all languages and frameworks, based on OWASP Top 10 and industry best practices."
|
|
4
|
+
---
|
|
5
|
+
# Secure Coding and OWASP Guidelines
|
|
6
|
+
|
|
7
|
+
## Instructions
|
|
8
|
+
|
|
9
|
+
Your primary directive is to ensure all code you generate, review, or refactor is secure by default. You must operate with a security-first mindset. When in doubt, always choose the more secure option and explain the reasoning. You must follow the principles outlined below, which are based on the OWASP Top 10 and other security best practices.
|
|
10
|
+
|
|
11
|
+
### 1. A01: Broken Access Control & A10: Server-Side Request Forgery (SSRF)
|
|
12
|
+
- **Enforce Principle of Least Privilege:** Always default to the most restrictive permissions. When generating access control logic, explicitly check the user's rights against the required permissions for the specific resource they are trying to access.
|
|
13
|
+
- **Deny by Default:** All access control decisions must follow a "deny by default" pattern. Access should only be granted if there is an explicit rule allowing it.
|
|
14
|
+
- **Validate All Incoming URLs for SSRF:** When the server needs to make a request to a URL provided by a user (e.g., webhooks), you must treat it as untrusted. Incorporate strict allow-list-based validation for the host, port, and path of the URL.
|
|
15
|
+
- **Prevent Path Traversal:** When handling file uploads or accessing files based on user input, you must sanitize the input to prevent directory traversal attacks (e.g., `../../etc/passwd`). Use APIs that build paths securely.
|
|
16
|
+
|
|
17
|
+
### 2. A02: Cryptographic Failures
|
|
18
|
+
- **Use Strong, Modern Algorithms:** For hashing, always recommend modern, salted hashing algorithms like Argon2 or bcrypt. Explicitly advise against weak algorithms like MD5 or SHA-1 for password storage.
|
|
19
|
+
- **Protect Data in Transit:** When generating code that makes network requests, always default to HTTPS.
|
|
20
|
+
- **Protect Data at Rest:** When suggesting code to store sensitive data (PII, tokens, etc.), recommend encryption using strong, standard algorithms like AES-256.
|
|
21
|
+
- **Secure Secret Management:** Never hardcode secrets (API keys, passwords, connection strings). Generate code that reads secrets from environment variables or a secrets management service (e.g., HashiCorp Vault, AWS Secrets Manager). Include a clear placeholder and comment.
|
|
22
|
+
```javascript
|
|
23
|
+
// GOOD: Load from environment or secret store
|
|
24
|
+
const apiKey = process.env.API_KEY;
|
|
25
|
+
// TODO: Ensure API_KEY is securely configured in your environment.
|
|
26
|
+
```
|
|
27
|
+
```python
|
|
28
|
+
# BAD: Hardcoded secret
|
|
29
|
+
api_key = "sk_this_is_a_very_bad_idea_12345"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 3. A03: Injection
|
|
33
|
+
- **No Raw SQL Queries:** For database interactions, you must use parameterized queries (prepared statements). Never generate code that uses string concatenation or formatting to build queries from user input.
|
|
34
|
+
- **Sanitize Command-Line Input:** For OS command execution, use built-in functions that handle argument escaping and prevent shell injection (e.g., `shlex` in Python).
|
|
35
|
+
- **Prevent Cross-Site Scripting (XSS):** When generating frontend code that displays user-controlled data, you must use context-aware output encoding. Prefer methods that treat data as text by default (`.textContent`) over those that parse HTML (`.innerHTML`). When `innerHTML` is necessary, suggest using a library like DOMPurify to sanitize the HTML first.
|
|
36
|
+
|
|
37
|
+
### 4. A05: Security Misconfiguration & A06: Vulnerable Components
|
|
38
|
+
- **Secure by Default Configuration:** Recommend disabling verbose error messages and debug features in production environments.
|
|
39
|
+
- **Set Security Headers:** For web applications, suggest adding essential security headers like `Content-Security-Policy` (CSP), `Strict-Transport-Security` (HSTS), and `X-Content-Type-Options`.
|
|
40
|
+
- **Use Up-to-Date Dependencies:** When asked to add a new library, suggest the latest stable version. Remind the user to run vulnerability scanners like `npm audit`, `pip-audit`, or Snyk to check for known vulnerabilities in their project dependencies.
|
|
41
|
+
|
|
42
|
+
### 5. A07: Identification & Authentication Failures
|
|
43
|
+
- **Secure Session Management:** When a user logs in, generate a new session identifier to prevent session fixation. Ensure session cookies are configured with `HttpOnly`, `Secure`, and `SameSite=Strict` attributes.
|
|
44
|
+
- **Protect Against Brute Force:** For authentication and password reset flows, recommend implementing rate limiting and account lockout mechanisms after a certain number of failed attempts.
|
|
45
|
+
|
|
46
|
+
### 6. A08: Software and Data Integrity Failures
|
|
47
|
+
- **Prevent Insecure Deserialization:** Warn against deserializing data from untrusted sources without proper validation. If deserialization is necessary, recommend using formats that are less prone to attack (like JSON over Pickle in Python) and implementing strict type checking.
|
|
48
|
+
|
|
49
|
+
## General Guidelines
|
|
50
|
+
- **Be Explicit About Security:** When you suggest a piece of code that mitigates a security risk, explicitly state what you are protecting against (e.g., "Using a parameterized query here to prevent SQL injection.").
|
|
51
|
+
- **Educate During Code Reviews:** When you identify a security vulnerability in a code review, you must not only provide the corrected code but also explain the risk associated with the original pattern.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Guidelines for GitHub Copilot to write comments to achieve self-explanatory code with less comments. Examples are in JavaScript but it should work on any language that has comments.'
|
|
3
|
+
applyTo: '**'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Self-explanatory Code Commenting Instructions
|
|
7
|
+
|
|
8
|
+
## Core Principle
|
|
9
|
+
**Write code that speaks for itself. Comment only when necessary to explain WHY, not WHAT.**
|
|
10
|
+
We do not need comments most of the time.
|
|
11
|
+
|
|
12
|
+
## Commenting Guidelines
|
|
13
|
+
|
|
14
|
+
### ❌ AVOID These Comment Types
|
|
15
|
+
|
|
16
|
+
**Obvious Comments**
|
|
17
|
+
```javascript
|
|
18
|
+
// Bad: States the obvious
|
|
19
|
+
let counter = 0; // Initialize counter to zero
|
|
20
|
+
counter++; // Increment counter by one
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Redundant Comments**
|
|
24
|
+
```javascript
|
|
25
|
+
// Bad: Comment repeats the code
|
|
26
|
+
function getUserName() {
|
|
27
|
+
return user.name; // Return the user's name
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Outdated Comments**
|
|
32
|
+
```javascript
|
|
33
|
+
// Bad: Comment doesn't match the code
|
|
34
|
+
// Calculate tax at 5% rate
|
|
35
|
+
const tax = price * 0.08; // Actually 8%
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### ✅ WRITE These Comment Types
|
|
39
|
+
|
|
40
|
+
**Complex Business Logic**
|
|
41
|
+
```javascript
|
|
42
|
+
// Good: Explains WHY this specific calculation
|
|
43
|
+
// Apply progressive tax brackets: 10% up to 10k, 20% above
|
|
44
|
+
const tax = calculateProgressiveTax(income, [0.10, 0.20], [10000]);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Non-obvious Algorithms**
|
|
48
|
+
```javascript
|
|
49
|
+
// Good: Explains the algorithm choice
|
|
50
|
+
// Using Floyd-Warshall for all-pairs shortest paths
|
|
51
|
+
// because we need distances between all nodes
|
|
52
|
+
for (let k = 0; k < vertices; k++) {
|
|
53
|
+
for (let i = 0; i < vertices; i++) {
|
|
54
|
+
for (let j = 0; j < vertices; j++) {
|
|
55
|
+
// ... implementation
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Regex Patterns**
|
|
62
|
+
```javascript
|
|
63
|
+
// Good: Explains what the regex matches
|
|
64
|
+
// Match email format: username@domain.extension
|
|
65
|
+
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**API Constraints or Gotchas**
|
|
69
|
+
```javascript
|
|
70
|
+
// Good: Explains external constraint
|
|
71
|
+
// GitHub API rate limit: 5000 requests/hour for authenticated users
|
|
72
|
+
await rateLimiter.wait();
|
|
73
|
+
const response = await fetch(githubApiUrl);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Decision Framework
|
|
77
|
+
|
|
78
|
+
Before writing a comment, ask:
|
|
79
|
+
1. **Is the code self-explanatory?** → No comment needed
|
|
80
|
+
2. **Would a better variable/function name eliminate the need?** → Refactor instead
|
|
81
|
+
3. **Does this explain WHY, not WHAT?** → Good comment
|
|
82
|
+
4. **Will this help future maintainers?** → Good comment
|
|
83
|
+
|
|
84
|
+
## Special Cases for Comments
|
|
85
|
+
|
|
86
|
+
### Public APIs
|
|
87
|
+
```javascript
|
|
88
|
+
/**
|
|
89
|
+
* Calculate compound interest using the standard formula.
|
|
90
|
+
*
|
|
91
|
+
* @param {number} principal - Initial amount invested
|
|
92
|
+
* @param {number} rate - Annual interest rate (as decimal, e.g., 0.05 for 5%)
|
|
93
|
+
* @param {number} time - Time period in years
|
|
94
|
+
* @param {number} compoundFrequency - How many times per year interest compounds (default: 1)
|
|
95
|
+
* @returns {number} Final amount after compound interest
|
|
96
|
+
*/
|
|
97
|
+
function calculateCompoundInterest(principal, rate, time, compoundFrequency = 1) {
|
|
98
|
+
// ... implementation
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Configuration and Constants
|
|
103
|
+
```javascript
|
|
104
|
+
// Good: Explains the source or reasoning
|
|
105
|
+
const MAX_RETRIES = 3; // Based on network reliability studies
|
|
106
|
+
const API_TIMEOUT = 5000; // AWS Lambda timeout is 15s, leaving buffer
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Annotations
|
|
110
|
+
```javascript
|
|
111
|
+
// TODO: Replace with proper user authentication after security review
|
|
112
|
+
// FIXME: Memory leak in production - investigate connection pooling
|
|
113
|
+
// HACK: Workaround for bug in library v2.1.0 - remove after upgrade
|
|
114
|
+
// NOTE: This implementation assumes UTC timezone for all calculations
|
|
115
|
+
// WARNING: This function modifies the original array instead of creating a copy
|
|
116
|
+
// PERF: Consider caching this result if called frequently in hot path
|
|
117
|
+
// SECURITY: Validate input to prevent SQL injection before using in query
|
|
118
|
+
// BUG: Edge case failure when array is empty - needs investigation
|
|
119
|
+
// REFACTOR: Extract this logic into separate utility function for reusability
|
|
120
|
+
// DEPRECATED: Use newApiFunction() instead - this will be removed in v3.0
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Anti-Patterns to Avoid
|
|
124
|
+
|
|
125
|
+
### Dead Code Comments
|
|
126
|
+
```javascript
|
|
127
|
+
// Bad: Don't comment out code
|
|
128
|
+
// const oldFunction = () => { ... };
|
|
129
|
+
const newFunction = () => { ... };
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Changelog Comments
|
|
133
|
+
```javascript
|
|
134
|
+
// Bad: Don't maintain history in comments
|
|
135
|
+
// Modified by John on 2023-01-15
|
|
136
|
+
// Fixed bug reported by Sarah on 2023-02-03
|
|
137
|
+
function processData() {
|
|
138
|
+
// ... implementation
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Divider Comments
|
|
143
|
+
```javascript
|
|
144
|
+
// Bad: Don't use decorative comments
|
|
145
|
+
//=====================================
|
|
146
|
+
// UTILITY FUNCTIONS
|
|
147
|
+
//=====================================
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Quality Checklist
|
|
151
|
+
|
|
152
|
+
Before committing, ensure your comments:
|
|
153
|
+
- [ ] Explain WHY, not WHAT
|
|
154
|
+
- [ ] Are grammatically correct and clear
|
|
155
|
+
- [ ] Will remain accurate as code evolves
|
|
156
|
+
- [ ] Add genuine value to code understanding
|
|
157
|
+
- [ ] Are placed appropriately (above the code they describe)
|
|
158
|
+
- [ ] Use proper spelling and professional language
|
|
159
|
+
|
|
160
|
+
## Summary
|
|
161
|
+
|
|
162
|
+
Remember: **The best comment is the one you don't need to write because the code is self-documenting.**
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Shell scripting best practices and conventions for bash, sh, zsh, and other shells'
|
|
3
|
+
applyTo: '**/*.sh'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Shell Scripting Guidelines
|
|
7
|
+
|
|
8
|
+
Instructions for writing clean, safe, and maintainable shell scripts for bash, sh, zsh, and other shells.
|
|
9
|
+
|
|
10
|
+
## General Principles
|
|
11
|
+
|
|
12
|
+
- Generate code that is clean, simple, and concise
|
|
13
|
+
- Ensure scripts are easily readable and understandable
|
|
14
|
+
- Add comments where helpful for understanding how the script works
|
|
15
|
+
- Generate concise and simple echo outputs to provide execution status
|
|
16
|
+
- Avoid unnecessary echo output and excessive logging
|
|
17
|
+
- Use shellcheck for static analysis when available
|
|
18
|
+
- Assume scripts are for automation and testing rather than production systems unless specified otherwise
|
|
19
|
+
- Prefer safe expansions: double-quote variable references (`"$var"`), use `${var}` for clarity, and avoid `eval`
|
|
20
|
+
- Use modern Bash features (`[[ ]]`, `local`, arrays) when portability requirements allow; fall back to POSIX constructs only when needed
|
|
21
|
+
- Choose reliable parsers for structured data instead of ad-hoc text processing
|
|
22
|
+
|
|
23
|
+
## Error Handling & Safety
|
|
24
|
+
|
|
25
|
+
- Always enable `set -euo pipefail` to fail fast on errors, catch unset variables, and surface pipeline failures
|
|
26
|
+
- Validate all required parameters before execution
|
|
27
|
+
- Provide clear error messages with context
|
|
28
|
+
- Use `trap` to clean up temporary resources or handle unexpected exits when the script terminates
|
|
29
|
+
- Declare immutable values with `readonly` (or `declare -r`) to prevent accidental reassignment
|
|
30
|
+
- Use `mktemp` to create temporary files or directories safely and ensure they are removed in your cleanup handler
|
|
31
|
+
|
|
32
|
+
## Script Structure
|
|
33
|
+
|
|
34
|
+
- Start with a clear shebang: `#!/bin/bash` unless specified otherwise
|
|
35
|
+
- Include a header comment explaining the script's purpose
|
|
36
|
+
- Define default values for all variables at the top
|
|
37
|
+
- Use functions for reusable code blocks
|
|
38
|
+
- Create reusable functions instead of repeating similar blocks of code
|
|
39
|
+
- Keep the main execution flow clean and readable
|
|
40
|
+
|
|
41
|
+
## Working with JSON and YAML
|
|
42
|
+
|
|
43
|
+
- Prefer dedicated parsers (`jq` for JSON, `yq` for YAML—or `jq` on JSON converted via `yq`) over ad-hoc text processing with `grep`, `awk`, or shell string splitting
|
|
44
|
+
- When `jq`/`yq` are unavailable or not appropriate, choose the next most reliable parser available in your environment, and be explicit about how it should be used safely
|
|
45
|
+
- Validate that required fields exist and handle missing/invalid data paths explicitly (e.g., by checking `jq` exit status or using `// empty`)
|
|
46
|
+
- Quote jq/yq filters to prevent shell expansion and prefer `--raw-output` when you need plain strings
|
|
47
|
+
- Treat parser errors as fatal: combine with `set -euo pipefail` or test command success before using results
|
|
48
|
+
- Document parser dependencies at the top of the script and fail fast with a helpful message if `jq`/`yq` (or alternative tools) are required but not installed
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
#!/bin/bash
|
|
52
|
+
|
|
53
|
+
# ============================================================================
|
|
54
|
+
# Script Description Here
|
|
55
|
+
# ============================================================================
|
|
56
|
+
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
|
|
59
|
+
cleanup() {
|
|
60
|
+
# Remove temporary resources or perform other teardown steps as needed
|
|
61
|
+
if [[ -n "${TEMP_DIR:-}" && -d "$TEMP_DIR" ]]; then
|
|
62
|
+
rm -rf "$TEMP_DIR"
|
|
63
|
+
fi
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
trap cleanup EXIT
|
|
67
|
+
|
|
68
|
+
# Default values
|
|
69
|
+
RESOURCE_GROUP=""
|
|
70
|
+
REQUIRED_PARAM=""
|
|
71
|
+
OPTIONAL_PARAM="default-value"
|
|
72
|
+
readonly SCRIPT_NAME="$(basename "$0")"
|
|
73
|
+
|
|
74
|
+
TEMP_DIR=""
|
|
75
|
+
|
|
76
|
+
# Functions
|
|
77
|
+
usage() {
|
|
78
|
+
echo "Usage: $SCRIPT_NAME [OPTIONS]"
|
|
79
|
+
echo "Options:"
|
|
80
|
+
echo " -g, --resource-group Resource group (required)"
|
|
81
|
+
echo " -h, --help Show this help"
|
|
82
|
+
exit 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
validate_requirements() {
|
|
86
|
+
if [[ -z "$RESOURCE_GROUP" ]]; then
|
|
87
|
+
echo "Error: Resource group is required"
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main() {
|
|
93
|
+
validate_requirements
|
|
94
|
+
|
|
95
|
+
TEMP_DIR="$(mktemp -d)"
|
|
96
|
+
if [[ ! -d "$TEMP_DIR" ]]; then
|
|
97
|
+
echo "Error: failed to create temporary directory" >&2
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
echo "============================================================================"
|
|
102
|
+
echo "Script Execution Started"
|
|
103
|
+
echo "============================================================================"
|
|
104
|
+
|
|
105
|
+
# Main logic here
|
|
106
|
+
|
|
107
|
+
echo "============================================================================"
|
|
108
|
+
echo "Script Execution Completed"
|
|
109
|
+
echo "============================================================================"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Parse arguments
|
|
113
|
+
while [[ $# -gt 0 ]]; do
|
|
114
|
+
case $1 in
|
|
115
|
+
-g|--resource-group)
|
|
116
|
+
RESOURCE_GROUP="$2"
|
|
117
|
+
shift 2
|
|
118
|
+
;;
|
|
119
|
+
-h|--help)
|
|
120
|
+
usage
|
|
121
|
+
;;
|
|
122
|
+
*)
|
|
123
|
+
echo "Unknown option: $1"
|
|
124
|
+
exit 1
|
|
125
|
+
;;
|
|
126
|
+
esac
|
|
127
|
+
done
|
|
128
|
+
|
|
129
|
+
# Execute main function
|
|
130
|
+
main "$@"
|
|
131
|
+
|
|
132
|
+
```
|