---
id: guideline/community/skills/review/al-copilot-review
type: guideline
title: AL Copilot review
summary: Reviews AL source changes that build Copilot features on the System.AI module against Copilot guidance from BCQuality.
tier: official
language: en
tags:
  - review-skill
system: development
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-11-23T00:15:10.597Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 37e68b43f06ed6366daa9402f28d6e195eaddb3f
evidence:
  - kind: guideline
    url: https://github.com/microsoft/BCQuality/blob/main/community/skills/review/al-copilot-review.md
    title: "microsoft/BCQuality: AL Copilot review"
    date: "2026-11-19"
    commit: aaaf6c13c219294fcebf644f1662f4d77061e2f7
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcquality/276
    - change/bcquality/229
  related:
    - to: object/codeunit/7773
      title: codeunit 7773 "Copilot Capability"
      label: possibly related
      why: a code span in the rule names it
      by: code
    - to: object/codeunit/7771
      title: codeunit 7771 "Azure OpenAI"
      label: possibly related
      why: a code span in the rule names it
      by: code
    - to: object/codeunit/7763
      title: codeunit 7763 "AOAI Chat Messages"
      label: possibly related
      why: a code span in the rule names it
      by: code
    - to: object/codeunit/7770
      title: codeunit 7770 "AOAI Operation Response"
      label: possibly related
      why: a code span in the rule names it
      by: code
repo_path: community/skills/review/al-copilot-review.md
layer: community
kind: skill
domain: null
bc_version:
  - all
technologies:
  - al
countries:
  - w1
application_area:
  - all
examples: 0
identifiers:
  - PromptDialog
  - RegisterCapability
  - IsCapabilityRegistered
  - SetCopilotCapability
  - SetAuthorization
  - SetManagedResourceAuthorization
  - IsEnabled
  - SetPrimarySystemMessage
  - AddSystemMessage
  - AddUserMessage
  - GenerateChatCompletion
  - GenerateTextCompletion
  - GenerateEmbeddings
  - IsSuccess
  - GetLastMessage
  - OnQueryClosePage
  - CloseAction
  - OnInstallAppPerDatabase
  - OnUpgradePerDatabase
  - HttpClient
---

# AL Copilot review

> Reviews AL source changes that build Copilot features on the System.AI module against Copilot guidance from BCQuality.

