Nim Code Organization logo

Nim Code Organization

Community
planetis-m
nim-code-organization

Organize Nim modules and multi-step workflows with explicit state ownership, cohesive boundaries, narrow exports, and structured orchestration. Use when refactoring a large Nim file, splitting logic across modules, designing parser-style stateful code, or simplifying nested helpers and hidden mutable state.

Overview

Publisherplanetis-m
Repositoryskills
Skill namenim-code-organization
Stars
66
Forks
7
Bundled files
2
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.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

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

Installation

Install the Nim Code Organization 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-code-organization
  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-code-organization .claude/skills/nim-code-organization
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nim Code Organization 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 Code Organization 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 Code Organization 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 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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Nim Code Organization AI skill do?

Organize Nim modules and multi-step workflows with explicit state ownership, cohesive boundaries, narrow exports, and structured orchestration. Use when refactoring a large Nim file, splitting logic across modules, designing parser-style stateful code, or simplifying nested helpers and hidden mutable state.

Why use Nim Code Organization on TypingMind?

Because you install it once and use it with any model. Nim Code Organization 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 Code Organization in TypingMind?

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

Which AI models can use Nim Code Organization?

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 Code Organization?

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

Is the Nim Code Organization 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 👇