build-pkgdown-site
关于
This Claude Skill builds and deploys a pkgdown documentation site for R packages to GitHub Pages. It covers configuration, theming, article organization, and deployment methods like branch-based or GitHub Actions. Use it to create or customize a package's documentation site, fix deployment issues, or migrate between deployment methods.
快速安装
Claude Code
推荐npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/build-pkgdown-site在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Build pkgdown Site
Config + deploy pkgdown doc site for R pkg.
Use When
- Doc site for R pkg
- Customize pkgdown layout, theme, nav
- Fix 404s on deployed pkgdown site
- Migrate between deploy methods
In
- Required: R pkg w/ roxygen2 docs
- Required: GitHub repo
- Optional: Custom theme/branding
- Optional: Vignettes to include as articles
Do
Step 1: Init pkgdown
usethis::use_pkgdown()
Creates _pkgdown.yml + adds pkgdown to .Rbuildignore.
→ _pkgdown.yml in project root. .Rbuildignore has pkgdown entries.
If err: Install pkgdown via install.packages("pkgdown"). _pkgdown.yml already exists → fn updates .Rbuildignore w/o overwriting config.
Step 2: Configure _pkgdown.yml
url: https://username.github.io/packagename/
development:
mode: release
template:
bootstrap: 5
bootswatch: flatly
navbar:
structure:
left: [intro, reference, articles, news]
right: [search, github]
components:
github:
icon: fa-github
href: https://github.com/username/packagename
reference:
- title: Core Functions
desc: Primary package functionality
contents:
- main_function
- helper_function
- title: Utilities
desc: Helper and utility functions
contents:
- starts_with("util_")
articles:
- title: Getting Started
contents:
- getting-started
- title: Advanced Usage
contents:
- advanced-features
- customization
Critical: Set development: mode: release. Default mode: auto causes 404s on GitHub Pages (appends /dev/ to URLs).
→ _pkgdown.yml valid YAML w/ url, template, navbar, reference, articles appropriate for pkg.
If err: Validate YAML syntax w/ online linter. All fn names in reference.contents match actual exported fns.
Step 3: Build Locally
pkgdown::build_site()
→ docs/ dir created w/ complete site incl index.html, fn ref pages, articles.
If err: Common issues: missing pandoc (set RSTUDIO_PANDOC in .Renviron), missing vignette deps (install suggested pkgs), broken examples (fix or wrap in \dontrun{}).
Step 4: Preview
pkgdown::preview_site()
Verify nav, fn ref, articles, search work.
→ Site opens in browser at localhost. Nav links work, ref pages render, search returns results.
If err: Preview doesn't open → manually open docs/index.html. Pages missing → check devtools::document() ran before build.
Step 5: Deploy to GitHub Pages
Method A: GitHub Actions (Recommended)
See setup-github-actions-ci skill for pkgdown workflow.
Method B: Manual Branch Deploy
# Build site
Rscript -e "pkgdown::build_site()"
# Create gh-pages branch if it doesn't exist
git checkout --orphan gh-pages
git rm -rf .
cp -r docs/* .
git add .
git commit -m "Deploy pkgdown site"
git push origin gh-pages
# Switch back to main
git checkout main
→ gh-pages branch on remote w/ site files at root.
If err: Push rejected → ensure write access. Using GitHub Actions instead → skip + follow setup-github-actions-ci.
Step 6: Configure GitHub Pages
- Repo Settings > Pages
- Source: "Deploy from a branch"
- Select
gh-pagesbranch,/ (root)folder - Save
→ Site available at https://username.github.io/packagename/ within min.
If err: 404 → verify Pages source matches deploy method (branch deploy needs "Deploy from a branch"). Check development: mode: release in _pkgdown.yml.
Step 7: Add URL to DESCRIPTION
URL: https://username.github.io/packagename/, https://github.com/username/packagename
→ DESCRIPTION URL has pkgdown site URL + GitHub repo URL, comma-separated.
If err: R CMD check warns invalid URLs → verify pkgdown site actually deployed + accessible before adding.
Check
- Builds locally w/o errs
- All fn ref pages render
- Articles/vignettes accessible + render
- Search works
- Nav links correct
- Deploys to GitHub Pages
- No 404s
-
development: mode: releaseset
Traps
- 404 after deploy: Almost always
development: mode: auto(default). →mode: release - Missing ref pages: Fns must be exported + documented. Run
devtools::document()first - Broken vignette links: Use
vignette("name")syntax for cross-refs, not file paths - Logo not showing: Place at
man/figures/logo.png, ref in_pkgdown.yml - Search not working: Needs
urlfield in_pkgdown.ymlset correctly - Wrong R binary hybrid sys: WSL/Docker →
Rscriptmay resolve to cross-platform wrapper vs native. Checkwhich Rscript && Rscript --version. Prefer native (e.g.,/usr/local/bin/Rscripton Linux/WSL). See Setting Up Your Environment
→
setup-github-actions-ci— automated pkgdown deploy workflowwrite-roxygen-docs— fn docs that appear on sitewrite-vignette— articles in site navrelease-package-version— trigger rebuild on release
GitHub 仓库
相关推荐技能
content-collections
元Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
polymarket
元这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
creating-opencode-plugins
元该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
sglang
元SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
