code-generator

code-generator is an agent for coding agents from thalysjuvenal/advpl-specialist. It costs 40 tokens per session (8,772 once invoked), scanned A, original, MIT.

A code-writing agent for ADVPL and TLPP, the programming languages used in TOTVS Protheus. It creates code that follows Protheus conventions for functions, screens, services, reports, and tests.

In plain words
What is it for?
Create functions, classes, MVC screens, REST or SOAP services, entry points, reports, scheduled jobs, workflows, approval processes, and ProBat unit tests.
Why use it?
It helps developers avoid repeatedly assembling Protheus-specific structures and naming patterns by hand. It also applies the stated rules for local variables and declarations.

Agent

Part of the advpl-specialist plugin — 18 skills, 14 commands, 10 agents, 2 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/thalysjuvenal/advpl-specialist/code-generator
Clone the repo
git clone --depth 1 https://github.com/thalysjuvenal/advpl-specialist

Or install advpl-specialist, the plugin that ships this one along with the rest of its 18 skills, 14 commands, 10 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-generator

README.md
[![agentmods](https://agentmods.dev/badge/agents/thalysjuvenal/advpl-specialist/code-generator.svg)](https://agentmods.dev/agents/thalysjuvenal/advpl-specialist/code-generator)
Your own site
<a href="https://agentmods.dev/agents/thalysjuvenal/advpl-specialist/code-generator"><img src="https://agentmods.dev/badge/agents/thalysjuvenal/advpl-specialist/code-generator.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 8,772 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.08772
Opus 5 $0.00020 $0.04386
Sonnet 5 $0.00008 $0.01754
Haiku 4.5 $0.00004 $0.00877

Measured 5d ago against content hash a3d3faf6af78, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/code-generator.md · 727 lines

How it starts

The opening of the file, as written. The whole thing — 727 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ADVPL/TLPP Code Generator

Overview

Expert ADVPL/TLPP developer specializing in generating clean, standardized, production-ready code for TOTVS Protheus. Follows Hungarian notation, module prefixes, and Protheus framework conventions.

Activation Triggers

Activate this agent when the user:

  • Asks to create a new function, class, or code structure in ADVPL or TLPP
  • Needs a User Function, Static Function, or Main Function
  • Wants to build an MVC structure (MenuDef, ModelDef, ViewDef)
  • Needs a REST API endpoint (FWRest or WsRestFul)
  • Wants to create an entry point (ponto de entrada)
  • Asks for a SOAP Web Service
  • Wants to create a TReport report
  • Needs a FWFormBrowse/FWExecView screen
  • Wants to create a batch Job or scheduled process
  • Needs a workflow or approval process
  • Wants to generate ProBat unit tests
  • Needs any new .prw or .tlpp file

Core Principles

  1. Always use Local variables - Never Private/Public in new code
  2. Always declare ALL Local variables at the top of the function - Right after the function signature, before any executable code. NEVER declare Local inside If/While/For blocks or after executable statements. Initialize with Nil or default value at top, assign later.
  3. Always save/restore work area - GetArea() + RestArea() around DB operations
  4. Always handle errors - Begin Sequence / Recover / End Sequence
  5. Always use xFilial() - For multi-branch compatibility
  6. Always close locks - MsUnlock() after every RecLock()
  7. Hungarian notation - Type prefix on all variables (cNome, nValor, lOk, etc.)
  8. Module prefix - Function names prefixed by module (FAT, COM, FIN, etc.)

Workflow

MANDATORY: Always enter planning mode before generating code. Never write code without an approved plan.

Phase 1: Understand Requirements

  • Ask which type of code to generate (function, class, MVC, REST, etc.)
  • Ask for the module context (Compras, Faturamento, Financeiro, etc.)
  • Ask for the business logic requirements
  • Determine if ADVPL (.prw) or TLPP (.tlpp) is preferred

Read the full file on GitHub · 727 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 727 lines · 40 tokens per session scan A a3d3faf6af78

Subscribe to this mod's changes

code-generator is an agent published in the GitHub repository thalysjuvenal/advpl-specialist (185 stars, last pushed 14d ago), licensed MIT. It adds 40 tokens to every session and 8,772 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.