/diagnose
Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
> /plugin marketplace add thalysjuvenal/advpl-specialist > /plugin install advpl-specialist@advpl-specialist-marketplace
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/diagnose
Context preview
What this command does when you run it.
Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
Command definition
diagnose.mddescription: Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
allowed-tools: Read, Glob, Grep, Bash, Agent, WebSearch, WebFetch
argument-hint: "<file|error-message> [--log logfile]"
/advpl-specialist:diagnose
**IMPORTANT:** Always respond in the same language the user is writing in. If the user writes in Portuguese, respond in Portuguese. If in English, respond in English. Adapt all explanations, error descriptions, and suggestions to the user's language. Code comments may remain in English or match the user's language.
Diagnose and resolve ADVPL/TLPP errors and problems.
Usage
/advpl-specialist:diagnose <target> [options]
Modes
| Mode | Input | What It Does | |------|-------|-------------| | File analysis | Path to .prw/.tlpp file | Scans code for potential issues | | Error diagnosis | Error message in quotes | Identifies cause and suggests fix | | Log analysis | --log flag with log file path | Parses log for errors and patterns |
Options
| Flag | Description | |------|------------| | `--log` | Path to Protheus log file for analysis | | `--verbose` | Show detailed diagnosis with explanations |
Process
1. **Identify mode** - File path, error message, or log file 2. **Load debugging reference** - Read `skills/advpl-debugging/reference.md` 3. **Analyze input:**
- **File:** Read code and scan for anti-patterns, missing error handling, lock issues
- **Error:** Match against common-errors.md, then search TDN if not found
- **Log:** Parse for ERROR/WARNING patterns, extract stack traces
4. **Report findings** - Clear explanation with severity levels 5. **Suggest fixes** - Specific code changes with examples 6. **Preventive advice** - How to avoid similar issues
Examples
# Analyze a source file for issues
/advpl-specialist:diagnose src/FATA001.prw
# Diagnose a specific error message
/advpl-specialist:diagnose "THREAD ERROR ([55889]) Variable does not exist: cCodCli"
# Analyze a Protheus log file
/advpl-specialist:diagnose --log /var/protheus/console.log
# Verbose diagnosis with full explanations
/advpl-specialist:diagnose src/FATA001.prw --verbose
Output
- List of issues found with severity (ERROR, WARNING, INFO)
- Root cause explanation for each issue
- Specific code fix with before/after comparison
- Preventive recommendations
Read more
description: Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis allowed-tools: Read, Glob, Grep, Bash, Agent, WebSearch, WebFetch argument-hint: "<file|error-message> [--log logfile]"
/advpl-specialist:diagnose
**IMPORTANT:** Always respond in the same language the user is writing in. If the user writes in Portuguese, respond in Portuguese. If in English, respond in English. Adapt all explanations, error descriptions, and suggestions to the user's language. Code comments may remain in English or match the user's language.
Diagnose and resolve ADVPL/TLPP errors and problems.
Usage
/advpl-specialist:diagnose <target> [options]
Modes
| Mode | Input | What It Does | |------|-------|-------------| | File analysis | Path to .prw/.tlpp file | Scans code for potential issues | | Error diagnosis | Error message in quotes | Identifies cause and suggests fix | | Log analysis | --log flag with log file path | Parses log for errors and patterns |
Options
| Flag | Description | |------|------------| | `--log` | Path to Protheus log file for analysis | | `--verbose` | Show detailed diagnosis with explanations |
Process
1. **Identify mode** - File path, error message, or log file 2. **Load debugging reference** - Read `skills/advpl-debugging/reference.md` 3. **Analyze input:**
- **File:** Read code and scan for anti-patterns, missing error handling, lock issues
- **Error:** Match against common-errors.md, then search TDN if not found
- **Log:** Parse for ERROR/WARNING patterns, extract stack traces
4. **Report findings** - Clear explanation with severity levels 5. **Suggest fixes** - Specific code changes with examples 6. **Preventive advice** - How to avoid similar issues
Examples
# Analyze a source file for issues /advpl-specialist:diagnose src/FATA001.prw # Diagnose a specific error message /advpl-specialist:diagnose "THREAD ERROR ([55889]) Variable does not exist: cCodCli" # Analyze a Protheus log file /advpl-specialist:diagnose --log /var/protheus/console.log # Verbose diagnosis with full explanations /advpl-specialist:diagnose src/FATA001.prw --verbose
Output
- List of issues found with severity (ERROR, WARNING, INFO)
- Root cause explanation for each issue
- Specific code fix with before/after comparison
- Preventive recommendations
Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:
Other commands on advpl-specialist.
- /advpr
Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto, relatórios, processamento, webservice, Smart View, TOTVS Message e SmartLink
Open command - /docs
Look up Protheus documentation - native functions, SX data dictionary, REST APIs, MV parameters, and framework reference
Open command - /document
Generate technical documentation from ADVPL/TLPP source code - Protheus.doc headers, routine docs, API docs
Open command - /explain
Explain ADVPL/TLPP code in plain language for developers and functional consultants
Open command - /generate
Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus
Open command - /migrate
Migrate ADVPL procedural code to TLPP object-oriented code with classes, namespaces, and modern patterns
Open command

