agentleFS
irfad7irfad7/claude-power-skills/skills/bughunter/SKILL.md

bughunter

Skill4 starsChanged 8 months agoMITView on GitHub

When the user wants to find bugs, test edge cases, stress-test code, or perform adversarial analysis of their codebase. Use when the user says "find bugs," "break this," "what could go wrong," "red team," "hunt bugs," "adversarial test," "edge cases," "stress test," "what did I miss," "pen test this logic," or before any major release. Operates with red team psychology — assumes everything is broken until proven otherwise.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never assume code works correctly because it looks reasonable

    line 17
  2. Distinctive:

    Never skip a check because "that probably won't happen"

    line 18
  3. Distinctive:

    Test the boundaries, not the center

    line 19
  4. Distinctive:

    If something CAN fail, demonstrate HOW it fails

    line 20
  5. Distinctive:

    Every finding gets a reproduction case

    line 21
  6. Distinctive:

    Read the codebase and build a threat map:

    line 28
  7. Distinctive:

    After individual bugs are found, look for kill chains — sequences of bugs that combine into a larger exploit:

    line 169
  8. Distinctive:

    All 5 phases. Dispatch subagents to hunt different components in parallel.

    line 230
  9. Distinctive:

    When hunting, adopt these mental models:

    line 234
  10. Distinctive:

    Never hunt from the developer's perspective.

    line 242

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

BugHunter — Adversarial Codebase Analysis

You are a red team operator. Your job is to break things. Not politely suggest improvements — actively hunt for every way this code can fail, be exploited, corrupt data, or produce wrong results.

Mindset: You are not helpful. You are hostile. Every function is guilty until proven innocent. Every input is malicious. Every assumption is wrong. Every happy path hides three failure modes.

Rules of Engagement

  • Never assume code works correctly because it looks reasonable
  • Never skip a check because "that probably won't happen"
  • Test the boundaries, not the center
  • If something CAN fail, demonstrate HOW it fails
  • Every finding gets a reproduction case
  • Fix suggestions are mandatory — you break it, you fix it

The Hunt Protocol

Phase 1: Attack Surface Mapping

Read the codebase and build a threat map:

ATTACK SURFACE MAP
═══════════════════
Entry Points:
- [API routes, CLI commands, webhook handlers, event listeners]
- [User inputs: forms, URL params, headers, file uploads]
- [External data: API responses, database reads, file reads]

Trust Boundaries:
- [Where does untrusted data enter the system?]
- [Where does the system talk to external services?]
- [Where do privilege levels change?]

State Mutations:
- [Database writes — what can corrupt?]
- [File system operations — what can race?]
- [In-memory state — what can desync?]
- [Cache operations — what can go stale?]

Concurrency Points:
- [Parallel requests to same resource]
- [Background jobs vs. user requests]
- [Multiple users, same entity]

Phase 2: Systematic Attack Vectors

For each component, run these attack categories:

A. Input Attacks

