Logo di Nim Api Design

Nim Api Design

Community
planetis-m
nim-api-design

Progetta API pubbliche Nim chiare per librerie e moduli, includendo tipi esportati, costruttori, gestione della proprietà dei parametri, funzioni di ricerca, contratti sugli errori e interfacce in stile contenitore. Usa questa skill per creare o revisionare l’API di una libreria Nim, definire l’interfaccia pubblica di un modulo esportato o decidere come chi chiama il codice debba creare, passare, accedere e convalidare i dati.

Add to TypingMind

Panoramica

Pubblicato daplanetis-m
Repositoryskills
Nome della skillnim-api-design
Stelle
66
Fork
7
File inclusi
6
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 6

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da planetis-m su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Nim Api Design in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/planetis-m/skills/tree/master/nim-api-design
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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-api-design .claude/skills/nim-api-design
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Nim Api Design in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Nim Api Design non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Nim Api Design non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Nim API Design

Rules

Public shape

  • Prefer plain object types for public data models.
  • Use ref object only when identity, aliasing, shared mutation, graph structure, or handle lifetime is part of the contract.
  • Export one primary public representation per concept. Add paired value/ref APIs only when both forms are part of the contract.
  • Prefer procs, overloads, generics, and iterators. Do not default to methods or runtime dispatch for ordinary APIs.
  • Use named object types for public semantic data.
  • Use tuples only for local glue or iterator yields such as (key, val).
  • Reuse stdlib names when the behavior matches: len, find, contains/hasKey, [], []=, items/mitems, pairs/mpairs, add, del, clear, incl/excl, and push/pop.
  • When indexed removal must preserve sequence order, use delete(idx), not del(idx).
  • Use find for an index or position result. Use contains or hasKey for boolean membership.
  • For collection-like types, expose items and pairs. Add mitems and mpairs only when callers may safely mutate yielded values.
  • For comparable types, define ==, < and <=. Do not define !=, >, or >=; Nim derives them.

Contracts

  • Use range types for constrained public parameters; store their values in the underlying type (int for Natural or Positive).
  • Pass arguments directly to range parameters; conversion is implicit, so do not write Positive(x).
  • Model closed choice sets as enums; add reserved members for future assignments in bounded protocol code spaces; use strings for open-ended or externally extensible token namespaces.
  • When an enum's string spelling is dictated by an external format or protocol, set explicit strings (dirNorth = "north"); $ and parseEnum[T] always round-trip.
  • Use static[T] in public APIs only when callers must supply a compile-time constant.
  • Bare typedesc parameters may name different types; share T across typedesc[T] parameters when they must match.
  • Use distinct when two values share a base type but must not mix.
  • If a public type can be used as a table or set key, define hash consistent with ==.
  • Use func for pure query operations when purity is part of the public contract.
  • Use {.raises: [].} when a proc must not raise. Leave raising procs unannotated.

Constructors and conversions

  • Use initX() for value types that copy by value.
  • Use newX() for ref types and for value types with reference semantics.
  • Use one toX() name for common conversions. Overload on input type. Do not define converters.
  • Use default parameter values for optional constructor arguments, keeping the no-argument call the main path.

Sequence parameters

  • When a parameter must accept both arrays and seqs, use openArray[T] for read-only traversal or var openArray[T] for fixed-length element mutation.
  • Resizing or replacement requires var seq[T]: an openArray is fixed-length.
  • When you control the callers, name the concrete type (array[N, T] or seq[T]) instead of openArray[T].

Parameter ownership

  • Use T when the caller's variable stays unchanged, var T when the proc changes it, sink T when the proc takes ownership, and lent T only for borrowed returns.
  • Passing x: T never copies what x points to. Do not use ptr T or addr x to avoid a copy.
  • Pass sink arguments normally — do not wrap them in move() or ensureMove(). Last-use auto-sink moves locals, their fields, tuple fields and indices, and direct-indexed seq/array elements with no copy.
  • Use move(x) only where auto-sink does not apply: var parameters and their fields, loop-indexed seq/array elements (arr[i]), and values reused later in the same scope.
  • Use ensureMove(x) to make an accidental copy a compile-time error.

