trigger-refactor-pipeline

Refactor Salesforce triggers into bulk-safe handler classes with tests.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/cchrisv/professorFlowVisualPicker --skill trigger-refactor-pipeline-cchrisv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trigger-refactor-pipeline
Source: https://github.com/cchrisv/professorFlowVisualPicker/tree/main/.agents/skills/trigger-refactor-pipeline
Command: npx skills add https://github.com/cchrisv/professorFlowVisualPicker --skill trigger-refactor-pipeline-cchrisv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Refactors legacy Salesforce triggers into clean, bulk-safe handler patterns, reducing DML/SOQL in loops and improving testability.

Core Features & Use Cases

  • Extracts trigger logic into dedicated handler classes for before/after contexts.
  • Provides guidance and templates for simple, bulkified, and unified frameworks.
  • Generates tests and deployment guidance to ensure parity with the original behavior.

Quick Start

Analyze an existing trigger with the script, generate a handler scaffold, and adapt it to your org.

Frequently Asked Questions about trigger-refactor-pipeline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a Salesforce trigger to be bulk-safe?

To refactor a Salesforce trigger to be bulk-safe, you extract logic from the trigger into dedicated handler classes, moving DML and SOQL out of loops to process records collectively. This ensures the trigger handles bulk operations without hitting governor limits.

What is a Salesforce trigger handler pattern?

A Salesforce trigger handler pattern is an architectural approach where trigger logic is moved out of the trigger itself and into dedicated handler classes. This separation organizes before and after contexts for insert, update, and delete events, making the code bulk-safe and testable.

How do I add test classes when refactoring a Salesforce trigger?

When refactoring a Salesforce trigger, you generate test scaffolds alongside the new handler classes. These tests ensure behavioral parity with the original trigger by validating the extracted logic across before and after insert, update, and delete contexts.

Why does my Salesforce trigger fail during bulk data loads?

A Salesforce trigger fails during bulk data loads because of SOQL or DML statements executed inside loops, which exceeds governor limits. Refactoring the trigger into a bulk-safe handler pattern extracts these operations to process records collectively.

Does this approach support both simple and unified trigger frameworks?

Yes, the refactoring approach supports simple, bulkified, and unified trigger frameworks. It provides specific guidance and templates for each framework type, allowing you to choose the structure that best fits your org's complexity and deployment needs.