Logo di Rseng Defensive Coding

Rseng Defensive Coding

Community
fdiblen
rseng-defensive-coding

Covers defenses against silently wrong research results: validating data at boundaries (schemas, assertions, sanity checks), explicit physical units and quantities in code (pint/astropy-style), disciplined randomness (explicit seeded generators, parallel streams), and fail-loud handling of NaN and missing data. Use PROACTIVELY when code ingests external or instrument data, when values carry physical units, when randomness enters simulations or sampling, or when NaN or missing-data handling is implicit; also when the user mentions data validation, unit errors, seeds or silent bugs, or reviews analysis code whose failure would be invisible. For floating-point behavior and tolerances see rseng-numerical-accuracy; for diagnosing an existing bug see rseng-debugging.

Panoramica

Autorefdiblen
Repositoryrseng-agent-skills
Nome della skillrseng-defensive-coding
Stelle
26
Fork
2
File inclusi
1
LicenzaCC-BY-4.0
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.

  • 1 file inclusi

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

  • Open source

    Pubblicata da fdiblen su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Rseng Defensive Coding 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/fdiblen/rseng-agent-skills/tree/main/skills/rseng-defensive-coding
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova 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 nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fdiblen/rseng-agent-skills.git /tmp/rseng-agent-skills
mkdir -p .claude/skills
cp -r /tmp/rseng-agent-skills/skills/rseng-defensive-coding .claude/skills/rseng-defensive-coding
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Rseng Defensive Coding 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 Rseng Defensive Coding 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 Rseng Defensive Coding 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à.

Defensive coding for research software

Research code's worst bug is the one that runs to completion: the unit mismatch, the silently dropped rows, the column shifted by one, the reused random stream - producing plausible, wrong numbers that reach a paper. Defensive coding is the discipline of making wrongness LOUD: validate at boundaries, make implicit physics and randomness explicit, and prefer a crash today to a correction notice next year. It complements rseng-numerical-accuracy (float behavior) and feeds rseng-testing (the checks become tests).

Validate at the boundaries

Data enters code at boundaries - files, instruments, APIs, user parameters - and every boundary is a corruption opportunity:

  • Schema-check tabular data on ingest: expected columns, dtypes, units, ranges, allowed categories, uniqueness of keys (pandera-style declarative schemas for DataFrames; JSON Schema for configs and records). The schema is executable documentation of the data contract (rseng-data-management's data dictionary, enforced).
  • Sanity-check the science, not just the types: physical ranges (no negative concentrations, latitudes within +/-90), plausible magnitudes, conservation totals, expected row counts within tolerance of yesterday's. Domain assertions catch what dtype checks cannot.
  • Missing data is a decision, not a default: silent NaN propagation and silent row-dropping (the pandas default in many operations) are the classic silent killers - count and REPORT what was excluded and why, and make exclusion rules explicit code (rseng-research-integrity checks this at the manuscript end; this skill prevents it at the source).
  • Fail loud, fail early: raise on contract violations at ingest rather than letting bad data flow downstream; in batch settings quarantine-and-log per item (rseng-big-data-processing) - but never silently skip.

Units and quantities

Unit errors are the canonical silent research bug - flagship missions have died of them:

  • Attach units in code, not in comments: a quantity library (pint; astropy.units in astronomy) makes units part of the value, checked at every operation - adding meters to seconds raises instead of publishing.
  • Enforce at boundaries even when the core stays plain-numeric for performance: convert-and-strip on ingest (asserting the expected unit), reattach on output, and document the internal convention in ONE place (rseng-scientific-file-formats' metadata discipline carries units in the files themselves).
  • Degrees vs radians, per-second vs per-minute, and log-vs-linear are unit bugs in spirit: name them in variable names or types when a full quantity system is overkill (angle_rad, rate_per_s).

Disciplined randomness

  • Explicit generators, never global state: create a seeded RNG object (numpy's Generator API) and pass it - seeding the global makes order-dependent, library-colliding randomness (the Scientific Python RNG guidance is the reference).
  • Parallel work gets derived streams: spawn per-worker generators from a master seed (seed sequences), never the same seed in every worker - identical streams across "independent" replicates is a silent statistics-destroyer (rseng-hpc-computing job arrays included).
  • Seeds are provenance: record them with outputs and in configs (rseng-reproducibility owns the bookkeeping); stochastic tests assert distributions or use fixed seeds knowingly (rseng-testing).

The habit, proportioned

Not every script needs schemas: exploration code needs only the cheap habits (explicit NaN policy, named units, seeded RNGs); shared pipelines add ingest validation; published analyses add the full contract checks in CI (rseng-ci-cd) so drift in upstream data sources is caught at the pull request, not in the plot. When a defensive check fires in production, keep it as a regression test - each catch is a documented failure mode (rseng-trainer's errors-are-curriculum applies: explain what the check just prevented).

Working with this skill

This skill is source-independent: its authority is the tool documentation and Scientific Python guidance linked below. It is the prevention layer for the failure modes rseng-research-integrity hunts post-hoc.

Learn more (verified):

Related skills

Check whether any of these applies before moving on:

  • rseng-big-data-processing - quarantine-and-log at batch scale
  • rseng-data-management - data dictionaries the schemas enforce
  • rseng-hpc-computing - per-worker RNG streams in parallel jobs
  • rseng-numerical-accuracy - float behavior behind silent errors
  • rseng-research-integrity - post-hoc hunt for same failures
  • rseng-testing - fired checks become regression tests

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 Rseng Defensive Coding?

Covers defenses against silently wrong research results: validating data at boundaries (schemas, assertions, sanity checks), explicit physical units and quantities in code (pint/astropy-style), disciplined randomness (explicit seeded generators, parallel streams), and fail-loud handling of NaN and missing data. Use PROACTIVELY when code ingests external or instrument data, when values carry physical units, when randomness enters simulations or sampling, or when NaN or missing-data handling is implicit; also when the user mentions data validation, unit errors, seeds or silent bugs, or review...

Perché usare Rseng Defensive Coding su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Rseng Defensive Coding è 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 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 Rseng Defensive Coding in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/fdiblen/rseng-agent-skills/tree/main/skills/rseng-defensive-coding. 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 Rseng Defensive Coding?

Qualsiasi modello che colleghi in 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 Rseng Defensive Coding?

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

La skill IA Rseng Defensive Coding è gratuita?

Sì. È pubblicata su GitHub da fdiblen con licenza CC-BY-4.0. 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, modelli 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.

Vedi tutti

Crea subito la tua area di lavoro IA

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