Trying out Claude Code for Delphi

Using Claude Code for Delphi — What I Learned Writing a Book About It

What started as a frustrated blog post became a 280-page book. Here’s the story.

In early 2026, a post on Delphipraxis claimed that one hour of development with Claude Code was worth a full day of solo programming. Bold claim. I had to test it.

I spent weeks testing Claude Code on real Delphi production projects — over 200,000 lines of code. The results were… mixed. Sometimes impressive. Sometimes infuriating. Always interesting. I documented everything — including the failures — and it grew into a full book: “Delphi in All Its Glory — AI-Assisted Development.”

This article summarizes what I learned and what’s in the book.

 

____________________________

How It All Started

This article was originally a raw, frustrated account of my first two weeks with Claude Code. The installation was painful (WSL, Linux, NodeJS — just to run a coding tool on Windows). The Pro plan ran out after 15 minutes on a 15,000-line project. Claude kept adding if nil then Exit everywhere. It overengineered a combo-to-listbox conversion into 50 lines of generic madness.

But I kept going. I learned the tricks — how to write effective CLAUDE.md files, when to use Plan Mode, how to keep context clean with /clear, the one-file-at-a-time workflow for large projects. Three months and 200,000+ lines of tested code later, I had enough material for a book.

The original article captured real frustrations that many Delphi developers will recognize. The book captures what I learned after those frustrations — how to make AI work for Delphi, honestly and practically.

The Honest Verdict

Let me put my cards on the table right away:

AI is a tool. A useful one… sometimes. The trick is knowing when to use it and when to put it down.

  • Legacy code maintenance: This is where AI shines brightest. If you’re maintaining decades-old Delphi code, Claude can be a genuine lifesaver — code review, bug hunting, understanding unfamiliar codebases, modernizing old patterns.
  • Code review and bug finding: Surprisingly good. Claude catches nil pointer issues, missing try-finally blocks, memory leaks, and coding convention violations with reasonable accuracy.
  • Writing new code: Here’s where it gets complicated. For small, well-defined tasks, Claude does fine. For complex architecture work on large projects? You need to guide it carefully, or it will create more work than it saves.
  • The 80% rule: AI gets you roughly 80% of the way there, fast. The last 20% — Delphi-specific quirks, VCL integration, DFM files — is still your job. Expecting 100% leads to frustration. Expecting 80% and cleaning up the rest? That’s a genuine productivity win.

The Delphi community member Des101 said it best: “Get something to 80% complete… is good enough for me.” That’s the right attitude.

What Claude Gets Right

  • Understanding codebases: Point Claude at a 200-unit Delphi project and ask “explain the architecture.” It reads the .dpr, scans the major units, maps class hierarchies, and gives you a solid overview. For inherited projects with zero documentation, this is gold.
  • Mechanical refactoring: Replacing .Free with FreeAndNil(), removing with statements, modernizing old string handling — Claude handles these reliably.
  • Writing unit tests: DUnitX tests are one of the things Claude does reasonably well. It creates test classes, covers edge cases, and follows existing patterns if you point it at your test folder.
  • Explaining code: “Trace the flow from when the user clicks Apply to when the wallpaper changes” — Claude follows the call chain across multiple units and explains how they connect.
  • Compiling your project: With a simple Build.cmd script, Claude can run MSBuild, read compiler errors, and fix them iteratively. This alone saves significant time.

What Claude Gets Wrong

And yes, there’s plenty it gets wrong. The book documents these in detail:

  • Library hallucinations: Claude invents non-existent units and functions. It’ll confidently tell you to use “System.Utils.FileHelper” — which doesn’t exist. This is worse for Delphi than for Python because there’s far less Delphi in the training data.
  • Overengineering: I asked Claude to convert a combo box to a list box. It used TValue.From<Integer> when a simple Item.Tag := i would do — 50 lines instead of 5.
  • Silent nil checks: Claude loves adding if Object = nil then Exit instead of finding why the object is nil. This hides bugs rather than fixing them.
  • DFM blindness: Claude can read DFM files as text, but it doesn’t truly understand the relationship between a DFM and its PAS file. It might add a button click handler but forget to add the button itself.
  • Reformatting your code: Without explicit instructions, Claude will “clean up” your entire file’s formatting, creating massive diffs that are impossible to review.

