hinna0818/ukbanalytica_v2/ukbsci-plot

Claude Code and agent skill by hinna0818/ukbanalytica_v2

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Publication-grade figure production for UK Biobank Research Analysis Platform (RAP) analyses built with UKBAnalytica. Wraps the package's built-in plotters — plot_forest (subgroup / regression forest), plot_calibration (clinical-model calibration), plot_regression_volcano (multi-exposure / multi-protein volcano), plot_heatmap, plot_stacked_bar, plot_violin, and plot_scatter for lightweight exploratory/manuscript panels, plus the family of survival, ML, SHAP, mediation, propensity, imputation, correlation, and enrichment plots from sibling skills — and adds a shared neutral theme (ukbsci_clinical / ukbsci_diverging / ukbsci_sequential palettes), a dual-format save helper, and a figure-contract checklist. Use this skill when the user asks for any manuscript figure derived from UKBAnalytica outputs: forest plots, volcano plots, KM curves, calibration plots, Love plots, SHAP summaries, multi-panel composites, or PDF / SVG high-resolution export. Triggers: UKB plotting, forest plot, volcano, calibration, manuscript figure, ggplot helper, ukbsci 画图, 论文级图, /ukbsci-plot. Hard rule: local agents must not read or inspect real UKB RAP participant-level data; generate scripts for RAP execution and interpret aggregate outputs only.

Install

npx vskill@latest install hinna0818/ukbanalytica_v2/ukbsci-plot

SKILL.md

ukbsci-plot — Manuscript figure production for UKBAnalytica

0. RAP guardrails

Core rule: do not export UK Biobank participant-level raw data, direct identifiers (eid, exact dates, raw RAP fields), or row-level source tables that can be linked back to participants.

Strict local-agent boundary: this skill is for script generation, workflow planning, package guidance, and interpretation of aggregate outputs. The agent must not read, inspect, summarize, or process real UK Biobank RAP participant-level data, including de-identified row-level tables, raw RAP fields, exact dates, per-row predictions, row-level SHAP matrices, screenshots, tracebacks, or logs containing row-level values. Generate scripts for the user to run inside RAP; only aggregate results or rendered figures may be shared back with the agent. See ../references/agent-privacy-boundary.md.

