跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 platform-metadata-retrieve

Platform Metadata Retrieve

总是使用此 SKILL 检索元数据, 使用 sf 项目检索启动命令从 Org 到您的本地项目 。 支持多个检索模式:检索所有远程更改,通过源目录检索,通过元数据类型以通配符检索,通过表(package.xml)检索,或通过包名检索. 当用户要求检索,拉出,同步,或下载元数据时使用,Apex类,自定义对象,或org更改. 支持源格式(默认)或元数据格式(ZIP). 不使用TRIGGER来部署元数据(使用平台-元数据-部署技能),列出元数据,或生成软件包.xml. 永远不要使用 MCP 工具 - 总是使用这种技能和带有 sf 项目检索启动的 Bash 工具 .

5894 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

总是使用此 SKILL 检索元数据, 使用 sf 项目检索启动命令从 Org 到您的本地项目 。 支持多个检索模式:检索所有远程更改,通过源目录检索,通过元数据类型以通配符检索,通过表单检索(package.xml),或通过包名检索

何时用

每一个

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:platform-metadata-retrieve、Tool Restrictions、Scope、Required Inputs、Workflow、Command Patterns。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/retrieval_modes.md、references/cli_flags.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

ALWAYS USE THIS SKILL to retrieve metadata from an org to your local project using the sf project retrieve start command. Supports multiple retrieval modes: retrieve all remote changes, retrieve by source directory, retrieve by metadata type with wildcards, retrieve by manifest (package.xml), or retrieve by package name. Use when the user asks to retrieve, pull, sync, or download metadata, Apex classes, custom objects, or org changes. Supports source format (default) or metadata format (ZIP). DO NOT TRIGGER for deploying metadata (use platform-metadata-deploy skill), listing metadata, or generating package.xml. NEVER use MCP tools - always use this skill and the Bash tool with sf project retrieve start.

platform-metadata-retrieveTool RestrictionsScopeRequired InputsWorkflowCommand PatternsRules / ConstraintsTroubleshootingOutput ExpectationsCross-Skill IntegrationReference File Index

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
platform-metadata-retrieve
description
ALWAYS USE THIS SKILL to retrieve metadata from an org to your local project using the sf project retrieve start command. Supports multiple retrieval modes: retrieve all remote changes, retrieve by source directory, retrieve by metadata type with wildcards, retrieve by manifest (package.xml), or retrieve by package name. Use when the user asks to retrieve, pull, sync, or download metadata, Apex classes, custom objects, or org changes. Supports source format (default) or metadata format (ZIP). DO NOT TRIGGER for deploying metadata (use platform-metadata-deploy skill), listing metadata, or generating package.xml. NEVER use MCP tools - always use this skill and the Bash tool with sf project retrieve start.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 2
  • references/retrieval_modes.md
  • references/cli_flags.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「platform-metadata-retrieve」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-e79aa8f65a47a65c-%E5%B9%B3%E5%8F%B0%E5%85%83%E6%95%B0%E6%8D%AE-%E8%8E%B7%E5%8F%96.html
请存为 .cursor/skills/platform-metadata-retrieve/SKILL.md 或 .claude/skills/platform-metadata-retrieve/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/forcedotcom/sf-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/forcedotcom/sf-skills' --list

npx skills add 'https://github.com/forcedotcom/sf-skills' --skill 'platform-metadata-retrieve'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: platform-metadata-retrieve description: "ALWAYS USE THIS SKILL to retrieve metadata from an org to your local project using the sf project retrieve start command. Supports multiple retrieval modes: retrieve all remote changes, retrieve by source directory, retrieve by metadata type with wildcards, retrieve by manifest (package.xml), or retrieve by package name. Use when the user asks to retrieve, pull, sync, or download metadata, Apex classes, custom objects, or org changes. Supports source format (default) or metadata format (ZIP). DO NOT TRIGGER for deploying metadata (use platform-metadata-deploy skill), listing metadata, or generating package.xml. NEVER use MCP tools - always use this skill and the Bash tool with sf project retrieve start." 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 --target-org --json` | | Retrieve by metadata type | `sf project retrieve start --metadata --target-org --json` | | Retrieve by metadata type with wildcard | `sf project retrieve start --metadata '' --target-org --json` | | Retrieve multiple metadata types | `sf project retrieve start --metadata --metadata --target-org --json` | | Retrieve by manifest | `sf project retrieve start --manifest --target-org --json` | | Retrieve by package name | `sf project retrieve start --package-name --target-org --json` | | Retrieve to metadata format (ZIP) | `sf project retrieve start --source-dir --target-metadata-dir --unzip --target-org --json` | | Ignore conflicts | `sf project retrieve start --source-dir --ignore-conflicts --target-org --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 " 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 trackable org (scratch/sandbox) — resolve conflicts manually or use --ignore-conflicts to force overwrite | --- ## Output Expectations The command returns JSON output with retrieved components details. See `examples/success_output.json` and `examples/error_output.json` for response structures. --- ## Cross-Skill Integration | Need | Delegate to | |------|-------------| | Deploy metadata to org | `platform-metadata-deploy` skill | | Preview retrieve without executing | Execute `sf project retrieve preview --target-org --json` | | List available metadata types | Execute `sf org list metadata-types --target-org --json` | --- ## Reference File Index | File | When to read | |------|-------------| | `examples/success_output.json` | To understand successful retrieve response structure | | `examples/error_output.json` | To handle common error scenarios | | `references/retrieval_modes.md` | For detailed explanation of all retrieval modes and when to use each | | `references/cli_flags.md` | For complete flag reference with usage patterns |

相关技能

运维与云

Docker Essentials

用于容器管理,图像操作,调试的基本道克命令和工作流程.

运维与云

Find Skills

从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…

运维与云

Microsoft Foundry

构建,部署,评价,优化,微调,管理微软创始代理,模型,资源最终结束. 用法:铸造、azd ai代理、azd 提供/部署、托管代理脚手架/开发/运行/部署/拖放、即时代理创建、创建代理、更新代理、添加代理工具、援引代理、代理.yaml、评估代理、批量活化、连续活化、持续监测、代理C…

运维与云

Azure Deploy

执行已有.azure/部署计划.md和基础设施文件的ALREADY-PREPARED应用程序的Azure部署。 当用户向 CREATE 请求新应用程序时, 请不要使用此技能 。 这种技能运行了 azd上行, azd 部署, trarraform 应用, 和 az 部署命令带有内置…