---
name: salesforce-multi-env-setup
description: 'Build Salesforce development, scratch-org, sandbox, staging, and production environments with explicit promotion and drift controls. Use when designing org topology. Trigger with "set up Salesforce environments".'
argument-hint: "[project] [org-topology]"
allowed-tools: Read, Glob, Grep, WebFetch, Write, Edit
version: 1.8.0
author: Jeremy Longshore <jeremy@intentsolutions.io>
license: MIT
tags: [saas, salesforce, environments, scratch-org, sandbox]
model: inherit
effort: high
compatibility: Designed for Claude Code; org creation, refresh, feature enablement, data seeding, and promotion require Dev Hub and Salesforce administrator approval
---
# Salesforce Multi-Environment and Org Topology

## Overview

Map each environment to a purpose, fidelity level, data policy, authorization boundary, lifecycle, and promotion contract.

## Prerequisites

- Business release model, Salesforce DX project, package strategy, org inventory, and environment owners
- Dev Hub, scratch-org, sandbox, staging, and production capabilities actually available to the customer
- Data seeding, masking, refresh, drift, namespace, dependency, promotion, rollback, and support requirements

## Tool Discipline

Use `Read`, `Glob`, and `Grep` to inspect approved repository and evidence files, `WebFetch` to re-check current first-party Salesforce documentation, and `Write` or `Edit` only for secretless plans, fixtures, configuration, and redacted receipts.

## Current Contract

Scratch orgs are disposable source-driven environments configured from project definitions; sandboxes provide different production fidelity and lifecycle characteristics. Available types, features, refreshes, data, and limits depend on the customer org.

## Authentication

Give each environment separate aliases, apps or policies, principals, permissions, and secret references. Never copy production tokens or unmasked production data into development or CI.

## Instructions

1. Inventory every org and environment with purpose, edition, features, packages, namespace, data class, owner, lifecycle, and authority.
2. Choose scratch org, developer sandbox, partial or full sandbox, or other approved environment from fidelity and data requirements.
3. Define source, metadata, package, settings, seed, masking, and post-refresh automation contracts.
4. Create environment-specific app, principal, permission, limit, event, endpoint, and secret-reference matrices.
5. Automate deterministic creation or refresh where supported, then verify org identity before any deployment or data load.
6. Promote immutable source and artifacts through validation gates; never promote mutable org state as the source of truth.
7. Detect configuration and metadata drift, reconcile approved exceptions, test rollback, and retire environments and credentials on schedule.

## Approval Boundaries

Do not create, refresh, clone, seed, mask, deploy, or retire an org without Dev Hub, admin, security, privacy, data, and release approval.

## Output

Return the org topology, fidelity and data matrix, lifecycle, configuration contract, authorization map, promotion gates, drift report, and retirement owners.

## Error Handling

| Condition | Response |
|---|---|
| Environment lacks a production feature | Move the test to an approved higher-fidelity org and document residual risk. |
| Production data appears in an unauthorized org | Stop access, invoke the data incident process, and prove deletion or containment. |
| Org alias resolves to an unexpected identity | Block all deployment and mutation until binding is corrected. |

## Example

A redacted completion receipt might look like this:

```text
project=core-crm; dev=scratch; integration=developer-sandbox; uat=partial; prod=production; drift=0; secrets=separate
```

## Resources

- [Salesforce DX development model](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop.htm)
- [Salesforce sandbox environments](https://help.salesforce.com/s/articleView?id=sf.data_sandbox_environments.htm)

## Next Steps

Run the workflow first in the lowest-risk authorized org and preserve its redacted receipt. Schedule a review against the next Salesforce seasonal release and the customer change calendar.


---
Source attribution: jeremylongshore
Original project: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/ab85a061f7bcc039dac13ee193de7a4cd4388571/plugins/saas-packs/salesforce-pack/skills/salesforce-multi-env-setup/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2025 Jeremy Longshore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: jeremylongshore
Original project: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/ab85a061f7bcc039dac13ee193de7a4cd4388571/plugins/saas-packs/salesforce-pack/skills/salesforce-multi-env-setup/SKILL.md
Attribution basis: Source repository record

Fields of work: Product Management, Sales
Roles: Business Development, Customer Success Manager, Product Manager, Sales Engineer, Sales Development Rep (SDR)
Specialties: API, Backend, Design, DevOps, Word Documents, Frontend, Git, Testing
Tools: Aws, Gcp, Salesforce, Vault
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 1c152adc0be4e54900f6705e62056c370789f290040d7f809b67769247f78659
