Skip to main content

r-package-skill

Use when creating, editing, or validating R package skills (library(pkg), pkg::), or gathering R package documentation (CRAN, pkgdown, vignettes) to generate a skill

跳到安装

来源信息

仓库
arthurgailes/r-package-skills
最近来源活动
2026年4月29日 13:01
检测到的 SKILL.md 语言
英语
星标
21
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
5 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
r-package-skill
description
Use when creating, editing, or validating R package skills (library(pkg), pkg::), or gathering R package documentation (CRAN, pkgdown, vignettes) to generate a skill
# R Package Skill Creation ## Overview Generates a new `r-{package}` skill from an R package's documentation. Core loop: capture intent → gather docs → draft skill → run test cases (with-skill + baseline in parallel) → grade → iterate until pass_rate >= 90% and no improvement for 2 iterations → optimize description. ## When NOT to Use - Package is simple/well-known (tidyverse core, base R) - One-off usage -- just read the help - A skill already exists that references this package ## Ask Where to Install Always ask before creating files. No silent defaults. If the user already specified a path, use it. See `references/installation-paths.md` for the prompt and agent-specific paths. ## R-Specific Skill Structure ``` {install-path}/r-{package}/ SKILL.md # <500 words references/ API.md # REQUIRED: Complete CRAN reference manual vignette-name.md # Include all CRAN vignettes ``` - `references/API.md` is required for every package skill. - Include every CRAN vignette as `references/{vignette}.md`. - Each generated SKILL.md must tell its reader: "Read `references/API.md` before writing code." - Quick Reference table must show ALL important parameters, including optional/advanced. Mark tiers: required (no mark), `(opt)` optional, `(adv)` advanced. Never hide parameters that affect performance or output size (zoom levels, batch sizes, etc.). ## Workflow 1. **Capture intent.** Ask what the user needs the skill to do, edge cases, input/output formats, and what makes it a success. Don't fetch docs until this is clear. 2. **Gather docs.** Fetch CRAN reference, vignettes, and (if available) btw tools. See `references/doc-gathering.md`. 3. **Draft.** Write SKILL.md, `references/API.md`, and vignettes. 4. **Test.** Spawn with-skill and baseline subagents **in the same turn** (parallel, not sequential). Grade outputs. Aggregate into `benchmark.json`. See `references/testing.md`. 5. **Iterate.** If `pass_rate < 90%` or it's still improving, analyze failures, edit the skill, rerun. Remove guidance transcripts show agents ignoring (YAGNI). Stop when `pass_rate >= 90%` AND no improvement for 2 iterations. 6. **Optimize the description last.** See `references/description-optimization.md`. ## Description Recognition Tokens Descriptions MUST include `library({pkg})` and `{pkg}::` tokens plus file-extension and domain triggers. Without the package-name tokens, descriptions that read as action-oriented ("Use when creating interactive maps") miss user prompts that contain `library(mapgl)` or `mapgl::`. ```yaml # Good description: Use when code loads or uses freestiler, working with .pmtiles files, or preparing tiles for mapgl/MapLibre in R # Bad: no recognition tokens description: Use when creating PMTiles vector tilesets from large spatial datasets ``` See `references/description-optimization.md` for the train/held-out test method. ## R Validators Domain assertions call R validators in `lib/r-validators/` at repo root via `Rscript`: - `plot-validator.R` -- ggplot2/mapgl visualizations - `spatial-validator.R` -- sf/spatial operations - `html-validator.R` -- flextable/Shiny outputs - `numerical-validator.R` -- collapse/regression results Each returns JSON (`valid`, `message`, domain fields) for use as grading evidence. ## R Execution Patterns - Default: `Rscript -e "code"` or mcptools MCP. - Create script files only if code is long-running or the user asks. - If unavoidable: prefix `temp_*.R` or use `tempfile()`, clean up with `on.exit(unlink(...))` or `file.remove()`. ## Common Mistakes | Mistake | Fix | |---------|-----| | Missing `references/API.md` | REQUIRED. Extract from CRAN reference manual. | | Missing vignettes | Include every CRAN vignette as `references/*.md`. | | Quick Reference hides parameters | Show ALL params that affect performance/output. Mark optional with `(opt)`. | | Running with-skill first, baseline later | Spawn both in the same turn so timing is comparable. | | Assertion schema drift | Use `text` / `passed` / `evidence` in `grading.json`, not `name` / `met` / `details`. | | Description too generic | Include `library({pkg})` and `{pkg}::` tokens. | | Skipping baseline | Without a baseline, you can't tell whether the skill helped. | | Optimizing description before skill works | Fix functionality first; tune triggering last. |
在 GitHub 查看