Find — and find all — the real problems that make a codebase harder to change: knowledge duplicated across places, dead or unfinished code, decisions in the wrong layer, broken boundaries and contracts, code a human cannot read without reconstructing it. Several independent angles, merged and evidence-checked. Scope: a path, a feature or scenario, a just-finished change (PR / branch / diff), review findings that keep coming, or `audit` for the whole repo. Diagnosis is read-only; the report gr...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rf?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/surething-io-cockpit-eff7aa82)
---
name: rf
description: "Find — and find all — the real problems that make a codebase harder to change: knowledge duplicated across places, dead or unfinished code, decisions in the wrong layer, broken boundaries and contracts, code a human cannot read without reconstructing it. Several independent angles, merged and evidence-checked. Scope: a path, a feature or scenario, a just-finished change (PR / branch / diff), review findings that keep coming, or `audit` for the whole repo. Diagnosis is read-only; the report groups findings into a few root causes with a recommended plan, and replying to it (or naming causes / numbers) fixes them after you approve, accepting only less code with quality no worse."
argument-hint: "[audit | <path / feature / PR · branch · diff / findings> | yes · <root causes ①② or finding numbers to fix>]"
---
# rf — find the real problems, all of them
## Why rf exists (reason from this when no rule fits)
AI writes code at roughly the average of the context it reads, and most of that context is
the repository. Two ways of doing a thing → it copies either; a half-finished migration →
it extends both halves. So a repo that ships through AI rots by default, and review and
tests only ask whether each change is *correct* — not whether the repository got better.
rf is that second line, and its job is **diagnosis**: find the problems that make the next
change more expensive, find all of them, prove each one on the code, and rank them. Fixing
is a second, separate step the engineer starts by picking findings; it adds only what an
ordinary rewrite skips — every site found before editing, merges proven to be one piece of
knowledge, and acceptance on **less code, quality no worse**.
## Principles
- **P1 Real** — every finding cites `file:line` and says how it was checked. Names,
comments and resemblance are leads, not evidence; an unverified suspicion is labelled so.
- **P2 All** — a single pass sees a few problems and a different few each time; coverage
comes from **independent angles, merged** (§2). Where no source can see, say so.
- **P3 Ranked** — order by what the next change pays (`axes.md`), churn breaking ties.
- **P4 Taste is the engineer's** — rf proposes the target shape and whether two places are
the same knowledge; it never decides either. Conflicts with written rules go to the
engineer unresolved.
- **P5 Diagnosis is read-only** — no edits, no probes that write, no tests, builds or
installs; an already-installed read-only checker is the one exception (`sources.md`, "Per
language"). Code changes only in fix mode: picked findings, an approved plan (`fix.md`).
Never read env or secret files (`.env*`, local config holding credentials, keys,
certificates) — note them as unread instead.
## Files
| File (under `{{COCKPIT_DIR}}/skills/rf/`) | Holds | Who opens it |
|---|---|---|
| `axes.md` | what counts as a problem, severity, tags, line format | everyone, first |
| `lenses.md` | the angles and what each looks for | each reviewer: its own angle |
| `sources.md` | cg / grep / git / skeleton: what each sees and misses; how to find every site | everyone, before any search |
| `converge.md` | review findings that keep coming → the root cause | the main session, Findings entry |
| `fix.md` | picked findings → plan → batches → acceptance | the main session, Fix entry only |
| `report.md` | the report's parts, the diagram, finding format, format gate | the main session, when rendering |
**Running a step from memory of this table is not running it** — open the file.
## 1. Entry and scope
```python
def scope_of(target):
if picks_findings(target): return Fix # a yes, "①③", "3 5" after an rf report → fix.md
if names_findings(target): return Findings # code-review reports, PR comments → converge.md first
if names_a_change(target): return Change # "pr", "#123", branch, commit, "this change"
if target == "audit": return Repo # whole tree
if names_a_path(target): return Area
return Theme # a feature, scenario or concept
```
The main session prepares the scope, never the verdicts:
- **Change** — the changed files (uncommitted work: `git status --porcelain`, `git diff HEAD`,
`git ls-files --others --exclude-standard`; drop env/secret files) and a price per
mechanism the change adds: `mechanism · prod lines · test lines · surfaces · guards against`.
Plus the change's **intent**: PR text / requirement / commit message only, never the dev
session's rationale or invariants it added while fixing. Reviewers judge `scope` against it.
- **Theme** — a map of the feature as it is: entry points → callees / impact → co-changed
files, storage, config, docs, tests. The map is the scope.
- **Repo** — the map: cg `symbols format=summary`, churn per file over 6 months (no git
history → say so; churn and co-change evidence are unavailable), hotspots
(high churn × the cyclomatic complexity cg `edges` reports per function). Skip vendored and
generated output.
- **Findings** — run `converge.md` §1–§2; its clusters and invariants join the merge below.
- **Maps** (Area / Theme / Repo) — write `layers.json` from the repo's declared layering, then run
cg `maps` on the scope before spawning (`sources.md` "Maps"). Mechanical facts, not the main
session's opinion, so they stay compatible with clean reviewers.
- **Fix** — leave this file and follow `fix.md`; §2–§3 below are for diagnosis only.
## 2. Independent angles, merged
```python
def diagnose(scope):
tier = "single" if clearly_small(scope) else "angles" # a few files → one reviewer, all lenses
reviewers = [ANGLES_ALL] if tier == "single" else ANGLES # lenses.md: A · B · C · D · E
maps = run_maps(scope, layers_from_repo_rules()) # sources.md "Maps"; None if skipped
reports = parallel(spawn_clean(PROMPT.format(scope=scope, angle=a,
maps=maps if a in ("C", "D") else None)) for a in reviewers)
# maps go to C and D only: they point at state and flow problems,
# and draw A's attention away from scanning for small duplicates
merged = merge(reports) # same root cause → one finding; keep every reviewer's evidence,
# note "found by A and C"; never rewrite, drop or re-rank inside one
for f in merged:
if not f.location or not f.how_checked:
f = ask_same_reviewer(f, "give file:line and how you checked") # mechanical gate
# a finding you doubt → a fresh clean subagent re-checks it; never overrule it yourself
return render(rank(merged)) # axes.md order; report.md format and gate
```
```text
PROMPT: Read <SKILL.md>, axes.md, sources.md, and lenses.md section <angle>. Scope: <scope>.
Repo rules: read them yourself. Find every problem your angle covers inside the
scope, each in the axes.md line format with file:line and how you checked it.
Read-only. Report only; do not propose fixes beyond the target shape.
[Change:] The change intends: <intent>. Give every finding a scope line
(axes.md "Scope") — needed only if you can name the part of the intent that fails
or the guarantee the change itself declares that breaks without it.
[C, D with maps:] Read <maps> first and compare it with the repo's declared
architecture; every dependency against a written rule, every state with several
writers and every private name imported from outside is a lead — trace from its
file:line with cg callers / callees and grep, verify on the code, and answer the
maps' open question. They miss things; do not limit yourself to them.
```
Reviewers are clean: they see the scope and the skill files, never each other's reports or
the main session's opinions. That independence is what makes the union larger than any one
pass.
## 3. Output — one message, then stop
Render the report exactly as `report.md` says — the scope drawn first with every problem marked
on it, an index, short findings, everything that needs the engineer's decision in one place —
and run its format gate until it passes. Then stop: never start fixing in the same turn, even
when a fix looks obvious.