bc-agent-instructions-debugger
Skill28 starsChanged 7 months agoMITView on GitHub
Audits and diagnoses Business Central agent instruction files (InstructionsV1.txt or InstructionsV2.txt) to identify why an agent is not behaving as expected, and produces a structured diagnosis report plus a corrected version of the instructions. Covers pre-publication review (catch issues before deploying) and post-deployment debugging (diagnose a live agent that is failing). Analyzes instruction files against the BC agent runtime keyword contract, the Responsibilities-Guidelines-Instructions framework, and known anti-patterns. Generates severity-classified findings (🔴 blocking / 🟡 degradation / 🔵 improvement) with root cause explanation and minimal targeted fixes. Use whenever an agent produces unexpected output, loses context between pages, ignores a guideline, fails to invoke an action, gets stuck in a loop, or when you want to review instructions before publishing an agent for the first time.
In this repository38 other files it gives its agents.
- bc-al-bug-fixSkill
- bc-al-code-reviewerSkill
- bc-al-project-contextSkill
- bc-api-page-generatorSkill
- bc-api-query-generatorSkill
- bc-approval-workflow-generatorSkill
- bc-attachments-generatorSkill
- skill-batch-processingSkill
- bc-business-events-generatorSkill
- bc-cds-page-generatorSkill
- bc-dataverse-entity-generatorSkill
- bc-dataverse-mapping-generatorSkill
- bc-field-propagationSkill
- bc-install-codeunit-generatorSkill
- bc-isolated-storage-generatorSkill
- bc-job-queueSkill
- bc-manifest-handoff-generatorSkill
- bc-matrix-page-generatorSkill
- bc-number-series-generatorSkill
- bc-pricing-refactorSkill
- bc-report-selection-generatorSkill
- bc-reportsSkill
- bc-setup-table-generatorSkill
- bc-setup-wizard-generatorSkill
- bc-table-dimensions-generatorSkill
- bc-telemetry-generatorSkill
- bc-test-codeunit-generatorSkill
- bc-upgrade-codeunit-generatorSkill
- documentation-bc-analysis-generatorSkill
- documentation-bc-architecture-generatorSkill
- documentation-bc-ccn-generatorSkill
- documentation-bc-md-to-docx-converterSkill
- documentation-bc-phase-plan-generatorSkill
- documentation-bc-release-note-generatorSkill
- documentation-bc-technical-spec-generatorSkill
- documentation-bc-user-story-generatorSkill
- onprem-remote-deploySkill
- skill-contribution-assistantSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Classifies: every finding by severity and maps it to its root cause
- Very specific: line 20
Read references/anti-patterns.md for the complete catalogue of known failure modes and their signatures.
- Distinctive: line 33
If the user provides only the instruction file with no symptom, run a pre-publication audit (full static analysis).
- Distinctive: line 75
Use the exact report template below.
- Very specific: line 170
If the agent has no name, use agent-diagnosis.md and agent-fixed.txt.
- Distinctive: line 176
Never guess page names, field names, or action captions — only reference what appears in the instruction file or what the user explicitly …
- Distinctive: line 180
If the symptom the user describes does not match any finding in the static analysis, say so explicitly and ask for the task timeline …
- Very specific: line 182
If the instruction file has no ## Task: sections, flag it as 🔴 structural and do not proceed with simulation until the user confirms the …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
BC Agent Instructions Debugger
Audits Business Central agent instruction files to explain why an agent misbehaves and how to fix it — both before first publication and after a live failure.
What this skill does
Given an instruction file (InstructionsV1.txt / InstructionsV2.txt) and an optional symptom description, this skill:
- Parses the three-part RGI framework (Responsibility → Guidelines → Instructions)
- Simulates the agent runtime's execution path step by step in natural language
- Classifies every finding by severity and maps it to its root cause
- Produces a structured diagnosis report (markdown)
- Produces a corrected instruction file with targeted, minimal changes
Read references/anti-patterns.md for the complete catalogue of known failure modes and their signatures. Read references/runtime-model.md for the BC agent runtime mental model used during simulation.
Input
The user provides one or more of:
- The instruction file content (pasted or as an uploaded
.txt) - A symptom description: what the agent does wrong, on which page, after which action
- The agent's profile page list (optional but improves diagnosis accuracy)
- Recent task timeline entries (optional, highest diagnostic value)
If the user provides only the instruction file with no symptom, run a pre-publication audit (full static analysis). If the user describes a symptom, run a targeted debug (symptom-first, then full static analysis).
Execution workflow
Step 1 — Parse and structure
Extract the three RGI sections. If any section is missing or malformed, flag it immediately as a 🔴 structural finding before proceeding.
Identify all:
- Keyword usages (
Navigate to,Set field,**Memorize**,**Reply**,Invoke action, etc.) - Guideline count and pattern (
ALWAYS/DO NOT) - Task sections (
## Task:) - Error handling sections
Step 2 — Simulate execution (per task)
For each ## Task: section, walk through the steps as the BC agent runtime would:
- Which page does the agent start on?
- Which fields/values are READ before being used elsewhere?
- Where is Memorize placed relative to where the value is needed?
- Are page names, field names, and action names stated exactly as they would appear in the agent's profile?
- Where could the agent get stuck, lose context, or produce wrong output?
Be explicit: "At step 3b, the agent reads Credit Limit (LCY) but this value is never Memorized before navigating away at step 4. When the agent reaches step 6, the value is gone."
Step 3 — Classify findings
Assign every finding a severity:
| Severity | Symbol | Meaning |
| Blocking | 🔴 | Agent cannot complete the task or will loop/crash |
| Degradation | 🟡 | Agent completes the task but with wrong output, missing data, or unsafe behaviour |
| Improvement | 🔵 | Agent works but style, safety, or performance could be better |
Map each finding to one of the root cause categories in references/anti-patterns.md.
Step 4 — Generate diagnosis report
Use the exact report template below. Do not add extra sections or reorder.
Step 5 — Generate corrected instructions
Produce a corrected version of the full instruction file. Apply only the fixes needed for 🔴 and 🟡 findings. Mark every changed line with an inline comment:
a. Read "Credit Limit (LCY)" field ← unchanged
b. **Memorize**: "Limit: {Credit Limit (LCY)}" ← FIXED: moved Memorize here, was missingFor 🔵 findings, list them in the report but do not apply them automatically — ask the user whether to include them.
Report template
# BC Agent Instructions — Diagnosis Report
**Agent:** {agent name or "unnamed"}
**Date:** {today}
**Mode:** Pre-publication audit | Targeted debug
**Symptom reported:** {symptom or "none — full static audit"}
---
## Executive summary
{2–4 sentences. What is the most likely root cause of the reported symptom?
What is the overall quality of the instruction file?}
---
## Findings
### 🔴 Blocking — {count}
#### [B-01] {Short title}
- **Location:** {Section / Step number}
- **Root cause category:** {from anti-patterns catalogue}
- **What happens:** {What the runtime does and why it fails}
- **Fix:** {Exact corrected text or instruction}
{Repeat for each blocking finding}
---
### 🟡 Degradation — {count}
#### [D-01] {Short title}
- **Location:** {Section / Step number}
- **Root cause category:** {from anti-patterns catalogue}
- **What happens:** {What the runtime does and why it produces wrong output}
- **Fix:** {Exact corrected text or instruction}
{Repeat for each degradation finding}
---
### 🔵 Improvement — {count}
| ID | Location | Issue | Recommendation |
|----|----------|-------|----------------|
| I-01 | {location} | {issue} | {recommendation} |
---
## Execution simulation
{Step-by-step walk of the first failing task. Narrate what the runtime does at each step
and where it goes wrong. Be concrete: quote the instruction text, name the page, name the field.}
---
## Skills Evidencing
| Field | Value |
|---|---|
| Skill loaded | bc-agent-instructions-debugger |
| Input | {file name or "pasted content"}, {symptom or "none"} |
| Mode | Pre-publication audit / Targeted debug |
| Findings | 🔴 {n} / 🟡 {n} / 🔵 {n} |
| Corrected file generated | Yes / No |Output files
| File | Content |
{agent-name}-diagnosis.md | Full diagnosis report |
{agent-name}-fixed.txt | Corrected instruction file |
If the agent has no name, use agent-diagnosis.md and agent-fixed.txt.
Behaviour rules
- Never guess page names, field names, or action captions — only reference what appears in the instruction file or what the user explicitly confirms exists in the agent's profile. Flag any unverifiable reference as a finding.
- The corrected file must preserve the user's intent and writing style. Fix only what is broken; do not rewrite the entire file.
- If the symptom the user describes does not match any finding in the static analysis, say so explicitly and ask for the task timeline entries — they are the highest-signal diagnostic source.
- If the instruction file has no
## Task:sections, flag it as 🔴 structural and do not proceed with simulation until the user confirms the format is intentional. - Produce the diagnosis report first. Ask the user to confirm before producing the corrected file, unless they explicitly asked for both upfront.
Reference files
references/anti-patterns.md— Full catalogue of known failure modes, their signatures, and standard fixesreferences/runtime-model.md— Mental model of the BC agent runtime: state retention, keyword contract, page navigation constraints
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.

