Logo vun Legacy Testing

Legacy Testing

Communautéit
dmoka
legacy-testing

Test legacy code: assess first, then propose a plan. Use when a codebase or module has few or no tests and you need to change it safely: adding tests to untested code, getting a safety net before a refactor, taking over code you did not write. Looks at the stack, the dependencies and the code no test touches, proposes which steps this repo needs (make it testable, characterize, approve, property tests that hunt for crashes at every entry point, measure, refactor last), waits for approval once, then runs every approved step without stopping.

Iwwersiicht

Editeurdmoka
Repositoryskills
Skill-Nummlegacy-testing
Stären
21
Forks
2
Matgeliwwert Fichieren
8
LizenzMIT
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.

  • 8 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

    Vum dmoka op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Legacy Testing an TypingMind, fir e mat all LLM ze benotzen, oder füügt 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 „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/dmoka/skills/tree/main/skills/legacy-testing
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu 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 de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dmoka/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/legacy-testing .claude/skills/legacy-testing
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Legacy Testing 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 Legacy Testing automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Legacy Testing 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-Keys.

  • 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.

Legacy testing

Legacy code is code without tests. The job is a net under the behaviour that carries the business, built before anyone refactors. Assess first, propose, wait for approval, then execute.

Steps

  1. Assess. Run scripts/assess.sh [path] from the repo root; the path is a file or a folder. It lists the tests anywhere in the repo that import the target, and the files no test imports. Read those tests and the three biggest untested areas, and name, for each, the load-bearing behaviour (money, permissions, data that must not be lost). Then list the target's entry points: every place outside input reaches it (an HTTP route, a CLI command, a message handler, a parser, an exported function called with user data); grep for the target's imports outside the tests and follow them to the edge. Done when you can state, per area: what it does, what it depends on, which tests already touch it, its entry points, and how a mistake there would hurt.
  2. Propose. Write the plan with the template below: which steps this repo needs, in which order, and why each one. Choose from the menu; skip what the assessment says is not needed. The refactor is the plan's last step by default, with its target and why; leave it out only when the user said so. Done when every chosen step names its target (files or functions) and its why.
  3. Stop for approval, once. Show the plan and wait. The user judges two things: is it aimed at the load-bearing behaviour, and do the tests check behaviour rather than today's implementation? Approving the plan approves its refactor step too. Done when the user approves or edits the plan.
  4. Execute the approved plan without stopping. Do the steps in order: open the step's playbook, do it, run the suite, start the next step. Do not ask "shall I go ahead?" between steps; approving the plan approved every step in it. Stop and ask only to: mark a mutant equivalent, change CI or config the plan did not list, or fix a suspected bug instead of pinning it. Start the refactor only after the measure step meets the target, and commit it separately from the tests, in commits that change no behaviour. Done when every step's own completion check passes and the suite is green.
  5. Report once, at the end: the score before and after, the tests added, the suspected bugs (the crashes the crash-hunt properties found included), what the refactor changed, the open decisions. Delete every TEMPORARY file first.

The menu

StepUse it whenPlaybook
Make it testablethe code reaches a database, an API, a queue, the clock or the filesystem directlyreferences/make-it-testable.md
Characterizenobody can say what the code does todayreferences/characterize.md
Approval teststhe output is big: JSON, HTML, reportsreferences/approval-tests.md
Property tests: crash huntevery target outside input can reach (an endpoint, a CLI command, a handler, a parser): generated input, valid and broken, must never crash an entry pointreferences/property-testing.md
Property tests: invariantsrules with edge cases: money, dates, limits, round tripsreferences/property-testing.md
Measurebefore calling the net done: coverage shows what never ran, mutation shows what was never checkedreferences/measure.md
Refactorevery plan, as the last step, after measure meets the target; leave it out only when the user says soreferences/refactor.md

Plan template

Area: <files> — load-bearing: <behaviour>
Entry points: <route / command / handler / exported function> → <target>
1. <step> on <target> — why: <reason from the assessment>
2. ...
n. Crash-hunt property on <each entry point> — why: outside input reaches it; no input may crash it
n+1. Invariant properties on <rules> — why: <the rules with edge cases>
last. Refactor <target>: <the structure change> — why: <what the assessment found hard to read or change>
Skipped: <step> — why not needed here
Target: mutation score on <area> ≥ <n>% (coverage is a hint, not the goal)

Gotchas

  • Characterization tests pin today's behaviour, bugs included. When a pinned result looks wrong, pin it anyway, name the test pins current behaviour — suspected bug: <what is wrong>, and list it in the final report; fixing it is a separate, later change.
  • A dependency that is fast, or that carries the business logic, stays real in the test (an in-memory or containerised database, the real rules engine). Use a test double only for slow or unreliable edges.
  • Approval tests are scaffolding. Mark them as temporary in their file name or a comment, so they get deleted once functional tests cover the behaviour.
  • A crash the crash-hunt property finds is a suspected bug, even when no user has hit it: pin the shrunk input, list it, and keep the property hunting. A crash spotted while reading the code does not replace the property: pin the spotted crash, and add the property for that entry point anyway.
  • A flaky test is not a net. When a test passes and fails without a change, quarantine it and report it before building on it.
  • Long suites: run the narrowest command that covers the area while working (one file, one folder), and the full suite at the end of each step.
  • Aim the mutation score at the load-bearing area, not the whole repo; a repo-wide number hides the money code in the average.
  • Scope every mutation run twice: mutate only the target file (Stryker: --mutate <file>), and run only the tests that import it (assess.sh <file> lists them). Use a project script if one exists; otherwise see "Scoped runs" in references/measure.md. The repo's own config can run its whole suite as the dry run.

Last verified: 2026-10-04 with Claude Code 2.1.289, plan only (no execution run), on TicketBay branch legacy/reporting: for src/finance/payouts.ts 2 of 2 plans listed a crash-hunt property on GET /api/v1/organizer/payouts and the refactor as the last step, unasked (the previous version: 0 of 2, "Skipped: Refactor" in both); 1 of 1 plan on src/finance/invoices.ts did the same. Before that, 2026-10-04 on TicketBay src/db/admin-queries.ts: mutation score 62.7% → 98.5%, four suspected bugs pinned. That trial drove this version: assess.sh took no file path and missed tests outside the target folder; the agent paused after every step; the unscoped dry run passed 10 minutes and never finished, the scoped one took 1.5 minutes. Earlier: 2026-09-29 with 2.1.284 (TicketBay with deleted tests, and a real untested MERN app).

Matgeliwwert Fichieren

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 Legacy Testing?

Test legacy code: assess first, then propose a plan. Use when a codebase or module has few or no tests and you need to change it safely: adding tests to untested code, getting a safety net before a refactor, taking over code you did not write. Looks at the stack, the dependencies and the code no test touches, proposes which steps this repo needs (make it testable, characterize, approve, property tests that hunt for crashes at every entry point, measure, refactor last), waits for approval once, then runs every approved step without stopping.

Firwat Legacy Testing op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Legacy Testing 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 vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Legacy Testing an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/dmoka/skills/tree/main/skills/legacy-testing 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 Legacy Testing 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 Legacy Testing benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Legacy Testing domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Legacy Testing gratis?

Jo. De Skill gëtt vum dmoka ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat 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 en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