The key insight: most of these problems are preventable. The book shows you exactly how.

The Secret Weapon: CLAUDE.md

The single most important thing you can do with Claude Code is write a good CLAUDE.md file — a project instruction file that teaches Claude your coding conventions, your build process, and your forbidden patterns.

This isn’t just my opinion. The book analyzes two scientific studies:

  • ETH Zurich (Feb 2026): Human-written instruction files improved task success by 4%. Auto-generated ones made things worse.
  • SMU/Heidelberg (Jan 2026): Instruction files made the AI agent 29% faster and use 17% fewer tokens.

For Delphi specifically, the payoff is even larger. Claude’s training data is thin on Delphi compared to Python or JavaScript. A CLAUDE.md that specifies your formatting conventions, your preferred libraries, your build process, and your forbidden constructs removes guesswork that simply doesn’t exist in mainstream language projects.

The book includes a complete CLAUDE.md template specifically for Delphi projects, with explanations for every section.

The Delphi AI Landscape in 2026

The situation has improved dramatically since my first tests:

  • Claude Code now runs natively on Windows — no more WSL required.
  • Embarcadero shipped Smart CodeInsight in RAD Studio 12.2 — an AI assistant built into the IDE supporting Claude, ChatGPT, Gemini, and local models via Ollama.
  • CodeBot by RemObjects is in beta — a proper AI agent that understands DFM files and Delphi project structure.
  • Community plugins (Delphi AI Developer, ChatGPTWizard) bring AI chat into the IDE for free.
  • GDK Software now offers dedicated Claude Code training for Delphi developers.
  • Context7 MCP server feeds up-to-date documentation into Claude’s context, reducing hallucinations.

A year ago, we had nothing. Now the tooling is evolving fast.

 

____________________________

The Book

Everything in this article — and much more — is covered in detail in “Delphi in All Its Glory — AI-Assisted Development.” Here’s what’s inside:

Part I — Understanding AI: How LLMs actually work, what agents are, and an honest look at what AI can and cannot do for Delphi developers.

Part II — Getting Started: Complete installation and configuration on Windows. Settings, permissions, sandboxing, the memory system, voice dictation, status line customization. Plus: connecting Claude to a Delphi project with CLAUDE.md files, build scripts, and prompt templates.

Part III — Day-to-Day Usage: Essential commands, context window management, parallel sessions, Plan Mode, building projects through Claude with MSBuild.

Part IV — Real-World Testing: The heart of the book. I tested Claude on actual production projects and documented everything — what worked, what failed, how much it cost, how much time it saved. No cherry-picked examples. Includes Claude’s actual Delphi knowledge gaps and a detailed productivity analysis backed by the CodeRabbit industry report.

Part V — Advanced Techniques: The CLAUDE.md skill document (with scientific research on its effectiveness), MCP servers, hooks for automating workflows (auto-compile after edits!), sub-agents for specialized tasks, and IDE integration options including Embarcadero’s Smart CodeInsight and the upcoming CodeBot by RemObjects.

Part VI — Best Practices: The “one-file workflow” for large projects, context management strategies, prompt writing for Delphi, cost management, the Desktop App and Web interfaces, data privacy, and the checkpoint/rewind system.

Part VII — Final Verdict: An honest assessment with recommendations for different skill levels.

No prior AI knowledge required. Every example is Delphi-specific. Every workflow is for native Windows applications.

About the Series

This is Part 5 of the “Delphi in All Its Glory” series — over 2,000 pages across five books:

  • Book 1: “Delphi for More Than Mere Programmers” — complete beginner’s guide (~580 pages)
  • Book 2: “Reaching for the Gods” — compiler internals, debugging, memory management, performance (~450 pages)
  • Book 3: “Libraries & Packages” — package architecture, VCL internals, custom components (~250 pages)
  • Book 4: “Crossplatform FMX” — cross-platform development with FireMonkey (~300 pages)
  • Book 5: “AI-Assisted Development” — this book (~280 pages)

All books are available on Amazon (print) and at www.GabrielMoraru.com (eBook).

Source code for examples: GitHub.com/GabrielOnDelphi

 

 

Scroll to Top