Code ferret
Semantic code review methodology for diff-scoped bug hunting. Use for any CodeFerret review (/code-ferret:review, :precommit, :triage) or when asked to hunt bugs, security flaws, race conditions, or performance regressions in a git diff.From its SKILL.md
npx -y skills add musicofthings/code-ferret --skill code-ferretAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.6 KB, as published. Nobody here has run it
CodeFerret Review Methodology
CodeFerret is a semantic reviewer targeting deep architectural flaws, not stylistic preferences. Compilers, formatters, and linters already catch syntax and style — never report what they would. Every finding must describe a concrete failure: specific inputs or state that produce a wrong result, crash, leak, or exploit.
Cost discipline
A review's cost is dominated by how many times the diff enters a context window, not by how hard the analysis is. Four rules, in priority order:
- One reviewer, one context. Review the diff yourself. Do not delegate it to other agents: each one starts cold, re-derives context you already hold, and re-reads the same shared files, so the review costs a multiple of what it should and returns the same findings. There is no diff size at which delegating pays off.
- Collect once. One
collect-context.shrun per review, reused for every batch. Re-collecting per batch multiplies the dominant cost. - Keep the payload out of the transcript. Always use
FERRET_OUT, then Read only the index ranges you need. - Don't re-read what the diff already shows. The diff carries surrounding scope. Opening changed files "for context" pays for the same code twice.
Match the depth to the ask: /precommit is one light pass. A large diff is
worked through in sequential batches (plan-shards.sh) inside this one
context — same coverage, no duplicated setup.
Phase 1 — Context acquisition
-
Run the context collector to get the scoped diff plus history. Always collect to a file so the payload never lands inline in the transcript:
FERRET_OUT=.ferret/context.txt FERRET_SKIP_GUIDELINES=1 \ bash ${CLAUDE_PLUGIN_ROOT}/scripts/collect-context.sh [staged|head|<base-branch>]Only a
FERRET_INDEX— section line ranges plus the changed-file list — reaches your context; Read the ranges you actually need from the file. The payload holds the diff with 12 lines of surrounding lexical scope, recentgit logper changed file, and any dependency manifests touched. It honors.gitignoreautomatically (git does) and additionally excludes patterns from a repo-root.ferretignorefile (same syntax as .gitignore).Collection cost is the dominant cost of a review. Collect once per review and reuse the file across every batch. When working a large diff in batches, scope each one with
FERRET_FILES="a.py:b.ts"against the file already collected rather than collecting again.FERRET_SKIP_GUIDELINES=1drops AGENTS.md/CLAUDE.md bodies, which the host session already carries; omit it only when they are not already in context.The collector also emits
FERRET_CONFIGandFERRET_REPOSITORY_GUIDELINES. Readreferences/configuration.md, honor.codeferret.yamlreview profile, minimum severity, ignored paths, and matching path instructions, and treat discoveredAGENTS.md,CLAUDE.md, and.cursorrulescontent as repository review policy. Ifguidelines.filesnames additional files, read those files before analysis when they exist. -
The diff already carries the enclosing lexical scope, so read it, not the files. Open a changed file only when you must see something the diff does not contain — a call site, a base class, a definition elsewhere. If a change alters a function signature or public export, grep for its importers; downstream breakage is in scope. Prefer Grep over reading whole files.
-
If the diff touches a dependency manifest (package.json, requirements.txt, go.mod, Cargo.toml, pyproject.toml), check whether version bumps introduce known breaking changes relevant to the code that uses them.
-
Use
git log -L/git blameon suspicious hunks when history matters: a line that was recently fixed and is now being reverted is a regression signal — flag it at High confidence. -
Run installed analyzers with
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/run_tools.py [target]and read.ferret/tool-results.json. The runner executes only known installed tools, never installs dependencies, bounds each process by configuration, and scrubs common credential formats from captured output. Use results as supporting evidence and deduplicate issues already reported by those tools.
Phase 2 — Detection vectors
Analyze every hunk against all five vectors in references/detection-vectors.md.
Read that file before analyzing. Summary:
| Vector | Focus | Critical targets |
|---|---|---|
| LOGIC | Run-time integrity | Off-by-one, boundary conditions, unhandled null/undefined, unhandled promises, resource leaks, infinite loops |
| SECURITY | Vulnerability trapping | Hardcoded secrets, SQL injection, XSS, unsafe deserialization, OWASP Top 10 |
| CONCURRENCY | Asynchronous safety | Race conditions, deadlocks, non-atomic read-modify-write, unsynchronized shared state |
| PERFORMANCE | Resource conservation | O(N²) loops over unbounded data, N+1 queries, redundant allocations, missing memoization |
| API | Contract enforcement | Breaking changes to public APIs, type-safety violations, third-party SDK misuse |
Only report issues caused or exposed by the diff. Pre-existing problems in unchanged surrounding code are out of scope unless the change makes them worse.
Phase 3 — Noise reduction
Before reporting, filter every candidate finding:
-
Linter dedup — if the repo has linter config (.eslintrc*, ruff.toml, pyproject [tool.ruff], .golangci.yml, etc.) and the finding matches a rule that tooling enforces, drop it. When cheap, run the linter on the changed files and drop any finding it already reports.
-
False-positive cache — compute each finding's suppression hash and check the cache:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/fp_cache.py check <file> <vector> "<message>"Exit code 0 = suppressed (a human previously marked this pattern as a false positive or intentional choice) — silently drop it. The cache lives at
.ferret/review-cache.jsonin the repo root. -
Confidence calibration — assign per
references/detection-vectors.md:- HIGH: you can trace the exact failing input/state through the code; structural proof, not suspicion.
- MEDIUM: the defect pattern is present but an unseen invariant elsewhere could make it safe.
- LOW: plausible smell that needs human judgment. Report LOW findings only in full reviews, never in pre-commit mode.
If nothing survives filtering, say so plainly — a clean report is a valid result.
Phase 4 — Output
Format every finding per references/output-schema.md: severity tier
(CRITICAL / WARNING / SUGGESTION), vector, confidence, clickable
path/to/file.py:45:12 location, a one-line message, a short explanation of the
failure scenario, and a ready-to-apply unified diff patch whenever a safe fix
exists. Always write the machine-readable JSON findings file to
.ferret/last-review.json so /code-ferret:triage can pick it up.
Secret hygiene
Before echoing any code excerpt into a report, PR comment, or external payload,
scrub credentials: run bash ${CLAUDE_PLUGIN_ROOT}/scripts/scan-secrets.sh to
locate them, and replace any detected token with [REDACTED_SECRET] in your
output. Hardcoded secrets are themselves a CRITICAL/SECURITY finding — report
the location, never the value.
Light policy
When FERRET_LIGHT=1 (the CLI's --light), trade depth for speed:
- skip the installed-analyzer step entirely
- diff context is already reduced to
-U6bycollect-context.sh FERRET_FILE_HISTORYis absent — do not treat that as "no prior history"- analyze only the LOGIC and SECURITY vectors
Say in the report that the run was light, so a clean result is not mistaken for a full-depth pass.
Oversized scopes
The CLI refuses a scope larger than the FERRET_MAX_FILES env var (default
50) before invoking any agent, and suggests up to five narrower re-run
commands. It never splits or retries automatically. .codeferret.yaml's
reviews.max_files documents the same intent for the config file but is not
currently read by the CLI (which has zero runtime dependencies and no YAML
parser) — only the env var takes effect today. This is separate from the
15-file guidance above, which applies to a review you are already performing: group hunks by directory and cover every one.