Logo di Verifying External Behavior

Verifying External Behavior

Community
wdm0006
verifying-external-behavior

Confirms what a third-party library, remote API, build backend, or scraped document actually does before writing code that depends on it — throwaway probes that run in seconds, permissive clients that forward wrong arguments instead of rejecting them, per-endpoint docs that don't generalize, response shapes that make a "fast path" always-false, fakes that encode your assumption rather than the service's behavior, dry-runs that skip the step that fails, and large inputs that were silently read only in part. Use when integrating a new dependency or endpoint, writing a tolerated-status or error branch, choosing a client argument name, testing against a fake, or reviewing code that asserts an upstream contract.

Panoramica

Autorewdm0006
Repositorypython-skills
Nome della skillverifying-external-behavior
Stelle
111
Fork
17
File inclusi
Solo istruzioni
LicenzaMIT
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.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

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

Installazione

Installa la skill IA Verifying External Behavior 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/wdm0006/python-skills/tree/main/skills/common/verifying-external-behavior
  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/wdm0006/python-skills.git /tmp/python-skills
mkdir -p .claude/skills
cp -r /tmp/python-skills/skills/common/verifying-external-behavior .claude/skills/verifying-external-behavior
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Verifying External Behavior 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 Verifying External Behavior 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 Verifying External Behavior 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à.

Verifying External Behavior

Most integration bugs are not coding errors. They are a belief about someone else's system — a status code, a parameter name, a response shape, a build backend's scoping rule — that was never checked and turned out to be wrong. The code is written correctly against a contract that does not exist.

The fix is not more care. It is a probe: a throwaway command that asks the real system the exact question, before the code is written. Probes cost seconds. The bugs they prevent are silent, ship green, and are found months later.

Probe the exact call you are about to write

Not a similar call, not the documented example — the same endpoint form, the same library version, the same argument spelling.

bash
# A library's real defaults / return shapes, with no venv to create or clean up
uv run --no-project --with somelib python -c "import somelib; print(somelib.Thing())"

# The exact URL, including the collection-vs-item distinction
curl -s -o /dev/null -w '%{http_code}\n' https://api.example.com/v1/things
curl -s -o /dev/null -w '%{http_code}\n' https://api.example.com/v1/things/1

