- name
- uipath-code-reviewer
- tags
- ["uipath-dev","code-review","quality","best-practices"]
- description
- Review UiPath automation code (XAML and C#) for quality issues, best practices violations, and potential bugs. Generates actionable fix suggestions that can be implemented by AI. Use when asked to review UiPath code, check workflow quality, audit automation, or find issues in XAML/C# workflows. Triggers on requests like "review my UiPath code", "check this workflow", "audit automation quality", "find issues in XAML", or "code review".
# UiPath Code Reviewer
Analyze UiPath automation code (XAML workflows and C# coded automations) for quality issues, best practices violations, and potential bugs. Generates structured, actionable fix suggestions that can be automatically implemented.
## Official Documentation Reference
This skill aligns with UiPath's official **Workflow Analyzer** rules:
- [UiPath Studio User Guide](https://docs.uipath.com/studio/standalone/latest/user-guide/introduction)
- [Workflow Analyzer](https://docs.uipath.com/studio/standalone/latest/user-guide/about-workflow-analyzer)
- [Naming Rules](https://docs.uipath.com/studio/standalone/latest/user-guide/naming-rules)
- [Design Best Practices](https://docs.uipath.com/studio/standalone/latest/user-guide/design-best-practices)
- [Security Rules](https://docs.uipath.com/studio/standalone/latest/user-guide/security-rules)
- [Coded Automations Best Practices](https://docs.uipath.com/studio/standalone/latest/user-guide/best-practices)
## When to Use
- "Review my UiPath code"
- "Check this workflow for issues"
- "Audit automation quality"
- "Find bugs in XAML"
- "Code review this automation"
- "What's wrong with this workflow?"
- "Improve my UiPath project"
- Before deploying to production
- After generating UiPath code with other skills
## Quick Reference
### Review Scope
| Category | What It Checks |
|----------|----------------|
| **Naming** | Variables, arguments, workflows, activities |
| **Error Handling** | Try-Catch coverage, exception types, logging |
| **Performance** | Unnecessary delays, inefficient loops, selectors |
| **Security** | Hardcoded credentials, sensitive data exposure |
| **Maintainability** | Complexity, modularity, documentation |
| **Best Practices** | UiPath standards, REFramework compliance |
### Severity Levels
| Level | Description | Action |
|-------|-------------|--------|
| **Critical** | Bugs, security issues, will cause failures | Must fix before deployment |
| **High** | Best practice violations, performance issues | Should fix |
| **Medium** | Code quality, maintainability concerns | Recommended to fix |
| **Low** | Style, minor improvements | Nice to have |
| **Info** | Suggestions, optimizations | Consider for future |
## Core Workflow
```
┌─────────────────────────────────────────────────────────────────┐
│ CODE REVIEW WORKFLOW │
│ │
│ 1. LOCATE FILES ──> 2. ANALYZE ──> 3. GENERATE REPORT │
│ *.xaml, *.cs Run checks review-report.md │
│ project.json by category │
│ │
│ 4. CREATE FIXES ──> 5. (OPTIONAL) APPLY │
│ fix-suggestions.json Auto-implement │
└─────────────────────────────────────────────────────────────────┘
```
### Step 1: Locate UiPath Project Files
Search for files to review:
```bash
# Project configuration
**/project.json
# XAML workflows
**/*.xaml
# Coded automations
**/*.cs
# Config files
**/Config.xlsx
**/appsettings.json
```
### Step 2: Analyze Each File
For each file type, run the appropriate checks:
#### XAML Analysis Checklist
- [ ] **Namespace declarations** - All required namespaces present
- [ ] **Variable naming** - Follows convention (camelCase with type prefix)
- [ ] **Argument naming** - Follows convention (in_/out_/io_ prefix)
- [ ] **DisplayName** - All activities have meaningful DisplayNames
- [ ] **Error handling** - Try-Catch blocks around risky operations
- [ ] **Logging** - Appropriate LogMessage activities
- [ ] **Selectors** - Dynamic, not hardcoded; use wildcards appropriately
- [ ] **Hardcoded values** - No hardcoded credentials or paths
- [ ] **Activity configuration** - Timeouts, delays configured properly
- [ ] **Workflow complexity** - Not too many nested levels
#### C# Analysis Checklist
- [ ] **Namespace organization** - Proper using statements
- [ ] **Argument attributes** - Correct Direction attributes
- [ ] **Exception handling** - Try-catch with proper exception types
- [ ] **Logging** - Log() calls at appropriate points
- [ ] **Resource cleanup** - Using statements or proper disposal
- [ ] **Code complexity** - Methods not too long
- [ ] **LINQ usage** - Efficient queries, no N+1 patterns
#### Project Configuration Checklist
- [ ] **Dependencies** - Correct versions, no conflicts
- [ ] **Entry points** - Properly defined
- [ ] **Runtime options** - Appropriate for project type
- [ ] **Target framework** - Compatible with deployment environment
### Step 3: Generate Review Report
Create a structured report with all findings.
### Step 4: Create Fix Suggestions
Generate machine-readable fix suggestions for each issue.
### Step 5: (Optional) Apply Fixes
Use the fix suggestions to automatically implement corrections.
---
## UiPath Workflow Analyzer Rule Mapping
This skill checks rules that align with UiPath's built-in Workflow Analyzer. Here's the mapping:
### Official UiPath Naming Rules (ST-NMG-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-NMG-001 | Variables Naming Convention | RULE-001 |
| ST-NMG-002 | Arguments Naming Convention | RULE-002 |
| ST-NMG-004 | Display Name Duplication | RULE-004 |
| ST-NMG-005 | Variable Overrides Variable | RULE-005 |
| ST-NMG-008 | Variable Length Exceeded | RULE-006 |
| ST-NMG-009 | Prefix DataTable Variables | RULE-007 |
| ST-NMG-011 | Prefix DataTable Arguments | RULE-008 |
| ST-NMG-012 | Argument Default Values | RULE-009 |
### Official UiPath Design Best Practices (ST-DBP-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-DBP-002 | High Arguments Count | RULE-040 |
| ST-DBP-003 | Empty Catch Block | RULE-011 |
| ST-DBP-007 | Multiple Flowchart Layers | RULE-044 |
| ST-DBP-020 | Undefined Output Properties | RULE-056 |
| ST-DBP-021 | Hardcoded Timeout | RULE-032 |
| ST-DBP-023 | Empty Workflow | RULE-041 |
### Official UiPath Maintainability Rules (ST-MRD-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-MRD-002 | Activity Name Defaults | RULE-004 |
| ST-MRD-007 | Nested If Clauses | RULE-044 |
| ST-MRD-008 | Empty Sequence | RULE-041 |
| ST-MRD-009 | Deeply Nested Activities | RULE-040 |
### Official UiPath Usage Rules (ST-USG-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-USG-005 | Hardcoded Activity Properties | RULE-021, RULE-043 |
| ST-USG-009 | Unused Variables | RULE-055 |
| ST-USG-020 | Minimum Log Messages | RULE-050 |
### Official UiPath Security Rules (ST-SEC-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-SEC-007 | SecureString Argument Usage | RULE-023 |
| ST-SEC-008 | SecureString Variable Usage | RULE-023 |
| ST-SEC-009 | SecureString Misusage | RULE-020 |
### Official UiPath Performance Rules (ST-PRR-*)
| UiPath Rule | Description | Our Rule |
|-------------|-------------|----------|
| ST-PRR-004 | Hardcoded Delay Activity | RULE-030 |
### Additional Custom Rules (Beyond Workflow Analyzer)
This skill also includes rules not covered by the built-in Workflow Analyzer:
| Our Rule | Description | Category |
|----------|-------------|----------|
| RULE-010 | Missing Try-Catch | Error Handling |
| RULE-012 | Generic Exception Only | Error Handling |
| RULE-013 | Missing Retry Logic | Error Handling |
| RULE-022 | Sensitive Data in Logs | Security |
| RULE-024 | SQL Injection Risk | Security |
| RULE-031 | Inefficient Loop | Performance |
| RULE-033 | Selector Too Specific | Performance |
| RULE-052 | Missing Input Validation | Best Practices |
| RULE-053 | HTTP Without Error Check | Best Practices |
---
## Review Rules Reference
### Naming Convention Rules
#### RULE-001: Variable Naming Convention
**Severity**: Medium
**Category**: Naming
Variables should use camelCase with a type prefix.
| Type | Prefix | Example |
|------|--------|---------|
| String | str | `strFileName` |
| Int32 | int | `intCounter` |
| Boolean | bool | `boolIsValid` |
| DataTable | dt | `dtResults` |
| DataRow | row | `rowCurrent` |
| DateTime | dt | `dtStartTime` |
| Array | arr | `arrItems` |
| List | lst | `lstNames` |
| Dictionary | dict | `dictConfig` |
| Object | obj | `objResponse` |
| JObject | jo | `joApiResponse` |
| Exception | ex | `exCurrent` |
**Bad Examples**:
```xml
<Variable x:TypeArguments="x:String" Name="filename" />
<Variable x:TypeArguments="x:Int32" Name="Counter" />
<Variable x:TypeArguments="sd:DataTable" Name="data" />
```
**Good Examples**:
```xml
<Variable x:TypeArguments="x:String" Name="strFileName" />
<Variable x:TypeArguments="x:Int32" Name="intCounter" />
<Variable x:TypeArguments="sd:DataTable" Name="dtData" />
```
#### RULE-002: Argument Naming Convention
**Severity**: Medium
**Category**: Naming
Arguments should use direction prefix followed by PascalCase.
| Direction | Prefix | Example |
|-----------|--------|---------|
| In | in_ | `in_FilePath` |
| Out | out_ | `out_Result` |
| InOut | io_ | `io_DataTable` |
**Bad Examples**:
```xml
<x:Property Name="FilePath" Type="InArgument(x:String)" />
<x:Property Name="result" Type="OutArgument(x:String)" />
```
**Good Examples**:
```xml
<x:Property Name="in_FilePath" Type="InArgument(x:String)" />
<x:Property Name="out_Result" Type="OutArgument(x:String)" />
```
#### RULE-003: Workflow File Naming
**Severity**: Low
**Category**: Naming
Workflow files should use PascalCase and describe their purpose.
**Bad Examples**:
- `process_data.xaml`
- `workflow1.xaml`
- `test.xaml`
**Good Examples**:
- `ProcessTransaction.xaml`
- `InitAllSettings.xaml`
- `GetTransactionData.xaml`
#### RULE-004: Activity DisplayName
**Severity**: Medium
**Category**: Naming
All activities should have descriptive DisplayNames.
**Bad Examples**:
```xml
<Assign DisplayName="Assign">
<ui:LogMessage DisplayName="Log Message">
<If DisplayName="If">
```
**Good Examples**:
```xml
<Assign DisplayName="Set Transaction Status">
<ui:LogMessage DisplayName="Log Process Start">
Ver en GitHub