sf-docs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesesf-docs: Salesforce Documentation Retrieval & Grounding
sf-docs: Salesforce文档检索与溯源
Expert Salesforce documentation researcher focused on official sources. This skill exists to make documentation lookup reliable when generic web search or naive page fetching fails on Salesforce's JavaScript-heavy docs experience.
sf-docs专注于官方来源的专业Salesforce文档检索工具。当通用网页搜索或简单页面抓取在Salesforce基于JavaScript的文档系统中失效时,本技能可确保文档查找的可靠性。
sf-docsCore Responsibilities
核心职责
- Official Docs Retrieval: Find authoritative answers from Salesforce documentation first
- Local-First Search: Use a local qmd index when available for speed and accuracy
- Salesforce-Aware Fallback: When qmd is unavailable or weak, use Salesforce-specific retrieval patterns instead of generic web fetch
- Source Grounding: Return answers with exact source URLs, guide names, and retrieval notes
- Cross-Skill Support: Serve as the documentation lookup layer for other skills
sf-*
- 官方文档检索:优先从Salesforce文档中查找权威答案
- 本地优先搜索:若有可用的本地qmd索引,使用它以提升速度和准确性
- Salesforce专属回退方案:当qmd不可用或效果不佳时,采用Salesforce专属的检索模式而非通用网页抓取
- 来源溯源:返回包含精确来源URL、指南名称和检索说明的答案
- 跨技能支持:作为其他技能的文档查找层
sf-*
Runtime Modes
运行模式
Mode A: qmd-Enabled
模式A:启用qmd
Use this mode when qmd is installed and a local Salesforce docs corpus exists.
Preferred flow:
- Detect qmd availability
- Query qmd first
- Evaluate result quality
- If results are strong, answer from local docs
- If results are weak or missing, fall back to Salesforce-aware scraping
当qmd已安装且存在本地Salesforce文档语料库时使用此模式。
优先流程:
- 检测qmd可用性
- 首先查询qmd
- 评估结果质量
- 若结果优质,从本地文档返回答案
- 若结果不佳或缺失,回退到Salesforce专属爬取
Mode B: No-qmd
模式B:未启用qmd
Use this mode when qmd is not installed or no local corpus exists.
Preferred flow:
- Identify the most likely Salesforce doc family
- Use Salesforce-aware discovery and retrieval patterns
- Prefer official URLs over summaries from third-party blogs
- Fall back to official PDFs when web pages are unstable or shell-rendered
- Return grounded findings with source links and any uncertainty called out
Claude Code operator shortcut:
When the local helper scripts are installed, prefer the built-in retrieval command over ad-hoc search-engine probing:
sf-docsbash
python3 ~/.claude/skills/sf-docs/scripts/cli.py retrieve \
--query "<user question>" \
--mode no_qmdFor hard questions, this command applies the local no-qmd retrieval flow, including targeted Help article discovery and browser-based rendering.
help.salesforce.com当qmd未安装或无本地语料库时使用此模式。
优先流程:
- 识别最可能的Salesforce文档系列
- 使用Salesforce专属的发现和检索模式
- 优先选择官方URL而非第三方博客的摘要
- 当网页不稳定或仅渲染框架时,回退到官方PDF
- 返回带有来源链接的溯源结果,并标注任何不确定性
Claude Code操作员快捷方式:
当本地辅助脚本已安装时,优先使用内置检索命令而非临时搜索引擎探测:
sf-docsbash
python3 ~/.claude/skills/sf-docs/scripts/cli.py retrieve \
--query "<用户问题>" \
--mode no_qmd对于复杂的问题,此命令会应用本地无qmd检索流程,包括定向Help文章发现和基于浏览器的渲染。
help.salesforce.comRuntime Detection
运行时检测
sf-docsUse this detection order:
- Check whether the CLI is available on
qmdPATH - Check whether a local Salesforce docs corpus exists
- If qmd exists but the local corpus/index is missing or effectively empty, treat the request as no-qmd mode
- If qmd exists and the corpus is populated, use qmd-enabled mode
Reference: references/local-corpus-layout.md
sf-docs检测顺序:
- 检查中是否有
PATHCLI可用qmd - 检查是否存在本地Salesforce文档语料库
- 若qmd存在但本地语料库/索引缺失或为空,按无qmd模式处理请求
- 若qmd存在且语料库已填充,使用启用qmd模式
参考:references/local-corpus-layout.md
Fallback Triggers
回退触发条件
Treat qmd results as weak and fall back when any of the following happen:
- No results returned
- Results are clearly from the wrong Salesforce product or guide family
- Results lack the exact concept, API name, CLI command, or error term requested
- Results are too fragmentary to answer confidently
- Results appear stale and the query is obviously release-sensitive
Rule: Prefer a reliable Salesforce-specific fallback over confidently answering from a poor local hit.
当出现以下任一情况时,将qmd结果视为质量不佳并触发回退:
- 无结果返回
- 结果明显来自错误的Salesforce产品或指南系列
- 结果缺少请求的精确概念、API名称、CLI命令或错误术语
- 结果过于碎片化,无法自信地回答
- 结果看起来过时,且查询明显与新版本相关
规则:优先选择可靠的Salesforce专属回退方案,而非基于质量不佳的本地结果勉强回答。
Salesforce Documentation Retrieval Playbook
Salesforce文档检索手册
1. Identify the Doc Family First
1. 先识别文档系列
Classify the request before searching:
| Family | Typical Sources | Use For |
|---|---|---|
| Developer Docs | | Apex, APIs, LWC, metadata, Agentforce developer docs |
| Salesforce Help | | Setup UI steps, admin guides, feature configuration |
| Platform Guides | | Newer guide-style docs with cleaner URLs |
| Atlas / Legacy Guides | | Older but still official guide and reference material |
| Official PDFs | | Large guide bundles, stable offline extraction |
搜索前先对请求进行分类:
| 系列 | 典型来源 | 适用场景 |
|---|---|---|
| 开发者文档 | | Apex、API、LWC、元数据、Agentforce开发者文档 |
| Salesforce帮助文档 | | 配置UI步骤、管理员指南、功能配置 |
| 平台指南 | | 较新的指南风格文档,URL更简洁 |
| Atlas / 旧版指南 | | 旧版但仍为官方的指南和参考资料 |
| 官方PDF | | 大型指南包,稳定的离线提取 |
2. Prefer Exact Guide Paths Over Homepage Search
2. 优先选择精确指南路径而非首页搜索
Avoid stopping at broad pages like the docs homepage unless you are discovering guide roots.
Instead, resolve toward:
- A specific guide root
- A specific article or page
- A guide PDF when page-level retrieval is unstable
除非是在发现指南根目录,否则避免停留在文档首页等宽泛页面。
相反,应定位到:
- 特定指南根目录
- 特定文章或页面
- 当页面级检索不稳定时,选择指南PDF
3. Retrieval Patterns for developer.salesforce.com
developer.salesforce.com3. developer.salesforce.com
的检索模式
developer.salesforce.comUse these patterns deliberately:
- Modern platform guide:
developer.salesforce.com/docs/platform/... - Legacy Atlas guide:
developer.salesforce.com/docs/atlas.en-us.<book>.meta/... - Guide PDF candidate: derive and try the matching official PDF URL
<book>
When an HTML page fails because of JavaScript rendering, shell content, or soft errors, try:
- the guide root
- the legacy Atlas variant if known
- the official PDF
有意使用以下模式:
- 现代平台指南:
developer.salesforce.com/docs/platform/... - 旧版Atlas指南:
developer.salesforce.com/docs/atlas.en-us.<book>.meta/... - 指南PDF候选:推导并尝试匹配的官方PDF URL
<book>
当HTML页面因JavaScript渲染、框架内容或软错误而失效时,尝试:
- 指南根目录
- 已知的旧版Atlas变体
- 官方PDF
4. Retrieval Patterns for help.salesforce.com
help.salesforce.com4. help.salesforce.com
的检索模式
help.salesforce.comHelp pages often fail with generic web fetch because of client-side rendering and site chrome.
Use this approach:
- Prefer exact URLs or article identifiers when available
help.salesforce.com/s/articleView?id=... - If you only have a product/topic query, start from a targeted official hub and discover linked Help articles from there
- Agentforce queries: start from the Agentforce developer guide and follow linked Help articles
- Messaging / Enhanced Web Chat queries: start from the Enhanced Web Chat docs or landing Help article, then follow one hop to child setup/security articles
- Expect navigation shell noise and incomplete body extraction
- Focus on retrieving the actual article body, not the rendered header/footer shell
- Reject shell or soft-404 pages such as "We looked high and low but couldn't find that page"
- Cross-check titles, product area, and article body before trusting a result
由于客户端渲染和站点框架,通用网页抓取通常无法获取Help页面内容。
采用以下方法:
- 优先使用精确的URL或文章标识符(如果有)
help.salesforce.com/s/articleView?id=... - 若仅能获取产品/主题查询,从定向官方中心开始,从那里发现关联的Help文章
- Agentforce查询:从Agentforce开发者指南开始,跟随关联的Help文章
- 消息/增强网页聊天查询:从增强网页聊天文档或落地Help文章开始,然后跳转到子级配置/安全文章
- 预期会有导航框架干扰和不完整的正文提取
- 专注于检索实际文章正文,而非渲染的页眉/页脚框架
- 拒绝框架页面或软404页面,如“我们四处查找但未找到该页面”
- 在信任结果前,交叉检查标题、产品领域和文章正文
5. PDFs Are a Valid Official Fallback
5. PDF是有效的官方回退方案
Use PDFs when:
- The guide has a stable official PDF
- HTML extraction is inconsistent
- A long-form developer guide is easier to search locally after normalization
PDFs may be stored locally and indexed later, but should not be committed into the public repo.
在以下情况使用PDF:
- 指南有稳定的官方PDF版本
- HTML提取不一致
- 标准化后,长格式开发者指南更便于本地搜索
PDF可本地存储并稍后索引,但不应提交到公共仓库。
Answer Requirements
答案要求
When using , answers should include:
sf-docs- Source type — qmd local hit, official HTML page, or official PDF
- Guide/article name
- Exact official URL
- Any retrieval caveat — for example, if fallback scraping was needed or if the content appeared partially rendered
If the evidence is weak, say so plainly.
使用时,答案应包含:
sf-docs- 来源类型 — qmd本地命中、官方HTML页面或官方PDF
- 指南/文章名称
- 精确官方URL
- 任何检索注意事项 — 例如,是否需要回退爬取,或内容是否部分渲染
若证据不足,应明确说明。
Cross-Skill Integration
跨技能集成
| Skill | How |
|---|---|
| Find Agentforce, PromptTemplate, Models API, and setup docs |
| Find Agent Script syntax, CLI, and reasoning engine docs |
| Find Apex language and reference docs |
| Find LWC guides, component references, and wire docs |
| Find REST, SOAP, Named Credential, and auth docs |
| Find CLI, deployment, packaging, and metadata references |
Delegation rule: If another skill needs authoritative Salesforce documentation, it should use as the retrieval layer rather than improvising generic web search.
sf-docs| 技能 | |
|---|---|
| 查找Agentforce、PromptTemplate、Models API和配置文档 |
| 查找Agent Script语法、CLI和推理引擎文档 |
| 查找Apex语言和参考文档 |
| 查找LWC指南、组件参考和wire文档 |
| 查找REST、SOAP、命名凭据和认证文档 |
| 查找CLI、部署、打包和元数据参考 |
委托规则:若其他技能需要权威Salesforce文档,应使用作为检索层,而非自行采用通用网页搜索。
sf-docsLocal Storage Policy
本地存储策略
- is part of the core skill suite
sf-docs - qmd remains an optional external dependency
- Downloaded PDFs, scraped markdown, manifests, and indexes should live on the user's machine
- Official Salesforce docs content should not be stored in this public Git repository
- 是核心技能套件的一部分
sf-docs - qmd仍是可选外部依赖
- 下载的PDF、爬取的markdown、清单和索引应存储在用户机器上
- 官方Salesforce文档内容不应存储在此公共Git仓库中
Default Local Corpus Layout
默认本地语料库布局
Use a stable local root such as:
text
~/.sf-docs/Recommended structure:
- — discovery manifests and fetch/index status
~/.sf-docs/manifest/ - — downloaded official PDFs
~/.sf-docs/raw/pdf/ - — optional raw HTML captures
~/.sf-docs/raw/html/ - — canonical markdown corpus for qmd indexing
~/.sf-docs/normalized/md/ - — qmd-specific config notes
~/.sf-docs/qmd/ - — optional diagnostics and fetch logs
~/.sf-docs/logs/
Full reference: references/local-corpus-layout.md
使用稳定的本地根目录,例如:
text
~/.sf-docs/推荐结构:
- — 发现清单和抓取/索引状态
~/.sf-docs/manifest/ - — 下载的官方PDF
~/.sf-docs/raw/pdf/ - — 可选的原始HTML捕获
~/.sf-docs/raw/html/ - — 用于qmd索引的标准markdown语料库
~/.sf-docs/normalized/md/ - — qmd专属配置说明
~/.sf-docs/qmd/ - — 可选的诊断和抓取日志
~/.sf-docs/logs/
完整参考:references/local-corpus-layout.md
First-Version Behavior
初始版本行为
The initial implementation should optimize for correctness and operational simplicity:
- qmd-first when available
- Sequential fallback to Salesforce-aware scraping
- Targeted retrieval, not broad crawling, during normal lookups
- Grounded responses with official source links
初始实现应优先保证正确性和操作简洁性:
- 可用时优先使用qmd
- 顺序回退到Salesforce专属爬取
- 正常查找时采用定向检索,而非广泛爬取
- 返回带有官方来源链接的溯源结果
Query-Time Runtime Flow
查询时运行流程
- Detect qmd and local corpus availability
- Run qmd lookup if available
- Evaluate hit quality
- On weak/missing results, use Salesforce-specific HTML/PDF fallback
- Answer with source grounding and retrieval caveats when needed
Full runtime guide: references/runtime-workflow.md
Parallel qmd + scraping can be considered later if benchmarks justify the added complexity.
- 检测qmd和本地语料库可用性
- 若可用,运行qmd查询
- 评估命中质量
- 若结果不佳/缺失,使用Salesforce专属HTML/PDF回退方案
- 必要时,返回带有来源溯源和检索注意事项的答案
完整运行指南:references/runtime-workflow.md
如果基准测试证明有必要,后续可考虑qmd+爬取并行执行。
Success Criteria
成功标准
sf-docs- Finds the right Salesforce page or PDF more often
- Avoids failed fetches on
help.salesforce.com - Reduces hallucinations by grounding on official sources
- Improves the documentation quality available to the rest of the skills
sf-*
当在以下方面优于通用网页搜索时,即视为成功:
sf-docs- 更频繁地找到正确的Salesforce页面或PDF
- 避免在上的抓取失败
help.salesforce.com - 通过基于官方来源的溯源减少幻觉
- 提升其他技能可获取的文档质量
sf-*
References
参考资料
| Document | Purpose |
|---|---|
| references/local-corpus-layout.md | Local-only corpus structure and runtime detection rules |
| references/discovery-manifest.md | Guide discovery manifest schema, mixed doc family handling, HTML vs PDF policy |
| references/qmd-integration.md | qmd collection, context, and retrieval strategy |
| references/runtime-workflow.md | Query-time flow, fallback rules, sync/index separation, and local persistence policy |
| references/ingestion-workflow.md | Targeted HTML/PDF fetch, normalization, and qmd bootstrap workflow |
| references/salesforce-scraper-techniques.md | Salesforce-aware browser extraction techniques, Shadow DOM handling, and PDF fallback rationale |
| references/pilot-scope.md | Initial guide scope for v1 ingestion |
| references/benchmark-protocol.md | qmd-first and no-qmd validation protocol |
| references/cli-workflow.md | Unified CLI workflow for discover, sync, bootstrap, diagnose, and benchmark scoring |
| references/implementation-order.md | Recommended v1 execution order |
| references/final-architecture.md | Final architectural recommendation |
| 文档 | 用途 |
|---|---|
| references/local-corpus-layout.md | 本地语料库结构和运行时检测规则 |
| references/discovery-manifest.md | 指南发现清单 schema、混合文档系列处理、HTML与PDF策略 |
| references/qmd-integration.md | qmd收集、上下文和检索策略 |
| references/runtime-workflow.md | 查询时流程、回退规则、同步/索引分离和本地持久化策略 |
| references/ingestion-workflow.md | 定向HTML/PDF抓取、标准化和qmd引导流程 |
| references/salesforce-scraper-techniques.md | Salesforce专属浏览器提取技术、Shadow DOM处理和PDF回退理由 |
| references/pilot-scope.md | v1版本语料库的初始指南范围 |
| references/benchmark-protocol.md | 优先qmd和无qmd模式的验证协议 |
| references/cli-workflow.md | 用于发现、同步、引导、诊断和基准评分的统一CLI流程 |
| references/implementation-order.md | 推荐的v1版本执行顺序 |
| references/final-architecture.md | 最终架构建议 |
Assets & Scripts
资产与脚本
| File | Purpose |
|---|---|
| assets/discovery-manifest.seed.json | Starter guide manifest seed |
| assets/retrieval-benchmark.json | Expanded core retrieval benchmark cases for exact identifiers, guide routing, and evidence grounding |
| assets/retrieval-benchmark.results-template.json | Template for recording qmd-first and no-qmd core benchmark outcomes |
| assets/retrieval-benchmark.robustness.json | Negative / wrong-guide rejection benchmark for hardening fallback behavior |
| assets/retrieval-benchmark.robustness.results-template.json | Template for recording robustness benchmark outcomes |
| scripts/cli.py | Unified sf-docs CLI for discover, sync, bootstrap-qmd, status, diagnose, retrieve, and benchmarking |
| scripts/discover_salesforce_docs.py | Enrich guide seeds into a discovery manifest and optionally verify PDF candidates |
| scripts/salesforce_dom_scraper.mjs | Salesforce-aware browser scraper with Shadow DOM, legacy doc container, iframe, and help-page heuristics |
| scripts/sync_sf_docs.py | Fetch targeted HTML/PDF sources into the local corpus and normalize them into markdown |
| scripts/bootstrap_qmd.py | Configure a single qmd collection over the normalized sf-docs corpus |
| scripts/sf_docs_runtime.py | Detect qmd/corpus readiness, build sequential lookup plans, and evaluate qmd result strength |
| scripts/retrieve_sf_docs.py | End-to-end qmd-first or no-qmd retrieval execution with Salesforce-aware fallback |
| scripts/run_retrieval_benchmark.py | Execute the benchmark cases through qmd-first and no-qmd retrieval modes |
| scripts/score_retrieval_benchmark.py | Score benchmark results for qmd-first and no-qmd modes |
| 文件 | 用途 |
|---|---|
| assets/discovery-manifest.seed.json | 初始指南清单种子 |
| assets/retrieval-benchmark.json | 扩展的核心检索基准案例,涵盖精确标识符、指南路由和证据溯源 |
| assets/retrieval-benchmark.results-template.json | 记录优先qmd和无qmd模式核心基准结果的模板 |
| assets/retrieval-benchmark.robustness.json | 用于强化回退行为的负面/错误指南拒绝基准 |
| assets/retrieval-benchmark.robustness.results-template.json | 记录鲁棒性基准结果的模板 |
| scripts/cli.py | 统一的sf-docs CLI,用于发现、同步、qmd引导、状态查看、诊断、检索和基准测试 |
| scripts/discover_salesforce_docs.py | 将指南种子扩展为发现清单,并可选验证PDF候选 |
| scripts/salesforce_dom_scraper.mjs | 带有Shadow DOM、旧版文档容器、iframe和帮助页面启发式的Salesforce专属浏览器爬取工具 |
| scripts/sync_sf_docs.py | 将定向HTML/PDF源抓取到本地语料库,并将其标准化为markdown |
| scripts/bootstrap_qmd.py | 配置基于标准化sf-docs语料库的单个qmd集合 |
| scripts/sf_docs_runtime.py | 检测qmd/语料库就绪状态,构建顺序查找计划,并评估qmd结果质量 |
| scripts/retrieve_sf_docs.py | 端到端的优先qmd或无qmd检索执行,带有Salesforce专属回退 |
| scripts/run_retrieval_benchmark.py | 通过优先qmd和无qmd检索模式执行基准案例 |
| scripts/score_retrieval_benchmark.py | 为优先qmd和无qmd模式的基准结果评分 |
License
许可证
MIT License. See LICENSE file in the repo root.
Copyright (c) 2024–2026 Jag Valaiyapathy
MIT许可证。请查看仓库根目录的LICENSE文件。
版权所有 (c) 2024–2026 Jag Valaiyapathy