Nim Defect Analysis logo

Nim Defect Analysis

Community
planetis-m
nim-defect-analysis

Find reliability and security defects in Nim code. Use when reviewing Nim source for bugs, auditing parsers or protocol handlers for crashes, checking FFI or ownership code for memory safety, or reducing false positives in code review findings.

Overview

Publisherplanetis-m
Repositoryskills
Skill namenim-defect-analysis
Stars
66
Forks
7
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by planetis-m on GitHub. Read the source before you install it.

Installation

Install the Nim Defect Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/planetis-m/skills/tree/master/nim-defect-analysis
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/planetis-m/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/nim-defect-analysis .claude/skills/nim-defect-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nim Defect Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Nim Defect Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Nim Defect Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Nim Defect Analysis

A finding is real when you can demonstrate it; until then it is a hypothesis. Focus on finding and confirming defects, not on elaborate triage mechanics.

Rules

Look Broadly

Review the code for correctness and reliability defects. Do not restrict attention to a fixed checklist of patterns or API names. Common bug sites include:

  • parsing, decoding, deserialization, and any external input handling
  • indexing, slicing, integer arithmetic, and size conversions
  • allocation and accumulation in string, seq, buffers, tables, and queues
  • async I/O, cancellation, shared state, and callbacks
  • C FFI, ptr, cstring, cast, {.emit.}, manual allocation
  • custom =destroy, =copy, =dup, =sink, and =wasMoved
  • exception boundaries where Defect may escape CatchableError handlers
  • logic errors, off-by-one, wrong conditions, missing cases

This list is illustrative, not exhaustive. If something looks wrong, investigate it regardless of whether it matches a known pattern.

Search Efficiently

Use rg to locate risky operations quickly — parsing functions, allocation, pointer operations, casts, FFI imports, ownership hooks. But also read the code to understand its logic. Many bugs are logic errors that no pattern search will find.

Trace Across Function Boundaries

Most false positives and false negatives come from incomplete cross-function reasoning. Do not stop at the function where a risky operation sits.

When a function calls another function with external input:

  • Read the callee. Does it validate, bounds-check, or truncate the input?
  • Check what the callee returns. Does it return a consumed length, a partial result, or an error code the caller might ignore?
  • Trace the data path through every intermediate function, not just the entry point and the crash site.
  • Read type definitions and when defined(...) branches that affect the path.

If you cannot trace the full path from input to failure, you do not have a complete trace. Say so and mark the finding SUSPECTED.

Classify By Evidence, Not Feelings

Use four classes. They describe what you have done, not how confident you feel.

ClassMeans
CONFIRMEDA reproducer, sanitizer, or test demonstrates the failure.
TRACEDComplete static trace from external input to the failure, but no reproducer yet.
SUSPECTEDPartial trace or unclear control flow. Something looks wrong but the path is not fully verified.
FALSE_POSITIVEA guard, type constraint, catch boundary, or unreachable path blocks the issue.

Do not assign numbers. Do not invent probability or confidence scores. State what you found and what evidence you have.

Test Guards, Do Not Debate Them

If you are unsure whether a guard blocks a path, write a reproducer that tests it. Do not spend time reasoning about whether a guard is sufficient when a three-line test can settle it.

Common guard questions a reproducer can answer:

  • Does except CatchableError catch this exception? Defect subclasses (IndexDefect, OverflowDefect, AssertionDefect) are not caught by it.
  • Does -d:danger change the behavior? assert and range checks are disabled; doAssert remains active.
  • Does a bounds check, limit, range conversion, or parser guard actually block the input shape you are testing?
  • Does a consumed-length parser leave trailing input unvalidated?

Use Compiler And Runtime As Primary Evidence

Compiler output, runtime behavior, and sanitizer reports are stronger evidence than pure reasoning. The hybrid approach — use tools, then reason about their output — produces fewer false positives than reasoning alone.

Build and run reproducers with nim c -r. Use doAssert for assertions, not assert — assert is compiled out under -d:danger.

Default build:

bash
nim c -r repro.nim

