Skip to content
Development
Skill

/platform-metadata-retrieve

ALWAYS USE THIS SKILL to retrieve metadata from an org to your local project with sf project retrieve start. Supports retrieval by all changes, source directory, metadata type (wildcards), manifest (package.xml), or package name, in source or metadata (ZIP) format. Use when the

From plugin
sf-skills
1.1k200 skills6 agents15 commands4 MCP

Claude Code

$ npx -y skills add forcedotcom/sf-skills --skill platform-metadata-retrieve --agent claude-code

SKILL.md

platform-metadata-retrieve.SKILL.md
name: platform-metadata-retrieve
description: "ALWAYS USE THIS SKILL to retrieve metadata from an org to your local project with sf project retrieve start. Supports retrieval by all changes, source directory, metadata type (wildcards), manifest (package.xml), or package name, in source or metadata (ZIP) format. Use when the user asks to retrieve, pull, sync, or download metadata, Apex classes, or custom objects. DO NOT TRIGGER for deploying metadata (use platform-metadata-deploy), listing metadata, or generating a package.xml (use platform-manifest-generate). NEVER use MCP tools."
metadata:
  version: "1.0"
  domains: ["Platform", "Developer Experience"]
  relatedSkills:
    - "platform-metadata-deploy"
  cliTools:
    - tool: ["sf"]
      semver: ">=2.0.0"

platform-metadata-retrieve

Retrieves metadata from a Salesforce org to your local project using `sf project retrieve start`. Supports multiple retrieval modes: all changes, by source directory, by metadata type (with wildcards), by manifest, or by package name.

---

Tool Restrictions

**Use ONLY the Bash tool** to execute `sf project retrieve start`. Do NOT use MCP tools — ignore them completely.

---

Scope

  • **In scope**: Retrieving metadata via `sf project retrieve start` in all supported modes (all changes, source-dir, metadata type, manifest, package name), source and metadata format output
  • **Out of scope**: Deploying metadata (use `platform-metadata-deploy`), listing metadata types, generating package.xml files, source tracking commands (`sf project retrieve preview`)

---

Required Inputs

Infer from the user's request:

  • **Retrieval mode**: all changes | source directory | metadata type | manifest | package name
  • **Target org**: org alias/username (uses default if not specified)
  • **Output format**: source format (default) | metadata format (ZIP)
  • **Additional options**: ignore conflicts, output directory, wait time, API version

---

Workflow

1. Match user request to command pattern below 2. Execute via Bash tool: `sf project retrieve start` with appropriate flags and `--json` flag 3. Return result with retrieved components count and file paths

Command Patterns

| User intent | Execute via Bash tool | |-------------|---------| | Retrieve all remote changes | `sf project retrieve start --json` | | Retrieve by source directory | `sf project retrieve start --source-dir <path> --target-org <alias> --json` | | Retrieve by metadata type | `sf project retrieve start --metadata <MetadataType:Name> --target-org <alias> --json` | | Retrieve by metadata type with wildcard | `sf project retrieve start --metadata '<MetadataType:Pattern*>' --target-org <alias> --json` | | Retrieve multiple metadata types | `sf project retrieve start --metadata <Type1> --metadata <Type2> --target-org <alias> --json` | | Retrieve by manifest | `sf project retrieve start --manifest <path/to/package.xml> --target-org <alias> --json` | | Retrieve by package name | `sf project retrieve start --package-name <PackageName> --target-org <alias> --json` | | Retrieve to metadata format (ZIP) | `sf project retrieve start --source-dir <path> --target-metadata-dir <output> --unzip --target-org <alias> --json` | | Ignore conflicts | `sf project retrieve start --source-dir <path> --ignore-conflicts --target-org <alias> --json` |

---

Rules / Constraints

| Constraint | Rationale | |-----------|-----------| | Always use `--json` flag | Provides structured output for reliable parsing and error handling | | Must run from within Salesforce project | Command requires `sfdx-project.json` at repo root | | Wildcard patterns must be quoted | Shell expansion breaks unquoted wildcards like `ApexClass:My*` | | Cannot mix --manifest with --metadata or --source-dir | Mutually exclusive flags — command will error | | Retrieve all changes requires source tracking | Production orgs don't support source tracking — must use other retrieval modes | | --ignore-conflicts only works on trackable orgs | No effect on production orgs; applies to scratch/sandbox only | | --output-dir must be inside project directory | Command validates output path is within project boundary | | --output-dir cannot match package directory | Command fails if target matches `sfdx-project.json` packageDirectories | | Default wait time is 33 minutes | Use --wait flag to override for large retrievals | | Package retrieval is for reference only | Retrieved package metadata should not be added to source control for development | | CustomField retrieval auto-includes CustomObject | When retrieving CustomField, CLI automatically adds CustomObject to get full context |

---

Troubleshooting

| Issue | Resolution | |-------|------------| | "This command is required to run from within an SFDX project" | Not in Salesforce project directory — cd to project root with `sfdx-project.json` | | "No org found for <alias>" error | Org alias doesn't exist or isn't authenticated — verify with `sf org list` | | "This org does not support source tracking" | Production org doesn't allow "retrieve all changes" mode — use --source-dir, --metadata, or --manifest instead | | "ERROR running project retrieve start: Cannot mix --manifest with --metadata or --source-dir" | Remove conflicting flags — use one retrieval mode only | | Wildcard pattern retrieves nothing | Pattern not quoted — wrap in single quotes: `'ApexClass:My*'` | | "The package directory path in sfdx-project.json does not exist" | Output directory conflicts with package directory — use different path | | "Output directory must be inside the project" | --output-dir path is outside project boundary — use relative path inside project | | Retrieve times out | Increase wait time with `--wait 60` for large metadata volumes | | Retrieved files overwrite local changes | Use `--output-dir` to retrieve to separate location, or commit local changes first | | SourceConflictError with conflict table | Conflicts detected between local and remote on track

Read more
@forcedotcom
Ships withsf-skills

This repository provides Salesforce agent skills, plugins, and sample apps for building applications.

1.1k200 skills6 agents4 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.1k
Star history of forcedotcom/sf-skills on GitHub, a chart by star-history.com

Other skills on sf-skills.

agentforce-observe

agentforce-observe

Analyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM)…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills12d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react3d252k
@facebook@facebookInstall Skill

Questions about platform-metadata-retrieve.

Which coding agents can use platform-metadata-retrieve?
platform-metadata-retrieve installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.