Fuzz Target Localizer
Purpose
This skill helps an agent quickly narrow a Python repository down to a small set of high-value fuzz targets. It produces:
- A ranked list of important files
- A ranked list of important functions and methods
- A summary of existing unit tests and inferred oracles
- A final shortlist of functions-under-test (FUTs) for fuzzing, each with a structured "note to self" for follow-up actions
When to use
Use this skill when the user asks to:
- Find the best functions to fuzz in a Python package/library
- Identify parsers, decoders, validators, or boundary code that is fuzz-worthy
- Decide what to fuzz based on existing test coverage and API surface
- Produce a structured shortlist of fuzz targets with harness guidance
- Automating testing pipeline setup for a new or existing Python project.
Do not use this skill when the user primarily wants to fix a specific bug,
refactor code, or implement a harness immediately
(unless they explicitly ask for target selection first).
Inputs expected from the environment
The agent should assume access to:
- Repository filesystem
- Ability to read files
- Ability to run local commands (optional but recommended)
Preferred repository listing command:
- Use
tree to get a fast, high-signal view of repository structure (limit depth if needed).
If tree is not available, fall back to a recursive listing via other standard shell tooling.
Outputs
Produce result:
A report in any format with the following information: - Localize important files - Localize important functions - Summarize existing unit tests - Decide function under test for fuzzing
This file should be placed in the root of the repository as APIs.txt,
which servers as the guidelines for future fuzzing harness implementation.
Guardrails
- Prefer analysis and reporting over code changes.
- Do not modify source code unless the user explicitly requests changes.
- If running commands could be disruptive, default to read-only analysis.
- Avoid assumptions about runtime behavior; base conclusions on code and tests.
- Explicitly consider existing tests in the repo when selecting targets and deciding harness shape.
- Keep the final FUT shortlist small (typically 1–5).
Localize important files
Goal
Produce a ranked list of files that are most likely to contain fuzz-worthy logic: parsing, decoding, deserialization, validation, protocol handling, file/network boundaries, or native bindings.
Procedure
Build a repository map
- Start with a repository overview using
tree to identify:
- Root packages and layouts (src/ layout vs flat layout)
- Test directories and configs
- Bindings/native directories
- Examples, docs, and tooling directories
- Identify packaging and metadata files such as:
- pyproject.toml
- setup.cfg
- setup.py
- Identify test configuration and entry points:
- tests/
- conftest.py
- pytest.ini
- tox.ini
- noxfile.py
Exclude low-value areas
- Skip: virtual environments, build outputs, vendored code, documentation-only directories, examples-only directories, generated files.
Score files using explainable heuristics
Assign a file a higher score when it matches more of these indicators:
- Public API exposure: init.py re-exports, all, api modules
- Input boundary keywords in file path or symbols: parse, load, dump, decode, encode, deserialize, serialize, validate, normalize, schema, protocol, message
- Format handlers: json, yaml, xml, csv, toml, protobuf, msgpack, pickle
- Regex-heavy or templating-heavy code
- Native boundaries: ctypes, cffi, cython, extension modules, bindings
- Central modules: high import fan-in across the package
- Test adjacency: directly imported or heavily referenced by tests
Rank and select
- Produce a Top-N list (default 10–30) with a short rationale per file.
Output format
For each file:
- path
- score (relative, not necessarily normalized)
- rationale (2–5 bullets)
- indicators_hit (list)
Localize important functions
Goal
From the important files, identify and rank functions or methods that are strong fuzz targets while minimizing full-body reading until needed.
Approach 1: AST-based header and docstring scan
For each localized Python file, parse it using Python’s ast module and extract only:
- Module docstring
- Function and async function headers (name, args, defaults, annotations, decorators)
- Class headers and method headers
- Docstrings for modules, classes, and functions/methods
Do not read full function bodies during the initial pass unless needed for disambiguation or final selection.
Procedure
Build per-file declarations via AST
- Parse the file with
ast
- Enumerate:
- Top-level functions
- Classes and their methods
- Nested functions only if they are likely to be directly fuzzable via an exposed wrapper
- For each symbol, collect:
- Fully-qualified name
- Signature details (as available from AST)
- Decorators
- Docstring (if present)
- Location information (file, line range if available)
Generate an initial candidate set using headers and docstrings
Prioritize functions/methods that:
- Accept bytes, str, file-like objects, dicts, or user-controlled payloads
- Convert between representations (raw ↔ structured)
- Perform validation, normalization, parsing, decoding, deserialization
- Touch filesystem/network/protocol boundaries
- Call into native extensions or bindings
- Clearly document strictness, schemas, formats, or error conditions
Use tests to refine candidate selection early
- Before reading full bodies, check if tests reference these functions/modules:
- Direct imports in tests
- Fixtures that exercise particular entry points
- Parameterizations over formats and inputs
- Down-rank candidates that are already well-covered unless they are high-risk boundaries (parsers/native bindings).
Confirm with targeted reading only for top candidates
For the top candidates (typically 10–20), read the full function bodies and capture:
- Preconditions and assumptions
- Internal helpers called
- Error handling style and exception types
- Any obvious invariants and postconditions
- Statefulness and global dependencies
Rank and shortlist
Rank candidates using an explainable rubric:
- Input surface and reachability
- Boundary risk (parsing/decoding/native)
- Structural complexity (from targeted reading only)
- Existing test coverage strength and breadth
- Ease of harnessing
Output format
For each function/method:
- qualname
- file
- line_range (if available)
- score (relative)
- rationale (2–6 bullets)
- dependencies (key helpers, modules, external state)
- harnessability (low/medium/high)
Approach 2: Scanning all important files yourself
For each localized Python file, read the file contents directly to extract:
- Module docstring and overall structure
- Function and async function definitions (name, args, defaults, annotations, decorators)
- Class definitions and their methods
- Full function bodies and implementation details
- Docstrings for modules, classes, and functions/methods
This approach reads complete file contents, allowing for deeper analysis at the cost of higher token usage.
Procedure
Read important files sequentially
- For each file from the important files list, read the full contents.
- Extract by direct inspection:
- Top-level functions and their complete implementations
- Classes and their methods with full bodies
- Nested functions if they are exposed or called by public APIs
- For each symbol, collect:
- Fully-qualified name
- Complete signature (from source text)
- Decorators
- Docstring (if present)
- Full function body
- Location information (file, approximate line range)
Generate an initial candidate set using full source analysis
Prioritize functions/methods that:
- Accept bytes, str, file-like objects, dicts, or user-controlled payloads
- Convert between representations (raw ↔ structured)
- Perform validation, normalization, parsing, decoding, deserialization
- Touch filesystem/network/protocol boundaries
- Call into native extensions or bindings
- Contain complex control flow, loops, or recursive calls
- Handle exceptions or edge cases
- Clearly document strictness, schemas, formats, or error conditions
Analyze implementation details from full bodies
For each candidate function, inspect the body for:
- Preconditions and assumptions (explicit checks, assertions, early returns)
- Internal helpers called and their purposes
- Error handling style and exception types raised
- Invariants and postconditions (explicit or implicit)
- Statefulness and global dependencies
- Input transformations and data flow
- Native calls or external process invocations
- Resource allocation and cleanup patterns
Use tests to refine candidate selection
- Check if tests reference these functions/modules:
- Direct imports in tests
- Fixtures that exercise particular entry points
- Parameterizations over formats and inputs
- Down-rank candidates that are already well-covered unless they are high-risk boundaries (parsers/native bindings).
- Note which aspects of each function are tested vs untested.
Rank and shortlist
Rank candidates using an explainable rubric:
- Input surface and reachability
- Boundary risk (parsing/decoding/native)
- Structural complexity (from full body analysis)
- Existing test coverage strength and breadth
- Ease of harnessing
- Observable implementation risks (unsafe operations, unchecked inputs, complex state)
Output format
For each function/method:
- qualname
- file
- line_range (if available)
- score (relative)
- rationale (2–6 bullets)
- dependencies (key helpers, modules, external state)
- harnessability (low/medium/high)
- implementation_notes (key observations from body analysis)
Summarize existing unit tests
Goal
Summarize what is already tested, infer test oracles, and identify gaps that fuzzing can complement.
Hard requirement
Always inspect and incorporate existing tests in the repository when:
- Ranking functions
- Selecting FUTs
- Designing input models and oracles
- Proposing seed corpus sources
Procedure
Inventory tests
- Locate tests and their discovery configuration (pytest.ini, pyproject.toml, tox.ini, noxfile.py).
- Enumerate test modules and map them to source modules via imports.
- Identify shared fixtures and data factories (conftest.py, fixture files, test utilities).
Summarize test intent
For each test module:
- What behaviors are asserted
- What inputs are used
- What exceptions are expected
- What invariants are implied
Infer oracles and properties
Common fuzz-friendly oracles include:
- Round-trip properties
- Idempotence of normalization
- Parser consistency across equivalent inputs
- Deterministic output given deterministic input
- No-crash and no-hang for malformed inputs
Identify coverage gaps
- FUT candidates with no direct tests
- Input classes not covered by tests (size extremes, malformed encodings, deep nesting, edge unicode, invalid schemas)
- Code paths guarded by complex conditionals or exception handlers with no tests
Output format
- test_map: module_under_test → tests → asserted behaviors
- inferred_oracles: list of reusable invariants with the functions they apply to
- gaps: ranked list of untested or weakly-tested candidates
Decide function under test for fuzzing
Goal
Select a final set of FUTs (typically 1–5) and produce a structured "note to self" for each FUT so the agent can proceed to harness implementation, corpus seeding, and fuzz execution.
Selection criteria
Prefer FUTs that maximize:
- Security/robustness payoff (parsing, decoding, validation, native boundary)
- Reachability with minimal setup
- Low existing test assurance or narrow test input coverage
- High fuzzability (simple input channel, clear oracle or crash-only target)
Explicitly weigh:
- What tests already cover (and what they do not)
- What seeds can be extracted from tests, fixtures, and sample data
Required "note to self" template
For each selected FUT, produce exactly this structure:
Fuzzing Target Note
- Target:
- File / location:
- Why this target:
- Input surface:
- Boundary or native considerations:
- Complexity or path depth:
- Current test gaps:
- Callable contract:
- Required imports or initialization:
- Preconditions:
- Determinism concerns:
- External dependencies:
- Input model:
- Primary payload type:
- Decoding or parsing steps:
- Constraints to respect:
- Edge classes to emphasize:
- Oracles:
- Must-hold properties:
- Acceptable exceptions:
- Suspicious exceptions:
- Crash-only vs correctness-checking:
- Harness plan:
- Recommended approach:
- Minimal harness signature:
- Seed corpus ideas:
- Timeouts and resource limits:
- Risk flags:
- Native extension involved:
- Potential DoS paths:
- External I/O:
- Next actions:
Output format
- selected_futs: list of chosen FUTs with brief justification
- notes_to_self: one "Fuzzing Target Note" per FUT
Final JSON block
At the end of the report, include a JSON object with:
- important_files: [{path, score, rationale, indicators_hit}]
- important_functions: [{qualname, file, line_range, score, rationale, dependencies, harnessability}]
- test_summary: {test_map, inferred_oracles, gaps}
- selected_futs: [{qualname, file, line_range, justification}]
- notes_to_self: [{target_qualname, note}]
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: discover-important-function3description: When given a project codebase, this skill observes the important functions in the codebase for future action. Use when this capability is needed.4---56# Fuzz Target Localizer78## Purpose910This skill helps an agent quickly narrow a Python repository down to a small set of high-value fuzz targets. It produces:1112- A ranked list of important files13- A ranked list of important functions and methods14- A summary of existing unit tests and inferred oracles15- A final shortlist of functions-under-test (FUTs) for fuzzing, each with a structured "note to self" for follow-up actions1617## When to use1819Use this skill when the user asks to:2021- Find the best functions to fuzz in a Python package/library22- Identify parsers, decoders, validators, or boundary code that is fuzz-worthy23- Decide what to fuzz based on existing test coverage and API surface24- Produce a structured shortlist of fuzz targets with harness guidance25- Automating testing pipeline setup for a new or existing Python project.2627Do not use this skill when the user primarily wants to fix a specific bug,28refactor code, or implement a harness immediately29(unless they explicitly ask for target selection first).3031## Inputs expected from the environment3233The agent should assume access to:3435- Repository filesystem36- Ability to read files37- Ability to run local commands (optional but recommended)3839Preferred repository listing command:4041- Use `tree` to get a fast, high-signal view of repository structure (limit depth if needed).4243If `tree` is not available, fall back to a recursive listing via other standard shell tooling.4445## Outputs4647Produce result:4849A report in any format with the following information: - Localize important files - Localize important functions - Summarize existing unit tests - Decide function under test for fuzzing50This file should be placed in the root of the repository as `APIs.txt`,51which servers as the guidelines for future fuzzing harness implementation.5253## Guardrails5455- Prefer analysis and reporting over code changes.56- Do not modify source code unless the user explicitly requests changes.57- If running commands could be disruptive, default to read-only analysis.58- Avoid assumptions about runtime behavior; base conclusions on code and tests.59- Explicitly consider existing tests in the repo when selecting targets and deciding harness shape.60- Keep the final FUT shortlist small (typically 1–5).6162---6364# Localize important files6566## Goal6768Produce a ranked list of files that are most likely to contain fuzz-worthy logic: parsing, decoding, deserialization, validation, protocol handling, file/network boundaries, or native bindings.6970## Procedure71721. Build a repository map73 - Start with a repository overview using `tree` to identify:74 - Root packages and layouts (src/ layout vs flat layout)75 - Test directories and configs76 - Bindings/native directories77 - Examples, docs, and tooling directories78 - Identify packaging and metadata files such as:79 - pyproject.toml80 - setup.cfg81 - setup.py82 - Identify test configuration and entry points:83 - tests/84 - conftest.py85 - pytest.ini86 - tox.ini87 - noxfile.py88892. Exclude low-value areas90 - Skip: virtual environments, build outputs, vendored code, documentation-only directories, examples-only directories, generated files.91923. Score files using explainable heuristics93 Assign a file a higher score when it matches more of these indicators:94 - Public API exposure: **init**.py re-exports, **all**, api modules95 - Input boundary keywords in file path or symbols: parse, load, dump, decode, encode, deserialize, serialize, validate, normalize, schema, protocol, message96 - Format handlers: json, yaml, xml, csv, toml, protobuf, msgpack, pickle97 - Regex-heavy or templating-heavy code98 - Native boundaries: ctypes, cffi, cython, extension modules, bindings99 - Central modules: high import fan-in across the package100 - Test adjacency: directly imported or heavily referenced by tests1011024. Rank and select103 - Produce a Top-N list (default 10–30) with a short rationale per file.104105## Output format106107For each file:108109- path110- score (relative, not necessarily normalized)111- rationale (2–5 bullets)112- indicators_hit (list)113114---115116# Localize important functions117118## Goal119120From the important files, identify and rank functions or methods that are strong fuzz targets while minimizing full-body reading until needed.121122## Approach 1: AST-based header and docstring scan123124For each localized Python file, parse it using Python’s `ast` module and extract only:125126- Module docstring127- Function and async function headers (name, args, defaults, annotations, decorators)128- Class headers and method headers129- Docstrings for modules, classes, and functions/methods130131Do not read full function bodies during the initial pass unless needed for disambiguation or final selection.132133### Procedure1341351. Build per-file declarations via AST136 - Parse the file with `ast`137 - Enumerate:138 - Top-level functions139 - Classes and their methods140 - Nested functions only if they are likely to be directly fuzzable via an exposed wrapper141 - For each symbol, collect:142 - Fully-qualified name143 - Signature details (as available from AST)144 - Decorators145 - Docstring (if present)146 - Location information (file, line range if available)1471482. Generate an initial candidate set using headers and docstrings149 Prioritize functions/methods that:150 - Accept bytes, str, file-like objects, dicts, or user-controlled payloads151 - Convert between representations (raw ↔ structured)152 - Perform validation, normalization, parsing, decoding, deserialization153 - Touch filesystem/network/protocol boundaries154 - Call into native extensions or bindings155 - Clearly document strictness, schemas, formats, or error conditions1561573. Use tests to refine candidate selection early158 - Before reading full bodies, check if tests reference these functions/modules:159 - Direct imports in tests160 - Fixtures that exercise particular entry points161 - Parameterizations over formats and inputs162 - Down-rank candidates that are already well-covered unless they are high-risk boundaries (parsers/native bindings).1631644. Confirm with targeted reading only for top candidates165 For the top candidates (typically 10–20), read the full function bodies and capture:166 - Preconditions and assumptions167 - Internal helpers called168 - Error handling style and exception types169 - Any obvious invariants and postconditions170 - Statefulness and global dependencies1711725. Rank and shortlist173 Rank candidates using an explainable rubric:174 - Input surface and reachability175 - Boundary risk (parsing/decoding/native)176 - Structural complexity (from targeted reading only)177 - Existing test coverage strength and breadth178 - Ease of harnessing179180### Output format181182For each function/method:183184- qualname185- file186- line_range (if available)187- score (relative)188- rationale (2–6 bullets)189- dependencies (key helpers, modules, external state)190- harnessability (low/medium/high)191192## Approach 2: Scanning all important files yourself193194For each localized Python file, read the file contents directly to extract:195196- Module docstring and overall structure197- Function and async function definitions (name, args, defaults, annotations, decorators)198- Class definitions and their methods199- Full function bodies and implementation details200- Docstrings for modules, classes, and functions/methods201202This approach reads complete file contents, allowing for deeper analysis at the cost of higher token usage.203204### Procedure2052061. Read important files sequentially207 - For each file from the important files list, read the full contents.208 - Extract by direct inspection:209 - Top-level functions and their complete implementations210 - Classes and their methods with full bodies211 - Nested functions if they are exposed or called by public APIs212 - For each symbol, collect:213 - Fully-qualified name214 - Complete signature (from source text)215 - Decorators216 - Docstring (if present)217 - Full function body218 - Location information (file, approximate line range)2192202. Generate an initial candidate set using full source analysis221 Prioritize functions/methods that:222 - Accept bytes, str, file-like objects, dicts, or user-controlled payloads223 - Convert between representations (raw ↔ structured)224 - Perform validation, normalization, parsing, decoding, deserialization225 - Touch filesystem/network/protocol boundaries226 - Call into native extensions or bindings227 - Contain complex control flow, loops, or recursive calls228 - Handle exceptions or edge cases229 - Clearly document strictness, schemas, formats, or error conditions2302313. Analyze implementation details from full bodies232 For each candidate function, inspect the body for:233 - Preconditions and assumptions (explicit checks, assertions, early returns)234 - Internal helpers called and their purposes235 - Error handling style and exception types raised236 - Invariants and postconditions (explicit or implicit)237 - Statefulness and global dependencies238 - Input transformations and data flow239 - Native calls or external process invocations240 - Resource allocation and cleanup patterns2412424. Use tests to refine candidate selection243 - Check if tests reference these functions/modules:244 - Direct imports in tests245 - Fixtures that exercise particular entry points246 - Parameterizations over formats and inputs247 - Down-rank candidates that are already well-covered unless they are high-risk boundaries (parsers/native bindings).248 - Note which aspects of each function are tested vs untested.2492505. Rank and shortlist251 Rank candidates using an explainable rubric:252 - Input surface and reachability253 - Boundary risk (parsing/decoding/native)254 - Structural complexity (from full body analysis)255 - Existing test coverage strength and breadth256 - Ease of harnessing257 - Observable implementation risks (unsafe operations, unchecked inputs, complex state)258259### Output format260261For each function/method:262263- qualname264- file265- line_range (if available)266- score (relative)267- rationale (2–6 bullets)268- dependencies (key helpers, modules, external state)269- harnessability (low/medium/high)270- implementation_notes (key observations from body analysis)271272---273274# Summarize existing unit tests275276## Goal277278Summarize what is already tested, infer test oracles, and identify gaps that fuzzing can complement.279280## Hard requirement281282Always inspect and incorporate existing tests in the repository when:283284- Ranking functions285- Selecting FUTs286- Designing input models and oracles287- Proposing seed corpus sources288289## Procedure2902911. Inventory tests292 - Locate tests and their discovery configuration (pytest.ini, pyproject.toml, tox.ini, noxfile.py).293 - Enumerate test modules and map them to source modules via imports.294 - Identify shared fixtures and data factories (conftest.py, fixture files, test utilities).2952962. Summarize test intent297 For each test module:298 - What behaviors are asserted299 - What inputs are used300 - What exceptions are expected301 - What invariants are implied3023033. Infer oracles and properties304 Common fuzz-friendly oracles include:305 - Round-trip properties306 - Idempotence of normalization307 - Parser consistency across equivalent inputs308 - Deterministic output given deterministic input309 - No-crash and no-hang for malformed inputs3103114. Identify coverage gaps312 - FUT candidates with no direct tests313 - Input classes not covered by tests (size extremes, malformed encodings, deep nesting, edge unicode, invalid schemas)314 - Code paths guarded by complex conditionals or exception handlers with no tests315316## Output format317318- test_map: module_under_test → tests → asserted behaviors319- inferred_oracles: list of reusable invariants with the functions they apply to320- gaps: ranked list of untested or weakly-tested candidates321322---323324# Decide function under test for fuzzing325326## Goal327328Select a final set of FUTs (typically 1–5) and produce a structured "note to self" for each FUT so the agent can proceed to harness implementation, corpus seeding, and fuzz execution.329330## Selection criteria331332Prefer FUTs that maximize:333334- Security/robustness payoff (parsing, decoding, validation, native boundary)335- Reachability with minimal setup336- Low existing test assurance or narrow test input coverage337- High fuzzability (simple input channel, clear oracle or crash-only target)338339Explicitly weigh:340341- What tests already cover (and what they do not)342- What seeds can be extracted from tests, fixtures, and sample data343344## Required "note to self" template345346For each selected FUT, produce exactly this structure:347348Fuzzing Target Note349350- Target:351- File / location:352- Why this target:353 - Input surface:354 - Boundary or native considerations:355 - Complexity or path depth:356 - Current test gaps:357- Callable contract:358 - Required imports or initialization:359 - Preconditions:360 - Determinism concerns:361 - External dependencies:362- Input model:363 - Primary payload type:364 - Decoding or parsing steps:365 - Constraints to respect:366 - Edge classes to emphasize:367- Oracles:368 - Must-hold properties:369 - Acceptable exceptions:370 - Suspicious exceptions:371 - Crash-only vs correctness-checking:372- Harness plan:373 - Recommended approach:374 - Minimal harness signature:375 - Seed corpus ideas:376 - Timeouts and resource limits:377- Risk flags:378 - Native extension involved:379 - Potential DoS paths:380 - External I/O:381- Next actions:382 1.383 2.384 3.385 4.386387## Output format388389- selected_futs: list of chosen FUTs with brief justification390- notes_to_self: one "Fuzzing Target Note" per FUT391392---393394# Final JSON block395396At the end of the report, include a JSON object with:397398- important_files: [{path, score, rationale, indicators_hit}]399- important_functions: [{qualname, file, line_range, score, rationale, dependencies, harnessability}]400- test_summary: {test_map, inferred_oracles, gaps}401- selected_futs: [{qualname, file, line_range, justification}]402- notes_to_self: [{target_qualname, note}]403404---405> Converted and distributed by [TomeVault](https://tomevault.io/claim/benchflow-ai) — claim your Tome and manage your conversions.406<!-- tomevault:4.0:skill_md:2026-04-11 -->