Ports That Keep the Same Behavior

Ports That Keep the Same Behavior

Make a language-to-language port list its semantic differences first, then name the exact inputs where old and new would disagree.

blackbox-ai migration language-port refactoring testing correctness

What it is for

A translation brief that makes the model enumerate semantic differences between two languages before it writes the port, and then hand you the inputs where the two versions would diverge. Use it for any rewrite across languages or major framework versions. It prevents silent behavior drift in division, nulls, sorting and dates that no happy-path test will catch.

The skill

Paste the source, then this. Fill in the two languages.

Port this from [source language] to [target language]. Behavior comes
first, idiom second, brevity last.

Before writing any code, list every place the two languages differ in a way
this code can feel:
- integer versus float division, and overflow
- string encoding, indexing, and case rules
- null / nil / undefined / Optional, and what equality does with them
- default mutable arguments, copy versus reference on assignment
- sort stability, and comparison of mixed types
- date, timezone, and epoch handling
- exception types, and what a bare catch swallows
- concurrency: what was thread-safe there and is not here

Then write the port. For each difference above, either match the original
behavior and say how, or change it and say why, in a comment on that line.

Finally give me:
- concrete input values where the two versions would disagree
- the tests I should write to prove they do not disagree
- any dependency you introduced, and what it replaced

Do not improve the logic while porting. If you see a bug, list it
separately and leave it in place - one change at a time.

Failure this prevents: a port that passes the happy-path test and returns a
different number for negative inputs, empty strings, or the last day of the
month.

How to install it

1. Open the tool and start a new conversation, project or template.
2. Paste the text below wherever the tool keeps standing instructions
   — usually called system prompt, instructions, or persona.
3. Save it so it applies to every run rather than a single message.

Did it work for you?

Where it came from

Skills app Original