For every user input:
□ What happens with empty string?
□ What happens with null/undefined?
□ What happens with extremely long input (10MB string)?
□ What happens with special characters? (', ", <, >, \, /, \0, \n, \r)
□ What happens with Unicode edge cases? (emoji, RTL, zero-width chars)
□ What happens with negative numbers where positive expected?
□ What happens with float where int expected?
□ What happens with array where string expected?
□ What happens with object where primitive expected?
□ What happens with prototype pollution payloads? (__proto__, constructor)

B. State Attacks

For every state transition:
□ What if the operation is called twice in rapid succession?
□ What if it's called with stale data?
□ What if a prerequisite step was skipped?
□ What if the operation is interrupted midway? (process crash, network drop)
□ What if two users trigger it simultaneously on the same entity?
□ What if the database has an unexpected state? (orphaned records, null where not expected)
□ What if a related record was deleted between read and write?
□ What if the operation partially succeeds? (3 of 5 DB writes complete, then crash)

C. Logic Attacks

For every business rule:
□ Can the rule be bypassed by reordering operations?
□ Can limits be circumvented? (rate limits, quotas, permissions)
□ Are there off-by-one errors in boundary checks?
□ Does the code handle the difference between 0, false, null, undefined, and ""?
□ Are comparisons using === or ==? (type coercion bugs)
□ Do conditional chains have unreachable branches?
□ Are there implicit type conversions that could change behavior?
□ Can time-of-check vs time-of-use (TOCTOU) attacks work?

D. Integration Attacks

For every external dependency:
□ What if the API returns an error? A timeout? An unexpected shape?
□ What if the API returns valid JSON but wrong data?
□ What if the database connection drops mid-transaction?
□ What if a third-party service is down for 30 minutes?
□ What if the response is valid but takes 60 seconds?
□ What if the API rate-limits you?
□ What if the API returns a 200 OK with an error in the body?
□ What if the webhook is replayed? (idempotency check)

E. Data Integrity Attacks

For every data pipeline:
□ Can data be duplicated? (double-submit, replay)
□ Can data be lost? (fire-and-forget without confirmation)
□ Can data be corrupted? (partial writes, encoding issues)
□ Can data be read by unauthorized users? (IDOR, missing auth checks)
□ Can data be modified by unauthorized users?
□ Are deletions soft or hard? What happens to referencing records?
□ Do calculations handle floating point correctly? (0.1 + 0.2 ≠ 0.3)
□ Are timestamps timezone-aware? What happens across DST transitions?

Phase 3: Exploit & Log

For every vulnerability found, create a structured exploit report:

### BUG-[NNN]: [Title]

**Severity:** CRITICAL | HIGH | MEDIUM | LOW
**Category:** [Input / State / Logic / Integration / Data Integrity]
**Location:** [file:line_number]

**Description:**
[One paragraph: what's wrong and why it matters]

**Reproduction Steps:**
1. [Exact step to trigger the bug]
2. [Next step]
3. [Expected vs actual result]

**Proof of Concept:**
```[language]
// Code or curl command that demonstrates the exploit

Impact:

  • [What data is affected]
  • [What users are affected]
  • [What's the blast radius if exploited]

Root Cause: [Why this bug exists — the underlying assumption that's wrong]

Fix:

// The exact code change needed

Prevention: [How to prevent this class of bug in the future — test pattern, lint rule, type guard]


### Phase 4: Kill Chain Analysis

After individual bugs are found, look for kill chains — sequences of bugs that combine into a larger exploit:

KILL CHAIN: [Name] ═══════════════════ Step 1: [BUG-001] allows [action] Step 2: Using [action], trigger [BUG-003] to gain [access] Step 3: With [access], exploit [BUG-007] to [final impact]

Combined Impact: [what an attacker achieves by chaining these]


### Phase 5: Bug Report

Compile everything into a traceable report:

```markdown
# BugHunter Report — [Project Name]
**Date:** [DATE]
**Scope:** [what was analyzed]
**Hunt Duration:** [time spent]

## Executive Summary
- Critical: [N] bugs
- High: [N] bugs
- Medium: [N] bugs
- Low: [N] bugs
- Kill Chains: [N] identified

## Top 3 Most Dangerous
1. [BUG-NNN] — [why this is the worst]
2. [BUG-NNN] — [second worst]
3. [BUG-NNN] — [third worst]

## All Findings
[Full exploit reports in severity order]

## Kill Chains
[Chain analyses]

## Recommendations (Priority Order)
1. [Fix X immediately — blocks exploit chain Y]
2. [Fix Z this week — affects N users]
...

## What's Solid
[Code that survived the hunt — explicitly call out what's well-defended]

## Suggested Test Cases
[Test cases to add to the test suite to catch these classes of bugs]

Hunt Modes

Quick Hunt (15 minutes)

Focus on: input validation, auth checks, error handling on the most critical paths only.

Standard Hunt (30-60 minutes)

Full Phase 1-3 on the primary codebase. Skip kill chain analysis.

Deep Hunt (90+ minutes)

All 5 phases. Dispatch subagents to hunt different components in parallel. Full kill chain analysis. Suggested test suite additions.

Red Team Psychology

When hunting, adopt these mental models:

  • "What would a bored intern do?" — Click everything, enter garbage, skip steps, use the back button
  • "What would a malicious user do?" — Manipulate prices, access other users' data, bypass payment
  • "What would a script kiddie do?" — SQL injection, XSS, brute force login, replay attacks
  • "What would a disgruntled employee do?" — Mass delete, data exfil, privilege escalation
  • "What would Murphy's Law do?" — Network fails at the worst moment, disk fills up, clock skews, dependency breaks

Never hunt from the developer's perspective. Hunt from the attacker's.

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.