al-code-review
Review AL code for Business Central extensions against project and Microsoft conventions, including the AL performance checklist and Copilot PromptDialog rules.
от EquerraNZ★ 16 звёзд на GitHub
Установить al-code-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
AL Code Review
When to use
Reviewing AL code in any BC extension, including AppSource submissions, custom extensions, and per-tenant work.
Sources
This skill synthesises:
- The project AL guidelines document
alguidelines.dev- Microsoft CAL guidelines (legacy patterns to be aware of)
- The
microsoft/alguidelinesrepository
When sources conflict, project house rules win.
House rules
- Never include
ODataKeyFieldsin BC API query definitions. This is a strict rule. Flag any API query that adds it. - Use object IDs from the project's assigned range. Never hardcode IDs outside the assigned range.
- Capture telemetry on every protected operation using the project's standard telemetry pattern.
- All user-facing labels go through
Labeldeclarations withCommentpopulated for translators.
Core checks
Naming
- Tables, pages, codeunits, and reports: PascalCase, descriptive.
- Variables: PascalCase, no Hungarian notation.
- Procedures: PascalCase, verb first ("CalculateAmount" not "AmountCalculation").
Structure
- Pages have a single purpose. Master, List, Card, Document, Worksheet, RoleCenter.
- Business logic lives in codeunits, not page triggers.
- One object per
.alfile.
Error handling
Errorfor user-facing failures.Confirmonly when the user can sensibly answer.- Use
ErrorInfofor structured errors that callers can react to.
API definitions
- Query objects use
APIPublisher,APIGroup,APIVersion,EntityName,EntitySetName. - Property
ODataKeyFieldsis forbidden by project house rules. - All API fields use
IncludeInDataSet = trueonly where needed.
Performance
- Avoid record locking in loops. Use
LockTableonce, then iterate. - Avoid
FindFirst/FindLastwhereGetwould do. - Filter on indexed fields when possible.
Event subscribers
The project has explicit rules for event subscribers, drawn from the AL Development Standards.
- Keep subscriber codeunits small and focused. A new instance of the codeunit is created when an event fires. Multi-purpose subscriber codeunits create unnecessary overhead.
- Group subscriptions by functionality. Examples:
Subs-SalesPostfor sales posting events,Subs-SalesHeaderLineEventsfor Sales Header and Sales Line table events. - Subscriber procedures are thin. They call a Management/Handler codeunit that holds the business logic.
- Consider
SingleInstancewhen shared cached state actually helps, but prefer stateless subscribers and avoid global variables. - Use
EventSubscriberInstance = Manualwhen events should only fire during a specific process and explicit control is needed. - Naming convention:
ObjectName_EventName_ElementName. Example:Job_OnBeforeUpdateJobTaskDimension. - Exit early. Bail on temp records, wrong record type,
Session.CurrentExecutionMode <> Normal, or any unmet precondition. SkipOnMissingLicense/SkipOnMissingPermission: for AppSource marketplace apps (BC21+),true, truemay be acceptable. Discuss with the Product Owner. For non-marketplace/internal apps, usefalse, falseso license and permission issues fail fast.
AL performance checklist
For any PR that touches AL on a performance-sensitive path, apply the checklist captured in templates/pr-performance-review.md. Headlines:
- Correct data access method (
Get>Find>FindFirst>IsEmpty, avoidFindSetunless necessary) - Filters applied before loops, not inside
SetCurrentKeywhen a non-primary index is requiredModifyAll/DeleteAllinstead of record-by-record loops- Temporary tables for heavy looping or sorting
- Queries instead of nested loops
- Subscribers exit early and avoid hidden DB calls
- No auto-increment fields as primary keys
- No assumptions about small data sets
Use the PR template at templates/pr-performance-review.md (in this skill folder) for any PR with non-trivial AL performance impact.
Anti-patterns to call out
- Stringly-typed option fields where an enum would be safer
- Direct DB access from pages instead of via codeunits
- Caught-and-ignored errors
- Magic strings for codes (use constants or enums)
FindSetloop withCalcFieldsof a FlowField inside- Event subscribers doing extra DB reads on the hot path
- Large multi-purpose subscriber codeunits
PromptDialog and Copilot review
For any AL changes that touch a PageType = PromptDialog, also enforce these rules from copilot-promptdialog:
Extensible = falseis mandatory. Customers cannot extend Copilot pages.Image = SparkleorSparkleFilledonly. Other icons are non-standard.- No repeater controls inside
area(Prompt)orarea(Content). area(PromptOptions)accepts only option-type fields.- Only the five sanctioned system actions:
Generate,Regenerate,Attach,OK,Cancel. Reject custom system action names. - No trailing whitespace in action names. Silently breaks Copilot. Caption can
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- templates/pr-performance-review.md
FAQ
Что делает скилл al-code-review?
Review AL code for Business Central extensions against project and Microsoft conventions, including the AL performance checklist and Copilot PromptDialog rules.
Как установить скилл al-code-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл al-code-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…