hinna0818/ukbanalytica_v2/ukbsci-ml
Claude Code and agent skill by hinna0818/ukbanalytica_v2
- community
Checking that the SKILL.md file is still in the repository.
Machine learning workflows (binary / multiclass classification and right-censored survival) for UK Biobank Research Analysis Platform (RAP) cohorts using UKBAnalytica. End-to-end pipelines (ukb_ml_workflow, ukb_ml_flow, ukb_ml_survival_workflow) cover frozen train / validation / test split, feature selection (Boruta, filter, glmnet), hyperparameter tuning (grid / random / Bayesian), final refit, test-set evaluation, model comparison, and model-agnostic interpretation via SHAP. Supports RF / XGBoost / glmnet / SVM / NNet / RPart / Naive Bayes / Logistic for classification, and RSF / GBM / coxnet for survival. Output evaluation: ROC, PR, calibration, DCA, KS, gain & lift, confusion matrix, threshold optimization, SHAP summary / dependence / force, plus plot_ml_* and plot_shap_* visualizations. Use this skill when the user asks for a UKB-based predictive model, ML pipeline, SHAP interpretation, C-index for a survival model, or comparison between several ML algorithms. Triggers: UKB ML, machine learning, XGBoost, random forest, SHAP, C-index, survival ML, calibration, decision curve, AUC, /ukbsci-ml. 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-mlSKILL.md
ukbsci-ml — Machine learning workflows for UKB cohorts
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.
| Output | Sharing rule | |||
|---|---|---|---|---|
| UK Biobank RAP raw participant-level data | Do not export. | |||
Direct identifiers (eid, raw dates, RAP field values) | Do not export. | |||
Train / validation / test datasets with raw fields or eid | Do not export. | |||
Trained model .rds | Keep in RAP project workspace unless sharing is explicitly permitted by project governance. | |||
Per-row predictions containing eid or re-identifiable row index | Do not export. | |||
| Per-row predictions without any identifier | Keep in RAP; do not share with the local agent. Export only aggregate metrics or rendered figures. | |||
| Aggregate metrics table (AUC, C-index, calibration intercept, RMSE…) | Shareable with the local agent. | |||
| ROC / PR / calibration / DCA / KS / gain plots | Shareable as rendered figures. | |||
| SHAP global importance table (mean \ | SHAP\ | per feature) | Shareable — aggregate only. | |
| SHAP beeswarm / dependence / summary plots | Shareable as rendered figures only, provided no row-level source data, row indices, or identifiers accompany the file. | |||
| SHAP force plot for a real participant row | Do not share with the local agent. Use a synthetic or representative prototype instead. |
1. When to load
- User wants a predictive model for a binary outcome (e.g. 10-year MACE
risk), a multiclass outcome (diabetes subtype), or a survival endpoint.
- User wants to compare several algorithms on the same train / test split.
- User wants SHAP-based interpretation.
- User wants Decision Curve Analysis or threshold optimization.
2. When NOT to load
- Effect estimation / inferential modeling →
ukbsci-regression. - Mediation, propensity scoring → respective skills.
- Just a Cox model without ML →
ukbsci-regression.
3. Prerequisites
Before using high-level workflow helpers, verify that the latest UKBAnalytica code is installed or loaded in the RAP session. If ukb_ml_flow() or ukb_ml_compare_flows() is not found, reinstall the current package version using the project-approved method or load the current source tree with pkgload::load_all().
After ML interface changes, run the shared skill smoke test:
4. Recommended entry points
Use the right function for your task:
| Task | Recommended function | |
|---|---|---|
| Single model, most analyses | ukb_ml_flow() | |
| Compare several algorithms or feature sets | ukb_ml_compare_flows() | |
| Fully staged workflow with explicit feature selection + per-stage artefacts | ukb_ml_workflow() | |
| Manual step-by-step control | lower-level functions (ukb_ml_split_data, ukb_ml_tune, …) |
Return-object cheat-sheet
| Function | Key slots in the returned object | |
|---|---|---|
ukb_ml_workflow() | $split, $feature_result, $tune_result, $threshold_result, $final_model, $final_test_metrics, $final_test_predictions | |
ukb_ml_flow() | $model, $metrics, $predictions, $roc, $shap (if compute_shap = TRUE) | |
ukb_ml_compare_flows() | $flows, $metrics, $comparison, $predictions, $roc, $thresholds |
Never mix components across workflow objects (e.g. workflow_obj$roc does not exist; use flow_obj$roc).
4a. ukb_ml_flow() — single model (recommended for most analyses)
4b. ukb_ml_workflow() — staged workflow with explicit feature selection
Use when you need per-stage artefacts (Boruta importance table, tuning grid, held-out validation metrics).
Note on `use_validation_in_refit`: ukb_ml_fit_final() uses the use_validation_in_refit argument to control whether validation-set rows are folded into the final refit. This defaults to TRUE in ukb_ml_fit_final() itself. In high-level frozen-test workflows such as ukb_ml_flow() and ukb_ml_compare_flows(), check the function default and pass this argument explicitly when you need to include or exclude validation rows from the final model.
4b. Survival — ukb_ml_survival_workflow()
Predict at specific horizons:
5. Sub-steps (when you don't want the all-in-one workflow)
Use this sub-stepped flow when the user needs per-stage artefacts (e.g. Boruta status table, tuning grid history) for the manuscript.
6. Comparison across models
Alternative: compare feature sets with one model:
7. SHAP interpretation
Sharing rules for SHAP outputs:
| SHAP output | Sharing rule | |||
|---|---|---|---|---|
| Importance table (mean \ | SHAP\ | per feature) | Shareable — aggregate summary, no identifiers. | |
| Summary / beeswarm / dependence plots | Shareable as rendered figures only; do not attach the row-level SHAP source matrix or feature-value table. | |||
| Force plot for a real participant row | Do not share with the local agent. Use a synthetic or representative prototype — a row constructed from group medians, not an actual participant. | |||
Raw shap$shap_values matrix | Keep on RAP and out of the agent context; it has one row per observation, even if eid is absent. |
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
- SKILL.md in the repositoryCheckinginst/skills/UKBAnalytica_skills/ukbsci-ml/SKILL.md
Popularity
- Repository stars
- 35
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 29 Aug 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
[](https://verified-skill.com/skills/hinna0818/ukbanalytica_v2/ukbsci-ml)