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

به چه درد می‌خورد

انتقال کد بین دو زبان معمولا روی مسیر خوش‌بینانه درست است و روی تقسیم عدد صحیح، مقدار تهی، مرتب‌سازی و تاریخ فرق می‌کند. این متن اول فهرست تفاوت‌های رفتاری را می‌خواهد، بعد کد، و در آخر ورودی‌هایی که دو نسخه با آن‌ها اختلاف پیدا می‌کنند. یک قاعده مهم هم دارد: هنگام انتقال، منطق را «بهتر» نکن.

خود اسکیل

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.

نصبش چطور است

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.

برای تو جواب داد؟

از کجا آمده

Skills app Original