بنقرة واحدة
synthesize
Generate complete fuzz scaffold artifacts aligned to selected targets and execution plan.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Generate complete fuzz scaffold artifacts aligned to selected targets and execution plan.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Classify reproduced crashes into harness bug, upstream bug, or inconclusive using evidence only.
Discover, update, and rank vulnerability candidates before execution planning.
Apply minimal evidence-driven build fixes in fuzz scaffold files for next build attempt.
Repair fuzz scaffold after build failures with strategy change and mapping consistency.
Repair scaffold for coverage replan cycles using seed and harness feedback as primary signals.
Re-plan targets and scaffold strategy after build-stage failures using diagnostic-first reasoning.
| name | synthesize |
| description | Generate complete fuzz scaffold artifacts aligned to selected targets and execution plan. |
| compatibility | opencode |
| metadata | {"stage":"synthesize","owner":"tianheng"} |
Builds a complete fuzz/ scaffold from planning artifacts, including harness source, build script, and runtime facts.
Use this skill in the primary synthesize stage after plan.
fuzz/targets.json (extra harnesses are rejected).LLVMFuzzerTestOneInput, no custom main(), no
argv/file-driven input. (See LibFuzzer harness contract.)repo_understanding.json before ./done — all required fields
non-empty (see its template contract). A missing field fails the stage.Everything below is the detail behind these four. Coverage instrumentation
flags are added automatically by the build wrapper — you do NOT write
-fsanitize-coverage yourself.
fuzz/PLAN.mdfuzz/targets.jsonfuzz/execution_plan.json (if present)fuzz/selected_targets.json (if present)fuzz/analysis_context.json (if present)
analysis_evidence.vuln_candidate_inventory[] when availableattack_hint.trigger_condition, attack_hint.key_code_path, attack_hint.boundary_values, attack_hint.vuln_category, attack_hint.sanitizer_hintfuzz/observed_target.json (if present)list_definitions, read_definition, read_source, find_referencesrun_ast_preprocessor, extract_api_functions, build_library_callgraphinit_knowledge_base, retrieve_documents, comprehend_*fuzz/targets.json. Do NOT generate harnesses for arbitrary targets not in this file. Extra harnesses will be rejected by the execution plan validation.fuzz/ (*.c, *.cc, *.cpp, *.cxx, or *.java) before docs/json completionfuzz/build.py or fuzz/build.shfuzz/README.mdfuzz/repo_understanding.jsonfuzz/build_strategy.jsonfuzz/build_runtime_facts.jsonfuzz/harness_index.json aligned to fuzz/execution_plan.jsonattack_hint values to shape harness input flow and boundary-case seeds.harness-first contract).fuzz/repo_understanding.jsonbuild_systemchosen_target_apichosen_target_reasonfuzzer_entry_strategyevidence (non-empty array)chosen_target_api must be a target API identifier, not a harness path.fuzz/xxx_fuzz.cc, fuzz/xxx.c, xxx_fuzz.cpp, target_fuzz.java.build_system must not be unknown.evidence must be a non-empty string array.Minimal valid template:
{
"build_system": "cmake",
"chosen_target_api": "archive_read_open1",
"chosen_target_reason": "runtime-reachable parser entrypoint",
"fuzzer_entry_strategy": "sanitizer_fuzzer",
"evidence": [
"CMakeLists.txt defines a library target",
"selected target API appears in repository source"
]
}
fuzz/build.pyDEFAULT_CMAKE_ARGS = ["-DENABLE_TEST=OFF", "-DENABLE_INSTALL=OFF"]cmake binary (for example ["cmake", "-S", ...] and ["cmake", "--build", ...]); do not use sys.executable, "-m", "cmake" or python -m cmake["-j", str(os.cpu_count() or 1)]$(nproc) or shell substitutions-I{BUILD_DIR} for generated headers such as pnglibconf.h)main() must not be linked into libFuzzer harnesses unless rewritten/guarded-fsanitize=fuzzer,address,undefined (or equivalent sanitizer set including fuzzer); do not use -fsanitize=fuzzer-no-link for final binaries unless you also provide and link a valid fuzzer main-fsanitize-coverage flags yourself: the build wrapper injects libFuzzer coverage instrumentation into every compile automatically (and normalizes any deprecated trace-pc-guard). Just write a normal compile/link.fuzz/out/<name>, also build a coverage replay sibling at fuzz/out/replay/<name> with -fprofile-instr-generate -fcoverage-mappingCFLAGS/CXXFLAGS containing -fprofile-instr-generate -fcoverage-mappingclang/clang++ (for example -DCMAKE_C_COMPILER=clang and -DCMAKE_CXX_COMPILER=clang++, or CC=clang CXX=clang++); do not pass LLVM coverage flags to /usr/bin/cc/GCCsubprocess compile commands must start with the compiler executable (clang or clang++); append sanitizer/coverage flags after the compiler, never as cmd[0]-fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping; if you use -fsanitize=fuzzer-no-link, you must compile and link a separate replay main() wrapper that calls LLVMFuzzerTestOneInputExact static-lib discovery block:
def find_static_lib(repo_root):
import subprocess
result = subprocess.run(
["find", str(repo_root), "-name", "*.a", "-type", "f"],
capture_output=True, text=True, timeout=60
)
if result.returncode != 0:
return None
for p in result.stdout.strip().split("\n"):
p = Path(p)
if "test" not in p.name.lower() and p.exists():
return p
return None
Compiler-by-suffix rule:
clang for .c sourcesclang++ for .cc, .cpp, .cxx sourcesclang++ by defaultdetail, _internal, impl, private) by default.api_surface_exception in fuzz/repo_understanding.json with non-empty reason and evidence (optional approved_symbols).Many target APIs operate on an object/handle that must be fully configured
before the call does any real work. A harness that calls the target with an
unconfigured/empty context compiles and runs but exercises almost nothing —
the hallmark is code coverage frozen at a trivial value (e.g. cov/ft
stuck below ~15) across millions of executions while the fuzzer never grows
its corpus. Treat such a harness as broken.
Before calling the target API, the harness MUST construct a valid, populated input object using the library's own setup sequence:
ts_parser_set_language(parser, tree_sitter_<grammar>()) is
REQUIRED before ts_parser_parse_string(...); without it the tree is empty,
ts_node_child_count(root) is 0, and every input short-circuits. Link a
concrete grammar (e.g. an available tree-sitter-<lang>/grammar object) so
the parse produces a non-trivial tree, then exercise the node/cursor target
on that tree.Rules:
fuzz/repo_understanding.json (chosen_target_reason / evidence) and
pick a target whose context can be constructed from the available sources,
rather than shipping a harness that cannot reach real code.*_wasm, marshal-buffer indirection) in place of the real public API; those
paths bypass the parse/decode the fuzzer needs to drive.fuzz/ and ./done.fuzz/repo_understanding.json.fuzz/harness_index.json.attack_hint.key_code_path is present, prefer harness call flow that reaches those functions instead of generic wrapper paths.attack_hint.boundary_values is present, reflect them in corpus/bootstrap seed strategy and parser field choices.main() in harness source;LLVMFuzzerTestOneInput (or language-equivalent fuzz entrypoint) as the only fuzz entry.uint8_t or size_t must include the standard headers that define them (<stdint.h> and <stddef.h> or C++ equivalents) in the harness source.fuzz/out/, including fuzz/out/replay/<name>, must link a runnable entrypoint; prefer -fsanitize=fuzzer,address,undefined for both primary and replay executables. -fsanitize=fuzzer-no-link alone is only valid for objects/libraries, or for replay executables that compile and link a separate main() wrapper that calls LLVMFuzzerTestOneInput.fopen(argv[1], ...), read(argv[1], ...), manual corpus file loops).Read and fix <path>[:line] before broader edits.fuzz/repo_understanding.json.fuzz/harness_index.json maps each execution target to an existing harness source file.Harness file: points to a real harness file.fuzz/repo_understanding.json is semantically valid and complete. Before writing ./done, re-read it and confirm ALL of these keys are present and non-empty: build_system (not unknown), chosen_target_api (an API identifier, not a harness path), chosen_target_reason, fuzzer_entry_strategy, and a non-empty evidence array. A missing field fails the stage with synthesize incomplete: repo understanding missing <field> and forces a wasted replan — never finish synthesize with an incomplete repo_understanding.json.fuzz/out/replay/<name> exists for each built native fuzzer and can emit LLVM_PROFILE_FILE=...profraw during single-input replay.fuzz/out/ as the sole text of ./done (run echo 'fuzz/out/' > ./done; do not copy the file's contents).