nim-testing
Write and run deterministic Nim tests, including isolated test files, expected-exception checks, multi-configuration builds, and sanitizer integration.
Skill by Vyrnexis
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-testing
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
Use cases: testing, writing
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-testing
What's inside
- Skill name
nim-testing- Description
- Write and run deterministic Nim tests, including isolated test files, expected-exception checks, multi-configuration builds, and sanitizer integration. Use when setting up a Nim test suite, testing failure behavior, running tests across debug/release/danger modes, or adding AddressSanitizer support.
- License
- MIT
- Instructions
- 176 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- block_test_pattern.md · references/
- ci_github_actions.md · references/
SKILL.md (first lines)
# Nim Testing
## Rules
### Use `block`-based tests with `doAssert`
Import `std/assertions`. Use `block` scopes with `doAssert` and `doAssertRaises`:
```nim
import std/assertions
block add_basic:
doAssert add(1, 2) == 3, "add should sum positive integers"
block greet_empty:
doAssert greet("") == "hello "
block parse_bad_input:
doAssertRaises ValueError:
discard parseThing("")
```
`doAssert` raises `AssertionDefect` on failure. `doAssertRaises` passes only when the requested exception type is raised; otherwise the test exits non-zero.
### Write unambiguous assertions
Use ordinary call syntax and grouped negation inside `doAssert`:
```nim
proc foo(x: int): int = x
proc same(x, y: int): bool = x == y
doAssert foo(1) == 1, "foo should return its argument"
doAssert same(1, 1), "same values should match"
doAssert not (foo(1) < 0), "foo should not return a negative value"
doAssert 4 notin @[1, 2, 3]
```
Avoid command-call syntax in assertions. `doAssert foo 1 == 1` can bind the
comparison to `foo`, and `doAssert same 1, 1` can bind the comma to `doAssert`.
### Project layout
```
project/
src/
mylib.nim
tests/
config.nims # shared compiler switches
tester.nim # central test runner (auto-discovers t*.nim)
tbasic.nim
tedge.nim
terrors.nim
```
Test files use `t` prefix: `tbasic.nim`, `tedge.nim`, `terrors.nim`, `tintegration.nim`.
### `tests/config.nims`
```nim
switch("path", "$projectdir/../src")
```
The compiler loads this config automatically when compiling files in `tests/`.
### `tests/tester.nim`
```nim
import std/os
proc fatal(msg: string) = quit "FAILURE " & msg
proc exec(cmd: string) =
echo "Running: ", cmd
if execShellCmd(cmd) != 0: fatal cmd
let testDir = getCurrentDir() / "tests"
for f in walkFiles(testDir / "t*.nim"):
let name = f.extractFilename
if name == "tester.nim":
discard
else:
exec "nim c -r " & quoteShell(testDir / name)
echo "All test files completed."
```
Run from project root: `nim c -r tests/tester.nim`
New test files are auto-discovered — no runner edits needed.
### Shared Test Code
Keep test files self-contained when practical. If setup is repeated, extract domain helpers such as sample builders, temp-file setup, or fixture data.
## Workflow
1. **Set up layout.** Create `src/`, `tests/`, and `tests/config.nims`.
2. **Write test files.** Name files with `t` prefix. Use `block`, `doAssert`, and `doAssertRaises`.
3. **Create the runner.** Add `tests/tester.nim` with the auto-discover pattern.
4. **Run all configurations:**
```
nim c -r tests/tester.nim
nim c -d:release -r tests/tester.nim
nim c -d:danger -r tests/tester.nim
```
5. **Run with ASan** if the project uses unsafe constructs. See "AddressSanitizer" below.
6. **Set up CI.** See `references/ci_github_actions.md`.
## Multi-configuration testing
| Mode | Overflow checks | Stack traces (file:line) |
|-----------------------|-----------------|--------------------------|
| default / `-d:debug` | Yes | Full |
| `-d:release` | Yes | Raising frame only |
| `-d:danger` | No | Raising frame only |From Vyrnexis/nim-agent-template, MIT.
More from Vyrnexis/nim-agent-template
- 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-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 - 0.574score
nim-fuzzing
Vyrnexis
Set up and run libFuzzer-based fuzz targets for Nim code, including harness wiring, compilation flags, corpus management, structure-aware mutators, and crash…
SkillBFreshness: B★ 4Claude Code +9 - 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
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
nimonyplugins
Vyrnexis
Build and debug Nimony compile-time plugins for code generation and DSL rewrites.
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
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
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-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-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-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
Cite this page
nim-testing skill. Agent Mart. https://agentmart.dev/skills/vyrnexis-nim-testing (last updated 2026-10-24)