code-review
Skill166 starsChanged 5 months agoMITView on GitHub
Perform comprehensive AdvPL/TLPP code review covering SonarQube rules, Protheus.doc documentation, security, performance, clean code, and TOTVS Protheus framework best practices. Use when a user says "review this code", "code review", "check this source", "audit this AdvPL/TLPP", or needs a structured quality assessment of .prw/.tlpp/.prx files.
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 184 edited versions we read keep these.
3
Distinctive
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 52
Read the entire file to understand purpose, scope, and dependencies
- Very specific: line 55
Check the includes — totvs.ch, tlpp-core.th, custom .ch/.th files
- Distinctive: line 87
Check for vulnerabilities that expose the application to attacks or data leaks.
- Very specific: line 131
Every public element must have a complete /*/{Protheus.doc} block with mandatory tags: @type, @author, @since, @param (per parameter), …
- Very specific: line 135
Check variable naming prefixes (c=Character, n=Numeric, l=Logical, etc.), Local vs Private scope, function size (< 50 lines), magic …
- Distinctive: line 143
Check syntax errors (CA0000), file encoding (Windows-1252), INI references (CA1005), and I18N compliance (CA2016).
“Common” is measured: kept by at least 6 in 10 of the 184 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.
Files
AdvPL/TLPP Code Review
You are an expert AdvPL/TLPP code reviewer. Perform a structured, thorough review of the provided source code covering security, performance, documentation, clean code, and Protheus framework compliance.
Overview
This skill reviews AdvPL and TLPP source files against TOTVS engineering standards, SonarQube static-analysis rules, ProtheusDOC documentation requirements, and clean-code principles. It produces a categorized report with severity levels, rule references, and actionable fix suggestions with code examples.
When to Use
- Reviewing new or modified
.prw,.tlpp, or.prxsource files - Pre-commit quality gate for pull request reviews
- Auditing legacy code for SonarQube compliance
- Checking that ProtheusDOC blocks are complete and correct
- Verifying security posture (SQL injection, hardcoded credentials, access control)
- Assessing code readiness for Cloud/SmartERP environments
Bundled Reference Files
This skill uses progressive disclosure. The SKILL.md body covers the review workflow, category definitions, checklist, and output format. Detailed code examples, anti-patterns, and rule-specific fixes are in the references/ directory — read them on demand based on the review scenario:
| Reference File | When to Read | Content |
| references/security-review-patterns.md | Reviewing security concerns — SQL injection, hardcoded credentials, restricted APIs, environment context | SQL injection examples, FWExecStatement patterns, restricted functions table, REST/SOAP environment rules |
| references/code-quality-patterns.md | Reviewing performance, legacy code, metadata access, or compilation issues | Loop/transaction anti-patterns, ISAM migration, deprecated API replacements, SX* metadata access table, encoding rules |
| references/documentation-and-conventions.md | Reviewing ProtheusDOC, naming conventions, clean code, or TLPP-specific patterns | ProtheusDOC tag reference, common documentation mistakes, variable naming/scope conventions, TLPP type annotations, namespace, Try-Catch |
Also refer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference shared across skills.
Review Process
Step 1 — Understand the Code
Before reviewing:
- Read the entire file to understand purpose, scope, and dependencies
- Identify the element types (Functions, Static Functions, Classes, Methods)
- Note the file extension —
.prw(AdvPL),.tlpp(TLPP),.prx(legacy) - Check the includes —
totvs.ch,tlpp-core.th, custom.ch/.thfiles
Step 2 — Load Relevant References
Based on the code under review, read the appropriate reference files:
- Security findings → read references/security-review-patterns.md
- Performance / legacy / metadata findings → read references/code-quality-patterns.md
- Documentation / clean code / TLPP findings → read references/documentation-and-conventions.md
- Full review → read all three reference files
Step 3 — Run Review Categories
Apply each review category below in order. For every finding, record:
- Category (Security, Performance, Documentation, Clean Code, Framework)
- Severity (CRITICAL, MAJOR, MINOR, INFO)
- Rule ID (SonarQube rule when applicable, e.g., CA2050)
- Location (function/method name and approximate line)
- Finding (what is wrong)
- Fix (how to correct it, with code example when helpful)
Step 4 — Produce the Report
Output findings as a structured report grouped by category, ordered by severity (CRITICAL first). End with a summary and overall assessment.
Review Categories
1. Security (SonarQube G1)
Check for vulnerabilities that expose the application to attacks or data leaks. Key rules:
- CA2050 / CA2051 — SQL Injection: concatenating user input in SQL strings → use
FWExecStatement(CRITICAL) - CA2052 — Hardcoded credentials in source → use environment configuration (CRITICAL)
- BG1000 —
RpcSetEnv/RpcSetTypein REST/SOAP services → configurePrepareIn(MAJOR) - CA2022–CA2025, CA2053 — Restricted/prohibited functions and assignments (CRITICAL)
- BG1200 —
ErrorBlockoverride → migrate toTry-Catchin TLPP (INFO)
2. Performance and Loops (SonarQube G2)
Detect patterns that degrade runtime performance:
- CA1003 — Prohibited APIs inside loops (
GetMV,SuperGetMV,ExistBlock,AllUsers,Type,Pergunte) → cache before loop (MAJOR) - CA1002 — UI APIs inside transactions (
MsgAlert,MsgYesNo, etc.) → move UI after transaction (MAJOR) - CS1000 — Direct SQL without evaluation → prefer framework APIs or
ChangeQuery()/BeginSQL(MAJOR)
3. Legacy and Deprecated Code (SonarQube G3)
Identify deprecated APIs and legacy patterns:
- CA1000 — ISAM driver access (
MSCREATE,DBCREATE) →FWTemporaryTable(MAJOR) - CA1001 — File-based semaphores →
LockByName()(MAJOR) - CA1004 — Console output (
ConOut) →FWLogMsg()(MINOR) - CA4000 —
IIFinline → explicitIf/Else/EndIf(INFO) - CA3001 — Uppercase
#INCLUDE→ lowercase#include(MINOR)
Obsolete Include Directives — Flag any of these legacy includes and recommend replacement:
| Obsolete Include | Replacement Include | Modern Class/API |
Ap5Mail.ch | totvs.ch | TMailMessage() |
ApWizard.ch | totvs.ch | FWWizardControl() |
FileIO.ch | totvs.ch | FWFileWriter() / FWFileReader() |
Font.ch | totvs.ch | TFont() |
ParmType.ch | totvs.ch | Default prefix for parameter handling |
protheus.ch | totvs.ch | — |
RWMake.ch | totvs.ch | — |
4. Metadata Access (SonarQube G4)
Direct DbSelectArea on Protheus system tables (SX*) is prohibited. All SX* tables (SM0, SIX, SX1–SXG, SXD, SE5, SPF) must be accessed through framework APIs. Key rules: CA2000–CA2013, CA2017–CA2019, CA2021 (CRITICAL/MAJOR).
5. ProtheusDOC Documentation
Every public element must have a complete /*/{Protheus.doc} block with mandatory tags: @type, @author, @since, @param (per parameter), @return. Static Functions should also be documented.
6. Clean Code and Naming Conventions
Check variable naming prefixes (c=Character, n=Numeric, l=Logical, etc.), Local vs Private scope, function size (< 50 lines), magic numbers, and dead code.
7. TLPP-Specific Checks
For .tlpp files: verify file extension consistency, type annotations on variables and functions, namespace usage, and Try-Catch error handling instead of ErrorBlock.
8. Compilation and Encoding (SonarQube G5)
Check syntax errors (CA0000), file encoding (Windows-1252), INI references (CA1005), and I18N compliance (CA2016).
Report Format
Output the review as follows:
# Code Review: <filename>
## Summary
- **Total Findings:** <count>
- **Critical:** <count> | **Major:** <count> | **Minor:** <count> | **Info:** <count>
- **Overall Assessment:** <PASS | PASS WITH OBSERVATIONS | NEEDS REVISION | FAIL>
## Critical Findings
### [CA####] <Title>
- **Location:** `FunctionName` (line ~NN)
- **Finding:** <description>
- **Fix:** <how to fix>
```advpl
// suggested fix code
```Major Findings
(same structure)
Minor Findings
(same structure)
Info / Recommendations
(same structure)
Documentation Review
- All public elements documented with ProtheusDOC
- @type, @author, @since present on all blocks
- @param tags match function signatures
- @return documented for non-void functions
- Identifiers match element names exactly
Assessment Criteria
| Category | Status | Notes |
| Security (G1) | ✅/⚠️/❌ | |
| Performance (G2) | ✅/⚠️/❌ | |
| Legacy/Deprecated (G3) | ✅/⚠️/❌ | |
| Metadata Access (G4) | ✅/⚠️/❌ | |
| Documentation | ✅/⚠️/❌ | |
| Clean Code | ✅/⚠️/❌ | |
| TLPP Compliance | ✅/⚠️/❌ | (if .tlpp file) |
| Compilation (G5) | ✅/⚠️/❌ |
### Overall Assessment Criteria
| Assessment | Condition |
|------------|-----------|
| **PASS** | Zero CRITICAL, zero MAJOR findings |
| **PASS WITH OBSERVATIONS** | Zero CRITICAL, ≤ 3 MAJOR findings |
| **NEEDS REVISION** | Zero CRITICAL, > 3 MAJOR findings |
| **FAIL** | Any CRITICAL finding |
---
## Quick Reference: All SonarQube Rules
For the complete rule definitions, severity levels, prohibited patterns, and required alternatives, consult [references/sonarqube-rules-reference.md](../references/sonarqube-rules-reference.md).
| Group | Rules | Focus |
|-------|-------|-------|
| G1 — Security | BG1000, CA2022–CA2053, BG1200 | Injection, credentials, restricted APIs |
| G2 — Performance | CA1002, CA1003, CS1000 | Loops, transactions, queries |
| G3 — Legacy | CA1000–CA1006, CA2014–CA2020, CA3001–CA3002, CA4000, BG1100 | Deprecated APIs, ISAM, console |
| G4 — Metadata | CA2000–CA2013, CA2021 | Direct SX* table access |
| G5 — Compilation | CA0000, CA1005, CA2016 | Syntax, encoding, I18N |
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 309ksame name
- TheAlgorithms/Python★ 226ksame name
- microsoft/vscode★ 194ksame name
- github/spec-kit★ 145ksame name
- ggml-org/llama.cpp★ 133ksame name
- shareAI-lab/learn-claude-code★ 80ksame name
- shareAI-lab/analysis_claude_code★ 78ksame name
- vectorize-io/hindsight★ 57ksame name
- dbeaver/dbeaver★ 52ksame name
- roboflow/supervision★ 51ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use add-new-model, azsdk-common-sdk-breaking-change and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
PydanticSkilladd-new-model
Add support for a newly-released language or image generation model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5, openai:gpt-image-2). Use when a provider ships a new model id and you need to wire literals, profile flags, adapters, and tests to recognize it. Handles SDK-lag, gateway list conventions, capability probing, and direct image-model geometry.
Also in 9 projects that use this
Microsoft AzureSkillazsdk-common-sdk-breaking-change
Detect and mitigate SDK Breaking changes for an SDK package which is generated from TypeSpec. WHEN: "Detect SDK breaking changes for a service", "Detect SDK breaking changes for an SDK package", "Detect and mitigate SDK breaking changes for a service", "Detect and mitigate SDK breaking changes for an SDK package". INVOKES: skill: azsdk-common-generate-sdk-locally; MCP tools: azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_package_detect_breaking_change.
Also in 4 projects that use this
ww-w-aiSkillbkend-auth
bkend.ai authentication guide. Signup, login, JWT tokens, sessions, role-based access control, and password management with bkend.ai BaaS. Triggers: bkend auth, bkend login, bkend signup, JWT, session, RBAC, password, bkend 인증, 로그인, 회원가입, bkend認証, ログイン, 新規登録, bkend认证, 登录, 注册, autenticacion bkend, authentification bkend, bkend-Auth Do NOT use for: data operations (use $bkend-data), file storage (use $bkend-storage).
Also in 4 projects that use this
ww-w-aiSkillbkend-cookbook
bkend.ai cookbook with step-by-step tutorials and example projects. Build a todo app, blog, e-commerce store, and more with bkend.ai BaaS. Triggers: bkend cookbook, bkend tutorial, bkend example, todo app, blog app, bkend 쿡북, bkend 튜토리얼, 예제 프로젝트, bkendクックブック, チュートリアル, bkend教程, 示例项目, tutorial bkend, tutoriel bkend, bkend-Tutorial, ricettario Do NOT use for: initial setup (use $bkend-quickstart), specific features (use $bkend-data/auth/storage).
Also in 4 projects that use this
dzhngSkillclose-spec
When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).
Also in 4 projects that use this
dzhngSkilldesign-with-images
Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.
Also in 4 projects that use this
- +5 more from ww-w-ai
In this repository35 other files it gives its agents.
- instructions/AGENTS.mdAGENTS.md
- instructions/CLAUDE.mdCLAUDE.md
- advpl-tlpp-compileSkill
- advpl-tlpp-sddSkill
- advpl-to-tlpp-migrationSkill
- context-mapSkill
- create-implementation-planSkill
- data-dictionary-lookupSkill
- documentation-writerSkill
- entry-point-designerSkill
- fwmsexcelxlsx-generatorSkill
- fwrest-client-generatorSkill
- mvc-generatorSkill
- query-builderSkill
- refactor-method-complexity-reduceSkill
- refactorSkill
- sql-code-reviewSkill
- sql-optimizationSkill
- tir-test-generatorSkill
- tlpp-rest-endpoint-generatorSkill
- utf8-to-cp1252-conversionSkill
- brainstormingSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

