Tlpp rest endpoint generator
Skill tbc-servicos/dataagile-agent-kit/protheus/skills/tlpp-rest-endpoint-generator
Plugin Claude Code para Protheus e ADVPL/TLPP — base 155k+ registros, Agent Teams, compilação TDS-CLI, testes TIR e MCP PO-UI
npx -y skills add tbc-servicos/dataagile-agent-kit --skill tlpp-rest-endpoint-generatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Generate TLPP REST endpoints using annotation-based routing (@Get, @Post, @Put, @Patch, @Delete) with the oRest object. Follows TOTVS API standards (TTALK) including pagination, error model, standard headers, and Swagger documentation. Use when user says 'create REST endpoint', 'TLPP REST', '@Get annotation', 'oRest endpoint'.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
9.4 KB, as published. Nobody here has run it
TLPP REST Endpoint Generator
Overview
Generate production-ready TLPP REST endpoints using the native annotation-based REST framework. TLPP REST replaces the legacy WsRESTful pattern with a simpler, annotation-driven approach. Each endpoint is a function decorated with an HTTP verb annotation and uses the global oRest object to handle requests and responses.
When to Use
Use this skill when:
- Creating new REST API endpoints in TLPP
- Implementing TOTVS TTALK-compliant APIs
- Generating CRUD endpoints for Protheus entities
- Building integration APIs for external systems
- Migrating WsRESTful services to TLPP REST
TLPP REST Architecture
How It Works
- A function is annotated with an HTTP verb annotation (e.g.,
@Get("/path")) - The TLPP REST Server automatically registers the route at startup via annotation scanning
- When a request matches the route, the annotated function is invoked
- The function uses the global
oRestobject to read the request and write the response - Swagger/OpenAPI documentation is generated automatically from the annotations
Available Annotations
| Annotation | HTTP Verb | Typical Use |
|---|---|---|
@Get("endpoint") | GET | Retrieve resource(s) |
@Post("endpoint") | POST | Create a new resource |
@Put("endpoint") | PUT | Full update of a resource |
@Patch("endpoint") | PATCH | Partial update of a resource |
@Delete("endpoint") | DELETE | Remove a resource |
Annotation properties:
endpoint(required): The URI path for the routedescription(optional): Description shown in Swagger docs
// Minimal form (endpoint only)
@Get("/api/v1/customers")
// Full form (named properties)
@Get(endpoint="/api/v1/customers", description="List all customers")
The oRest Object
The oRest object is a global object available inside any annotated REST function. It provides all methods for reading requests and writing responses.
Request Methods
| Method | Returns | Description |
|---|---|---|
oRest:getQueryRequest() | Json | Query string parameters (?key=value) |
oRest:getBodyRequest() | Character | Raw request body as string |
oRest:getPathParamsRequest() | Json | Path parameters (e.g., :id) |
oRest:getHeaderRequest() | Json | All request headers |
oRest:getClientIP() | Character | Client IP address |
Response Methods
| Method | Parameters | Description |
|---|---|---|
oRest:setResponse(cBody) | Character | Set response body (concatenates if called multiple times) |
oRest:setStatusResponse(nCode, cBody) | Numeric, Character | Set HTTP status code and body; returns Logical |
oRest:setKeyHeaderResponse(cKey, cValue) | Character, Character | Set a response header |
oRest:updateKeyHeaderResponse(cKey, cValue) | Character, Character | Update an existing response header |
oRest:resetResponse() | — | Clear the response body |
oRest:getBodyResponse() | — | Get current response body |
Path Parameters
Use :paramName syntax in the endpoint path to define path parameters:
@Get("/api/v1/customers/:id")
User Function getCustomer() as Logical
Local jPathParams := oRest:getPathParamsRequest() as Json
Local cId := jPathParams["id"] as Character
// ...
Return oRest:setStatusResponse(200, cResponse)
Bundled Reference Files
This skill uses progressive disclosure. The SKILL.md body covers the architecture, decision logic, and the generation checklist. Detailed endpoint templates, TTALK standards, and troubleshooting are in the references/ directory — read them on demand based on the scenario:
| Reference File | When to Read | Content |
|---|---|---|
| references/tlpp-rest-endpoint-templates.md | Generating any CRUD endpoint — GET list (paginated), GET by ID, POST, PUT, or DELETE | Full code templates for all 5 HTTP verbs, shared helper functions (BuildErrorResponse, BuildValidationErrorResponse) |
| references/ttalk-standards-and-configuration.md | Checking TTALK response formats, HTTP status codes, REST server appserver.ini configuration, or debugging endpoint issues | TTALK collection/error JSON formats, pagination query parameters, status code table, appserver.ini REST section, troubleshooting guide |
Also refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference shared across skills.
Endpoint Generation Workflow
Step 1: Gather Requirements
Determine from the user's request:
- Which HTTP verb(s) to generate (GET, POST, PUT, PATCH, DELETE, or full CRUD)
- The target Protheus entity/table (e.g., SA1 = Customers, SA2 = Suppliers)
- The endpoint base path (e.g.,
/api/v1/customers) - Whether TTALK-compliant pagination is needed (collection endpoints)
Step 2: Load Templates
Read references/tlpp-rest-endpoint-templates.md for the code templates matching the required verb(s). Adapt the templates to the target entity by replacing table aliases, field names, and namespace.
Step 3: Apply TTALK Standards
For TOTVS-ecosystem APIs, read references/ttalk-standards-and-configuration.md to ensure responses follow the standard collection format, error model, and HTTP status codes.
Step 4: Validate Against Checklist
Use the checklist below to verify the generated code covers all requirements.
Endpoint Generation Checklist
Structure
-
#include "tlpp-core.th"is the first include -
Namespacedeclaration matches project convention - User Function name is descriptive and uses camelCase
- HTTP verb annotation matches the operation semantics
- Endpoint path follows RESTful conventions (
/api/v1/{resource}) - Path parameters use
:paramNamesyntax
Request Handling
- Body parsed and validated for POST/PUT/PATCH
- Path parameters extracted via
oRest:getPathParamsRequest() - Query parameters extracted via
oRest:getQueryRequest() - Input sanitized before use in SQL queries (
FWExecStatement)
Response
-
Content-Typeheader set toapplication/json - Correct HTTP status code used
- Success response follows TTALK format
- Error response follows TTALK error model
- Collection endpoints include pagination (
hasNext,items,remainingRecords)
Data Access
- Workarea positioned correctly before read/write
- Database locks acquired with
RecLock()and released withMsUnlock() -
D_E_L_E_T_filter always included in queries - Branch filter (
FWxFilial) always included - Temporary aliases closed with
DBCloseArea() - SQL injection prevented (
FWExecStatement)
Error Handling
-
Try-Catchwraps database operations - Errors logged with
FWLogMsg()including function context - Error responses use TTALK error format
- Lock failures handled gracefully
Security
- Authentication verified (if applicable)
- Authorization checked for the operation
- Input validated against expected types and ranges
- No sensitive data in error messages
SonarQube Compliance
- No
RpcSetEnv/RpcSetTypecalls in REST endpoint functions — use REST ServerPrepareInconfiguration instead - No assignment to
__cUserIDorcEmpAnt— these are protected system variables - No
StaticCall()— useFWLoadModel(),FWLoadMenuDef(), or namespace-based calls - No hardcoded passwords or credentials in source code
-
FWExecStatementused for all queries with dynamic parameters - Logging via
FWLogMsg(), notConOut() - No
IIF()— useIf/Else/EndIfblocks -
GetMV()/ExistBlock()calls moved outside of loops - No UI functions (
MsgAlert,MsgYesNo,Aviso,Help) inside transaction-scoped handlers - Includes in lowercase (e.g.,
#include "totvs.ch")
Refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference.
Gives 0 of the 12 instructions most apis services skills give
Counted across 424 of the 426 authors here whose files we hold, read 2026-08-06
- use plural nouns for resource namesin 41 of 424, across 32 files
- use cursor-based pagination for large datasetsin 35 of 424, across 20 files
- include rate limit headers in responsesin 25 of 424, across 13 files
- Use kebab-case for multi-word resourcesin 23 of 424, across 13 files
- version APIs in the URL pathin 19 of 424, across 9 files
- use semantic HTTP status codesin 18 of 424, across 8 files
- verify webhook signaturesin 18 of 424, across 11 files
- use query parameters for filteringin 17 of 424, across 6 files
- use async database operationsin 14 of 424, across 7 files
- wrap successful responses in a data fieldin 13 of 424, across 3 files
- prefix sorting parameters with a hyphen for descending orderin 13 of 424, across 3 files
- set appropriate HTTP status codesin 13 of 424, across 6 files
Said here and by no other author read
- Read code templates before generating CRUD endpoints
- Apply TTALK standards to all generated responses
- Decorate endpoint functions with HTTP verb annotations
- Wrap database operations in Try-Catch blocks
- Release database locks with MsUnlock
- Filter database queries by D_E_L_E_T_ and branch
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.