Logo: Nim Code Organization

Nim Code Organization

Communautéit
planetis-m
nim-code-organization

Organiséiert Nim-Moduler a Méischrëtt-Workflows mat enger kloer definéierter Zouuerdnung vum Zoustand, kohärente Grenzen, limitéierten Exporter a strukturéierter Orchestratioun. Benotzt dat, wann Dir eng grouss Nim-Datei refaktoréiert, Logik op Moduler verdeelt, zoustandsbehaftete Code no Parser-Virbild designt oder verschachtelt Hëllefsfunktiounen a verstoppt verännerlechen Zoustand vereinfacht.

Add to TypingMind

Iwwersiicht

Editeurplanetis-m
Repositoryskills
Skill-Nummnim-code-organization
Stären
66
Forks
7
Matgeliwwert Dateien
2
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.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • 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 Code Organization 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-code-organization
  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-code-organization .claude/skills/nim-code-organization
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Nim Code Organization 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 Code Organization 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 Code Organization 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 Code Organization

Choose the smallest structure that exposes the real workflow.

Rules

State ownership

  • Use ordinary locals when a workflow fits clearly in one proc.
  • When independently meaningful operations must preserve one invariant, collect that state in a named object and pass it explicitly.
  • Start with a plain object passed by var.
  • Choose ref object when identity, aliasing, or shared lifetime is part of the design.
  • Make shared mutation visible in proc parameters and field updates.

Helper placement

  • Extract a helper when it names a meaningful step, is reused, isolates a contract, or makes an invariant easier to state.
  • To share an implementation across compile-time variants, parameterize one helper with static[bool] or a static enum and branch with when.
  • Keep a short, one-use sequence in its driver when extraction would only move lines elsewhere.
  • Put helpers at module scope when several phases use them or they stand on their own.
  • Use a nested proc for logic local to one caller or for an intentional closure.
  • A nested proc captures outer locals by default. Mark it {.nimcall.} when its non-capturing calling convention is required.

Module boundaries

  • Give each module one cohesive responsibility and public contract. A module may own several related types or pieces of state.
  • Split a module when a part has an independent responsibility, dependency set, lifecycle, or reuse boundary.
  • Export only the types and entry points callers need.
  • Keep orchestration state and helpers private unless another module is meant to use them.
  • Do not use {.define.}/{.undef.} to scope behavior across modules; use a runtime parameter.

Control flow

  • Keep the normal path structured so its invariants remain visible.
  • For a closed set of behaviors, represent the kind as data and branch with case.
  • Use method when runtime subtype dispatch is part of the design, rather than as the default way to divide orchestration steps.

Incremental APIs

  • When the caller drives consumption piecewise, keep the cursor and lifecycle state in the object's fields so it survives between calls.
  • Expose one proc per transition, with open/close-style lifecycle procs only when a resource or ordering constraint spans calls; keep a one-shot operation a single proc.
  • Enforce that ordering with an assert on the lifecycle field (for example assert s.opened) at the start of each next-style proc.

Workflow

  1. Trace the data flow. Identify which values evolve, which steps share them, and which invariants must hold between steps.
  2. Choose the smallest state scope. Use locals for one clear proc, a plain object for operations preserving one invariant, and a reference only for intentional identity or shared lifetime.
  3. Shape the helpers. Extract meaningful operations. Keep local incidental logic near its caller.
  4. Choose module boundaries. Group code by responsibility and contract, then split only at a real dependency, lifecycle, or reuse boundary.
  5. Define the public surface. Export the minimum caller-facing types and operations.
  6. Choose dispatch. Use direct calls and case for closed behavior. Introduce runtime dispatch for an open subtype-based design.

State Scope

SituationDefault shape
One linear operationLocal values in one proc
Several operations share an invariantPlain state object passed by var
One caller owns a short captured operationNested proc
Several phases share a named operationModule-level proc
Identity or shared lifetime is requiredref object

Common Mistakes

MistakeWhy it is wrong
Hiding state shared by several phases in nested capturesThe mutation and cross-phase invariants disappear from proc signatures
Creating a state type for a short linear calculationThe extra type adds ceremony without clarifying ownership or invariants
Extracting every small block into a top-level helperThe reader must jump between names that do not represent meaningful operations
Splitting modules by file size aloneFile length does not identify a responsibility, dependency, lifecycle, or reuse boundary
Using a method hierarchy for a closed set of kindsStatic data plus case keeps the possible behaviors visible to the compiler and reader
Exporting orchestration helpers or state by defaultIt turns implementation details into a public compatibility obligation
Starting with ref object for locally owned stateIt introduces aliasing and identity that the workflow does not require

References

  • references/orchestration_pattern.md — Inventory reservations across independent operations that share a stock invariant, contrasted with a local calculation.
  • references/parser_state_pattern.md — A scanner object for incremental cursor and lifecycle state.

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Nim Code Organization?

Organiséiert Nim-Moduler a Méischrëtt-Workflows mat enger kloer definéierter Zouuerdnung vum Zoustand, kohärente Grenzen, limitéierten Exporter a strukturéierter Orchestratioun. Benotzt dat, wann Dir eng grouss Nim-Datei refaktoréiert, Logik op Moduler verdeelt, zoustandsbehaftete Code no Parser-Virbild designt oder verschachtelt Hëllefsfunktiounen a verstoppt verännerlechen Zoustand vereinfacht.

Firwat Nim Code Organization op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Nim Code Organization 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 Code Organization an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/planetis-m/skills/tree/master/nim-code-organization an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Nim Code Organization 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 Code Organization benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Nim Code Organization 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 Code Organization 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 👇