Agent skill

Km Survival Curve

by aipoch in aipoch/medical-research-skills

A skill your agent uses when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group.

MITAuto-check passedDocuments & Office

Install Km Survival Curve

skills CLI
$ npx skills add aipoch/medical-research-skills --skill km-survival-curve -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aipoch/medical-research-skills km-survival-curve --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aipoch/medical-research-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/'awesome-med-research-skills/Data Analysis/km-survival-curve' .claude/skills/km-survival-curve && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
km-survival-curve
GitHub stars
1.9k
Token cost
~2.5k tokens
SKILL.md length
955 words
Files
13 (incl. scripts, references)
Skills in repo
578
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group.

  • Works in 3 steps: Confirm the input file exists and… → Run scripts/main.R with the requested… → Check the output directory for…
  • Generating Kaplan-Meier survival curves from tabular survival data containing time
  • SKILL.md covers Use This Skill When, Primary Command, Prerequisites and Core Arguments, plus 12 more sections
  • Runs R scripts from its folder; reaches cloud.r-project.org

What it does

Km Survival Curve is an agent skill from aipoch/medical-research-skills. Use when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group. Supports command-line parameter input, parameter validation, automatic time-unit handling, single-file PDF figure export, and session metadata capture.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 16 other files, including scripts and reference files (for example `eval_report_km-survival-curve_result.json`, `references/algorithm.md` and `references/cli-guide.md`).

It sits in Documents & Office. The repository describes itself as: Hundreds of agent skills for medical research, including protocol design, data analysis, evidence insights, and academic writing. The licence is MIT.

When your agent uses it

  • Generating Kaplan-Meier survival curves from tabular survival data containing time
  • A precomputed risk group

Example prompts

  • “/km-survival-curve”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Confirm the input file exists and identify the time, status, and group columns.
  2. Run scripts/main.R with the requested output directory and any optional plot parameters.
  3. Check the output directory for km-plot.pdf.

What it can do on your machine

Read from SKILL.md and the folder at commit 686e09d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 4 files in scripts/ (R), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • cloud.r-project.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Km Survival Curve loads about 2.5k tokens when it runs, and up to ~5.8k if it reads all its reference files. Until then it costs about 77 tokens; SKILL.md has 955 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~77
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from aipoch/medical-research-skills at commit 686e09d, republished under its MIT licence (© aipoch). 955 words, ~2,451 tokens.

