agentleFS
totvstotvs/engpro-advpl-tlpp-skills/skills/advpl-tlpp/documentation-writer/SKILL.md

documentation-writer

Skill166 starsChanged 5 months agoMITView on GitHub

Generate ProtheusDOC comment blocks for AdvPL and TLPP source code. Use when a user says "document this function", "add ProtheusDOC", "write documentation block", "document this class/method", or needs structured source-code documentation following the Protheus.doc standard for functions, classes, methods

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 37 edited versions we read keep these.

  • 8

    Distinctive

    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:

    Every ProtheusDOC block follows this structure:

    line 32
  2. Distinctive:

    Follow this process for every documentation request:

    line 248
  3. Distinctive:

    If the source code alone does not provide enough information, ask about:

    line 260
  4. Distinctive:

    Since: When was this element introduced?

    line 263
  5. Distinctive:

    Place each block immediately before the element it documents

    line 270
  6. Distinctive:

    Use the minimum necessary tags — do not add empty or placeholder tags

    line 271
  7. Distinctive:

    Write descriptions in the same language as the existing code comments (Portuguese or English)

    line 275
  8. Distinctive:

    Verify each generated block against this checklist:

    line 279

“Common” is measured: kept by at least 6 in 10 of the 37 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.

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

ProtheusDOC Documentation Writer

You are an expert in writing ProtheusDOC comment blocks for AdvPL and TLPP source code following the official TOTVS standard.

Overview

ProtheusDOC is a structured comment format that self-documents AdvPL/TLPP source files. Each block starts with /*/{Protheus.doc}, contains an identifier (the element name), a brief description, a required @type tag, optional tags, and closes with /*/. The generated HTML documentation comes from these blocks.

When to Use

  • Adding documentation to new or existing functions, classes, methods
  • Generating ProtheusDOC blocks for undocumented source files
  • Reviewing and correcting existing ProtheusDOC blocks for completeness
  • Batch-documenting all elements in a .prw or .tlpp source file

ProtheusDOC Block Structure

Every ProtheusDOC block follows this structure:

/*/{Protheus.doc} <Identifier>
<Brief description of the element>
@type <element-type>
[optional tags...]
/*/

Rules

  • The block must open with /*/{Protheus.doc} followed by a space and the identifier
  • The identifier must match exactly:
    • Functions: the function name (e.g., areaQuad)
    • Classes: the class name (e.g., TReceivable)
    • Methods: ClassName::MethodName (e.g., TReceivable::New)
  • The brief description is a concise sentence immediately after the identifier line
  • The @type tag is mandatory — it disambiguates elements with the same name
  • The block must close with /*/
  • Optional parameters use brackets: [paramName]

Supported Tags Reference

TagParametersMultipleDescription
@typefunction | class | methodNoRequired. Element type being documented
@authorname-textNoAuthor name
@sincedate or version textNoWhen the element was introduced
@versionversion-textNoProduct/server version required
@paramname, type, descriptionYesParameter specification. Use [name] for optional params
@returntype, descriptionNoReturn value specification
@descriptiontextNoExtended description for additional detail
@examplecode-textYesCode usage example
@samplecode-textYesAlias for @example
@seereference-textYesCross-reference ("See also")
@tabletable-name [, table-name]*NoTables used by the element
@obstextYesObservation/note
@deprecatedtextNoDeprecation reason and replacement
@historydate, author, descriptionYesChange history entries
@linkURI [, label]YesHyperlink reference
@todotextYesPending task
@protected(none)NoMarks method as non-public scope
@readonly(none)NoMarks property as read-only
@proptypetype-textNoProperty data type
@defvaluevalue-textNoDefault value for property
@accessLevellevel-textNoAccess level
@countrycountry-textNoCountry-specific element
@databasedatabase-textNoDatabase compatibility
@languagelanguage-textNoLanguage/locale
@buildbuild-textNoRequired server build version
@systemOperos-textNoRequired operating system
@sourcesource-textNoSource file indication

Templates by Element Type

User Function (@type user function)

/*/{Protheus.doc} FunctionName
Brief description of what the function does.
@type user function
@author Author Name
@since dd/mm/yyyy
@version Product Version
@param cParam1, character, Description of first parameter
@param nParam2, numeric, Description of second parameter
@param [cOptional], character, Description of optional parameter
@return logical, Description of the return value
@example
  lResult := FunctionName("value", 10)
@see RelatedFunction
@obs Any relevant observation
/*/
User Function FunctionName(cParam1, nParam2, cOptional)

Class (@type class)

/*/{Protheus.doc} TClassName
Brief description of the class purpose.
@type class
@author Author Name
@since dd/mm/yyyy
@version Product Version
@see TParentClass
@obs Inherits from TParentClass via From keyword
/*/
Class TClassName From TParentClass

