Skip to content

{Agent} Add AI-powered custom code agent - #33760

Open
Qi Pan (Pan-Qi) wants to merge 7 commits into
devfrom
bernard-explore-ai-custom-code
Open

{Agent} Add AI-powered custom code agent#33760
Qi Pan (Pan-Qi) wants to merge 7 commits into
devfrom
bernard-explore-ai-custom-code

Conversation

@Pan-Qi

@Pan-Qi Qi Pan (Pan-Qi) commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Qi Pan (@Pan-Qi),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@yonzhan

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We will review the pull request and get back to you soon.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test skipped

⏭️ Skipping the live test for this revision because no new test file was added (tests/**/test_*.py).

The live-test pipeline runs only the test files a PR changes, so there is nothing to execute for this commit. This is informational — a regression test is encouraged where it makes sense, but not required. If a test file is added in a later commit, the live test will run automatically.

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Review Summary — PR #33760

Live test: ⚪ Skipped (no live-testable command module test files changed)

CI status: ❌ 4 checks failed, 88 passed

Failed checks:

The core Build failure is likely the root cause and worth investigating first;
the Homebrew/macOS build failures may be downstream of it.

This PR was reviewed on request (Azure Client Tools Agent Requested); a
human maintainer should follow up since automated Copilot re-triggering is not
used for human-authored PRs.

@Pan-Qi
Qi Pan (Pan-Qi) marked this pull request as ready for review August 24, 2026 07:37
@Pan-Qi
Qi Pan (Pan-Qi) requested a review from a team as a code owner August 24, 2026 07:37
Copilot AI lite review requested due to automatic review settings August 24, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an AI-assisted workflow for Azure CLI custom code authoring by introducing a @custom-code-agent, OpenSpec configuration scaffolding, and a set of OpenSpec-related prompts/skills to guide proposal → implementation → sync → archive flows.

Changes:

  • Add OpenSpec scaffolding (openspec/config.yaml, keepalive directories, and gitignore rules) to support spec-driven change planning.
  • Introduce documentation and Copilot artifacts (agent + instructions + skills + prompts) for AI-assisted custom code authoring workflows.
  • Add common skills/templates to route and generate Azure CLI custom code (AAZ subclass, legacy SDK-backed, legacy non-SDK) and a help-to-live-test scaffold.

Reviewed changes

Copilot reviewed 23 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openspec/specs/.gitkeep Keep openspec/specs/ tracked until real specs are added.
openspec/config.yaml Add OpenSpec repository context and spec-driven workflow rules.
openspec/changes/.gitkeep Keep openspec/changes/ tracked as a workspace root.
doc/ai_custom_code.md Document how to use @custom-code-agent vs OpenSpec workflows.
.gitignore Ignore local OpenSpec change workspace contents while keeping .gitkeep.
.github/skills/openspec-update-change/SKILL.md Skill definition for updating existing OpenSpec change artifacts.
.github/skills/openspec-sync-specs/SKILL.md Skill definition for syncing delta specs into main specs.
.github/skills/openspec-propose/SKILL.md Skill definition for creating a new OpenSpec change and artifacts.
.github/skills/openspec-explore/SKILL.md Skill definition for exploration mode (investigation/planning without implementation).
.github/skills/openspec-archive-change/SKILL.md Skill definition for archiving an OpenSpec change, optionally syncing specs.
.github/skills/openspec-apply-change/SKILL.md Skill definition for implementing tasks from an OpenSpec change.
.github/skills/common-live-test-from-help/SKILL.md Skill definition for deriving live test scaffolding from help examples.
.github/skills/common-live-test-from-help/references/live-test-template.md Template for generated help-driven live test structure.
.github/skills/common-legacy-sdk-backed-custom-code-generation/SKILL.md Guidance/templates for SDK-backed custom command handlers.
.github/skills/common-legacy-non-sdk-custom-code-generation/SKILL.md Guidance/templates for non-SDK custom workflows (tools/subprocess/raw HTTP/etc.).
.github/skills/common-custom-code-router/SKILL.md Routing classifier to choose exactly one custom-code authoring route.
.github/skills/common-aaz-custom-code-generation/SKILL.md Guidance/templates for AAZ subclass customization workflow.
.github/prompts/opsx-update.prompt.md Prompt to revise an OpenSpec change’s planning artifacts.
.github/prompts/opsx-sync.prompt.md Prompt to sync delta specs from a change into main specs.
.github/prompts/opsx-propose.prompt.md Prompt to propose a new change and generate artifacts.
.github/prompts/opsx-explore.prompt.md Prompt to enter explore mode for investigation/planning.
.github/prompts/opsx-archive.prompt.md Prompt to archive a completed change.
.github/prompts/opsx-apply.prompt.md Prompt to implement tasks from a change.
.github/instructions/custom-code.instructions.md File-scoped Copilot guidance for editing CLI module custom code.
.github/instructions/agent-safety.instructions.md Global safety/scope rules for all agents.
.github/agents/custom-code.agent.md Define the custom-code-agent behavior and the localization entry gate.
Suppressed comments (4)

.github/skills/common-legacy-non-sdk-custom-code-generation/SKILL.md:128

  • This template imports knack.util.CLIError, which is deprecated per doc/error_handling_guidelines.md. Use an azure.cli.core.azclierror type here so generated code follows current repo guidance.
    from knack.util import CLIError

.github/skills/common-legacy-non-sdk-custom-code-generation/SKILL.md:133

  • This template raises CLIError, which is deprecated per doc/error_handling_guidelines.md. Update the template to raise an azure.cli.core.azclierror type so generated code follows current repo guidance.
        raise CLIError(stderr.decode().strip() or "Command failed.")

.github/skills/common-aaz-custom-code-generation/SKILL.md:189

  • This template raises CLIError for an invalid resource ID format, but the repo guidance is to use azure.cli.core.azclierror types. InvalidArgumentValueError is a better fit here and keeps templates aligned with the error handling guidelines.
        raise CLIError(f"Invalid resource ID format: {resource_uri}")

.github/skills/common-aaz-custom-code-generation/SKILL.md:200

  • This template raises CLIError when the checked resource already exists. Per doc/error_handling_guidelines.md, templates should use azure.cli.core.azclierror types; ValidationError fits a pre-operation state check and lets you put the actionable guidance in recommendation.
        raise CLIError("The resource already exists. Use update to modify it or delete it before creating a new one.")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

- If a new command is added, wire it in commands.py and define args in _params.py.
- Keep return shapes compatible with existing CLI output patterns.
- Keep help/examples aligned with command behavior.
- Prefer concise error messages through CLIError when user input is invalid.
Comment on lines +118 to +122
from knack.util import CLIError

command = '<tool>'
if not shutil.which(command):
raise CLIError("'<tool>' is required for this command. Install it and try again.")
def _check_<condition>(ctx):
from azure.cli.core.azclierror import HTTPError
from azure.cli.core.util import send_raw_request
from knack.util import CLIError
@Pan-Qi Qi Pan (Pan-Qi) changed the title AI-assisted custom code agent Add AI-powered custom code agent Aug 27, 2026
@Pan-Qi Qi Pan (Pan-Qi) changed the title Add AI-powered custom code agent {Agent} Add AI-powered custom code agent Sep 1, 2026
@a0x1ab Aditya Pujara (a0x1ab) added X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent and removed azure-client-tools-agent labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants