---
schema_version: "1"
id: 6e3b17ed1364ac1e162eb2d4fd7d643c7bce90336a986292a997a1d16ab56f20
title: Workflow Patterns
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/agentforcevibes/guides/files/afv-workflow-patterns.md
canonical_url: https://developer.salesforce.com/docs/platform/agentforcevibes/guide/afv-workflow-patterns.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2ea82bf7fc7162ab7d5ac4f105072e41058372623d5564aee4d176839eeb8e40
products:
  - Agentforce Vibes Developer Guide
  - salesforcedx
---
# Workflow Patterns

Agentforce Vibes has two modes: Chat and Plan Mode. In Chat, the agent figures out the right approach based on your prompt — whether that means answering a question, generating code, debugging an issue, or coordinating parallel work. Use Plan Mode when you want a structured plan to review and approve before the agent executes.

## When to Use Chat

Use Chat for most tasks. Describe what you want and the agent determines how to handle it. Examples:

- Reading unfamiliar Apex code and asking what it does
- Querying org metadata to understand object relationships
- Generating a trigger + handler + test class from a description of the business logic
- Scaffolding an LWC with an Apex controller, event handling, and CSS
- Debugging a failing test class or tracing why a trigger isn't firing
- Writing a batch Apex class with proper start/execute/finish methods

The agent uses your org context, active Skills, and Rules to produce accurate, org-aware output. Create a Checkpoint before any complex execution so you can roll back if needed.

**What to verify after execution:**

- Do generated Apex classes follow bulkification patterns?
- Are SOQL (Salesforce Object Query Language) queries selective and outside of loops?
- Do test classes cover positive, negative, and bulk scenarios?
- Are field-level security and object permissions handled correctly?
- Does the code reference real fields and objects from your org (not placeholder names)?

## When to Use Plan Mode

Use Plan Mode when the work is complex enough that you want to see and approve the approach before anything executes. Examples:

- Designing a trigger framework that spans a handler class, test class, and custom metadata configuration
- Scoping an LWC (Lightning Web Component) feature that requires an Apex controller, wire adapters, and Jest tests
- Breaking down a complex integration into sequenced tasks with dependencies
- Any multi-file feature where execution order matters

Plan Mode produces a structured plan with Goals, Non-Goals, Approach, and numbered Tasks. No files change until you click **Approve Plan**.

**What to verify:** Review the plan for completeness. Does it account for all the objects, permissions, and test scenarios you need? Are there dependencies it missed?

## Anti-Patterns: When to Slow Down

Some tasks benefit from more careful handling regardless of mode.

**Security-sensitive logic that requires line-by-line review:**

- Encryption/decryption implementations
- Authentication and authorization flows
- Code that handles PII (Personally Identifiable Information) or financial data
- Sharing rule and permission set configurations that control data access

Use Plan Mode to get a recommended approach, then review every generated change carefully before accepting.

**Org-specific business rules the agent can't infer:**

- Complex validation logic based on undocumented business processes
- Integration mappings that depend on external system contracts not visible in your project
- Workflow behavior that exists only in production configuration (not code)

Provide these as explicit context or Rules before prompting. Don't let the agent guess business logic.

**Configuration-heavy work where Setup UI is faster:**

- Building permission sets and profiles
- Creating page layouts and record types
- Configuring sharing rules and org-wide defaults

Use Chat to understand what you need, then configure manually in Setup.

## Quick Reference

| You want to...                                       | Use       |
| :--------------------------------------------------- | :-------- |
| Ask a question, explore code, or understand metadata | Chat      |
| Generate code, debug, or execute a well-defined task | Chat      |
| Map out a multi-step feature before any files change | Plan Mode |
| Review and approve the approach for a complex build  | Plan Mode |

## See Also

- [What Is Agentic Development](https://developer.salesforce.com/docs/platform/agentforcevibes/guide/afv-agentic-dev.md)
- [Plan Mode](https://developer.salesforce.com/docs/platform/agentforcevibes/guide/afv-plan-mode.md)
- [Permissions and Safety](https://developer.salesforce.com/docs/platform/agentforcevibes/guide/afv-permissions-safety.md)
