Logo: Nim Defect Analysis

Nim Defect Analysis

Communautéit
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.

Iwwersiicht

Editeurplanetis-m
Repositoryskills
Skill-Nummnim-defect-analysis
Stären
66
Forks
7
Matgeliwwert Dateien
Nëmmen Instruktiounen
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    planetis-m huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Nim Defect Analysis an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/planetis-m/skills/tree/master/nim-defect-analysis
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Nim Defect Analysis an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Nim Defect Analysis automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Nim Defect Analysis net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Nim Defect Analysis op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Nim Defect Analysis besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Nim Defect Analysis an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/planetis-m/skills/tree/master/nim-defect-analysis an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Nim Defect Analysis benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Nim Defect Analysis benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Nim Defect Analysis domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Nim Defect Analysis gratis?

planetis-m huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