Method (@type method)

/*/{Protheus.doc} TClassName::MethodName
Brief description of what the method does.
@type method
@author Author Name
@since dd/mm/yyyy
@param oParam, object, Description of parameter
@return numeric, Description of return value
@example
  nResult := oObj:MethodName(oParam)
/*/
Method MethodName(oParam) Class TClassName

Complete Example: User Function with Full Tags

/*/{Protheus.doc} areaQuad
Efetua o cálculo da área de alguns quadriláteros.
@type user function
@author José Silva
@since 20/11/2012
@version P10 R4
@param nBase, numérico, Medida do lado ou da base
@param [nAltura], numérico, Medida da altura
@param [nBaseMenor], numérico, Medida da base menor (trapézios)
@return numérico, Área calculada
@example
  nArea := areaQuad(10, 5)
  nAreaTrapezio := areaQuad(10, 5, 6)
@see areaCirc
@table
@obs Quando nAltura não informada, calcula área do quadrado (nBase^2)
/*/
User Function areaQuad(nBase, nAltura, nBaseMenor)

Complete Example: Class with Methods

#include "tlpp-core.th"

Namespace finance.receivable

/*/{Protheus.doc} TReceivable
Classe para gestão de títulos a receber.
@type class
@author Dev Team
@since 01/03/2025
@version 12.1.2410
@see TBaseEntity
/*/
Class TReceivable From TBaseEntity
  Private Data cDocNumber as Character
  Private Data nValue     as Numeric
  Private Data dDueDate   as Date
  Private Data lPaid      as Logical

  Public Method New(cDoc as Character, nVal as Numeric, dDue as Date) as Object
  Public Method Pay(nAmount as Numeric) as Logical
  Public Method GetBalance() as Numeric
EndClass

/*/{Protheus.doc} TReceivable::New
Construtor da classe TReceivable. Inicializa as propriedades do título.
@type method
@author Dev Team
@since 01/03/2025
@param cDoc, character, Número do documento
@param nVal, numeric, Valor do título
@param dDue, date, Data de vencimento
@return object, Instância de TReceivable (Self)
@example
  Local oRec := TReceivable():New("NF001", 1500.00, CtoD("31/12/2025"))
/*/
Method New(cDoc, nVal, dDue) Class TReceivable
  _Super:New()
  ::cDocNumber := cDoc
  ::nValue     := nVal
  ::dDueDate   := dDue
  ::lPaid      := .F.
Return Self

/*/{Protheus.doc} TReceivable::Pay
Registra o pagamento do título se o valor for suficiente.
@type method
@author Dev Team
@since 01/03/2025
@param nAmount, numeric, Valor do pagamento
@return logical, .T. se pagamento realizado com sucesso
/*/
Method Pay(nAmount) Class TReceivable
  If nAmount >= ::GetBalance()
    ::lPaid := .T.
    Return .T.
  EndIf
Return .F.

/*/{Protheus.doc} TReceivable::GetBalance
Retorna o saldo devedor do título.
@type method
@author Dev Team
@since 01/03/2025
@return numeric, Saldo restante (0 se já pago)
/*/
Method GetBalance() Class TReceivable
  If ::lPaid
    Return 0
  EndIf
Return ::nValue

Workflow

Follow this process for every documentation request:

1. Analyze the Source Code

  • Identify all documentable elements: functions, classes, methods
  • Determine the correct @type for each element
  • Build the correct identifier (function name, class name, or ClassName::MethodName)
  • Identify parameters with their types and whether they are optional
  • Identify return types

2. Ask Clarifying Questions (if needed)

If the source code alone does not provide enough information, ask about:

  • Author: Who wrote or maintains this code?
  • Since: When was this element introduced?
  • Version: Which Protheus product version is this for?
  • Tables: Which tables does the element access?
  • Observations: Any non-obvious behaviors or side effects?

3. Generate ProtheusDOC Blocks

  • Place each block immediately before the element it documents
  • Use the minimum necessary tags — do not add empty or placeholder tags
  • For @param: always include name, type, and description
  • For @return: always include type and description
  • For optional parameters: wrap the name in brackets [paramName]
  • Write descriptions in the same language as the existing code comments (Portuguese or English)

4. Validate

Verify each generated block against this checklist:

  • Opens with /*/{Protheus.doc} <correct-identifier>
  • Has a brief description line
  • Has @type with correct value (function/class/method)
  • Method identifiers use ClassName::MethodName format
  • All parameters are documented with name, type, and description
  • Optional parameters use [name] syntax
  • Return value is documented (if applicable)
  • Closes with /*/
  • Block is placed immediately before the documented element

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.