Download SKILL.mdSave it as .claude/skills/km-survival-curve/SKILL.md (or your agent's skills folder). This skill also uses 12 other files; get the full folder from GitHub.
name
km-survival-curve
description
Use when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group. Supports command-line parameter input, parameter validation, automatic time-unit handling, single-file PDF figure export, and session metadata capture.
license
MIT
author
AIPOCH

Source: https://github.com/aipoch/medical-research-skills

Kaplan-Meier Survival Curve Analysis

Use this skill to run Kaplan-Meier survival analysis on a tabular dataset and export a single PDF survival figure.

Use This Skill When

  • You need a Kaplan-Meier survival curve from a table containing time, status, and group columns.
  • You need a command-line survival workflow with parameter validation.
  • You need a single Kaplan-Meier plot as the final analysis result.

Primary Command

bash
Rscript scripts/main.R \
  --input_file <input_file> \
  --output_dir <output_dir> \
  --time_col <time_column> \
  --status_col <status_column> \
  --risk_col <group_column>

Prerequisites

  • Rscript is available in the shell.
  • Required R packages: optparse, data.table, survival, survminer, ggplot2.
  • Install missing packages with Rscript -e 'install.packages(c("optparse", "data.table", "survival", "survminer", "ggplot2"), repos="https://cloud.r-project.org")'.

Core Arguments

ArgumentRequiredDescription
--input_fileYesInput data file in CSV or tab-delimited TXT/TSV format
--output_dirNoOutput directory, default ./KM_Results
--time_colNoSurvival time column, default futime
--status_colNoEvent status column, default fustat
--risk_colNoRisk group column, default risk_group
--time_unitNoTime unit label: year, month, or day, default year
--auto_convert_daysNoHeuristically convert large time values from days when time_unit is year or month, default true
--statistics_methodNologrank or wald, default logrank

Plot Customization Arguments

ArgumentDefaultDescription
--figure_width10Figure width in inches
--figure_height7Figure height in inches
--figure_familysansFont family
--title_xTimeX-axis title. If left as default, the script renders Time (<time_unit>)
--title_ySurvival probabilityY-axis title
--title_mainemptyPlot title
--legend_positiontoptop, bottom, left, right, none
--legend_showtrueWhether to show legend
--legend_titleemptyLegend title
--line_typesolidSurvival line type: solid, dashed, dotted, dotdash, longdash, twodash
--line_size1Survival line width
--line_colors#4DBBD5,#E64B35,#00A087,#3C5488,#F39B7F,#8491B4,#91D1C2,#DC0000Comma-separated group colors
--censor_showtrueWhether to show censor markers
--censor_size7Censor marker size
--confidence_showtrueWhether to show confidence interval
--confidence_alpha0.2Confidence band transparency
--risk_table_showtrueWhether to show the risk table
--risk_table_bordertrueWhether to show the risk table border
--risk_table_panelfalseWhether to show the risk table panel background
--risk_table_size6Risk table font size
--axis_title_size12Axis title font size
--axis_text_size10Axis tick-label font size
--legend_text_size11Legend text font size

Input Requirements

  • The input file must contain the requested time, status, and group columns.
  • .txt inputs must be tab-delimited.
  • time must contain finite non-negative numeric values.
  • status must be coded as 0 for censored and 1 for event.
  • The risk group column must be a precomputed categorical grouping variable, not a continuous score column.
  • The risk group column must contain at least 2 groups after filtering.
  • --line_colors must provide at least one color per retained group when you override the default palette.
  • Rows with missing time, status, or group values are removed before analysis.
  • At least 2 complete observations must remain after filtering.
  • Near-unique or continuous-looking grouping columns are rejected before model fitting.
  • If --auto_convert_days true and max(time) > 365, the script assumes the retained time values are in days and converts them to the requested --time_unit when time_unit is year or month.
  • Only use --auto_convert_days true when the source time column is known to be in days.
  • If your source data are already in years or months, disable --auto_convert_days to avoid incorrect conversion.
  • --statistics_method wald only supports exactly 2 retained groups; use logrank for multi-group comparisons.
  • Invalid plotting parameters such as unsupported --line_type values are rejected before plotting.

Example input:

text
id	fustat	futime	risk_score	risk_group	GPR161	RIBC2
TCGA-C5-A1M5	1	5.62191780821918	-1.10702407761445	low	2.82521576230566	5.35318564979635
TCGA-VS-A94W	0	3.40547945205479	-0.671246677921865	high	4.26241812321536	4.00802068790173

Bundled test datasets:

  • tests/data/km_sample1.txt: baseline KM example with risk_group
  • tests/data/km_sample2.txt: alternate cohort for plotting and statistics examples
  • tests/data/km_sample3.txt: additional cohort for validation and repeated testing
Show full SKILL.md (402 more words)Show less

Minimal Workflow

  1. Confirm the input file exists and identify the time, status, and group columns.
  2. Run scripts/main.R with the requested output directory and any optional plot parameters.
  3. Check the output directory for km-plot.pdf.

If you omit --input_file, the script exits with SKILL_MISSING_INPUT.

Outputs

Expected output:

text
<output_dir>/
├── km-plot.pdf
└── session_info.txt

Interpretation Guide

  • Use the survival figure to inspect separation between groups over time.
  • Use the p-value annotation, confidence interval, and risk table in the figure to interpret group separation.

Time Conversion Caution

  • Automatic conversion is a convenience heuristic, not a unit detector.
  • The script only checks whether max(time) > 365; it does not infer the true source unit from metadata.
  • If the input time column is already expressed in years or months, run with --auto_convert_days false.
  • Review the console log for the conversion warning whenever time_unit is year or month.

Reproducibility Note

  • Repeated runs on identical input should be analytically consistent.
  • The exported km-plot.pdf may not be byte-identical across repeated runs because PDF metadata and graphics-device output can vary.
  • If you need byte-stable artifacts, add a deterministic PDF post-processing step outside this skill.

Do Not Use This Skill When

  • You need this tool to derive a cutoff or split a continuous score into risk groups.
  • You need multivariable Cox regression, covariate adjustment, or hazard-ratio modeling beyond the p-value route already exposed here.
  • You need a broader survival-analysis workflow with upstream feature engineering, biomarker selection, or data harmonization.
  • You need multiple plots, report generation, or downstream interpretation beyond producing one Kaplan-Meier figure and session metadata.

Read These Files When Needed

NeedFile
Kaplan-Meier method details and interpretationreferences/algorithm.md
More CLI examplesreferences/cli-guide.md
Error diagnosisreferences/troubleshooting.md
Main execution entry pointscripts/main.R
Sample test datatests/data/km_sample1.txt, tests/data/km_sample2.txt, tests/data/km_sample3.txt

Quick Examples

Basic Kaplan-Meier analysis:

bash
Rscript scripts/main.R \
  --input_file tests/data/km_sample1.txt \
  --output_dir tests/output_basic

Custom column names:

bash
Rscript scripts/main.R \
  --input_file tests/data/km_sample1.txt \
  --time_col futime \
  --status_col fustat \
  --risk_col risk_group \
  --output_dir tests/output_custom_columns

Custom plot title:

bash
Rscript scripts/main.R \
  --input_file tests/data/km_sample2.txt \
  --title_main "Study KM Curve" \
  --output_dir tests/output_title

Hide confidence interval and risk table:

bash
Rscript scripts/main.R \
  --input_file tests/data/km_sample3.txt \
  --confidence_show false \
  --risk_table_show false \
  --output_dir tests/output_simple

Validation

bash
Rscript scripts/main.R --help
bash
Rscript scripts/main.R \
  --input_file tests/data/km_sample1.txt \
  --output_dir tests/validation_output

After running analysis, verify that tests/validation_output/km-plot.pdf exists.

Common Errors

  • SKILL_FILE_NOT_FOUND: Input file path is wrong or inaccessible.
  • SKILL_MISSING_COLUMNS: A requested time, status, or risk group column is missing.
  • SKILL_INVALID_DATA: Input data is malformed or unsuitable for survival analysis.
  • SKILL_INVALID_DATA: A continuous or near-unique risk column was supplied where a categorical group column is required.
  • SKILL_INVALID_PARAMETER: An argument value is invalid.
  • SKILL_INVALID_PARAMETER: Plotting options such as --line_type or --line_colors are incompatible with the retained groups.
  • SKILL_INSUFFICIENT_DATA: Too few complete observations remain after filtering.
  • SKILL_DEPENDENCY_MISSING: A required R package such as optparse or survival is unavailable.

If the issue is not obvious, read references/troubleshooting.md.

© aipoch, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 12 other files (scripts, references) in awesome-med-research-skills/Data Analysis/km-survival-curve of aipoch/medical-research-skills.

  • SKILL.md
  • eval_report_km-survival-curve_result.json
  • references/algorithm.md
  • references/cli-guide.md
  • references/troubleshooting.md
  • scripts/functions.R
  • scripts/main.R
  • scripts/run_analysis.R
  • scripts/utils.R
  • tests/data/km_custom_columns.csv
  • tests/data/km_sample1.txt
  • tests/data/km_sample2.txt
  • tests/data/km_sample3.txt

Open the folder on GitHubat commit 686e09d

Compare with similar skills

Km Survival Curve next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Km Survival Curve compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Km Survival Curve this skillaipoch/medical-research-skills1.9k—~2.5kAutomated safety check: PassMIT
Mathmodel SkillhandsomeZR-netizen/mathmodel-skill292—~2.5kAutomated safety check: PassMIT
Power DesignItsssssJack/power-design722—~2.8kAutomated safety check: PassMIT
Paginated Reportdata-goblin/power-bi-agentic-development1k—~3.5kAutomated safety check: PassGPL-3.0
Data Cleanupsgharlow/claude-code-recipes389—~566Automated safety check: PassCustom licence
Observal OpsObserval/Observal4.3k—~654Automated safety check: PassApache-2.0

Similar skills

  • Mathmodel Skill

    handsomeZR-netizen/mathmodel-skill

    CUMCM 国赛、MCM/ICM 美赛与电工杯数学建模竞赛的端到端协作工作流。Use when a user explicitly works on one of these modeling contests or asks to run/review a modeling-competition paper from problem selection through modeling…

    292 GitHub stars~2.5k tokensUpdated 15 days ago
    Documents & OfficeAuto-check passed
  • Power Design

    ItsssssJack/power-design

    Generate beautiful, on-brand HTML — presentation decks or full responsive websites — in any brand's design language, combining brand DNA extracted via Firecrawl with codified, research-backed design…

    722 GitHub stars~2.8k tokensUpdated 2 mo ago
    Documents & OfficeAuto-check passed
  • Paginated Report

    data-goblin/power-bi-agentic-development

    Author, validate, publish, and test Power BI paginated reports in the RDL format.

    1k GitHub stars~3.5k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Data Cleanup

    sgharlow/claude-code-recipes

    Clean and standardize messy tabular data (CSV, spreadsheet paste, system exports) into an analysis-ready dataset — consistent dates and names, typed columns, duplicates identified, missing values…

    389 GitHub stars~566 tokensUpdated 2 mo ago
    Documents & OfficeAuto-check passed
  • Observal Ops

    Observal/Observal

    Inspects Observal traces, sessions, rankings, feedback, telemetry health, logs, and Agent insight reports.

    4.3k GitHub stars~654 tokensUpdated today
    Documents & OfficeAuto-check passed
  • Sn Da Image Caption

    MichaelYang-lyx/AIDABench

    图片理解与数据提取 skill。当图片文件(.png/.jpg/.jpeg/.gif/.webp/.bmp)是主要输入且用户需要理解、提取数据或分析图片内容时使用。提供预配置的 caption 脚本(scripts/caption.py),通过 vision 模型将图片转为文本描述,无需额外配置 API Key。覆盖:(1) 通过 scripts/caption.py…

    111 GitHub starsUsed in 1 repo~2k tokens
    Documents & OfficeAuto-check passed

More from aipoch/medical-research-skills

All 578 skills in this repo
  • Academic Poster Generator

    aipoch/medical-research-skills

    Complete workflow for generating academic research posters from PDF literature; use when you need to extract paper content from PDFs and produce a LaTeX-based poster…

    1.9k GitHub stars~2.2k tokensUpdated 24 days ago
    Auto-check passed
  • Diagnostic Study Quality Assessment Quadas

    aipoch/medical-research-skills

    Analyzes clinical diagnostic accuracy studies for bias using the QUADAS-2 tool.

    1.9k GitHub stars~1.4k tokensUpdated 24 days ago
    Auto-check passed
  • Exploratory Data Analysis

    aipoch/medical-research-skills

    Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats.

    1.9k GitHub stars~3.7k tokensUpdated 24 days ago
    Auto-check passed
  • Iso Certification

    aipoch/medical-research-skills

    A toolkit for preparing ISO 13485:2016 certification documentation for medical device QMS.

    1.9k GitHub stars~1.8k tokensUpdated 24 days ago
    Auto-check passed
  • Journal Skills

    aipoch/medical-research-skills

    Recommends target journals for manuscript submission by analyzing the paper topic/abstract and the journal distribution of similar PubMed literature; use when users ask for journal…

    1.9k GitHub stars~1.7k tokensUpdated 24 days ago
    Auto-check passed
  • Latex Posters

    aipoch/medical-research-skills

    Creates academic-poster writing packages for LaTeX using beamerposter, tikzposter, or baposter.

    1.9k GitHub stars~1.3k tokensUpdated 24 days ago
    Auto-check passed

Questions about Km Survival Curve

What does Km Survival Curve do?

A skill your agent uses when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group. Km Survival Curve is an agent skill from aipoch/medical-research-skills. Use when generating Kaplan-Meier survival curves from tabular survival data containing time, event status, and a precomputed risk group.

When should I use Km Survival Curve?

Km Survival Curve fits situations like: generating Kaplan-Meier survival curves from tabular survival data containing time; A precomputed risk group.

How do I install Km Survival Curve in Claude Code?

Run `npx skills add aipoch/medical-research-skills --skill km-survival-curve -a claude-code`. Or copy the skill folder (awesome-med-research-skills/Data Analysis/km-survival-curve in aipoch/medical-research-skills) into .claude/skills/km-survival-curve in your project. Claude Code loads it when a task matches its description.

How do I install Km Survival Curve in Codex?

Run `npx skills add aipoch/medical-research-skills --skill km-survival-curve -a codex`. Or copy the skill folder (awesome-med-research-skills/Data Analysis/km-survival-curve in aipoch/medical-research-skills) into .agents/skills/km-survival-curve in your project. Codex loads it when a task matches its description.

Can I use Km Survival Curve in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aipoch/medical-research-skills --skill km-survival-curve -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/km-survival-curve, .gemini/skills/km-survival-curve, .github/skills/km-survival-curve and .opencode/skills/km-survival-curve in your project.

What does Km Survival Curve need to run?

Going by SKILL.md and its folder, Km Survival Curve needs R for the scripts in its folder.

Does Km Survival Curve access the network?

SKILL.md names 1 domain. In commands or code: cloud.r-project.org; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Km Survival Curve safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Km Survival Curve use?

Km Survival Curve is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Km Survival Curve use?

About 2.5k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.

What are the alternatives to Km Survival Curve?

Skills that share tags, products or a category with Km Survival Curve: Mathmodel Skill (handsomeZR-netizen/mathmodel-skill, 292 stars), Power Design (ItsssssJack/power-design, 722 stars), Paginated Report (data-goblin/power-bi-agentic-development, 1k stars) and Data Cleanup (sgharlow/claude-code-recipes, 389 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Km Survival Curve?

aipoch (a GitHub organization) maintains it in aipoch/medical-research-skills, which has 1,937 GitHub stars. The repository holds 578 skills in this directory. The repository was last updated on September 17, 2026.

Source: aipoch/medical-research-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.