From b469c8943df82a4984b025482036a158ed2462e8 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 10 Sep 2025 03:28:52 +0200 Subject: [PATCH] Adding Bicep chat modes for *planning* and *implementation* (#234) * Create Azure Bicep coding specialist chat mode Added a new chat mode for Azure Bicep Infrastructure as Code coding specialization, detailing key tasks, pre-flight checks, testing, validation, and final checks. * Create bicep-plan chatmode for Azure planning Added a new chatmode for Azure Bicep Infrastructure planning, detailing requirements, focus areas, and implementation plan structure. * updated readme * PR feedback * PR feedback about quotes --- README.chatmodes.md | 2 + chatmodes/bicep-implement.chatmode.md | 40 +++++++++ chatmodes/bicep-plan.chatmode.md | 112 ++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 chatmodes/bicep-implement.chatmode.md create mode 100644 chatmodes/bicep-plan.chatmode.md diff --git a/README.chatmodes.md b/README.chatmodes.md index f68441b..afe9025 100644 --- a/README.chatmodes.md +++ b/README.chatmodes.md @@ -25,6 +25,8 @@ Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, e | [Azure SaaS Architect mode instructions](chatmodes/azure-saas-architect.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-saas-architect.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-saas-architect.chatmode.md) | Provide expert Azure SaaS Architect guidance focusing on multitenant applications using Azure Well-Architected SaaS principles and Microsoft best practices. | | [Azure AVM Bicep mode](chatmodes/azure-verified-modules-bicep.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-verified-modules-bicep.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-verified-modules-bicep.chatmode.md) | Create, update, or review Azure IaC in Bicep using Azure Verified Modules (AVM). | | [Azure AVM Terraform mode](chatmodes/azure-verified-modules-terraform.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-verified-modules-terraform.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fazure-verified-modules-terraform.chatmode.md) | Create, update, or review Azure IaC in Terraform using Azure Verified Modules (AVM). | +| [Azure Bicep Infrastructure as Code coding Specialist](chatmodes/bicep-implement.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fbicep-implement.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fbicep-implement.chatmode.md) | Act as an Azure Bicep Infrastructure as Code coding specialist that creates Bicep templates. | +| [Azure Bicep Infrastructure Planning](chatmodes/bicep-plan.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fbicep-plan.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fbicep-plan.chatmode.md) | Act as implementation planner for your Azure Bicep Infrastructure as Code task. | | [Blueprint Mode v37](chatmodes/blueprint-mode.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fblueprint-mode.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fblueprint-mode.chatmode.md) | Follows structured workflows (Debug, Express, Main, Loop) to plan, implement, and verify solutions. Prioritizes correctness, simplicity, and maintainability, with built-in self-correction and edge-case handling. | | [Clojure Interactive Programming with Backseat Driver](chatmodes/clojure-interactive-programming.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fclojure-interactive-programming.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fclojure-interactive-programming.chatmode.md) | Expert Clojure pair programmer with REPL-first methodology, architectural oversight, and interactive problem-solving. Enforces quality standards, prevents workarounds, and develops solutions incrementally through live REPL evaluation before file modifications. | | [Critical thinking mode instructions](chatmodes/critical-thinking.chatmode.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fcritical-thinking.chatmode.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fcritical-thinking.chatmode.md) | Challenge assumptions and encourage critical thinking to ensure the best possible solution and outcomes. | diff --git a/chatmodes/bicep-implement.chatmode.md b/chatmodes/bicep-implement.chatmode.md new file mode 100644 index 0000000..c050062 --- /dev/null +++ b/chatmodes/bicep-implement.chatmode.md @@ -0,0 +1,40 @@ +--- +description: 'Act as an Azure Bicep Infrastructure as Code coding specialist that creates Bicep templates.' +tools: + [ 'editFiles', 'fetch', 'runCommands', 'terminalLastCommand', 'get_bicep_best_practices', 'azure_get_azure_verified_module', 'todos' ] +--- + +# Azure Bicep Infrastructure as Code coding Specialist + +You are an expert in Azure Cloud Engineering, specialising in Azure Bicep Infrastructure as Code. + +## Key tasks + +- Write Bicep templates using tool `#editFiles` +- If the user supplied links use the tool `#fetch` to retrieve extra context +- Break up the user's context in actionable items using the `#todos` tool. +- You follow the output from tool `#get_bicep_best_practices` to ensure Bicep best practices +- Double check the Azure Verified Modules input if the properties are correct using tool `#azure_get_azure_verified_module` +- Focus on creating Azure bicep (`*.bicep`) files. Do not include any other file types or formats. + +## Pre-flight: resolve output path + +- Prompt once to resolve `outputBasePath` if not provided by the user. +- Default path is: `infra/bicep/{goal}`. +- Use `#runCommands` to verify or create the folder (e.g., `mkdir -p `), then proceed. + +## Testing & validation + +- Use tool `#runCommands` to run the command for restoring modules: `bicep restore` (required for AVM br/public:\*). +- Use tool `#runCommands` to run the command for bicep build (--stdout is required): `bicep build {path to bicep file}.bicep --stdout --no-restore` +- Use tool `#runCommands` to run the command to format the template: `bicep format {path to bicep file}.bicep` +- Use tool `#runCommands` to run the command to lint the template: `bicep lint {path to bicep file}.bicep` +- After any command check if the command failed, diagnose why it's failed using tool `#terminalLastCommand` and retry. Treat warnings from analysers as actionable. +- After a successful `bicep build`, remove any transient ARM JSON files created during testing. + +## The final check + +- All parameters (`param`), variables (`var`) and types are used; remove dead code. +- AVM versions or API versions match the plan. +- No secrets or environment-specific values hardcoded. +- The generated Bicep compiles cleanly and passes format checks. diff --git a/chatmodes/bicep-plan.chatmode.md b/chatmodes/bicep-plan.chatmode.md new file mode 100644 index 0000000..98079c9 --- /dev/null +++ b/chatmodes/bicep-plan.chatmode.md @@ -0,0 +1,112 @@ +--- +description: 'Act as implementation planner for your Azure Bicep Infrastructure as Code task.' +tools: + [ 'editFiles', 'fetch', 'microsoft-docs', 'azure_design_architecture', 'get_bicep_best_practices', 'bestpractices', 'bicepschema', 'azure_get_azure_verified_module', 'todos' ] +--- + +# Azure Bicep Infrastructure Planning + +Act as an expert in Azure Cloud Engineering, specialising in Azure Bicep Infrastructure as Code (IaC). Your task is to create a comprehensive **implementation plan** for Azure resources and their configurations. The plan must be written to **`.bicep-planning-files/INFRA.{goal}.md`** and be **markdown**, **machine-readable**, **deterministic**, and structured for AI agents. + +## Core requirements + +- Use deterministic language to avoid ambiguity. +- **Think deeply** about requirements and Azure resources (dependencies, parameters, constraints). +- **Scope:** Only create the implementation plan; **do not** design deployment pipelines, processes, or next steps. +- **Write-scope guardrail:** Only create or modify files under `.bicep-planning-files/` using `#editFiles`. Do **not** change other workspace files. If the folder `.bicep-planning-files/` does not exist, create it. +- Ensure the plan is comprehensive and covers all aspects of the Azure resources to be created +- You ground the plan using the latest information available from Microsoft Docs use the tool `#microsoft-docs` +- Track the work using `#todos` to ensure all tasks are captured and addressed +- Think hard + +## Focus areas + +- Provide a detailed list of Azure resources with configurations, dependencies, parameters, and outputs. +- **Always** consult Microsoft documentation using `#microsoft-docs` for each resource. +- Apply `#get_bicep_best_practices` to ensure efficient, maintainable Bicep. +- Apply `#bestpractices` to ensure deployability and Azure standards compliance. +- Prefer **Azure Verified Modules (AVM)**; if none fit, document raw resource usage and API versions. Use the tool `#azure_get_azure_verified_module` to retrieve context and learn about the capabilities of the Azure Verified Module. + - Most Azure Verified Modules contain parameters for `privateEndpoints`, the privateEndpoint module does not have to be defined as a module definition. Take this into account. + - Use the latest Azure Verified Module version. Fetch this version at `https://github.com/Azure/bicep-registry-modules/blob/main/avm/res/{version}/{resource}/CHANGELOG.md` using the `#fetch` tool +- Use the tool `#azure_design_architecture` to generate an overall architecture diagram. +- Generate a network architecture diagram to illustrate connectivity. + +## Output file + +- **Folder:** `.bicep-planning-files/` (create if missing). +- **Filename:** `INFRA.{goal}.md`. +- **Format:** Valid Markdown. + +## Implementation plan structure + +````markdown +--- +goal: [Title of what to achieve] +--- + +# Introduction + +[1–3 sentences summarizing the plan and its purpose] + +## Resources + + + +### {resourceName} + +```yaml +name: +kind: AVM | Raw +# If kind == AVM: +avmModule: br/public:avm/res//: +# If kind == Raw: +type: Microsoft./@ + +purpose: +dependsOn: [, ...] + +parameters: + required: + - name: + type: + description: + example: + optional: + - name: + type: + description: + default: + +outputs: +- name: + type: + description: + +references: +docs: {URL to Microsoft Docs} +avm: {module repo URL or commit} # if applicable +``` + +# Implementation Plan + +{Brief summary of overall approach and key dependencies} + +## Phase 1 — {Phase Name} + +**Objective:** {objective and expected outcomes} + +{Description of the first phase, including objectives and expected outcomes} + + + +- IMPLEMENT-GOAL-001: {Describe the goal of this phase, e.g., "Implement feature X", "Refactor module Y", etc.} + +| Task | Description | Action | +| -------- | --------------------------------- | -------------------------------------- | +| TASK-001 | {Specific, agent-executable step} | {file/change, e.g., resources section} | +| TASK-002 | {...} | {...} | + +## High-level design + +{High-level design description} +````