risk-score

risk-score is a skill for Claude Code from thoughtbot/rails-consultant. It costs 46 tokens per session (1,221 once invoked), scanned A, original, MIT.

A fixed-rule scorer for a pull request, branch, or code difference. It produces JSON so continuous integration (automated checks run for code changes) can make the same decision for the same diff every time.

In plain words
What is it for?
Use it to score a GitHub pull request or compare the current branch with a base branch, then pass the JSON result to CI for review or merge decisions.
Why use it?
It removes subjective, one-off risk judgments from merge or review gates. Keeping the scoring in a script also makes the result reproducible.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the rails-consultant plugin — 15 skills shipped together

Good fit Use it to score a GitHub pull request or compare the current branch with a base branch, then pass the JSON result to CI for review or merge decisions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thoughtbot/rails-consultant/risk-score
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add thoughtbot/rails-consultant --skill risk-score
Clone the repo
git clone --depth 1 https://github.com/thoughtbot/rails-consultant

Made for: Claude Code.

Or install rails-consultant, the plugin that ships this one along with the rest of its 15 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for risk-score

README.md
[![agentmods](https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/risk-score/github.svg)](https://agentmods.dev/skills/thoughtbot/rails-consultant/risk-score)
Your own site
<a href="https://agentmods.dev/skills/thoughtbot/rails-consultant/risk-score"><img src="https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/risk-score/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for risk-score

Your own site · 80×15
<a href="https://agentmods.dev/skills/thoughtbot/rails-consultant/risk-score"><img src="https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/risk-score.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,221 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.01221
Opus 5.5 $0.00018 $0.00488
Sonnet 5.5 $0.00009 $0.00244
Haiku 4.5 $0.00005 $0.00122

Measured 23d ago against content hash 3bcf89a75845, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

risk-score scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 23d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/score.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/risk-score/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Risk score

This runs in CI, where something reads the JSON and decides whether a PR needs a second reviewer or can merge. That only works if the same diff gets the same score every time. So the score comes from scripts/score.py, never from you.

Your job is getting the right diff into the script and handing back what it prints, untouched. If a rule looks wrong for this PR, that's a change to the script, made in a PR of its own. Bending one score breaks the thing CI trusts.

1. Pick the diff

$ARGUMENTS decides:

  • A number, or a GitHub PR URL: the PR.

    gh pr diff <number or url> --color=never
    
  • Anything else non-empty: a base branch to compare the current branch with.

  • Empty: the base is origin/$GITHUB_BASE_REF when that's set (GitHub Actions sets it on pull_request runs), else what git symbolic-ref --short refs/remotes/origin/HEAD prints, else main.

    git -c core.quotePath=false diff --no-color --no-ext-diff --find-renames <base>...HEAD
    

The flags pin the output format, so a user's git config can't change the score. Three dots means the diff since the branch left the base, which is what a PR shows. Uncommitted changes aren't part of a PR, so they aren't scored.

2. Score it

Pipe the diff straight in. Don't save, trim, or filter it first; the script already skips lockfiles and generated files where they shouldn't count.

git ... | python3 <this skill's directory>/scripts/score.py

The script reads only the diff, never git history, so a shallow CI checkout works as long as the diff command does.

3. Reply

Reply with exactly what the script printed: one JSON object, no code fence, nothing before or after. Something like jq parses your reply, so a sentence of commentary breaks the job that called you.

{
  "score": 7,
  "level": "high",
  "files_changed": 3,
  "lines_changed": 41,
  "signals": [
    {
      "rule": "migration",
      "points": 2,
      "reason": "Changes the database schema",
      "files": ["migrations/20261103_drop_legacy_status.js"]
    },
    {
      "rule": "destructive_migration",
      "points": 3,
      "reason": "Drops, renames, or rewrites existing columns, tables, or rows",
      "files": ["migrations/20261103_drop_legacy_status.js"]
    },
    {
      "rule": "untested_code",
      "points": 2,
      "reason": "Changes code without changing any tests",
      "files": ["src/orders.js"]
    }
  ]
}

Read the full file on GitHub · 120 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 23d ago First seen · 120 lines · 46 tokens per session scan A 3bcf89a75845

Subscribe to this mod's changes

risk-score is a skill published in the GitHub repository thoughtbot/rails-consultant (39 stars, last pushed 9d ago), licensed MIT. It adds 46 tokens to every session and 1,221 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-07.

Related

risk-score compared with skills from other repositories

risk-score next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
risk-scorethoughtbot/rails-consultantSkill399d agoMITA46Claude Code
elixir-wayoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA55Claude Code
auditoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA35Claude Code
reviewoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA51Claude Code
pr-reviewoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA59Claude Code
phx-pr-reviewoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA61Claude Code, Codex
startoliver-kriska/claude-elixir-phoenixSkill5783d agoMITA57Claude Code