Additional modes when the bug depends on them:

bash
nim c --panics:on -r repro.nim        # Defect termination behavior
nim c -d:danger -r repro.nim          # Overflow and assertion behavior
nim c --mm:arc -r repro.nim           # Ownership and hook behavior

Sanitizers for unsafe memory, FFI, or manual allocation:

bash
nim c --cc:clang -g -d:noSignalHandler -d:useMalloc \
  --passC:"-fsanitize=address,undefined -fno-omit-frame-pointer" \
  --passL:"-fsanitize=address,undefined -fno-omit-frame-pointer" \
  -r repro.nim

useMalloc exposes Nim allocations to ASan. noSignalHandler lets ASan report signal-based crashes.

Check For Guards

Before reporting, verify whether the path is actually reachable:

  • Does external input reach the defect site?
  • Is there a bounds check, limit, range type, or parser guard?
  • Does a catch boundary catch the exception? Defect subclasses (IndexDefect, OverflowDefect, AssertionDefect) are not caught by except CatchableError.
  • Does -d:danger change the behavior?
  • Are there when defined(...) branches that affect the path?
  • For parser defects: check whether functions that return a consumed length leave trailing input unvalidated.
  • For FFI defects: check pointer lifetime, nullability, struct layout, calling convention, and string ownership.
  • For ownership-hook defects: check move-after-destroy, self-copy, zero-length allocation, and destroy-after-move.

If a guard blocks the path, report FALSE_POSITIVE with the blocking line.

Report Concisely

Each finding needs:

  • file and line
  • what is wrong
  • how input reaches it
  • expected vs actual behavior
  • evidence: reproducer command and output for CONFIRMED, complete static trace for TRACED, partial trace and what is missing for SUSPECTED, blocking guard for FALSE_POSITIVE
  • remediation direction

Keep the report short. Prefer a few well-evidenced findings over many speculative ones.

Workflow

  1. Read the code. Understand what it does, where input enters, and where sensitive operations happen. Read callee functions and type definitions, not just the entry point. Look for anything that could go wrong.
  2. Trace candidate defects. For each suspicious site, trace the full path from input to the operation across function boundaries. Check for guards along the way. If you cannot complete the trace, mark it SUSPECTED and say what is missing.
  3. Write a minimal reproducer. Confirm the bug with the smallest possible input. If a guard's sufficiency is unclear, test it with a reproducer instead of debating it. If you cannot reproduce a traced finding, keep it as TRACED and state what is missing.
  4. Report. List CONFIRMED findings with reproducer evidence, TRACED findings with their complete static traces, SUSPECTED findings with what is missing, and FALSE_POSITIVE findings with the blocking guard.

Common Mistakes

MistakeWhy it is wrong
Marking a source-only claim CONFIRMEDConfirmation requires executable evidence.
Stopping the trace at the function with the risky APIMost false positives come from not reading callees and cross-function data flow.
Debating whether a guard blocks a path instead of testing itA three-line reproducer settles it faster and more reliably.
Reporting a risky API call without a reachable pathAPI presence is not a defect.
Ignoring Defect vs CatchableErrorIndexDefect, OverflowDefect, and AssertionDefect escape ordinary handlers.
Treating assert as a reliable guardassert is compiled out in -d:danger; use doAssert in tests.
Assigning numerical confidence scoresNumbers add false precision without improving the analysis.

References

No reference files.

Frequently asked questions

What does the Nim Defect Analysis AI skill do?

Find reliability and security defects in Nim code. Use when reviewing Nim source for bugs, auditing parsers or protocol handlers for crashes, checking FFI or ownership code for memory safety, or reducing false positives in code review findings.

Why use Nim Defect Analysis on TypingMind?

Because you install it once and use it with any model. Nim Defect Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Nim Defect Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/planetis-m/skills/tree/master/nim-defect-analysis. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Nim Defect Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Nim Defect Analysis?

As many as you like. As long as a model supports skills, you can use Nim Defect Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Nim Defect Analysis AI skill free?

It is published on GitHub by planetis-m. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