[Skill on GitHub](https://github.com/microsoft/BCQuality/blob/main/community/skills/review/al-copilot-review.md) · community layer · review skill · BC all · tier official · derived

Reviews AL source changes against the `copilot` knowledge domain in BCQuality and emits a findings report. This is a leaf action skill: it invokes no sub-skills. It is not one of the skills composed by `al-code-review`; Entry discovers and dispatches it as a top-level peer, so it produces an independent findings report.

Copilot findings apply to AL files that build generative AI features with the System.AI module or call a language model: `Copilot Capability` registration, `Azure OpenAI` and `AOAI *` codeunits, `PromptDialog` pages and their prompt actions, metaprompts, and HTTP calls to LLM endpoints. Agent SDK implementations belong to the Agents review. Return `not-applicable` when the diff contains no AL changes or none of these surfaces.

An orchestrator invokes this skill with a `pr-diff`, `file-path`, or
`folder-path`. For a folder, review all relevant source below it under DO's
current-state input semantics. The skill produces one JSON document
conforming to the DO output contract.

## Source

Use READ's **Bounded retrieval for review skills** workflow with `-Domain copilot`. Consume every catalog page across enabled layers before applying this leaf's Relevance and Worklist; preserve each exact catalog path and open complete bodies only for exact paths selected by the Worklist. If the helper or prepared index is unavailable or invalid, use READ's explicit path-discovery and bounded native-read fallback.

## Relevance

Apply READ's frontmatter matching semantics to the target BC version, AL technology, countries, and application areas. When the orchestrator supplies no target version, take it from the major version of the `application` field in the consuming app's `app.json`; if neither is available, the dimension is unknown. If a dimension is unknown, retain conditionally applicable guidance only when configuration permits it; cap resulting confidence at `medium` and name the unknown dimension in the finding message.

## Worklist

Match changed objects, procedures, and tokens against article keywords, titles, descriptions, and paths. Give particular weight to these tokens: `Copilot Capability`, `RegisterCapability`, `IsCapabilityRegistered`, `SetCopilotCapability`, `Azure OpenAI`, `SetAuthorization`, `SetManagedResourceAuthorization`, `IsEnabled`, `AOAI Chat Messages`, `SetPrimarySystemMessage`, `AddSystemMessage`, `AddUserMessage`, `GenerateChatCompletion`, `GenerateTextCompletion`, `GenerateEmbeddings`, `AOAI Operation Response`, `IsSuccess`, `GetLastMessage`, `PromptDialog`, `systemaction(Generate)`, `systemaction(Regenerate)`, `OnQueryClosePage`, `CloseAction`, `openai.azure.com`, `chat/completions`, `api-key`, `OnInstallAppPerDatabase`, `OnUpgradePerDatabase`.

Use these targeted rules to avoid broad token-only matches:

- Worklist `register-copilot-capability-on-install-and-upgrade` when a `Copilot Capability` enum extension value is added or used and `RegisterCapability` is reachable only from an install codeunit, or from nowhere. Do not match registration shared by install and upgrade paths.
- Worklist `call-azure-openai-through-the-ai-module` when AL code sends an `HttpClient` request to an LLM completion endpoint for a user-facing feature, or uses `Azure OpenAI` without `SetCopilotCapability`. Do not match HTTP calls to non-LLM services.
- Worklist `check-aoai-operation-response-before-using-output` when a `Generate*` call is followed by `GetLastMessage`, use of the returned text, or persistence of the result without an `IsSuccess()` check on that response.
- Worklist `save-promptdialog-proposals-only-when-the-user-keeps-them` when a `PromptDialog` page's `Generate`/`Regenerate` action, or the procedure it calls, writes non-temporary records, or `OnQueryClosePage` saves without testing `CloseAction`.
- Worklist `keep-user-input-out-of-the-system-message` when the text passed to `SetPrimarySystemMessage` or `AddSystemMessage` is built from a prompt field, a parameter carrying user text, or a user-editable record field. Do not match values the extension controls.

After selection, resolve conflicting guidance using READ's layer precedence. Record displaced candidates in `suppressed` with `reason: "layer-precedence"`; record disabled-layer candidates with `reason: "configuration"`.

An empty worklist caused by absent applicable knowledge produces `no-knowledge`. An empty worklist caused by no match produces `completed` with no findings.

## Action

Evaluate each worklisted article's `## Best Practice` and `## Anti Pattern` against the changed code:

- Emit `major` for a clear anti-pattern and `minor` for a concrete best-practice contradiction.
- Use `blocker` only when the article identifies a violated platform guarantee.
- Do not emit a finding from applicability alone.
- Set confidence to `high` for unambiguous syntax or identifier evidence, `medium` for heuristic or conditionally applicable evidence, and `low` only for an explicit advisory.

Agent-originated findings without a matching article must follow the DO contract: prefix the ID with `agent:`, use `references: []`, cap severity at `minor` and confidence at `medium`, and emit only concrete defects within the Copilot domain.

Provide `suggested-code` when the repair is small, local, and unambiguous. Otherwise, when a mechanical-looking repair depends on missing context or has multiple valid forms, set `suggested-code-omission-reason`.

Use the standard DO outcomes: `completed`, `no-knowledge`, `not-applicable`, `partial`, or `failed`.

## Output

Return only one JSON document conforming to the DO output contract. Every finding emitted by this skill MUST set `findings[].domain` to `"Copilot"`. Knowledge-backed finding IDs and references MUST use the exact repository-relative article path from the knowledge index.

## Names

- [codeunit 7773 "Copilot Capability"](../../../../objects/codeunit/7773.md) (possibly related: a code span names it)
- [codeunit 7771 "Azure OpenAI"](../../../../objects/codeunit/7771.md) (possibly related: a code span names it)
- [codeunit 7763 "AOAI Chat Messages"](../../../../objects/codeunit/7763.md) (possibly related: a code span names it)
- [codeunit 7770 "AOAI Operation Response"](../../../../objects/codeunit/7770.md) (possibly related: a code span names it)

## Changed by

- [#276 Minor consistency fixes: bc-version format, CI permissions, community skill retrieval](../../../../changes/bcquality/276.md), 2026-11-19
- [#229 Knowledge: Community Copilot domain (System.AI features) and review skill](../../../../changes/bcquality/229.md), 2026-10-20

---

From microsoft/BCQuality at aaaf6c1, MIT License, Copyright (c) 2026 Microsoft Corporation ([license](../../../LICENSE-BCQuality.txt)).
