mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
* Add events knowledge domain and review leaf skill Add a new `events` knowledge domain covering AL events & subscribers, wired into the AL review pipeline. - 3 atomic articles (+ .good.al/.bad.al samples) under microsoft/knowledge/events/: the IsHandled override pattern, thin OnBefore/OnAfter integration-event publishers, and static vs manual subscribers. - New leaf skill microsoft/skills/review/al-events-review.md sourcing the events domain. - Wired into microsoft/skills/review/al-code-review.md (sub-skills + Source + description) and README.md (leaf-skill count + domain list). AL event syntax verified against Microsoft Learn. Samples are demonstration-only (not compiled by CI). Additive change; no contract change. Part of #34. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add 12 general AL event-design articles to events domain Add 12 atomic knowledge articles under microsoft/knowledge/events covering general AL event-design best practices: IsHandled initialization and OnAfter preservation, appending new event parameters, position-based event naming, reusing/extending events, avoiding per-iteration publishing, Temp-prefixing temporary record parameters, unabbreviated parameter names, preferring the this keyword over IncludeSender, avoiding loosely typed parameters, not mutating existing event contracts, and not bypassing critical operations with IsHandled. Each article ships a .good.al and .bad.al demonstration sample (object IDs 50240-50296; not compiled by CI). Extend the al-events-review leaf Worklist with one targeted check per new rule. Additive only; no contract or wiring change (events leaf already wired). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Refine events articles after review feedback Correct wording in five events articles to reflect that AL event subscribers bind by parameter name, not position: - add-new-event-parameters-at-the-end: drop the inaccurate claim that appending a parameter forces subscribers to be updated or causes wrong values; keep the append-at-end best practice. - do-not-add-ishandled-to-an-existing-event: reframe from "breaking change" to the semantic/purpose shift that leaves existing subscribers pointless; rename the breaking-change keyword to semantic-change. - name-events-by-publisher-position: extend the good sample with position-named publishers raised from table and report trigger contexts. - initialize-ishandled-to-false-before-publishing: scope the detection and best practice to events that actually carry a var IsHandled, so an OnBefore with no IsHandled is not flagged. - do-not-bypass-critical-operations-with-ishandled: add a litmus-test definition of a critical operation (code that cannot stand as an independent, self-contained unit). Knowledge-only; no contract or wiring change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Soften Anti Pattern wording in add-new-event-parameters article Remove the last name-vs-position misconception from the Anti Pattern so it is consistent with the corrected Description: mid-list insertion is framed as noisy and harder to review rather than as forcing subscriber re-mapping. Detection sentence unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add events domain reviewers to CODEOWNERS Add @AleksandricMarko and @pchriste-microsoft-com as required reviewers for the events knowledge domain, matching the existing per-domain expert ownership convention. Inserted in alphabetical order ahead of the performance line. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
151 lines
10 KiB
Markdown
151 lines
10 KiB
Markdown
# BCQuality
|
|
|
|
Quality skills and knowledge for Business Central development.
|
|
|
|
BCQuality is a curated knowledge base and skills library for Business Central. It provides structured, machine-readable guidance that development agents and tools can consume — establishing a consistent quality bar across tooling and teams.
|
|
|
|
## What belongs here
|
|
|
|
BCQuality is a remedial knowledge base. A file exists because a capable LLM **would get something wrong, or miss something, without it** — not because the topic is important. The admission test for a knowledge file is one question:
|
|
|
|
> If this file did not exist, would a modern LLM reviewing or generating BC code make a mistake this file would have prevented?
|
|
|
|
If the answer is no — the advice is generic software-engineering guidance, or the LLM already knows the BC mechanic in question — the file does not belong here, regardless of how sound the content is. A file earns its place by encoding something BC-specific that LLMs demonstrably get wrong: a CodeCop rule number, a platform API whose semantics the training data gets backwards, a non-obvious ordering rule, a BC property whose default is a footgun.
|
|
|
|
Good fit: "`SetLoadFields` must be called before filters, not after" (non-obvious ordering rule). "`FindSet(true)` takes a LockTable and the two-parameter signature is obsolete" (subtle platform behaviour + outdated training data). "CodeCop AA0233 flags `FindFirst … Next` loops" (rule-specific).
|
|
|
|
Poor fit: "Use HTTPS instead of HTTP." "Don't hardcode secrets." "Keep transactions short." These are true but any capable LLM already applies them without prompting.
|
|
|
|
The practical consequence: when a code-review agent flags something it shouldn't have, or misses something it should have caught, the remedy is a new knowledge file. When it already behaves correctly on a topic, no file is needed.
|
|
|
|
## What's in this repo
|
|
|
|
BCQuality contains **knowledge** and **skills**. It does not contain agents. Agents that consume BCQuality ship with [AL-Go](https://github.com/microsoft/AL-Go) and other orchestrators.
|
|
|
|
### Knowledge files
|
|
|
|
Atomic markdown files with YAML frontmatter. Each file covers one concern — one thing an agent would cite when reviewing or generating code. Knowledge files live in two layers:
|
|
|
|
- **`/microsoft/`** — Microsoft-endorsed layer.
|
|
- `/microsoft/knowledge/` — Platform guardrails, official guidance.
|
|
- `/microsoft/skills/` — Microsoft-endorsed action skills.
|
|
- **`/community/`** — BC community layer.
|
|
- `/community/knowledge/` — Community patterns and shared guidance.
|
|
- `/community/skills/` — Community-contributed action skills.
|
|
|
|
- **`/custom/`** — Partner- and customer-specific overrides. Empty by default; populated in forks.
|
|
- `/custom/knowledge/` — Organization-specific knowledge files.
|
|
- `/custom/skills/` — Organization-specific action skills.
|
|
|
|
All three layers are enabled by default when an agent consumes BCQuality. Content can be promoted from Community to Microsoft-endorsed once it proves itself — this is a first-class concept, not an afterthought.
|
|
|
|
### Skills
|
|
|
|
Skills define how agents consume knowledge. They come in three flavors:
|
|
|
|
- **The entry-point skill** ([`skills/entry.md`](skills/entry.md)) — the first skill an agent invokes at runtime. Given a task context (goal, available inputs, technologies, BC version, etc.), it returns a **dispatch record** naming the action skill or skills to invoke next. Routing logic lives here, not in the orchestrator.
|
|
|
|
- **Meta-skill contracts** (`/skills/`) — three stable references that define the rest of the repo:
|
|
1. **Schema + Use** (READ, [`skills/read.md`](skills/read.md)) — how to read a knowledge file: interpret frontmatter, parse sections, understand layer precedence. Any agent or skill that reads knowledge files depends on it.
|
|
2. **Action Skill** (DO, [`skills/do.md`](skills/do.md)) — the template every action skill follows. Defines the four-step pattern (Source → Relevance → Worklist → Action) and the structured output format that orchestrators expect.
|
|
3. **New Knowledge** (WRITE, [`skills/write.md`](skills/write.md)) — how to author a valid knowledge file. References Schema + Use for the format specification and adds authoring rules (atomicity, section guidance).
|
|
|
|
READ and DO are read on demand — typically when the first dispatched action skill runs. They are not prerequisites for invoking Entry. WRITE is only used when scaffolding new content.
|
|
|
|
- **Action skills** — concrete skills that follow the Action Skill template to do real work (review code, audit telemetry, etc.). Action skills live inside the layers that own them (`/microsoft/skills/`, `/community/skills/`, `/custom/skills/`). An action skill is either a **leaf** that evaluates knowledge files directly, or a **super-skill** that composes other action skills (declared via `sub-skills` in frontmatter). The canonical reference is [`microsoft/skills/review/al-code-review.md`](microsoft/skills/review/al-code-review.md) (super-skill), which composes eight leaf skills under [`microsoft/skills/review/`](microsoft/skills/review/) — one per knowledge domain (performance, security, privacy, upgrade, style, UI, error handling, events, interfaces).
|
|
|
|
### Agent bootstrapping
|
|
|
|
An orchestrator (such as AL-Go) points the agent at BCQuality's URL and provides a task context. The agent's first call is `/skills/entry.md`, which returns a dispatch record naming the action skill(s) to invoke. The agent then invokes each dispatched skill in turn, reading READ and DO on demand. No prior knowledge of BCQuality's structure is baked into the orchestrator — only the convention *"invoke `/skills/entry.md` first."*
|
|
|
|
## Knowledge file format
|
|
|
|
Every knowledge file is a markdown file with mandatory YAML frontmatter. Files target under 100 lines (ideal under 50). If two ideas would share a file, split them.
|
|
|
|
### Frontmatter schema (v1)
|
|
|
|
```yaml
|
|
---
|
|
bc-version: [all] # or [26..28], or [26..] for "26 and later"
|
|
domain: performance # security | performance | ux | telemetry | ...
|
|
keywords: [query, filtering, partial] # free-text tags for retrieval
|
|
technologies: [al] # al | javascript | powershell | ...
|
|
countries: [w1] # ISO codes, or [w1]
|
|
application-area: [all] # finance | manufacturing | jobs | [all]
|
|
---
|
|
```
|
|
|
|
All six fields are required. The schema is locked — changes require a PR approved by both maintainers.
|
|
|
|
### Sections
|
|
|
|
Every knowledge file must contain a `## Description` section. The following sections are optional but recommended:
|
|
|
|
- **`## Best Practice`** — the recommended approach
|
|
- **`## Anti Pattern`** — what to avoid and why
|
|
|
|
Code examples belong in separate files, not in the knowledge file itself. Knowledge files must not contain fenced code blocks.
|
|
|
|
## Scope
|
|
|
|
BCQuality covers Business Central broadly — the application domains it supports, the technologies used to extend it, and the practices that keep implementations healthy. The scope includes:
|
|
|
|
- **Business Central domains** — Finance, Supply Chain Management, Manufacturing, Jobs, Warehousing, Service, and the many other functional areas BC covers. Domain knowledge helps agents understand the business context they are working in.
|
|
- AL language patterns and anti-patterns
|
|
- PowerShell scripting for BC
|
|
- Pipelines (AL-Go, GitHub Actions)
|
|
- Business Central APIs
|
|
- Power Platform integration
|
|
- Telemetry and KQL
|
|
- AppSource lifecycle
|
|
|
|
A BC developer's actual job spans all of this, and BCQuality reflects that.
|
|
|
|
## How agents consume BCQuality
|
|
|
|
Action skills follow a four-step pattern:
|
|
|
|
1. **Source** — which knowledge folders and tags to search
|
|
2. **Relevance** — filter by frontmatter (version, technology, country, area)
|
|
3. **Worklist** — narrow from N candidates to the M that apply to the current task
|
|
4. **Action** — apply the relevant knowledge and produce structured output
|
|
|
|
Every action skill produces output in a common format that orchestrators can consume without skill-specific parsing. The format is JSON and includes an `outcome` (so a clean run, a not-applicable skill, and a partial failure are all distinguishable), `findings` (what the skill observed), structured `references` back to the knowledge files that informed each finding, per-finding `confidence`, and a `suppressed` list recording any knowledge files overridden by layer precedence. This contract is defined in the Action Skill meta-skill so that orchestrators and action skills remain independently evolvable.
|
|
|
|
BCQuality is an **additive** knowledge layer: it augments the agent's review judgement, it does not replace it. Super-skills (such as `al-code-review`) run a self-review pass alongside their sub-skills and surface concerns the agent identified on its own, marked with `from-sub-skill: "agent"` and an empty `references: []` so consumers can render them distinctly from knowledge-backed findings. See [agent-consumption.md](agent-consumption.md) and [`skills/do.md`](skills/do.md) for the full contract.
|
|
|
|
The meta-skills in `/skills/` define this pattern. Every concrete action skill follows it.
|
|
|
|
For the end-to-end flow — from orchestrator trigger through to how output reaches developers — see [agent-consumption.md](agent-consumption.md).
|
|
|
|
## Repository structure
|
|
|
|
```
|
|
├── /skills/ # Global: entry-point skill + meta-skill contracts (READ, DO, WRITE)
|
|
├── /.github/ # Actions and workflows
|
|
├── /microsoft/ # Microsoft-endorsed layer
|
|
│ ├── /knowledge/ # Knowledge files by domain
|
|
│ │ └── /<domain>/ # Each article: <slug>.md + optional <slug>.good.al / <slug>.bad.al
|
|
│ └── /skills/ # Microsoft-endorsed action skills
|
|
├── /community/ # BC community layer
|
|
│ ├── /knowledge/ # Knowledge files by domain
|
|
│ │ └── /<domain>/ # Article + sibling samples, same convention
|
|
│ └── /skills/ # Community action skills
|
|
├── /custom/ # Partner/customer-specific overrides (empty; populated in forks)
|
|
│ ├── /knowledge/
|
|
│ └── /skills/
|
|
```
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome. Before submitting a PR:
|
|
|
|
1. Read the knowledge file format above — frontmatter and sections are validated by CI.
|
|
2. Keep files atomic: one concern per file, under 100 lines.
|
|
3. Target your contribution to the right layer — most community contributions go in `/community/knowledge/`.
|
|
|
|
CI runs validation on every PR. If your knowledge file has schema violations, missing sections, code blocks, or exceeds 100 lines, the check will fail with a clear error message.
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE)
|