# Salesforce code review

> Automated Salesforce code reviews for Apex and metadata via GitLab/GitHub CLI with strict PMD and documentation checks.

Salesforce code review is a subscription AI agent skill on Agensi by Ocky Harliansyah, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5/mo (subscription, cancel anytime)
- Creator: [Ocky Harliansyah](https://www.agensi.io/creators/ockyharli)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.0
- Last updated: 2026-10-18
- Security: scan passed (2026-10-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/salesforce-code-review
- Tags: ai-agents, code-review, salesforce, apex, git-lab, github-cli

## About this skill

Manual code reviews for Salesforce projects often miss critical metadata documentation or skip over hidden PMD suppressions. This skill automates the inspection of Apex and Salesforce metadata within your GitLab MRs or GitHub PRs, ensuring every change meets strict organizational standards before it reaches production.

### What it does
- **Enforce Apex Standards** flags bulkification issues, SOQL in loops, hardcoded IDs, and incorrect sharing keywords.
- **Strict PMD Governance** identifies and blocks any `@SuppressWarnings` annotations to prevent bypassing quality gates.
- **Metadata Documentation Audit** checks for missing or placeholder `Description` fields in Flows, Custom Fields, and Validation Rules.
- **REST API Validation** ensures HTTP status codes in `@RestResource` classes match the response body logic.
- **Deployment Safety** verifies that changed test classes are correctly registered in `app.yaml` for specified test runs.

### How it works
1. **Context Discovery** detects whether the project uses GitLab or GitHub by inspecting git remotes and CLI auth status.
2. **Metadata Retrieval** fetches the MR/PR title, description, and the full diff against the `master` or `main` branch.
3. **Automated Analysis** runs a multi-pass check across Apex classes, triggers, and XML metadata files.
4. **Interactive Reporting** generates an inline-style review showing file names, line numbers, and severity levels.
5. **Human-in-the-Loop Posting** asks for permission before using the `glab` or `gh` CLI to post the final verdict to the remote platform.

### Frameworks & tools
Built for Salesforce development environments using Apex and Salesforce Metadata API. It requires `git` and either the GitLab CLI (`glab`) or GitHub CLI (`gh`) to be installed and authenticated.

### Why this beats prompting it yourself
Generic prompts often fail to parse complex XML metadata or miss subtle Apex-specific anti-patterns like `inherited sharing` nuances. This skill implements a specific, multi-step workflow that cross-references `app.yaml` and reference rule files for consistent enforcement that a basic chat prompt cannot maintain.

### Use cases
- **Pre-deployment Audits** to catch missing Flow documentation that breaks maintenance cycles.
- **Security Reviews** to identify dynamic SOQL injection risks or improper sharing declarations.
- **Standardization** to block developers from silencing PMD alerts without team consensus.

### Known limitations
Requires local CLI authentication and repository access; cannot review private PRs without active `glab` or `gh` sessions. Inline comments are posted as a summary note rather than line-anchored threads.

## Requires

- Git
- Salesforce CLI
- GitLab
- GitHub

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Salesforce code review skill from Agensi" and describe your task.
3. Subscribe on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific Salesforce quality issues does this skill resolve that a standard code review might miss?

This skill automates the detection of Apex anti-patterns, missing metadata descriptions, and unauthorized PMD suppressions, ensuring your Salesforce deployments meet strict quality standards without manual oversight.

### Do I need to provide my Salesforce or Git credentials directly to the AI agent?

It requires the GitLab CLI (`glab`) or GitHub CLI (`gh`) to be installed and authenticated on your local machine, as it uses these tools to securely fetch diffs and post review summaries.

### Can this skill review Salesforce metadata components like Flows, or is it limited to Apex classes?

Yes, the skill is designed to analyze both Apex code and Salesforce XML metadata, specifically auditing Flows, Custom Fields, and Validation Rules for missing documentation.

### How does the 'human-in-the-loop' feature work during the reporting phase?

The skill performs a local analysis and then asks for your explicit permission before using your CLI to post the review findings back to the repository, keeping you in control of the final output.

### Which AI agent platforms are compatible with the 'sf code review' skill?

It is compatible with any AI agent that supports file system access and terminal execution, provided the environment has `git` and the necessary Git platform CLIs configured.

### Does the skill post comments directly onto specific lines of code in my Pull Request?

Currently, the skill posts a comprehensive summary note to the MR or PR; it identifies specific line numbers and file names within that summary rather than creating individual line-anchored threads.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
