nim-fuzzing
Set up and run libFuzzer-based fuzz targets for Nim code, including harness wiring, compilation flags, corpus management, structure-aware mutators, and crash…
Skill by Vyrnexis
Chalk Labs
Need help deploying nim-fuzzing?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/vyrnexis-nim-fuzzing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/nim-fuzzing
What's inside
- Skill name
nim-fuzzing- Description
- Set up and run libFuzzer-based fuzz targets for Nim code, including harness wiring, compilation flags, corpus management, structure-aware mutators, and crash triage. Use when adding fuzzing to a Nim project, building a fuzz harness for a parser/protocol/format handler, or reproducing and minimizing a fuzzer-found crash.
- License
- MIT
- Instructions
- 356 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- protocol_fuzzer.md · references/
- simple_byte_target.md · references/
- structure_aware_fuzzing.md · references/
SKILL.md (first lines)
# Nim Fuzzing
This skill covers wiring code to libFuzzer — harness structure, compilation, corpus, mutators, and crash triage. It does NOT cover writing the code under test.
# Rules
## Harness structure: the two required procs
Every Nim fuzz target needs these two exported procs:
```nim
proc initialize(): cint {.cdecl, exportc: "LLVMFuzzerInitialize".} =
{.emit: "N_CDECL(void, NimMain)(void); NimMain();".}
proc testOneInput(data: ptr UncheckedArray[byte], len: int): cint {.
cdecl, exportc: "LLVMFuzzerTestOneInput", raises: [].} =
result = 0
# exercise code under test with data[0..<len]
```
`initialize` is called once at startup. It bootstraps Nim's runtime via
`NimMain()`. Without it the target will segfault before any inputs are tested.
`testOneInput` is called by libFuzzer with a raw byte buffer. It must return
0. Use `raises: []` — any uncaught exception will crash the fuzzer process,
which is treated as a finding.
## Minimum working example
```nim
proc fuzzMe(data: openArray[byte]): bool =
result = data.len >= 3 and
data[0].char == 'F' and
data[1].char == 'U' and
data[2].char == 'Z' and
data[3].char == 'Z' # out-of-bounds when data.len == 3
proc initialize(): cint {.cdecl, exportc: "LLVMFuzzerInitialize".} =
{.emit: "N_CDECL(void, NimMain)(void); NimMain();".}
proc testOneInput(data: ptr UncheckedArray[byte], len: int): cint {.
cdecl, exportc: "LLVMFuzzerTestOneInput", raises: [].} =
result = 0
discard fuzzMe(data.toOpenArray(0, len-1))
```
## Data extraction patterns
How to convert `ptr UncheckedArray[byte]` + `len` to Nim types:
| Target format | Extraction code |
|------------------------|-----------------|
| raw byte buffer | `data.toOpenArray(0, len-1)` |
| string | `var s = newString(len); if len > 0: copyMem(addr s[0], data, len)` |
| seq[T] via copyMem | `let n = len div sizeof(T); var s = newSeq[T](n); if n > 0: copyMem(addr s[0], data, n * sizeof(T))` |
| plain fixed-layout type | `if len >= sizeof(T): var value: T; copyMem(addr value, data, sizeof(T))` |
For the copyMem patterns, the fuzzer-provided buffer is a flat byte array.
Check the length before taking element addresses or copying bytes.
## Error handling in the harness
Compile fuzz targets with `--panics:on`. This turns `Defect` subtypes
(`IndexDefect`, `OverflowDefect`, `AssertionDefect`, etc.) into non-catchable
panics that immediately crash the process — which libFuzzer interprets as a
finding. You don't need a manual `except Defect` block.
`testOneInput` must have `raises: []`. Catch only specific expected error
types (e.g., `except ValueError`) and let everything else crash. Never use
`except Exception` — it catches `Defect` even with panics off, masking real
bugs. Bare `except` is equivalent to `except CatchableError` and does not
catch `Defect`.
```nim
proc testOneInput(data: ptr UncheckedArray[byte], len: int): cint {.
cdecl, exportc: "LLVMFuzzerTestOneInput", raises: [].} =
result = 0
if len > 0:
var input = newString(len)
copyMem(addr input[0], data, len)
try:
parseMyFormat(input)
except ValueError:
discard # expected rejection
# Defects crash the process — no catch needed with --panics:on
```
## Compilation
### Build config file (recommended)
Name the config file `<harnessname>.nims` (e.g. `my_fuzzer.nims` for
`my_fuzzer.nim`) or `config.nims`.
```nim
--cc: clang
--panics: on
--define: noSignalHandler
--define: useMalloc
--noMain: on
--passC: "-fsanitize=fuzzer,address,undefined"
--passL: "-fsanitize=fuzzer,address,undefined"
--debugger: native
```
| Flag | Purpose |
|------------------------|---------|
| `--cc: clang` | libFuzzer requires Clang. |
| `--panics: on` | Defects crash the process immediately. |
| `--noMain: on` | libFuzzer provides its own `main`. |
| `--define: noSignalHandler` | Prevents Nim's signal handler from masking crashes before ASan. |
| `--define: useMalloc` | Uses C malloc so ASan tracks all allocations. |
| `--passC:"-fsanitize=fuzzer,address,undefined"` | Enables libFuzzer + ASan + UBSan. |
| `--passL:"-fsanitize=fuzzer,address,undefined"` | Links the sanitizer runtimes. |
| `--debugger: native` | Embeds DWARF debug info in crash reports. |
## Corpus management
libFuzzer needs a corpus directory. Start with at least one seed input:From Vyrnexis/nim-agent-template, MIT.
More from Vyrnexis/nim-agent-template
- 0.574score
nim-ownership-hooks
Vyrnexis
Implement and review Nim ARC/ORC ownership hooks for types that manually manage resources, including move-only, deep-copy, refcounted, and copy-on-write…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
atlas-package-cloner
Vyrnexis
Use Atlas to initialize Nim projects, install or update Atlas-managed dependencies, configure dependency directories, inspect Atlas-generated nim.cfg paths…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nimonyplugins
Vyrnexis
Build and debug Nimony compile-time plugins for code generation and DSL rewrites.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-style-guide
Vyrnexis
Write clear, consistent Nim code in a simple stdlib-aligned style, covering imports, naming, proc vs func vs template choices, local variables, constructors…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-api-design
Vyrnexis
Design clear public Nim APIs for libraries and modules, including exported types, constructors, parameter ownership, lookup functions, error contracts, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-c-bindings
Vyrnexis
Bind C libraries to Nim and make them build reliably across Linux, macOS, and Windows, including headers, types, linking, shared-library loading, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-c-wrappers
Vyrnexis
Turn low-level C FFI bindings into an idiomatic Nim API, with safer types, cleaner module boundaries, resource management, callbacks, enums, bitflags, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-code-organization
Vyrnexis
Organize Nim modules and multi-step workflows with explicit state ownership, cohesive boundaries, narrow exports, and structured orchestration.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-debugging
Vyrnexis
Debug Nim compile failures, crashes, wrong results, macro expansion, ownership behavior, and unsafe-memory defects using focused reproduction, stack traces…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-testing
Vyrnexis
Write and run deterministic Nim tests, including isolated test files, expected-exception checks, multi-configuration builds, and sanitizer integration.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-doc-comments
Vyrnexis
Document exported Nim modules and APIs with doc comments that `nim doc` actually picks up, including module docs, proc and type docs, field docs, and runnable…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-error-handling
Vyrnexis
Design clear Nim error-handling flows; when to raise exceptions vs return `Option`/`bool`, how to enforce non-raising contracts, and where to translate or…
SkillBFreshness: B★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 2
- Open issues
- 0
- Last commit (this folder)
- Aug 20, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Vyrnexis/nim-agent-template
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Vyrnexis
- 0.574score
nim-c-wrappers
Vyrnexis
Turn low-level C FFI bindings into an idiomatic Nim API, with safer types, cleaner module boundaries, resource management, callbacks, enums, bitflags, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-testing
Vyrnexis
Write and run deterministic Nim tests, including isolated test files, expected-exception checks, multi-configuration builds, and sanitizer integration.
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
atlas-package-cloner
Vyrnexis
Use Atlas to initialize Nim projects, install or update Atlas-managed dependencies, configure dependency directories, inspect Atlas-generated nim.cfg paths…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-api-design
Vyrnexis
Design clear public Nim APIs for libraries and modules, including exported types, constructors, parameter ownership, lookup functions, error contracts, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-c-bindings
Vyrnexis
Bind C libraries to Nim and make them build reliably across Linux, macOS, and Windows, including headers, types, linking, shared-library loading, and…
SkillBFreshness: B★ 4Claude Code +9 - 0.574score
nim-code-organization
Vyrnexis
Organize Nim modules and multi-step workflows with explicit state ownership, cohesive boundaries, narrow exports, and structured orchestration.
SkillBFreshness: B★ 4Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get nim-fuzzing running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
nim-fuzzing skill. Agent Mart. https://agentmart.dev/skills/vyrnexis-nim-fuzzing (last updated 2026-10-24)