Tools: GitHub Copilot CLI: A DevOps Engineer's Practical Guide to AI-Powered Terminal Automation

Tools: GitHub Copilot CLI: A DevOps Engineer's Practical Guide to AI-Powered Terminal Automation

Source: Dev.to

GitHub Copilot CLI: A DevOps Engineer's Practical Guide to AI-Powered Terminal Automation ## Why Copilot CLI Matters for DevOps Engineers ## Getting Started: Installation and Configuration ## Prerequisites ## Installation Methods ## Windows (WinGet) ## macOS/Linux (Homebrew) ## All Platforms (npm - requires Node.js 22+) ## macOS/Linux (Install Script) ## Initial Authentication ## Verification ## Understanding Copilot CLI Modes ## 1. Interactive Mode (Default) ## 2. Programmatic Mode ## Practical DevOps Use Cases: Step-by-Step ## Use Case 1: Infrastructure as Code (IaC) Development ## Use Case 2: CI/CD Pipeline Creation and Debugging ## Use Case 3: Incident Response and Log Analysis ## Use Case 4: Managing GitHub Operations at Scale ## Use Case 5: Script Generation and Automation ## Use Case 6: Documentation and Knowledge Management ## Advanced Tips and Best Practices ## 1. Use File References ## 2. Manage Working Directories ## 3. Direct Shell Commands ## 4. Custom Instructions ## 5. Session Management ## 6. Delegate to Copilot Coding Agent ## 7. Security Permissions ## 8. Context Management Commands ## 9. Model Selection ## 10. Built-in Custom Agents ## 11. Extend with MCP Servers ## Real-World DevOps Workflow Integration ## Morning Standup Prep ## Deployment Checklist ## Post-Incident Review ## Infrastructure Audit ## Common Pitfalls and How to Avoid Them ## 1. Over-Trusting Automatic Approval ## 2. Not Using Custom Instructions ## 3. Forgetting to Review Generated Code ## 4. Not Leveraging Iteration ## Measuring the Impact ## Time Savings ## Error Reduction ## Knowledge Sharing ## Consistency ## Conclusion ## Your Action Plan ## Resources for Further Learning ## Author ## Marcel.LFollow As DevOps engineers, we live in the terminal, deploying infrastructure, debugging production issues, managing CI/CD pipelines, and orchestrating complex workflows. What if you could have an AI assistant directly in your command line that understands your context, writes scripts, debugs issues, and even interacts with GitHub.com on your behalf? Enter GitHub Copilot CLI, a powerful AI agent that brings GitHub Copilot's intelligence to your terminal, enabling you to automate DevOps tasks faster and more efficiently than ever before. In this hands-on guide, we'll explore how to set up and leverage Copilot CLI to supercharge your DevOps workflows, from infrastructure automation to incident response and everything in between. The traditional DevOps workflow involves context switching between documentation, Stack Overflow, man pages, and your terminal. Copilot CLI eliminates this friction by providing: For DevOps teams, this means faster incident response, reduced context switching, consistent automation patterns, and the ability to handle complex multi-step tasks with simple natural language prompts. Before diving into practical use cases, let's get Copilot CLI set up properly. The tool is currently in public preview with data protection guarantees. Important Note: This guide focuses on GitHub Copilot CLI (copilot command), which is distinct from the GitHub CLI (gh). Copilot CLI is the AI-powered terminal assistant, whilst GitHub CLI is for general GitHub API operations. Choose the installation method that fits your platform: After installation, authenticate with GitHub: Follow the on-screen instructions to authenticate via your browser. Alternatively, you can use a fine-grained personal access token with the "Copilot Requests" permission: Verify your installation: You're now ready to start using Copilot CLI! For comprehensive documentation, refer to the official GitHub Copilot CLI documentation. Copilot CLI operates in two distinct modes, each suited for different DevOps workflows: Start an interactive session where you can work iteratively with Copilot: This mode is ideal for: Execute single prompts directly from the command line: This mode is perfect for: Security Note: When using automatic approval flags like --allow-all-tools, Copilot has the same access as your user account. Use with caution in production environments. Let's explore real-world scenarios where Copilot CLI shines in DevOps workflows. Scenario: You need to create a Terraform module for an Azure Kubernetes Service (AKS) cluster with monitoring and security best practices. Step 1: Start Copilot CLI in your project directory Step 2: Trust the directory when prompted (choose option 2 if you trust this directory for future sessions) Step 3: Provide a natural language prompt Step 4: Review the files Copilot creates and approve operations Copilot will ask permission to: Step 5: Iterate and refine Step 6: Validate the configuration Copilot will execute the commands and report any issues, which you can then ask it to fix. Scenario: Create a GitHub Actions workflow that runs tests, builds a Docker image, and deploys to Azure Container Apps. Step 1: Generate the workflow Step 2: Copilot creates .github/workflows/deploy.yml Review and approve the file creation. Copilot will structure the workflow with proper jobs, steps, and best practices. Step 3: Debug a failing workflow When your workflow fails, analyse it with Copilot: Copilot fetches the workflow run logs, analyses the failure, and suggests fixes: Step 4: Automatically fix and commit Copilot makes the changes and creates a PR on GitHub.com for you to review. Scenario: You're responding to a production incident and need to analyse application logs quickly. Step 1: Aggregate and analyse logs Step 2: Investigate a specific error pattern Step 3: Generate a runbook entry Step 4: Create a monitoring alert Scenario: Manage multiple repositories, issues, and pull requests across your organization. Step 1: Audit open pull requests Step 2: Batch operations Step 3: Repository maintenance Step 4: Issue triaging Scenario: Generate operational scripts for common DevOps tasks. Step 1: Create a backup script Step 2: Create a deployment script Step 3: Generate monitoring checks Scenario: Maintain up-to-date documentation for your infrastructure. Step 1: Generate architecture documentation Step 2: Update README files Step 3: Create API documentation Include specific files in your prompts using @: Switch directories without leaving your session: Add additional trusted directories: Run shell commands directly with !: Enhance Copilot's understanding by adding custom instructions to your repository. Copilot CLI supports multiple instruction formats: Create .github/copilot-instructions.md: Resume previous sessions: For complex multi-file changes, delegate to the more powerful Copilot coding agent: This creates a draft PR where Copilot coding agent works in the background and requests your review when complete. Control what Copilot can access: Copilot CLI provides slash commands to monitor and manage your context window: Note: Copilot CLI automatically compresses history when approaching 95% of the token limit and warns you when less than 20% remains. Switch models during your session: Select from the available models. Each submission reduces your monthly premium request quota by the multiplier shown (e.g., Claude Sonnet 4.5 (1x) = 1 premium request per prompt). Copilot CLI includes specialised agents for common tasks: Or call them directly in prompts: Use the Plan agent to analyse how to refactor the authentication module Copilot CLI comes with the GitHub MCP server pre-configured. Add more MCP servers to extend functionality: Fill in the server details and press Ctrl+S to save. Server configurations are stored in ~/.copilot/mcp-config.json. Problem: Using --allow-all-tools without understanding the risks. Solution: Use granular approval flags in scripts: Problem: Copilot generates solutions that don't match your team's conventions. Solution: Maintain .github/copilot-instructions.md with your standards and update it regularly. Problem: Blindly accepting generated scripts without understanding them. Solution: Always ask Copilot to explain complex code: Problem: Expecting perfect results on the first attempt. Solution: Work iteratively with Copilot: Track how Copilot CLI improves your DevOps workflows: GitHub Copilot CLI represents a paradigm shift in how DevOps engineers interact with their terminal. By bringing AI assistance directly into your workflow, it enables you to work faster, make fewer mistakes, and spend more time on strategic work rather than repetitive tasks. Tip: Use the /feedback slash command in an interactive session to submit feedback, report bugs, or suggest new features directly to GitHub. The future of DevOps is conversational, start the conversation with Copilot CLI today! Like, share, follow me on: 🐙 GitHub | 🐧 X | 👾 LinkedIn Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse COMMAND_BLOCK: # Stable version winget install GitHub.Copilot # Prerelease version winget install GitHub.Copilot.Prerelease Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Stable version winget install GitHub.Copilot # Prerelease version winget install GitHub.Copilot.Prerelease COMMAND_BLOCK: # Stable version winget install GitHub.Copilot # Prerelease version winget install GitHub.Copilot.Prerelease COMMAND_BLOCK: # Stable version brew install copilot-cli # Prerelease version brew install copilot-cli@prerelease Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Stable version brew install copilot-cli # Prerelease version brew install copilot-cli@prerelease COMMAND_BLOCK: # Stable version brew install copilot-cli # Prerelease version brew install copilot-cli@prerelease COMMAND_BLOCK: # Stable version npm install -g @github/copilot # Prerelease version npm install -g @github/copilot@prerelease Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Stable version npm install -g @github/copilot # Prerelease version npm install -g @github/copilot@prerelease COMMAND_BLOCK: # Stable version npm install -g @github/copilot # Prerelease version npm install -g @github/copilot@prerelease COMMAND_BLOCK: # Standard installation curl -fsSL https://gh.io/copilot-install | bash # Or using wget wget -qO- https://gh.io/copilot-install | bash # Install as root to /usr/local/bin curl -fsSL https://gh.io/copilot-install | sudo bash # Custom directory installation curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Standard installation curl -fsSL https://gh.io/copilot-install | bash # Or using wget wget -qO- https://gh.io/copilot-install | bash # Install as root to /usr/local/bin curl -fsSL https://gh.io/copilot-install | sudo bash # Custom directory installation curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash COMMAND_BLOCK: # Standard installation curl -fsSL https://gh.io/copilot-install | bash # Or using wget wget -qO- https://gh.io/copilot-install | bash # Install as root to /usr/local/bin curl -fsSL https://gh.io/copilot-install | sudo bash # Custom directory installation curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash COMMAND_BLOCK: # Start Copilot CLI copilot # On first launch, you'll be prompted to login /login Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Start Copilot CLI copilot # On first launch, you'll be prompted to login /login COMMAND_BLOCK: # Start Copilot CLI copilot # On first launch, you'll be prompted to login /login COMMAND_BLOCK: # Set the token in your environment (GH_TOKEN takes precedence over GITHUB_TOKEN) export GH_TOKEN="your_token_here" # Or use GITHUB_TOKEN export GITHUB_TOKEN="your_token_here" # Or add to your shell profile (.bashrc, .zshrc, etc.) echo 'export GH_TOKEN="your_token_here"' >> ~/.bashrc Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Set the token in your environment (GH_TOKEN takes precedence over GITHUB_TOKEN) export GH_TOKEN="your_token_here" # Or use GITHUB_TOKEN export GITHUB_TOKEN="your_token_here" # Or add to your shell profile (.bashrc, .zshrc, etc.) echo 'export GH_TOKEN="your_token_here"' >> ~/.bashrc COMMAND_BLOCK: # Set the token in your environment (GH_TOKEN takes precedence over GITHUB_TOKEN) export GH_TOKEN="your_token_here" # Or use GITHUB_TOKEN export GITHUB_TOKEN="your_token_here" # Or add to your shell profile (.bashrc, .zshrc, etc.) echo 'export GH_TOKEN="your_token_here"' >> ~/.bashrc CODE_BLOCK: copilot --version Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: copilot --version CODE_BLOCK: copilot --version CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: copilot -p "Show me this week's Git commits and summarize them" --allow-tool 'shell(git)' # Pipe output from scripts ./generate-prompt.sh | copilot Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: copilot -p "Show me this week's Git commits and summarize them" --allow-tool 'shell(git)' # Pipe output from scripts ./generate-prompt.sh | copilot COMMAND_BLOCK: copilot -p "Show me this week's Git commits and summarize them" --allow-tool 'shell(git)' # Pipe output from scripts ./generate-prompt.sh | copilot CODE_BLOCK: cd ~/projects/terraform-azure-aks copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: cd ~/projects/terraform-azure-aks copilot CODE_BLOCK: cd ~/projects/terraform-azure-aks copilot CODE_BLOCK: Create a Terraform module in the modules/aks directory that provisions an Azure Kubernetes Service cluster with the following requirements: - Use Azure CNI networking - Enable Azure Monitor Container Insights - Configure Azure Active Directory integration - Use managed identity - Enable node auto-scaling (1-5 nodes) - Include proper variable definitions and outputs - Follow Terraform best practices Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a Terraform module in the modules/aks directory that provisions an Azure Kubernetes Service cluster with the following requirements: - Use Azure CNI networking - Enable Azure Monitor Container Insights - Configure Azure Active Directory integration - Use managed identity - Enable node auto-scaling (1-5 nodes) - Include proper variable definitions and outputs - Follow Terraform best practices CODE_BLOCK: Create a Terraform module in the modules/aks directory that provisions an Azure Kubernetes Service cluster with the following requirements: - Use Azure CNI networking - Enable Azure Monitor Container Insights - Configure Azure Active Directory integration - Use managed identity - Enable node auto-scaling (1-5 nodes) - Include proper variable definitions and outputs - Follow Terraform best practices CODE_BLOCK: Add a locals.tf file with common tags for all resources, including environment, managed-by, and cost-center tags Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Add a locals.tf file with common tags for all resources, including environment, managed-by, and cost-center tags CODE_BLOCK: Add a locals.tf file with common tags for all resources, including environment, managed-by, and cost-center tags CODE_BLOCK: Run terraform init and terraform validate in the modules/aks directory Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Run terraform init and terraform validate in the modules/aks directory CODE_BLOCK: Run terraform init and terraform validate in the modules/aks directory CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a GitHub Actions workflow file that: 1. Triggers on push to main and pull requests 2. Runs unit tests with pytest 3. Builds a Docker image 4. Pushes to Azure Container Registry 5. Deploys to Azure Container Apps 6. Uses GitHub secrets for Azure credentials 7. Includes proper caching for dependencies Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a GitHub Actions workflow file that: 1. Triggers on push to main and pull requests 2. Runs unit tests with pytest 3. Builds a Docker image 4. Pushes to Azure Container Registry 5. Deploys to Azure Container Apps 6. Uses GitHub secrets for Azure credentials 7. Includes proper caching for dependencies CODE_BLOCK: Create a GitHub Actions workflow file that: 1. Triggers on push to main and pull requests 2. Runs unit tests with pytest 3. Builds a Docker image 4. Pushes to Azure Container Registry 5. Deploys to Azure Container Apps 6. Uses GitHub secrets for Azure credentials 7. Includes proper caching for dependencies CODE_BLOCK: Check the last failed run of the deploy workflow and explain what went wrong Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Check the last failed run of the deploy workflow and explain what went wrong CODE_BLOCK: Check the last failed run of the deploy workflow and explain what went wrong CODE_BLOCK: The workflow failed because the Azure Container Registry login step is missing the registry name. Fix this in the workflow file. Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: The workflow failed because the Azure Container Registry login step is missing the registry name. Fix this in the workflow file. CODE_BLOCK: The workflow failed because the Azure Container Registry login step is missing the registry name. Fix this in the workflow file. CODE_BLOCK: Fix the workflow file and create a pull request with the fix Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Fix the workflow file and create a pull request with the fix CODE_BLOCK: Fix the workflow file and create a pull request with the fix CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Read the last 500 lines from /var/log/app/application.log, filter for ERROR level messages from the last hour, group them by error type, and show the top 5 most frequent errors with their counts Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Read the last 500 lines from /var/log/app/application.log, filter for ERROR level messages from the last hour, group them by error type, and show the top 5 most frequent errors with their counts CODE_BLOCK: Read the last 500 lines from /var/log/app/application.log, filter for ERROR level messages from the last hour, group them by error type, and show the top 5 most frequent errors with their counts CODE_BLOCK: I see "Database connection timeout" errors. Check the database connection configuration in @config/database.yml and suggest fixes based on the error pattern Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: I see "Database connection timeout" errors. Check the database connection configuration in @config/database.yml and suggest fixes based on the error pattern CODE_BLOCK: I see "Database connection timeout" errors. Check the database connection configuration in @config/database.yml and suggest fixes based on the error pattern CODE_BLOCK: Create a markdown runbook entry in docs/runbooks/database-timeouts.md documenting this issue, the investigation steps, and the solution. Include the commands used for diagnosis. Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a markdown runbook entry in docs/runbooks/database-timeouts.md documenting this issue, the investigation steps, and the solution. Include the commands used for diagnosis. CODE_BLOCK: Create a markdown runbook entry in docs/runbooks/database-timeouts.md documenting this issue, the investigation steps, and the solution. Include the commands used for diagnosis. CODE_BLOCK: Based on this incident, create a GitHub Actions workflow that monitors the application log for database connection timeouts and creates an issue if the error rate exceeds 10 per hour Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Based on this incident, create a GitHub Actions workflow that monitors the application log for database connection timeouts and creates an issue if the error rate exceeds 10 per hour CODE_BLOCK: Based on this incident, create a GitHub Actions workflow that monitors the application log for database connection timeouts and creates an issue if the error rate exceeds 10 per hour CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: List all open pull requests across my-org/infrastructure-* repositories that have been open for more than 7 days and haven't been updated in the last 3 days Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: List all open pull requests across my-org/infrastructure-* repositories that have been open for more than 7 days and haven't been updated in the last 3 days CODE_BLOCK: List all open pull requests across my-org/infrastructure-* repositories that have been open for more than 7 days and haven't been updated in the last 3 days CODE_BLOCK: For each PR in the list, add a comment asking the author for an update and assign the "needs-attention" label Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: For each PR in the list, add a comment asking the author for an update and assign the "needs-attention" label CODE_BLOCK: For each PR in the list, add a comment asking the author for an update and assign the "needs-attention" label CODE_BLOCK: In my-org/terraform-modules, check if there are any open dependabot PRs. If they pass CI and are patch or minor version updates, merge them automatically. Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: In my-org/terraform-modules, check if there are any open dependabot PRs. If they pass CI and are patch or minor version updates, merge them automatically. CODE_BLOCK: In my-org/terraform-modules, check if there are any open dependabot PRs. If they pass CI and are patch or minor version updates, merge them automatically. CODE_BLOCK: Create a report showing all critical severity issues across my-org repositories that are unassigned. Save it as triage-report-2026-01-27.md Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a report showing all critical severity issues across my-org repositories that are unassigned. Save it as triage-report-2026-01-27.md CODE_BLOCK: Create a report showing all critical severity issues across my-org repositories that are unassigned. Save it as triage-report-2026-01-27.md CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a bash script called backup-postgres.sh that: - Takes database name, host, and output directory as arguments - Uses pg_dump to create a backup - Compresses the backup with gzip - Names the file with a timestamp - Rotates backups (keeps only the last 7 days) - Logs operations to /var/log/backup.log - Includes error handling and exit codes - Has usage instructions in comments Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a bash script called backup-postgres.sh that: - Takes database name, host, and output directory as arguments - Uses pg_dump to create a backup - Compresses the backup with gzip - Names the file with a timestamp - Rotates backups (keeps only the last 7 days) - Logs operations to /var/log/backup.log - Includes error handling and exit codes - Has usage instructions in comments CODE_BLOCK: Create a bash script called backup-postgres.sh that: - Takes database name, host, and output directory as arguments - Uses pg_dump to create a backup - Compresses the backup with gzip - Names the file with a timestamp - Rotates backups (keeps only the last 7 days) - Logs operations to /var/log/backup.log - Includes error handling and exit codes - Has usage instructions in comments CODE_BLOCK: Create a Python script deploy-app.py that: - Accepts environment (dev/staging/prod) as argument - Validates the environment configuration - Builds the Docker image - Tags it appropriately - Pushes to the registry - Updates the Kubernetes deployment - Waits for rollout to complete - Rolls back if health checks fail - Includes comprehensive logging Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a Python script deploy-app.py that: - Accepts environment (dev/staging/prod) as argument - Validates the environment configuration - Builds the Docker image - Tags it appropriately - Pushes to the registry - Updates the Kubernetes deployment - Waits for rollout to complete - Rolls back if health checks fail - Includes comprehensive logging CODE_BLOCK: Create a Python script deploy-app.py that: - Accepts environment (dev/staging/prod) as argument - Validates the environment configuration - Builds the Docker image - Tags it appropriately - Pushes to the registry - Updates the Kubernetes deployment - Waits for rollout to complete - Rolls back if health checks fail - Includes comprehensive logging CODE_BLOCK: Create a health-check script that tests our microservices (API, database, Redis, message queue) and outputs results in JSON format suitable for Prometheus Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a health-check script that tests our microservices (API, database, Redis, message queue) and outputs results in JSON format suitable for Prometheus CODE_BLOCK: Create a health-check script that tests our microservices (API, database, Redis, message queue) and outputs results in JSON format suitable for Prometheus CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Analyse the Terraform files in the infrastructure/ directory and create a comprehensive architecture.md document describing our cloud infrastructure, including diagrams in Mermaid format, resource dependencies, and data flows Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Analyse the Terraform files in the infrastructure/ directory and create a comprehensive architecture.md document describing our cloud infrastructure, including diagrams in Mermaid format, resource dependencies, and data flows CODE_BLOCK: Analyse the Terraform files in the infrastructure/ directory and create a comprehensive architecture.md document describing our cloud infrastructure, including diagrams in Mermaid format, resource dependencies, and data flows CODE_BLOCK: Review all README.md files in this repository and update them to include current setup instructions, dependencies, and examples based on the actual code Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Review all README.md files in this repository and update them to include current setup instructions, dependencies, and examples based on the actual code CODE_BLOCK: Review all README.md files in this repository and update them to include current setup instructions, dependencies, and examples based on the actual code CODE_BLOCK: Analyse the FastAPI application in src/api/ and generate OpenAPI documentation with examples for each endpoint Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Analyse the FastAPI application in src/api/ and generate OpenAPI documentation with examples for each endpoint CODE_BLOCK: Analyse the FastAPI application in src/api/ and generate OpenAPI documentation with examples for each endpoint CODE_BLOCK: Explain the pipeline configuration in @.github/workflows/ci.yml and suggest optimizations Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Explain the pipeline configuration in @.github/workflows/ci.yml and suggest optimizations CODE_BLOCK: Explain the pipeline configuration in @.github/workflows/ci.yml and suggest optimizations CODE_BLOCK: /cwd ~/projects/kubernetes-configs Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: /cwd ~/projects/kubernetes-configs CODE_BLOCK: /cwd ~/projects/kubernetes-configs CODE_BLOCK: /add-dir /home/user/shared-scripts Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: /add-dir /home/user/shared-scripts CODE_BLOCK: /add-dir /home/user/shared-scripts CODE_BLOCK: !kubectl get pods -n production Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: !kubectl get pods -n production CODE_BLOCK: !kubectl get pods -n production COMMAND_BLOCK: # DevOps Team Instructions ## Our Stack - Cloud: Azure (Primary), AWS (Legacy) - Orchestration: Kubernetes (AKS) - IaC: Terraform - CI/CD: GitHub Actions - Monitoring: Prometheus, Grafana, Azure Monitor ## Conventions - All Terraform modules use semantic versioning - Kubernetes manifests use Kustomize overlays - Scripts must include error handling and logging - Follow the repository's existing naming conventions ## Best Practices - Always include resource tags: environment, cost-center, managed-by - Use managed identities instead of service principals - Enable diagnostic settings on all Azure resources Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # DevOps Team Instructions ## Our Stack - Cloud: Azure (Primary), AWS (Legacy) - Orchestration: Kubernetes (AKS) - IaC: Terraform - CI/CD: GitHub Actions - Monitoring: Prometheus, Grafana, Azure Monitor ## Conventions - All Terraform modules use semantic versioning - Kubernetes manifests use Kustomize overlays - Scripts must include error handling and logging - Follow the repository's existing naming conventions ## Best Practices - Always include resource tags: environment, cost-center, managed-by - Use managed identities instead of service principals - Enable diagnostic settings on all Azure resources COMMAND_BLOCK: # DevOps Team Instructions ## Our Stack - Cloud: Azure (Primary), AWS (Legacy) - Orchestration: Kubernetes (AKS) - IaC: Terraform - CI/CD: GitHub Actions - Monitoring: Prometheus, Grafana, Azure Monitor ## Conventions - All Terraform modules use semantic versioning - Kubernetes manifests use Kustomize overlays - Scripts must include error handling and logging - Follow the repository's existing naming conventions ## Best Practices - Always include resource tags: environment, cost-center, managed-by - Use managed identities instead of service principals - Enable diagnostic settings on all Azure resources COMMAND_BLOCK: # Resume the most recent session copilot --continue # Browse and select from available sessions copilot --resume Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Resume the most recent session copilot --continue # Browse and select from available sessions copilot --resume COMMAND_BLOCK: # Resume the most recent session copilot --continue # Browse and select from available sessions copilot --resume CODE_BLOCK: /delegate Refactor the Terraform modules to use Azure Verified Modules (AVM) standards and update all references Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: /delegate Refactor the Terraform modules to use Azure Verified Modules (AVM) standards and update all references CODE_BLOCK: /delegate Refactor the Terraform modules to use Azure Verified Modules (AVM) standards and update all references COMMAND_BLOCK: # Allow all paths (use with caution) copilot --allow-all-paths # Allow all URLs (use with caution) copilot --allow-all-urls # Pre-approve specific domains copilot --allow-url github.com --allow-url api.github.com # Allow specific tools without confirmation copilot -p "Backup the database" --allow-tool 'shell(pg_dump)' Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: # Allow all paths (use with caution) copilot --allow-all-paths # Allow all URLs (use with caution) copilot --allow-all-urls # Pre-approve specific domains copilot --allow-url github.com --allow-url api.github.com # Allow specific tools without confirmation copilot -p "Backup the database" --allow-tool 'shell(pg_dump)' COMMAND_BLOCK: # Allow all paths (use with caution) copilot --allow-all-paths # Allow all URLs (use with caution) copilot --allow-all-urls # Pre-approve specific domains copilot --allow-url github.com --allow-url api.github.com # Allow specific tools without confirmation copilot -p "Backup the database" --allow-tool 'shell(pg_dump)' CODE_BLOCK: /model Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: /agent Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: /mcp add Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: copilot -p "Summarise my work from yesterday: show commits, closed PRs, and completed issues from all my-org repositories" --allow-all-urls Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: copilot -p "Summarise my work from yesterday: show commits, closed PRs, and completed issues from all my-org repositories" --allow-all-urls CODE_BLOCK: copilot -p "Summarise my work from yesterday: show commits, closed PRs, and completed issues from all my-org repositories" --allow-all-urls CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a deployment checklist for the v2.3.0 release: 1. Verify all tests pass in CI 2. Check database migration scripts 3. Review open security issues 4. Confirm rollback procedure is documented 5. List all changed configuration values 6. Generate release notes from PR descriptions Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Create a deployment checklist for the v2.3.0 release: 1. Verify all tests pass in CI 2. Check database migration scripts 3. Review open security issues 4. Confirm rollback procedure is documented 5. List all changed configuration values 6. Generate release notes from PR descriptions CODE_BLOCK: Create a deployment checklist for the v2.3.0 release: 1. Verify all tests pass in CI 2. Check database migration scripts 3. Review open security issues 4. Confirm rollback procedure is documented 5. List all changed configuration values 6. Generate release notes from PR descriptions CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Based on the incident timeline in docs/incidents/2026-01-27-outage.md: 1. Create a root cause analysis document 2. Generate corrective action items as GitHub issues 3. Update the runbook with new procedures 4. Create a monitoring alert to prevent recurrence Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Based on the incident timeline in docs/incidents/2026-01-27-outage.md: 1. Create a root cause analysis document 2. Generate corrective action items as GitHub issues 3. Update the runbook with new procedures 4. Create a monitoring alert to prevent recurrence CODE_BLOCK: Based on the incident timeline in docs/incidents/2026-01-27-outage.md: 1. Create a root cause analysis document 2. Generate corrective action items as GitHub issues 3. Update the runbook with new procedures 4. Create a monitoring alert to prevent recurrence CODE_BLOCK: copilot Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Audit our Terraform state files and list: - Resources without required tags - Resources in non-compliant regions - Unencrypted storage accounts - Public IP addresses Generate a compliance report in CSV format Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Audit our Terraform state files and list: - Resources without required tags - Resources in non-compliant regions - Unencrypted storage accounts - Public IP addresses Generate a compliance report in CSV format CODE_BLOCK: Audit our Terraform state files and list: - Resources without required tags - Resources in non-compliant regions - Unencrypted storage accounts - Public IP addresses Generate a compliance report in CSV format CODE_BLOCK: copilot -p "Deploy to staging" \ --allow-tool 'shell(kubectl)' \ --allow-tool 'shell(helm)' \ --allow-url 'staging.example.com' Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: copilot -p "Deploy to staging" \ --allow-tool 'shell(kubectl)' \ --allow-tool 'shell(helm)' \ --allow-url 'staging.example.com' CODE_BLOCK: copilot -p "Deploy to staging" \ --allow-tool 'shell(kubectl)' \ --allow-tool 'shell(helm)' \ --allow-url 'staging.example.com' CODE_BLOCK: Explain the script you just created line by line, especially the error handling logic Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Explain the script you just created line by line, especially the error handling logic CODE_BLOCK: Explain the script you just created line by line, especially the error handling logic CODE_BLOCK: Good start, but modify the script to: - Use jq for JSON parsing instead of grep - Add progress indicators - Exit with non-zero code on failure Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: Good start, but modify the script to: - Use jq for JSON parsing instead of grep - Add progress indicators - Exit with non-zero code on failure CODE_BLOCK: Good start, but modify the script to: - Use jq for JSON parsing instead of grep - Add progress indicators - Exit with non-zero code on failure - Contextual AI assistance: Copilot understands your project structure, Git history, and working directory - Code generation and modification: Create scripts, modify configuration files, and refactor code without leaving your terminal - GitHub integration: Manage issues, pull requests, workflows, and releases directly from the CLI - Intelligent troubleshooting: Debug failed builds, analyse logs, and suggest fixes based on error messages - Safe execution: Built-in permission system for file operations, shell commands, and network access - Iterative workflows: Work back-and-forth with the AI to refine solutions progressively - Active GitHub Copilot subscription (Pro, Pro+, Business, or Enterprise) - PowerShell v6+ (Windows users) - Organization policy enabled (if using Copilot through an organization) - Exploratory tasks and troubleshooting - Multi-step workflows requiring feedback - Learning and experimentation - Complex tasks where you need to review each step - CI/CD pipeline integration - Scripted automation - One-off tasks in scripts - Batch operations - Create directory structure - Write .tf files (main.tf, variables.tf, outputs.tf) - Set file permissions - Repository-wide instructions: .github/copilot-instructions.md - Path-specific instructions: .github/instructions/**/*.instructions.md - Agent files: AGENTS.md in your repository root - /usage - View session statistics (premium requests used, duration, lines edited, token breakdown) - /context - Visual overview of current token usage - /compact - Manually compress conversation history to free up context space - Before: 30 minutes to write a deployment script with proper error handling - After: 5 minutes to generate, review, and test with Copilot CLI - Before: Manual script writing leads to missed edge cases - After: Copilot suggests best practices and error handling patterns - Before: Tribal knowledge in senior engineers' heads - After: Captured in prompts, custom instructions, and generated runbooks - Before: Each engineer writes scripts differently - After: Standardised patterns through custom instructions - Install Copilot CLI today using your preferred method - Start small: Use it for simple tasks like generating scripts or analysing logs - Add custom instructions to align Copilot with your team's practices - Integrate into daily workflows: Make Copilot CLI part of your standup, deployment, and incident response processes - Share learnings: Document effective prompts and patterns for your team - Measure impact: Track time saved and productivity improvements - Official Copilot CLI Documentation - About GitHub Copilot CLI - Installing GitHub Copilot CLI - Custom Instructions Guide - GitHub Copilot Plans