skill-debug
Skill115 starsChanged 10 days agoMITView on GitHub
AL debugging and diagnostics for Business Central. Use when performing snapshot debugging, CPU profiling, analyzing telemetry, or troubleshooting runtime issues.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- kannaka-labs/Kannaktopustheir own version, first seen Oct 13, 2026
- Noizefield/audio-plugin-codertheir own version, first seen Oct 8, 2026
- yknothing/skills-refinertheir own version, first seen Sep 20, 2026
- nyldn/claude-octopustheir own version, first seen Aug 13, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- nyldn/claude-octopus★ 4.4ksame name
- Noizefield/audio-plugin-coder★ 334same name
- yknothing/skills-refiner★ 24same name
- kannaka-labs/Kannaktopus★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository55 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- claude-plugin/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- instructions/copilot-instructions.mdCopilot instructions
- agent-builderSkill
- al-agent-build-instructionsSkill
- al-agent-createSkill
- al-agent-instructionsSkill
- al-agent-taskSkill
- al-agent-testSkill
- al-buildSkill
- al-context-createSkill
- al-initializeSkill
- al-memory-createSkill
- al-pr-prepareSkill
- al-spec-createSkill
- architectSkill
- auditSkill
- conductSkill
- developSkill
- presalesSkill
- reviewSkill
- skill-agent-instructionsSkill
- skill-agent-task-patternsSkill
- skill-agent-toolkitSkill
- skill-al-review-pipelineSkill
- skill-apiSkill
- skill-contribution-assistantSkill
- skill-copilotSkill
- skill-debugSkill
- skill-estimationSkill
- skill-eventsSkill
- skill-migrateSkill
- skill-pagesSkill
- skill-performanceSkill
- skill-permissionsSkill
- skill-testingSkill
- skill-translateSkill
- specSkill
- triageSkill
- skill-agent-instructionsSkill
- skill-agent-task-patternsSkill
- skill-agent-toolkitSkill
- skill-al-review-pipelineSkill
- skill-apiSkill
- skill-contribution-assistantSkill
- skill-copilotSkill
- skill-estimationSkill
- skill-eventsSkill
- skill-migrateSkill
- skill-pagesSkill
- skill-performanceSkill
- skill-permissionsSkill
- skill-testingSkill
- skill-translateSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use actual compiler/runtime evidence and keep compilation distinct from execution.
- Distinctive: line 118
Read existing plans context first:
- Distinctive: line 126
When does it happen: always / sometimes / specific conditions?
- Very specific: line 161
Check app.json dependencies version alignment.
- Very specific: line 168
Publishing failures: check environment connectivity, extension version increment, dependency resolution via al_packages.
- Very specific: line 187
Create .github/plans/<issue-kebab-case>-diagnosis.md before proposing any fix:
- Distinctive: line 228
Consider edge cases and side effects
- Very specific: line 230
After approval: handoff implementation to al-developer (simple) or via al-conductor TDD cycle (complex refactor)
- Distinctive: line 231
After fix: run tests, re-profile if performance issue, verify regression scenarios
- Distinctive: line 248
NEVER: leave debugging code, breakpoints, or temporary logging in production code
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: AL Debugging & Diagnostics
Purpose
For BC29 AL0926 section-order errors or new isolation behavior, read the relevant sections of AL18 capability checks. Use actual compiler/runtime evidence and keep compilation distinct from execution.
Systematic diagnosis and root cause analysis for AL Business Central issues: runtime errors, logic bugs, intermittent failures, performance bottlenecks, and configuration problems.
When to Load
This skill should be loaded when:
- A runtime error, exception, or unexpected behavior is reported
- A logic bug needs root cause analysis (not just a symptom fix)
- An intermittent issue needs snapshot capture
- A performance bottleneck needs CPU profiling
- Configuration issues (auth, symbols, build, publishing) block development
- An event subscriber is not firing as expected
Core Patterns
Pattern 1: Choose Debugging Strategy
Select the right tool before starting:
| Issue Type | Strategy | Tool |
| Consistent runtime error | Standard debugger | al_debug |
| Already deployed code | Debug without publish | al_debug |
| Rapid dev cycle | Incremental publish | al_publish (incremental) |
| Intermittent / hard-to-reproduce | Snapshot debugging | al_snapshotdebugging |
| Slow performance | CPU profiling | VS Code command (not an agent tool) |
| Auth / symbols / build | Configuration troubleshoot | See Workflow Step 2b |
| Copilot AI feature | Agent session debug | launch.json with clientType: Agent |
Pattern 2: Data Flow Tracing
Scenario: "Value is wrong after posting"
1. Set breakpoint at final location (where value is wrong)
2. Work backwards to find where value is set
3. Use `usages` tool to find all assignments
4. Set breakpoints at each assignment point
5. Step through to find which execution path is taken
6. Inspect conditions and variable states at each pointPattern 3: Event Subscriber Not Firing
Scenario: "My event subscriber doesn't execute"
1. Verify subscriber signature exactly matches publisher (name, parameters, types)
2. Check SkipOnMissingLicense and SkipOnMissingPermission attributes
3. Confirm the extension containing the publisher is active and published
4. Set breakpoint inside subscriber body
5. Verify the publisher event is actually being raised (breakpoint in publisher)
6. Check if IsHandled = true is set before your subscriber runs
7. Inspect subscriber execution order (EventPriority)Pattern 4: Performance Bottleneck
// ❌ N+1 pattern — common cause of slow pages
repeat
Item.Get(SalesLine."No."); // DB call inside loop
SalesLine.Amount := Item.Price * SalesLine.Quantity;
until SalesLine.Next() = 0;
// ✅ Use SetLoadFields + single pass
SalesLine.SetLoadFields("No.", Quantity, Amount);
if SalesLine.FindSet() then
repeat
// ...
until SalesLine.Next() = 0;CPU profile analysis focus:
- Top time-consuming procedures (hotspots)
- Frequently called procedures in loops
- Expensive database operations
- FlowField CalcFormula complexity
Pattern 5: Snapshot Debugging for Intermittent Issues
⚠️ HUMAN GATE: Snapshots may capture sensitive runtime data.
Before initializing:
1. Confirm what data will be captured
2. Security review for sensitive information
3. Obtain explicit user approval
Commands (one tool — `al_snapshotdebugging` — covers initialize / finish / view):
al_snapshotdebugging (initialize) ← start capture session
[reproduce scenario 10-20 times]
al_snapshotdebugging (finish) ← end capture
al_snapshotdebugging (view) ← view and compare
Compare snapshots between success and failure cases:
- Variable values at failure point
- Timing differences
- Execution paths taken
- Data state variationsWorkflow
Step 1: Context Gathering (MANDATORY before any debugging)
Read existing plans context first:
.github/plans/memory.md ← project state and recent decisions
.github/plans/*-diagnosis.md ← previous debug sessions (similar issues)Gather issue information:
- What is the expected behavior vs actual behavior?
- When does it happen: always / sometimes / specific conditions?
- Exact error message and stack trace
- Recent code changes (potential regression source)
- User/permission set and environment where it occurs
Stop criterion: can reproduce the issue consistently (≥80% success rate).
Step 2a: Isolate the Problem (Runtime / Logic)
- Narrow down scope with
searchandusagestools - Identify suspect objects (tables, pages, codeunits, event subscribers)
- Attach debugger with selected strategy (Pattern 1)
- Set strategic breakpoints:
- Just before the error occurs
- At data modification points
- In event subscribers and validation triggers
- Inspect: variable values, record filters, call stack, parameter values
- Step execution: F10 (step over), F11 (step into), Shift+F11 (step out)
Step 2b: Configuration Troubleshooting
Authentication failures (401/403, cannot download symbols):
⚠️ HUMAN GATE: Clearing credentials disconnects active sessions.
Confirm impact and obtain approval before clearing the credentials cache
(a VS Code command, not an agent tool).
Then re-authenticate and verify launch.json authentication method.Missing symbols (unresolved references, red squiggles):
al_downloadsymbols ← first attempt
al_downloadsymbols (globalSourcesOnly) ← if no BC server connection is available
al_build ← verify compilationCheck app.json dependencies version alignment.
Build errors — common codes:
AL0896— Recursive FlowField: map dependency graph, break circular chainAL0185— Object ID conflict: check ID range inapp.json, no duplicatesAL0118— Field length mismatch: align extension field length with base table
Publishing failures: check environment connectivity, extension version increment, dependency resolution via al_packages.
Step 3: Diagnose Root Cause
Identify the exact point of failure and — critically — WHY it occurs:
Common AL root causes by scenario:
| Symptom | Root Cause Candidates |
| Record Not Found | Wrong key values, filters blocking read, wrong company context, permission on read |
| FlowField wrong value | CalcFields not called, incorrect CalcFormula filters, circular dependency (AL0896) |
| OnValidate not firing | Direct assignment without Validate(), IsHandled = true in subscriber, disabled trigger |
| Custom event not firing | Signature mismatch, wrong ObjectType/ObjectId, publisher not raising event, compilation error in subscriber |
| Slow page | Missing SetLoadFields, N+1 loop, FlowField CalcFormula too complex, missing index/key |
| Intermittent failure | Race condition, timing dependency, data-state dependency, environment-specific |
Step 4: Document Diagnosis (MANDATORY)
Create .github/plans/<issue-kebab-case>-diagnosis.md before proposing any fix:
# Debug Session: <Issue Title>
**Date**: YYYY-MM-DD
**Severity**: Critical / High / Medium / Low
**Status**: Investigating → Diagnosed → Fixed → Verified
## Issue Summary
[Brief description]
## Symptoms
- Expected: [what should happen]
- Actual: [what happens — include exact error text]
## Reproduction Steps
1. [Step]
2. [Step]
**Reproducibility**: Always / Sometimes / Rare
## Root Cause
[Technical explanation with evidence — code snippet, line reference]
## Recommended Fix
[Specific solution. Short-term hotfix + long-term if needed]
## Testing Strategy
- Unit: [what to mock/test]
- Regression: [related functionality to verify]
## Next Steps
1. [Action]
2. [Action]File naming: sales-posting-error-diagnosis.md, slow-customer-list-diagnosis.md.
Step 5: Propose Fix & Handoff (MANDATORY HITL gate)
- Design fix addressing root cause (never symptoms only)
- Consider edge cases and side effects
- PAUSE — present diagnosis and proposed fix to user for approval
- After approval: handoff implementation to
al-developer(simple) or viaal-conductorTDD cycle (complex refactor) - After fix: run tests, re-profile if performance issue, verify regression scenarios
Clean up: remove debugging artifacts, breakpoints, and temporary logging from code.
References
Constraints
- This skill covers diagnosis and root cause analysis only — code changes are implemented by
al-developeror viaal-conductor - NEVER guess solutions without evidence from debugging tools
- NEVER skip Step 4 (diagnosis document) for non-trivial issues (>5 min investigation)
- NEVER proceed to fix without user approval (Step 5 HITL gate)
- NEVER leave debugging code, breakpoints, or temporary logging in production code
- Performance deep-dive (SetLoadFields, FlowField patterns, query optimization) → load
skill-performance.md - Event publisher/subscriber design patterns → load
skill-events.md - Permission set generation → load
skill-permissions.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

