agentleFS
javiarmestojaviarmesto/ALDC-AL-Development-Collection/skills/al-agent-task/SKILL.md

al-agent-task

Skill115 starsChanged 14 days agoMITView on GitHub

Generate AL code for Business Central Agent SDK task integration. Applies the patterns from skill-agent-task-patterns to produce production-ready codeunits, page extensions, and event subscribers — verified against the runtime API availability matrix.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before generating code, determine:

    line 16

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Workflow: Generate Agent Task Integration Code

Generates production-ready AL code for agent task integration. This prompt does not contain pattern knowledge — it applies the patterns from skill-agent-task-patterns.

Load skill first: skill-agent-task-patterns (8 patterns A–H, SDK codeunits, API availability matrix, OnPrem-only restrictions, workarounds).

Step 1 — Gather context

Before generating code, determine:

  1. Agent name and prefix — read from app.json or ask the developer
  2. Object ID range — check existing objects in app/ for the next available IDs
  3. Which pattern(s) — ask or infer from the request:
    • "I need a Public API" → Pattern A
    • "Add a button to send work to the agent" → Pattern B (calls A)
    • "Trigger agent on posting/releasing" → Pattern C (calls A)
    • "Agent needs to process files" → Pattern D (combine with A/B/C)
    • "Continue an existing task" → Pattern E (verify AddToTask availability against the matrix)
    • "Run code only in agent context" → Pattern G/H
    • "Force human review" → Warning annotation workaround (matrix: SetRequiresReview OnPrem-only)
  4. ExternalId format — convention {PREFIX}-{No.} (e.g. LEAD-001, SO-1001)
  5. Target page/table — which page extension or event subscriber is needed?

Step 2 — Verify availability

Before writing any code, check each method against the API Availability Matrix in skill-agent-task-patterns. Any method marked OnPrem-only or "Not in 17.0" requires the documented workaround.

Step 3 — Generate code

For each requested pattern:

  1. Search the codebase for existing agent objects (Setup table, Public API, enums) to reuse
  2. Generate AL objects following the pattern from the skill, substituting:
    • {Agent} → actual agent name/prefix
    • {id} → actual object IDs
    • Record names, field names, enum values → actual project values
  3. Place files in the correct folder of the project structure:
    • Public API + Impl → app/Example/
    • Page extensions → app/Example/
    • Session events → app/Setup/TaskExecution/
  4. Verify generated code references correct enum values and codeunit names

Step 4 — Validate

  • All generated codeunits compile (correct parameter types, return types)
  • Public API has Access = Public, Implementation has Access = Internal
  • Event-driven task creation uses [TryFunction]
  • Business conditions checked BEFORE task creation (outside TryFunction)
  • Failures logged via Session.LogMessage
  • ExternalId follows the agreed format convention
  • Page extensions use AgentSetup.OpenAgentLookup() for agent selection
  • No OnPrem-only methods invoked from Extension scope
  • If AddToTask was needed, follow-up task workaround is in place

🛑 STOP — Review generated code with the developer.

Skills Evidencing

End with:

**Skills loaded**: skill-agent-task-patterns
**Patterns applied**:
- Pattern {X} — {file where applied}
- API matrix verified: {list any OnPrem/future methods that triggered workarounds}

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.