# What a build backend actually put in the artifact
uv build && unzip -l dist/*.whl

# A real service instead of a fake, for one minute
docker run --rm -p 6390:6379 redis:7-alpine

Two rules make probes worth the minute they cost:

  • Probe before you design around the answer. A probe that confirms a parameter tweak "should" fix a discrepancy is worth more than the tweak.
  • Paste the probe command and its output into the PR, comment, or test. A finding with no reproduction decays into folklore, and the next person re-derives it — or, worse, trusts it after it has gone stale.

Permissive clients don't reject wrong arguments — they ignore them

This is the highest-severity class, because the failure returns plausible data. Many HTTP client wrappers forward keyword arguments verbatim into the query string without validating them against their own documented parameter list. The remote service then drops the unknown parameter and applies its default — often "the authenticated user". A misspelled selector (owner= for owner_screen_name=, id_= for id=) does not raise; it silently returns someone else's records.

Never infer "the library would have rejected that" from the library's declared parameter list. Read the bytes that leave the process:

python
# Probe: intercept the transport and print the outbound request, then stop.
import requests

sent = {}
def spy(self, method, url, **kw):
    sent["url"], sent["params"] = url, kw.get("params")
    raise RuntimeError("probe: request intercepted")

requests.Session.request = spy
try:
    client.favorites(id_=12345)          # the call you were about to ship
except RuntimeError:
    pass
print(sent)      # {'url': '.../favorites/list.json', 'params': {'id_': 12345}}

If the parameter you passed is not in params under the name the service documents, the call is wrong no matter how healthy the response looks.

Two corollaries:

  • Pass every selector by keyword. Clients that bind positional arguments in a per-endpoint order will happily accept get_thing(owner, slug) and send slug as owner_id, while a neighbouring method with the same-looking signature is correct by luck.
  • Check that the parameter exists at all. Some endpoints have no equivalent of the selector you want. "Forward it under the right name" is not a fix when the right name does not exist — the feature has to be built differently.

Per-endpoint docs do not generalize across sibling endpoints

A status code documented for the single-item form frequently does not apply to the collection form of the same resource. Verified live against a large public REST API: GET /repos/{repo}/issues on a repository with issues disabled returns 200 with an empty array, while GET /repos/{repo}/issues/1 returns 410 Gone. Code written to "tolerate 410 when issues are disabled" therefore has a branch that never fires, and the real path — an empty 200 — falls through to whatever the generic handler does.

Probe the exact URL before writing a tolerated-status branch. If you keep a defensive branch for a status you could not reproduce, label it as defensive and name the path you did observe, so the next reader does not mistake it for verified behaviour.

python
# Observed: issues-disabled repos return 200 with []. The 410 branch is
# defensive — the item endpoint documents it, the list endpoint never sent it.
if resp.status_code == 410:
    return []

The response shape is part of the contract

List endpoints commonly embed a summary object — a handful of identity fields — rather than the full entity. A "we already have the data" fast path written against the full entity is then always false:

python
# This check is intended to skip a per-item fetch. Against summary objects that
# carry only {login, id, avatar_url}, it is False for every item — so the
# "fallback" enrichment fetch is the common path, and the loop is N+1.
if all(k in user for k in ("name", "company", "location", "followers")):
    return user
return fetch_user(user["login"])       # runs every time

Before optimizing around a response, print one real element and compare its keys to what your code reads. The same probe settles range and boundary assumptions that otherwise get "handled" defensively forever: if a per-year query provably returns exactly that year's days, the dedup pass guarding against adjacent-year leakage is dead code, and saying so in the PR is more valuable than the code.

A fake proves your code calls the fake

Fakes are written by the same person as the code, from the same beliefs, so they agree with each other by construction. Stand the real thing up once and re-run the same assertions against it — a container is a minute, and it is the only thing that validates the semantics the fake asserts: TTL and expiry sentinels, whether a client factory is awaitable, key eviction, ordering, which exception type a failure raises.

Simulate the outage deterministically instead of mocking the error, so the code takes the same path production would:

python
# A dead port is a real, instant, deterministic connection failure.
client = redis.asyncio.from_url("redis://localhost:1")

The same reasoning applies to documents you parse. A hand-written fixture encodes your reading of the markup; the live page may render the same tokens across indented lines, so a regex requiring single spaces matches every fixture and never matches production. Capture one real sample, commit it, and point the parser's test at it. Prefer a machine-readable attribute (data-date="2024-01-01") over a human-readable string when the source offers both — it survives markup and locale changes that a prose regex does not. (See testing-strategy for the wider false-green audit.)

Dry-runs skip the step that fails

Resolve-only and plan-only modes are not verification of anything the real run does after resolution. A dependency resolver's --dry-run reports success for a requirement whose presence makes the actual build hard-fail, because the dry run never builds. A build script's --check may never invoke the platform-specific tool that breaks.

Run the real operation once, on the platform that matters:

bash
uv pip install --dry-run .    # resolves; does NOT build → misses build-time errors
uv build                      # actually builds → catches them

More generally: if a mode exists specifically to be cheap, ask which step it bought that discount by skipping, and whether your bug lives there.

A big input can be partial without saying so

Before drawing a conclusion from a large dataset, file, or mirrored copy of one, establish that you read all of it, and that the source you read is all of it.

The reader aborts mid-stream. Streaming parsers have hidden size limits. Python's csv module raises _csv.Error: field larger than field limit (131072) on the first oversized field — possibly minutes into a multi-gigabyte file. If your loop catches the error, or you were aggregating as you went, you are left with a plausible-looking partial result. Raise the limit up front (csv.field_size_limit(sys.maxsize)) and assert the row count you processed against the count the source advertises.

The convenient copy is flagged partial. Hosted dataset viewers, parquet conversions, and API "preview" endpoints often cover only a prefix of the data, and say so in a metadata field ("partial": true) that nothing forces you to read. A prefix of a file sorted by group (domain, model, attack type) is a biased sample, not a smaller random one: any list of categories you derive from it ("the 4 generators in this dataset") is just the first groups. Read the metadata flag, and when the file is grouped, locate where each group starts before sampling.

python
import csv, sys
csv.field_size_limit(sys.maxsize)          # else aborts mid-file, long after you started
n = sum(1 for _ in csv.DictReader(open(path, newline="")))
assert n == EXPECTED_ROWS, f"read {n}, source says {EXPECTED_ROWS}"

Record the processed count next to every statistic computed from the data.

Some verified behaviour is not yours to fix

A probe sometimes proves the upstream system is simply wrong, or surprising, for your use case. Resist reaching for a configuration knob to make the number look right — if the underlying model or endpoint produces that output across parameter settings, tuning a parameter buries the finding instead of recording it. Write down what was observed, at which version, with the command, and choose a different approach.

Record findings with three things or they will not survive: the command, the observed output, and the date. External behaviour changes; an undated claim cannot be re-checked.

Checklist

Before shipping code that depends on an external system:
- [ ] The exact call/endpoint/version was probed, not a similar one
- [ ] Outbound request parameters inspected — names match what the service documents
- [ ] Selectors passed by keyword, never positionally
- [ ] Collection and item forms probed separately for status-code branches
- [ ] One real response element printed and compared against the fields the code reads
- [ ] Fakes validated against the real service at least once
- [ ] Failure paths exercised against a real failure (dead port, revoked token), not a mock
- [ ] Verified with the real build/install, not a dry-run
- [ ] Large inputs: rows read matches the source's advertised count, and no "partial" flag applies
- [ ] Every tolerated-status or defensive branch is either reproduced or labelled defensive
- [ ] Findings recorded with command, output, and date

Domande frequenti

Cosa fa la skill IA Verifying External Behavior?

Confirms what a third-party library, remote API, build backend, or scraped document actually does before writing code that depends on it — throwaway probes that run in seconds, permissive clients that forward wrong arguments instead of rejecting them, per-endpoint docs that don't generalize, response shapes that make a "fast path" always-false, fakes that encode your assumption rather than the service's behavior, dry-runs that skip the step that fails, and large inputs that were silently read only in part. Use when integrating a new dependency or endpoint, writing a tolerated-status or erro...

Perché usare Verifying External Behavior su TypingMind?

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

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/wdm0006/python-skills/tree/main/skills/common/verifying-external-behavior. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Verifying External Behavior?

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 Verifying External Behavior?

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

La skill IA Verifying External Behavior è gratuita?

Sì. È pubblicata su GitHub da wdm0006 con licenza MIT. 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 👇