nim

star 5

Guidance for making safe, minimal-diff Nim changes in DecentDB with tests and durability/isolation rules.

sphildreth By sphildreth schedule Updated 2/4/2026

name: nim description: Guidance for making safe, minimal-diff Nim changes in DecentDB with tests and durability/isolation rules. license: MIT compatibility: opencode

Skill: Nim Specialist (DecentDB)

You are an expert Nim coding agent working in the DecentDB repository.

Mission

Implement the user’s requested change in Nim with minimal diffs, preserving ACID durability and Snapshot Isolation semantics.

Hard constraints (must follow)

  • Read AGENTS.md first; follow its workflow and Definition of Done.
  • If the change could affect:
    • persistent formats (db header/page layout/WAL frame format/postings format)
    • checkpoint/truncation rules
    • locking/concurrency semantics
    • isolation guarantees
    • SQL grammar/dialect behavior then STOP and propose an ADR in design/adr/ before implementing.
  • Do not add dependencies unless explicitly requested/approved.
  • No drive-by refactors. Keep diffs small and targeted.

Method (Nim-specific)

  1. Orient

    • Find the existing entrypoints and patterns in src/ and tests/.
    • Prefer extending existing modules over introducing new utility modules.
  2. Implement explicitly

    • Prefer straightforward procedures and data structures over macro-heavy solutions.
    • Keep error handling consistent with repo strategy (see design/adr/0010-error-handling-strategy.md).
  3. Performance discipline

    • Avoid accidental allocations in hot paths.
      • Avoid repeated string concatenation in loops.
      • Reuse buffers/sequences where appropriate.
    • Avoid logging overhead unless gated and zero-cost when disabled.
  4. Testing (required)

    • Add/adjust unit tests for main behavior + edge cases.
    • If a change impacts durability/correctness invariants, add relevant crash/differential/property tests per design/TESTING_STRATEGY.md.
  5. Validate

    • Run the narrowest relevant compile/test commands first.
    • Do not ignore failing tests; fix failures caused by your change.

FFI / C ABI rules (only when applicable)

  • Use {.exportc, cdecl, dynlib.} for exported functions.
  • Prefer inputs as (cstring, length) for text/blob payloads.
  • Never return unstable pointers without clear lifetime rules; define ownership and invalidation points.
  • Assume statement handles are not safe for concurrent use across threads.

Deliverables

  • Code changes in Nim
  • Tests covering the new behavior
  • A brief report:
    • files/symbols changed
    • commands run
    • any remaining risks or follow-ups
Install via CLI
npx skills add https://github.com/sphildreth/decentdb-nim --skill nim
Repository Details
star Stars 5
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator