Jump to content
Registration disabled at the moment Read more... ×
Javier Tarí

Using "Claude Code" with Delphi

Recommended Posts

Anyone else using the Claude Code software to program in Delphi?

I'm not asking about using AI to ask stuff about Delphi (not Claude, not ChatGPT, not Gemini)

 

If you are using Claude Code, please share anything useful for you on the topic

 

My two cents:

  • I'm using with it the Context7 MCP server, which is helpful
  • I've made a "compile" bash command that takes care of compilation
  • I've finally made an agent that uses the command, and returns the result (It helps keeping the context cleaner):
    • Compilation Sucessful
    • Compilation Sucessful but there are warnings that you MUST fix (and the list of warnings)
    • Compilation Error (and the list of the errors)

 

I'm trying to use DelphiLSP.exe through a MCP server, but with low success

Edited by Sherlock
corrected typo, for better search results

Share this post


Link to post

I've been using it with C++Builder for some time and love it. 

 

I'm on the max £150 plan and only use the Opus model. 

 

I haven't got around to setting up automatic compilation, but it's no big deal, I have CC running on WSL1/Debian so it's simple enough to just paste in any compilation errors, let CC fix them and just click to compile again.

 

(actually my biggest bugbear is probably the cutting and pasting in the terminal, despite what it says, it won't use cntrl-c/v and I have to paste via the menu, I probably need to use a different terminal).

 

Overall, I'm astonished at how well it understands my requests and is able to give me what I need. The results are rarely perfect, but I'm fine with that, the fact that it can get something to 80% complete by itself is good enough for me.

 

I think the main trick to using it is to work out when it's probably reached its limits on a particular task, and rather than just keep asking it to fix things, realise it's time to jump in and do the rest yourself. 

 

Des

 

 

Share this post


Link to post

I've got Claude Code installed on WSL2 (Claude helped me get there--it was quite a chore) but probably won't be using it much for Delphi. I support some web sites using the Hugo static generator so plan on getting my feet wet with that.

Share this post


Link to post

I've been playing with AI lately - if you can't beat them then join them 😢

 

My experiences are that the AI tools out there right now do not work that well for Delphi - they suffer far too much from library hallucinations (generate great code, if only the library existed!). I gave up and focused on some other projects/ideas

 

On the other hand, if you want to create a React or NextJs application - they will do an amazing job. The main thing is to provide a good context to start with, use the AI to generate a Product Requirements Document - refine that before you have it start coding (and tell it not to start coding till you are ready).

 

I'm still learning all this - but I was able to take a simple saas idea and spit out a working prototype in a day. I probably won't use the prototype - it generated Nodejs/Express/React code even though I told it it use asp dotnet for the backend - I'll recode it using some existing dotnet backend code (since nodejs is single threaded and I have background tasks) and iterate on the prototype front end React code. 

 

I will say the whole prompting experience is like looking over the shoulder of a junior dev - spending a day to get them to do a weeks worth of work. 2 steps forwards, 1 step back, over and over - it can be both exhilerating and friustrating at the same time. That 1 day chewed through my $25 Replit credit - so be prepared to spend. 

 

Will be trying claude code next - I have tried replit and bolt.new (good for web) so far, along with various others for basic chat stuff. 

  • Like 1

Share this post


Link to post
2 hours ago, Vincent Parrett said:

I've been playing with AI lately - if you can't beat them then join them 😢

Agree, also lately i am trying to get handle on some use of AI.

 

But, here one incident with Claude just less than 2 weeks ago, (free Claude as i am not ready to join the mass hallucinations with money yet), i had this piece of code that i just optimized, four functions that calculate some variations of an algorithm, but it was mess in commented lines and the original implementation, so out of laziness i pasted it for Claude and asked it to format it and extract/keep the original algorithms as comments, and it did beautifully in seconds, i checked the commented lines and it is right and correct, replaced the original code and all looked fine, 

Next day and out of pure luck, i was looking on different place in that unit file, and dropped the new/modified unit against the old in BeyondCompare, also by pure luck i noticed small difference in those lines, Clause changed one constant from (-8.427913) to (-7.779733), returned to my question in its history and it is there, i have no idea why and from where that constant came, but that indicate to me it is way far from being trusted, the four functions each have 7 constants that i calculated/simplified, yet it decide to change only one.

 

That is big red flag.

 

Another story on the opposite side; two days ago there was a certificate expiration problem in this very forum, and i have used Tampermonkey and Greasemonkey for years now, yet it is pain in the back still for me writing a simple script, searching the net for long time and failure goes hand by hand writing script for TM and GM, anyway, i had a script that i did years back which pop a small notification when loading visiting a site and its certificate will expire within 10 days.

So i went with Grok and asked for Chrome Extension to do the same, without providing my GM script, and it gave a full instruction and code for such extension, the extension didn't work as there was problem in manifest file, with 2 consequential questions and report of the problem the extension was running perfectly on my Chrome ( i don't really use Chrome it self but a fork called Supermium, the portable version), it was smooth experience and just saved me lot of time, just brilliant, and huge time saving.

 

Both Claude and Grok fail with Pascal/Delphi in so many ways sometimes fundamentally, yet Grok is do evolve from question to another unlike Claude which revert and keep returning to the original mistakes, as example when i asked them both to extract test vectors from C files, the test vectors where huge and more than 1000 bytes in hex values, both replaced some values out of the blue, just single byte (hex value) is different, Grok remembered the one broken value i pointed to in later questions, Claude fixed it once and after a question it reverted to the wrong value, trying to correct it second time it did drop the whole approach of constant and tried to convince me reading the data from external file is better and correct way !

I tried only the free Grok and Free Claude, as for resources extraction as the best to my short experience with AI is perplexity, it give extensive resources and sources to read when asked.

 

For now i am on the watcher bench, waiting for some real advancement when this hype frenzy start to calm down like its dust.

  • Like 1

Share this post


Link to post

@Kas Ob.  It is like having a conversation with an old pal who you know is an "embellisher" or "exaggerator". You never trust what he says and always suspect a lie being told. That is counter-productive. I would rather do the work myself. I use AI as a glorified search engine and still I doubt the answers it gives.

 

And I absolutely hate the assumptions being provided as facts. Many times I see the AIs do that.

 

Edited by PeaShooter_OMO
  • Like 1

Share this post


Link to post
18 hours ago, Vincent Parrett said:

if you can't beat them then join them 😢

It sounds as if you've given up before the fight's begun - and a fight there will be. On many different fronts.

 

So far I've read and heard endless tales of the efforts wasted on "ai". I'm sure it will eventually settle into something actually usable - if we can survive that long, but until then I'm running circles around the people that try to get ahead of the game  "ai".

The cake is a lie.

  • Like 2

Share this post


Link to post
10 minutes ago, Anders Melander said:

It sounds as if you've given up before the fight's begun

Not really - more a case of trying to better understand it so I can have an informed opinion.  

 

My experiences with ai so far - Delphi/c# meh - typescript/react/nextjs useful for prototyping or simple things. I'm about to dive into web design (looking to redevelop my website) to see if it can help.

Share this post


Link to post
53 minutes ago, Vincent Parrett said:

I'm about to dive into web design (looking to redevelop my website) to see if it can help.

A little while ago, I asked CC to suggest some designs to update our website, starting with the hompage. On one of its suggested designs it created a panel which included:-

Why Choose XYZ?

  • • Over 30 years of experience in xyz software

I was curious, as I didn't recall that information being on the website, so I asked where it had got it from. It told me that it had found a testimonial on the site that mentioned  "We purchased the xyz system in 1994..."

 

I was pretty impressed.

 

Edited by Des101

Share this post


Link to post
51 minutes ago, Vincent Parrett said:

My experiences with ai so far - Delphi/c# meh - typescript/react/nextjs useful for prototyping or simple things. I'm about to dive into web design (looking to redevelop my website) to see if it can help.

For me, I use AI with Delphi sparingly. But in two cases, it's helped quite a bit: 1) recalling seldom-used functions when I can't remember the right keyword but can describe the problem; and 2) writing unit tests.

 

For web stuff, yes, it's great!

 

The overall consensus, though is that it's not replacing our jobs any time soon: Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×