スキル一覧に戻る

build-pkgdown-site

pjt222
更新日 2 days ago
1 閲覧
17
2
17
GitHubで表示
メタworddesign

について

このClaude Skillは、Rパッケージのpkgdownドキュメントサイトを構築し、GitHub Pagesにデプロイします。設定、テーマ設定、記事構成、ブランチベースやGitHub Actionsなどのデプロイ方法を網羅しています。パッケージのドキュメントサイトの作成やカスタマイズ、デプロイ問題の解決、デプロイ方法間の移行にご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add pjt222/agent-almanac -a claude-code
プラグインコマンド代替
/plugin add https://github.com/pjt222/agent-almanac
Git クローン代替
git 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

  1. Repo Settings > Pages
  2. Source: "Deploy from a branch"
  3. Select gh-pages branch, / (root) folder
  4. 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: release set

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 url field in _pkgdown.yml set correctly
  • Wrong R binary hybrid sys: WSL/Docker → Rscript may resolve to cross-platform wrapper vs native. Check which Rscript && Rscript --version. Prefer native (e.g., /usr/local/bin/Rscript on Linux/WSL). See Setting Up Your Environment

  • setup-github-actions-ci — automated pkgdown deploy workflow
  • write-roxygen-docs — fn docs that appear on site
  • write-vignette — articles in site nav
  • release-package-version — trigger rebuild on release

GitHub リポジトリ

pjt222/agent-almanac
パス: i18n/caveman-ultra/skills/build-pkgdown-site
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

関連スキル

content-collections

メタ

このスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。

スキルを見る

polymarket

メタ

このスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。

スキルを見る

creating-opencode-plugins

メタ

このスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。

スキルを見る

sglang

メタ

SGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。

スキルを見る