OutputSharing rule
Rendered PDF / SVG / PNG figureShareable if it does not expose identifiers, exact dates, raw RAP fields, row labels, or data previews.
05-figs/data/Fig*.csv source CSVShareable only if aggregate (per-bin, per-strata, per-feature means/CIs). Never share a source CSV that contains raw per-participant values or identifiers.
Coefficient / metric table from 04-results/*.csvShareable — aggregate only.
Per-participant raw values used to build a figureDo not export. Keep intermediate data on RAP.
Individual-level interpretation figure (e.g. SHAP force plot)Do not use a real participant row with the local agent. Generate synthetic or representative prototype-row figures inside RAP if needed.

1. When to load

  • Build the manuscript-ready forest plot of the main Cox / subgroup result.
  • Produce calibration / DCA / ROC for a clinical model (paired with

ukbsci-ml).

  • Volcano of a protein / metabolite / batch regression screen.
  • Polished multi-panel figures combining outputs from multiple skills.
  • Standardized save (.pdf + .png + .svg) at 300 dpi.

2. When NOT to load

  • The user wants a KM curve only → ukbsci-survival::plot_km_curve (this

skill defers to it).

  • The user wants Love / PS distribution → ukbsci-propensity plots.
  • The user wants mediation / MI / SHAP plots → use the originating skill's

plotter; this skill provides the shared theme and save helper.


3. Figure contract (always run first)

For any figure the user asks for, restate three things before plotting:

  1. Claim — the one-sentence conclusion the figure must support.
  2. Evidence panel(s) — which underlying CSV(s) from 04-results/ feed

the figure.

  1. Export contract — final size (mm), single-column / double-column,

font family, palette family.

A figure that cannot be re-rendered from 05-figs/data/Fig*.csv is not acceptable.


4. Shared theme & palettes (define once, reuse everywhere)

UKBAnalytica does not ship custom themes. This skill defines the following neutral helpers — copy verbatim into each plotting script:

r
library(ggplot2)
ukbsci_theme <- function(base_size = 7, base_family = "Arial") {
theme_classic(base_size = base_size, base_family = base_family) +
theme(
axis.line = element_line(linewidth = 0.35, colour = "black"),
axis.ticks = element_line(linewidth = 0.35, colour = "black"),
legend.title = element_text(size = base_size * 0.95),
legend.text = element_text(size = base_size * 0.85),
strip.text = element_text(size = base_size * 0.95, face = "bold"),
plot.title = element_text(size = base_size * 1.1, face = "bold"),
panel.grid = element_blank()
)
}
# Categorical palette — clinical / two-arm + accent
ukbsci_clinical <- c(
baseline = "#2F6FA3",
exposure = "#C74732",
control = "#7F7F7F",
accent = "#F2A93B",
highlight1 = "#3D8B66",
highlight2 = "#7A4E9B"
)
# Diverging palette — for heatmaps / SMD / signed effects
ukbsci_diverging <- c("#2166AC", "#67A9CF", "#D1E5F0",
"#F7F7F7",
"#FDDBC7", "#EF8A62", "#B2182B")
# Sequential palette — for density / continuous gradients
ukbsci_sequential <- c("#FFF7EC", "#FEE8C8", "#FDD49E",
"#FDBB84", "#FC8D59", "#EF6548",
"#D7301F", "#990000")
# Apply the theme once, globally, at the top of a script
theme_set(ukbsci_theme())

These names are intentionally generic — they do not reference any specific journal brand.


5. Standardized save helper

r
save_ukbsci_figure <- function(plot, name,
width_mm = 180, height_mm = 120,
dpi = 300,
outdir = "/mnt/project/<area>/05-figs") {
dir.create(outdir, showWarnings = FALSE, recursive = TRUE)
w <- width_mm / 25.4; h <- height_mm / 25.4
# SVG (editable)
svglite::svglite(file.path(outdir, paste0(name, ".svg")), width = w, height = h)
print(plot); dev.off()
# PDF (vector, cairo for fonts)
grDevices::cairo_pdf(file.path(outdir, paste0(name, ".pdf")),
width = w, height = h, family = "Arial")
print(plot); dev.off()
# PNG (raster, 300 dpi)
ragg::agg_png(file.path(outdir, paste0(name, ".png")),
width = w, height = h, units = "in", res = dpi)
print(plot); dev.off()
}

Manuscript single-column ≈ width_mm = 89; double-column ≈ 180. Use a height that yields golden-ratio-ish aspect unless the figure dictates otherwise.


6. UKBAnalytica plot families (where each one lives)

PlotProvided byNotes
Forest (subgroup / batch reg)UKBAnalytica::plot_forestThis skill — see §7
CalibrationUKBAnalytica::plot_calibrationThis skill — see §8
VolcanoUKBAnalytica::plot_regression_volcanoThis skill — see §9
HeatmapUKBAnalytica::plot_heatmapLong-format matrix-style data
Stacked barUKBAnalytica::plot_stacked_barCategorical composition
ViolinUKBAnalytica::plot_violinGrouped continuous distributions
ScatterUKBAnalytica::plot_scatterExposure-response or feature-feature trends
KM survivalplot_km_curveukbsci-survival
Love / PS distributionplot_balance, plot_ps_distributionukbsci-propensity
Mediation effectsplot_mediation, plot_mediation_forestukbsci-mediation
MI diagnosticsplot_mi_pooled, plot_mi_diagnosticsukbsci-imputation
GO bar / lollipopplot_go_ora_bar, plot_enrichment_lollipopukbsci-proteomics
Correlation heatmapplot_correlationthis skill (re-export-friendly)
ML evaluationplot_ml_roc, plot_ml_calibration, plot_ml_dca, …ukbsci-ml
SHAPplot_shap_summary, plot_shap_beeswarm, plot_shap_dependence, plot_shap_forceukbsci-ml

When mixing plots from sibling skills, apply the same theme via theme_set(ukbsci_theme()) at the top of the orchestrating script and override colors using the ukbsci_* palettes.


7. Forest plot — plot_forest()

r
plot_forest(results,
estimate_col = "estimate",
lower_col = "lower95",
upper_col = "upper95",
label_col = "subgroup",
pvalue_col = "pvalue",
p_interaction_col = "p_interaction",
null_value = 1,
log_scale = TRUE,
colors = NULL,
title = "Subgroup Analysis",
xlab = "Hazard Ratio (95% CI)",
show_n = TRUE,
show_events = TRUE)

Input: any data.frame with at least estimate, lower95, upper95, label. Naturally consumes outputs of runmulti_cox / run_subgroup_analysis / run_multi_subgroup / runmulti_competing / pool_mi_models$pooled / tidy().


8. Calibration — plot_calibration()

r
plot_calibration(data, predicted, observed,
n_bins = 10,
smooth = TRUE,
conf_int = TRUE)

Input: per-prediction rows with predicted probabilities and binary outcome. Note: this is participant-level so the data argument should come from flow$final_test_predictions (which stays on RAP); the figure itself summarises into n_bins bins, so the rendered output is aggregate.


9. Volcano — plot_regression_volcano()

r
plot_regression_volcano(data,
effect_col = NULL,
p_col = "pvalue",
adjusted_p_col = NULL,
label_col = NULL,
significance_cutoff = 0.05,
top_n_label_each = 5,
null_effect = 1,
x_lab = NULL,
y_lab = NULL,
x_limits = NULL,
y_limits = NULL,
point_size = 1.05,
label_size = 2,
colors = c(neutral = "#D8D8D8",
lower = "#2F6FA3",
higher = "#C74732"),
show_cutoff = TRUE)

Auto-detects effect_col (HR → OR → estimate) and label_col (gene_symbol → protein_clean → variable). The output's attr(., "plot_data") and attr(., "label_data") give the aggregate underlying tables — write those to 05-figs/data/.


10. Lightweight plot helpers

Use these for compact exploratory or supplementary panels when the user has an aggregate or de-identified plotting table.

r
plot_heatmap(cor_df, x = "trait", y = "protein", fill = "rho")
plot_stacked_bar(tab_df, x = "risk_group", fill = "case_status", position = "fill")
plot_violin(plot_df, x = "group", y = "marker", fill = "group")
plot_scatter(plot_df, x = "exposure", y = "outcome", color = "group")

Inputs must use column names as strings. Do not pass eid, exact dates, or row-level raw RAP fields into local-agent-visible source CSVs.

11. Multi-panel composition

patchwork is the recommended layout engine:

r
library(patchwork)
top <- p_forest + p_volcano + plot_layout(widths = c(1, 1.2))
mid <- p_calib + p_dca + plot_layout(widths = c(1, 1))
fig <- top / mid +
plot_annotation(tag_levels = "a") &
ukbsci_theme()
save_ukbsci_figure(fig, "Fig01-composite",
width_mm = 180, height_mm = 200)

plot_annotation(tag_levels = "a") gives lowercase a, b, c, … panel labels — common across observational epidemiology.


12. Common pitfalls

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
35
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 2 Sep 2026, 2 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hinna0818/ukbanalytica_v2/ukbsci-plot/badge)](https://verified-skill.com/skills/hinna0818/ukbanalytica_v2/ukbsci-plot)

Something wrong with this skill or its page? Tell us.