agentleFS
valperevalpere/session-indexer/.claude/skills/find-bugs/SKILL.md

find-bugs

Skill42 starsChanged 4 months agoApache-2.0View on GitHub

Read-only bug audit of the current branch vs a base ref. Dispatches subagents per stack (Go, JS/TS, etc.), consolidates findings, produces a prioritized report. Does not fix. Usage: /find-bugs [base-ref]

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use gcp-cloud-run, conversation-memory and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • xfstudioSkill

    gcp-cloud-run

    Specialized skill for building production-ready serverless applications on GCP. Covers Cloud Run services (containerized), Cloud Run Functions (event-driven), cold start optimization, and event-driven architecture with Pub/Sub.

    Also in 3 projects that use this

  • xfstudioSkill

    conversation-memory

    Persistent memory systems for LLM conversations including short-term, long-term, and entity-based memory Use when: conversation memory, remember, memory persistence, long-term memory, chat history.

    Also in 3 projects that use this

  • SentrySkill

    iterate-pr

    Iterate on a PR until actionable CI passes and high/medium review feedback is addressed. Use for PR CI failures, review feedback, or green-check loops; do not wait for human approval, draft status, or merge gates.

    Also in 3 projects that use this

  • xenitV1Skill

    powershell-windows

    PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.

    Also in 3 projects that use this

  • abdullah1854Skill

    context-optimization

    Also in 3 projects that use this

  • SentrySkill

    code-simplifier

    Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code", "refactor for clarity", "improve readability", or review recently modified code for elegance. Focuses on project-specific best practices.

    Also in 3 projects that use this

  • +1 more from getsentry

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If diff > 2000 lines: warn and ask if user wants to narrow scope (specific files or commits) before proceeding.

    line 42
  2. Very specific:

    Remove findings already caught by make lint / linter output

    line 112
  3. Distinctive:

    Remove "consider adding X" without concrete evidence in the diff

    line 113
  4. Distinctive:

    Read-only: No edits, no commits, no git checkout.

    line 146

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: /find-bugs

Bug Audit — Read-Only

Audit the current branch for bugs without touching code. Produces a prioritized report; user decides what to fix.


Steps

Step 1 — Determine scope

BASE="${1:-main}"

# If on a feature branch: diff vs base
if git rev-parse --verify "$BASE" >/dev/null 2>&1; then
  DIFF=$(git diff "$BASE"...HEAD)
else
  if git rev-parse --verify --quiet HEAD~10 >/dev/null; then
    BASE=HEAD~10
  else
    BASE=$(git rev-list --max-parents=0 HEAD | tail -1)
  fi
  DIFF=$(git diff "$BASE"...HEAD)
fi

# Fallback: on main with no base arg → recent commits
if [[ -z "$DIFF" ]]; then
  DIFF=$(git log --since='2 weeks ago' -p --no-merges)
fi

echo "Auditing $(git rev-parse --abbrev-ref HEAD) vs $BASE"
echo "Diff size: $(echo "$DIFF" | wc -l) lines"

If diff > 2000 lines: warn and ask if user wants to narrow scope (specific files or commits) before proceeding.

Step 2 — Read project context

head -100 CLAUDE.md 2>/dev/null
cat .claude/context-essentials.md 2>/dev/null

# Detect stack
cat go.mod 2>/dev/null | head -3
cat package.json 2>/dev/null | jq -r '(.dependencies // {}) + (.devDependencies // {}) | keys | join(", ")' 2>/dev/null

# Changed files by type
git diff "$BASE"...HEAD --name-only | sort

Step 3 — Dispatch stack-aware subagents

Dispatch in parallel based on detected stack. Each subagent gets:

  • The full diff
  • Project context (CLAUDE.md / context-essentials.md excerpt)
  • Stack-specific checklist (below)

Always dispatch — Generic bug finder:

Checklist:

  • Null/nil dereference on unchecked return values
  • Resource leaks (files, connections, goroutines not closed/cancelled)
  • Unhandled errors silently discarded (_ = err, bare catch {})
  • Off-by-one in loops, slice bounds, index arithmetic
  • Race conditions: shared mutable state accessed from goroutines/async
  • Incorrect error propagation (wrapping lost, status code swallowed)
  • Context not propagated into blocking calls
  • Missing timeout on external calls (HTTP, DB, queue)

If .go files changed — Go reviewer:

Additional checklist:

  • defer f.Close() missing after open (cursor/file leak)
  • sync.Mutex copied by value
  • go func() capturing loop variable by reference (pre-Go 1.22)
  • http.Response.Body not closed
  • context.WithCancel leak (cancel not called on all paths)
  • Integer overflow in slice/index math
  • iota misuse in const blocks

If .ts / .tsx / .js files changed — JS/TS reviewer:

Additional checklist:

  • await missing on async calls (fire-and-forget)
  • Unhandled promise rejection
  • useEffect missing dependency array or stale closure
  • JSON.parse without try/catch
  • Type assertion as X hiding runtime mismatch
  • undefined access on optional chaining result used as non-optional

If DB/ORM files changed (any stack) — DB reviewer:

Additional checklist:

  • Query result not closed / cursor leak
  • Missing transaction rollback on error path
  • N+1 query pattern introduced
  • Unique constraint not enforced at app level (only in migration)
  • Index missing for new filter/sort introduced in diff

Step 4 — Consolidate

Merge all subagent reports:

  • Deduplicate by (file, line) — keep highest severity, merge bodies
  • Remove findings already caught by make lint / linter output
  • Remove "consider adding X" without concrete evidence in the diff

Step 5 — Report

# Bug audit — <branch> vs <base> — <date>

## Critical — block merge
- `file.go:42` **nil deref**: `resp.Body` read before nil check after `http.Get` error path.
  Fix: check `err != nil` before using `resp`.

## High
- ...

## Medium
- ...

## Low / nits
- ...

---
Findings: <N> total (<critical> critical, <high> high, <medium> medium, <low> low)

Save to /tmp/<project>-bugs-<short-sha>.md and print inline.

Final message:

"<N> findings. Address with Edit or a dedicated fix subagent."


Constraints

  • Read-only. No edits, no commits, no git checkout.
  • Cite file:line for every finding — no location = skip it.
  • Differentiate certainty: "definite bug" vs "potential hazard" vs "worth checking".
  • Severity guide:

    LevelDefinition
    CriticalDefinite crash, data corruption, or security hole in the diff
    HighLikely bug under realistic conditions; resource leak
    MediumPotential bug; depends on caller contract not visible in diff
    LowMinor hazard, defensive improvement, nit

Anti-patterns

  • ❌ Generic "consider adding error handling" without showing which call and why.
  • ❌ Severity inflation — not everything is critical.
  • ❌ Reproducing what make lint / go vet already reports.
  • ❌ Flagging code not present in the diff.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.