brownfield-score

brownfield-score is a command for Claude Code from wednesday-solutions/ai-agent-skills. It costs 0 tokens per session (1,277 once invoked), scanned A, original, MIT.

A command that explains why a particular code file is considered risky, using measures such as dependencies, tests, age, and past changes.

In plain words
What is it for?
Use it to investigate risky files, review their dependents and imports, check whether they have tests, and compare their risk with the project.
Why use it?
It turns a single risk score into specific reasons, making it easier to judge whether a change needs extra care.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Good fit Use it to investigate risky files, review their dependents and imports, check whether they have tests, and compare their risk with the project.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/wednesday-solutions/ai-agent-skills/brownfield-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.

Clone the repo
git clone --depth 1 https://github.com/wednesday-solutions/ai-agent-skills

Made for: Claude Code.

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 brownfield-score

README.md
[![agentmods](https://agentmods.dev/badge/commands/wednesday-solutions/ai-agent-skills/brownfield-score/github.svg)](https://agentmods.dev/commands/wednesday-solutions/ai-agent-skills/brownfield-score)
Your own site
<a href="https://agentmods.dev/commands/wednesday-solutions/ai-agent-skills/brownfield-score"><img src="https://agentmods.dev/badge/commands/wednesday-solutions/ai-agent-skills/brownfield-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 brownfield-score

Your own site · 80×15
<a href="https://agentmods.dev/commands/wednesday-solutions/ai-agent-skills/brownfield-score"><img src="https://agentmods.dev/badge/commands/wednesday-solutions/ai-agent-skills/brownfield-score.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,277 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.00000 $0.01277
Opus 5 $0.00000 $0.00639
Sonnet 5 $0.00000 $0.00255
Haiku 4.5 $0.00000 $0.00128

Measured 11d ago against content hash 614b3cace22a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

brownfield-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 11d ago.

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.

.claude/commands/brownfield-score.md · 186 lines

How it starts

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

/brownfield-score — Risk Score Breakdown

Purpose

Detailed risk scoring breakdown for a specific file. Shows all contributing factors and project comparison.

Trigger

  • "Why is this file risky?"
  • "Show me the risk breakdown for X"
  • "How does X's risk score compare?"

Type: /brownfield-score <file-path>


Steps

1. Resolve the target file

If $ARGUMENTS is empty, use currently open file. Resolve relative paths to project root. Verify file exists in graph.

2. Load file risk data from DB

const queries = require('./.claude/query-helpers.js');
const fileSummary = queries.getFileSummary(targetFilePath);

Returns all contributing factors:

  • riskScore (final 0-100 score), band
  • bugFixCommits, totalCommits
  • ageInDays (days since creation)
  • importedByCount (fan-in)
  • importCount (fan-out)
  • hasTests (boolean)
  • isCircularDep (boolean)

3. Compute the score formula

Use the risk scoring algorithm (from graph.js):

riskScore = min(100, 
  (min(importedByCount, 50) * 1.2)
  + (isPublicContract ? 25 : 0)
  + ((100 - testCoverage) * 0.15)
)

Break this down visually for the dev.

4. Determine the band

  • 0-30: Safe
  • 31-60: Moderate
  • 61-79: Risky
  • 80-100: Critical

5. Compare to project average

Read all risk scores from dep-graph.json. Compute the median and average.

Example: "This file scores 72 (Risky). Project average is 45 (Moderate). This is in the top 15% most risky."

6. Build the scorecard

Format:

# Risk Score — <file-path>

## Overall Score

**72 / 100** — RISKY ⚠️

This file is in the top 15% most risky files in the project.
Project average: 45 (Moderate)
Project median: 38 (Moderate)

---

## Contributing Factors

| Factor | Value | Weight | Impact |
|--------|-------|--------|--------|
| Files importing this | 18 | ×1.2 | 21.6 pts |
| Public contract | Yes | +25 | 25 pts |
| Missing test coverage | 40% | ×0.15 | 9 pts |
| Recent bug fixes | 4 | - | Flagged ⚠️ |
| Age | 800 days | - | Old, many changes |
| **TOTAL** | | | **72** |

---

## What This Means

### High fan-in (18 files depend on this)
Changes here affect <N> files. You cannot change the public API without coordinating with dependents.

### Low test coverage (40%)
Only 40% of this file is tested. Changes are risky.

### Recent bug fixes (4 in last 6 months)
This file is fragile. Has had bugs before.

### Old file (800 days)
Lots of history. Many people have touched it. Potential for hidden assumptions.

---

## Recommendation

**Before editing this file:**
1. Add tests for the code you're changing (current coverage is below project average of 65%)
2. Check all dependents in the dependency graph
3. Run full test suite — not just unit tests
4. Get code review from whoever last edited this file

**If you need to change the public API:**
- Notify all 18 dependent file owners
- Use a deprecation period (add `@deprecated` comment)
- Update all dependents in the same PR

---

## Comparison

| File | Score | Reason |
|------|-------|--------|
| <high-risk-file> | 88 | Core infrastructure, many dependents |
| **<this-file>** | **72** | **Your file** |
| <moderate-file> | 45 | Utility, lower impact |

Your file is riskier than <moderate-file> because it has higher fan-in.
Your file is safer than <high-risk-file> because it's not core infrastructure.

Read the full file on GitHub · 186 lines

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. 11d ago First seen · 186 lines · 0 tokens per session scan A 614b3cace22a

Subscribe to this mod's changes

brownfield-score is a command published in the GitHub repository wednesday-solutions/ai-agent-skills (168 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,277 tokens. 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-08-30.