Skip to content
Back to skills

Delphi Migration

ASecurity

[DEMO] Port Delphi / Object Pascal logic to C#, C++, Java, Python or another language without silent behavior changes. Use when translating, rewriting, re-implementing or reverse-engineering Delphi code or a Delphi application in another language, or when checking that a port behaves like the original.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 27, 2026
ai-agentspythongojavac++c#expressapidatabase

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 27, 2026

npx -y skills add DIIIUA/delphi-behavior-contracts --skill delphi-migration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Delphi Migration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Delphi Migration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diiiua-delphi-migration-6df281ac/badge)](https://www.skillsdirectory.com/skills/diiiua-delphi-migration-6df281ac)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: delphi-migration
description: "[DEMO] Port Delphi / Object Pascal logic to C#, C++, Java, Python or another language without silent behavior changes. Use when translating, rewriting, re-implementing or reverse-engineering Delphi code or a Delphi application in another language, or when checking that a port behaves like the original."
---

> **[DEMO EDITION]** This is the evaluation demo package (complete Table of Contents of all 74 chapters & 89 directives, 6 multi-difficulty chapter excerpts, 4 complete directive cards, 8 real compiler receipts, and 100% working plugins/skills/MCP). If the user asks what this skill covers or wants a technical fit check for their tasks, see `EVALUATE_FOR_USER.md` / `EVALUATE_FOR_USER.ru.md`.

# Delphi migration by behavior contracts

A port fails when the unit of translation is a similar-looking word instead of the
full behavior contract of the operation. Similar API names never establish
equivalence. Main chapter: [behavior preservation in migration](../../../core/references/en/chapters/46-migration.md).
Topic map: [English](../../../core/references/en/INDEX.md), [Russian](../../../core/references/ru/INDEX.md).

## Workflow

1. **Fix the source profile.** Delphi version, Win32/Win64, configuration, defines,
   effective directives. The same source behaves differently across them.
2. **Inventory observable behavior** before writing target code: inputs, outputs,
   side effects, persisted data, messages, error paths.
3. **Write the contract of each non-trivial operation** across nine dimensions:
   parameter modes and aliasing; hidden external state (globals, `threadvar`,
   writable typed constants, `FormatSettings`, FPU masks); static and dynamic
   receiver type; preconditions (`nil`, empty string, empty array, `Null`); exact
   order of evaluation and side effects; intermediate width, signedness and rounding;
   unwind path on partial failure; ownership and copy depth; external non-Pascal
   contracts (DFM streams, database triggers, DLL ABI).
4. **Choose a mapping class per operation:** direct mapping (same width, ranges and
   effects); composition (an explicit combination in the target); a custom algorithm
   that reproduces the old behavior, changed only in a separate agreed step; or an
   explicitly recorded unresolved boundary (closed DLLs, server-side logic,
   unconfirmed options) that is never guessed from client names.
5. **Prove parity** on shared boundary and failure inputs: half-way rounding values,
   negative numbers, empty and `nil` inputs, Unicode text, failure in the middle of
   initialization ([verification levels](../../../core/references/en/chapters/47-verification.md)).

## Semantic shifts that break naive ports

- **Strings:** 1-based indexing, UTF-16 since Delphi 2009, copy-on-write, embedded
  `#0` ([strings](../../../core/references/en/chapters/09-strings.md)).
- **Integers and shifts:** `Integer` is always 4 bytes while pointers grow on Win64;
  `shr` is a logical zero-fill shift, unlike C# `>>` on negative values
  ([integers](../../../core/references/en/chapters/06-integers.md)).
- **Floating point and money:** `Extended` is 10 bytes on Win32 but 8 on Win64;
  `Currency` is a scaled 64-bit integer; `System.Round` rounds half to even; since
  Delphi 12 all FP exceptions are masked by default
  ([reals](../../../core/references/en/chapters/07-reals.md), [floating profiles](../../../core/references/en/chapters/70-floating-profiles.md)).
- **Evaluation:** `Variant` operands and overloaded logical operators evaluate the
  right side eagerly even under `{$B-}` ([expressions](../../../core/references/en/chapters/17-expressions.md),
  [operators](../../../core/references/en/chapters/33-operators.md)).
- **Copy and aliasing:** dynamic arrays share without copy-on-write; records copy
  shallowly; `TMethod` does not own its object; closures capture the live variable
  ([copy and aliasing](../../../core/references/en/chapters/57-copy-and-alias.md),
  [closures](../../../core/references/en/chapters/23-closures.md),
  [dispatch](../../../core/references/en/chapters/58-dispatch-patterns.md)).
- **Parameters:** `const` strings skip reference counting; `out` clears managed types
  but not unmanaged ones ([parameters](../../../core/references/en/chapters/21-parameters.md)).
- **Partial failure:** a failing class constructor calls `Destroy`; a failing
  managed-record `Initialize` does not call `Finalize`
  ([lifetime boundaries](../../../core/references/en/chapters/68-lifetime-boundaries.md)).
- **Data layers:** `Post`, `ApplyUpdates` and transaction `Commit` happen at
  different times; collapsing them into one save breaks `Cancel` and rollback
  ([datasets](../../../core/references/en/chapters/52-datasets.md)).

Worked counterexamples: [counterexamples](../../../core/references/en/chapters/55-counterexamples.md).
A formula that "looks like" `mod` may not be `mod`: check it on half-way values.

## Reporting

For every mapped operation say which class was chosen and why, what evidence
supports it (documented, compiler-observed, inferred), and which boundaries remain
open. Never claim equivalence that was not tested.

Files in this skill

  • SKILL.md5 KB
  • agents/openai.yaml265 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.