Template parameters

  • Treat template parameters as syntax substituted into the template body. Design them around the expressions, names, types, or statement blocks the caller must provide—not like proc parameters.

Lookup surface

  • Separate required lookup from optional lookup.
  • A required lookup raises one specific catchable exception. It does not return a silent default.
  • Use contains or hasKey for membership checks and getOrDefault for explicit fallback values.
  • If several accessors fail the same way, route the failure through one private {.noinline, noreturn.} helper.

Borrowed and mutable access

  • Use lent T for read accessors that return storage owned by the receiver.
  • Return var T only for deliberate mutable views. If changes require validation or related updates, expose mutation procs instead.
  • In lent and var accessors, return directly from storage. Do not route through a temp local.

Public boundary

  • Export only the stable surface. Keep helpers private.
  • Keep accessor-backed fields private, so external dot access routes to the accessors; an exported field would bypass them.
  • Use descriptive public names.
  • In user code, gate version-specific API with when (NimMajor, NimMinor) >= (x, y).
  • Keep template lookup escape hatches such as withValue secondary to the main lookup surface.

Workflow

  1. Choose the representation. Start with a plain object. Switch to ref object only if the contract needs identity or aliasing.
  2. Name the public types. Use named objects for semantic results and distinct types for domain identities.
  3. Name the constructor surface. Use initX, newX, and toX in the stdlib style.
  4. Design the lookup surface. Provide one strict path for required data and one explicit safe path for optional data.
  5. Choose parameter modes and borrowed access. Use T when the caller's variable stays unchanged, var T when the proc changes it, sink T when the proc takes ownership, and lent T to return a borrow. Use mutation procs when changes need validation or related updates.
  6. Verify the contract. Compile public examples. Exercise each mutation, ownership, and failure path.

Common Mistakes

MistakeWhy it is wrong
Starting with ref object for plain dataIt adds aliasing and shared mutation where the API does not need them
Defaulting to methods or runtime dispatchIt hides behavior behind runtime polymorphism when a proc surface is simpler and clearer
Weakening a constrained public parameter to int and re-checking manuallyIt throws away a stronger boundary contract
Returning a silent default for required dataIt hides missing-data bugs
Returning var T for controlled stateCallers can bypass validation and related updates
Returning a lent or var result through a temp localThe temp dies at return; the compiler rejects the dangling borrow
Using lent T for an input parameterlent T is a borrowed return type; the compiler rejects it in parameter position
Assuming a sink call always moves the caller's variableNim copies the argument when it cannot prove last use
Wrapping a routine sink argument in ensureMoveSink already performs last-use analysis; use ensureMove only when the code must fail instead of copy
Defining !=, >, or >= for a typeThese override Nim's derived comparison templates and can make comparisons inconsistent
Assuming variant of branches scope their own fieldsReusing a name is a compile error

References

  • references/representation_and_construction.md — Choosing value or reference semantics with initX and newX construction.
  • references/object_variants.md — Variant branches sharing attribute names through per-branch payload objects.
  • references/lookup_and_mutation.md — Collection access through required, optional, borrowed, and controlled-mutation paths.
  • references/parameter_and_result_shapes.md — Domain IDs, related options, constrained parameters, and named results in one public API.
  • references/parameter_ownership.md — Choosing openArray, var, sink, and lent parameters.
  • references/template_usage.md — Templates for scoped cleanup, caller-named access, and lazy evaluation that a proc cannot express.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Nim Api Design?

Progetta API pubbliche Nim chiare per librerie e moduli, includendo tipi esportati, costruttori, gestione della proprietà dei parametri, funzioni di ricerca, contratti sugli errori e interfacce in stile contenitore. Usa questa skill per creare o revisionare l’API di una libreria Nim, definire l’interfaccia pubblica di un modulo esportato o decidere come chi chiama il codice debba creare, passare, accedere e convalidare i dati.

Perché usare Nim Api Design su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Nim Api Design è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Nim Api Design in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/planetis-m/skills/tree/master/nim-api-design. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Nim Api Design?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Nim Api Design?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Nim Api Design: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Nim Api Design è gratuita?

È pubblicata su GitHub da planetis-m. Consulta il repository per i termini di licenza. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