Using Claude or CoPilot to generate templates

Hi Rick,

That is exactly what I have been doing. However, both CoPilot and Claude, took me into a loop of potential fixes that resolved nothing.

I then tried asking for just a class/classes, a CLW and INC, I could use and forget about the template. Still working on this but neither seem to have a minimum grasp of Clarion 11.1.13855.

Thanks,

Jeff

1 Like

Whats the API’s you are trying to put into a class?

Hi Rich,

The API is from Florence Healthcare. They have a web app for storing medical research projects. I have a C11.1 desktop app that I want to integrate with the Florence API. I have access to a sandbox/training version of Florence eBinders and eConsents.

I have been working recently on seeing how feasible it would be to use CoPilot, Claude, and ChatGPT, to generate a template and classes. It has not gone well, as the AI is just not familiar enough with the latest Clarion versions.

I have decided to forgo the template and just use classes. However, I’m not too knowledgeable so find it difficult to help the AI learn from it’s mistakes, and this has led to many ā€œcorrection loopsā€ that wastes a lot of time.

I would welcome any help you can provide.

Thanks,

Jeff

Hi Jeff,

I do not think the core problem is that the AI is not up to speed on the latest Clarion versions. The bigger issue is that Clarion (especially templates) is not a mainstream language, so the AI often does not have enough real Clarion patterns in its training to reliably stay inside the lines.

I have used AI heavily for Clarion class work. In our QuickBooks API wrapper, I used it to produce well over 5000 lines of Clarion class code. It was not flawless, especially at first, but it absolutely became productive once I set it up to succeed.

What made the difference was giving the AI the ā€œrules of the gameā€ and a couple of known-good patterns to copy.

What to feed it up front

  • Concrete examples of real Clarion source files: INC, CLW, and optionally EQU.

  • A tiny, correct starter class example (even ā€œHello Worldā€ style) that shows:

    • How the class is declared in the INC.
    • How methods are implemented in the CLW.
    • How you format indentation and structure.
  • Clarion-specific rules that AIs constantly mess up unless you spell them out, like:

    • Do not use reserved words as variable names.
    • Procedure prototypes in the INC include the return type, but the CLW method implementation line does not.
    • Procedure names, routine names, and variable declarations start in column 0.
    • Executable code starts in column 2 and indents by 2 consistently.

How to avoid correction loops

  • Give it a small task first, then build up.

  • When you get errors, paste back:

    • The exact source it generated.
    • The exact compiler error text.
    • Your best guess about what is wrong (even if you are not sure).
  • Ask it to explain the fix in plain terms, then generate a corrected full block.

Also, keep reminding yourself what the AI is.

It is not sentient. It is a pattern machine.

If you show it the pattern you want, and you give it the constraints clearly, it can surprise you with how well it does even in a niche environment like Clarion. But if you ask it to invent a template or a class from scratch with no examples, you will get confident-looking nonsense.

One more practical tip

Because Clarion is not mainstream, you will often need to re-establish some of this context in new chats. When it starts drifting or ā€œgoing off the railsā€, grab a short continuation prompt from it and restart a fresh thread with your key rules and examples. That is usually faster than burning time in endless correction loops.

If you want to see the kind of prompting and structure that made this work for me, here is the QB AI primer I use as a base.

https://clarionproseries.com/ai/qbai-primer.txt

A developer can feed this to any major AI and it will write workable code that they can paste into our AI Code Checker (a part of the QB wrapper) and it will allow you to get instant results without even writing code in your program or knowing how the QuickBooks API works - the AI already knows this, so you just tell it what you are trying to do.

Also, I am working on a book called ā€œReal Programmers Use AIā€ that gets very specific about how to work with AI effectively (prompt structure, iteration loops, error-driven repair, avoiding token drift, etc.). I am also planning a Clarion-focused supplement that shows concrete Clarion examples and patterns, since Clarion developers have a special challenge here due to limited AI familiarity with the language.

If you post a small example of the class you are trying to build (INC and CLW, plus the errors you are seeing), I can help you set up a tighter prompt and iteration loop so you get productive instead of stuck in correction cycles.

Charles

1 Like

I cant find their API’s online only a reference to an open API here

Does eBinders integrate with other software?
Yes, eBindersā„¢ has an open API which means it can integrate with all other software systems that are open to integrate. We work with all clients to verify that their software processes are seamless across systems and duplicate work is avoided at all costs.

If you want to learn more about what software integrations an eRegulatoryā„¢ system should have, please visit our integrations debrief here.

So I cant really comment on how you are going to build a class for this.

As its online, I’m guessing there is going to be some sort of TCP communication, doubt they will use UDP for medical data despite its expedienc but they might because some scans generate a lot of data.

With that in mind you might be able to use/adapt the SV tcp/ip classes but most likely Nettalk for the comms, with your class acting as a wrapper between the two.

Hi Rich,

I have access to a Developer Portal at Florence. I’ll ask if I can share this with others here. In the meantime, I’ll have Claude generate a new INC and CLW and post them here so you and others can see them. Charles also posted some nice tips, and I’ll try to apply those to see how I do. Do you have a recommended AI engine? I like Claude the best after recent testing.

Thanks,

Jeff

Hi Charles,

I’ll get you, and the others here, the next set of CLW and INC files shortly, so you can take a look. I’m also going to be uploading the references, others have mentioned, to Claude and see how much difference this makes. I like Claude the best so far. In your experience is there a better AI engine to use?

Thanks,

Jeff

Jeff, that sounds like a good next step.

Uploading the reference docs and a couple of real CLW/INC examples will make a huge difference. That is usually the point where the output stops being random pattern-matching and starts respecting the constraints it is working under.

On the ā€œbest engineā€ question, and not just for templates but for Clarion in general, it honestly reminds me of something from a few years back when I was researching the best camera to take on a hiking trip. The answer I kept hearing was, ā€œThe best camera is the one you actually use.ā€

I think AI is the same way.

I work with all five of the top AIs and use three of them regularly, including ChatGPT. They all have strengths and weaknesses. I have written a tremendous amount of solid Clarion code with ChatGPT, but like any AI, you have to recognize the signs when it is starting to drift or go off the rails. When that happens, you need to stop, tighten the prompt, add context or examples, and guide it back on track.

The real advantage comes from familiarity. The AI you use the most is usually the one you get the most out of, not because it is inherently better, but because you have learned how to talk to it. You learn what kind of prompts it responds well to, when it is guessing, and how to correct it before it wastes too much time.

So I would not frame it as ā€œwhich AI is best,ā€ but rather ā€œwhich AI do you learn to use well.ā€

With good references, known-good examples, and a willingness to actively steer it, all of the major engines can be very productive for Clarion work.

I dont, I’ve not got any to do anything more than a few lines of code which then needs me to correct the syntax and other problems, kind of like what you are going through right now.

So in the main, I just use them for generating equate lists which is one of the hardest things I find because its often (but not always) not in the online microsoft window api docs, so co-pilot and others can pull them bit by bit out of different github repos (but typically microsoft’s own) and where neccesary reassemble the odd equate or two.

The normal search engines like google and bing cant always deliver because by virture of being a search engine will only direct you to a finished list, which is great when they exist. Google and Bing dont like directing me to github repo’s where equate lists exist.

However I do read alot of blogs on the subject, like these:

https://spectrum.ieee.org/ai-coding-degrades

https://blog.cloudflare.com/code-mode/

There’s just so much on the subject and thats before we build LLM’s into our own applications as this large blog post will give you a hint at… :grinning_face:

1 Like

Hi Rich,

I have attached another run at a template and classes. The template does register this time but the inc and clw files seem to be a problem. I have corrected a number of errors, like a space after Procedure (), which should have no spaces before the parentheses. There was also an issue with case sensitivity with the inc and clw extensions.

Thanks,

FlorenceAPI.tpl (7.2 KB)

FlorenceAPI.inc (4.5 KB)

FlorenceAPI.clw (22.3 KB)

Jeff

Jeff,

That sounds like your AI is making things up.

Clarion is not case sensitive about filenames.

Charles

I dont use these, so cant load the files up. Sorry.

  Requires: NetTalk 14.30+, jFiles 3+, StringTheory 3+

It sounds like SDD (Spec-Driven Development).
Do you use some framework? I read something that OpenSpec it’s simpler than BMAD

Hi Jeff,

I’m not sure, but I don’t think the compiler has a problem with a space after PROCEDURE () and Clarion is not case sensitive in either the language or the template language and it doesn’t care about case of filenames because Windows doesn’t.

I have used Claude, CP, and Gemini to generate Clarion code and they all hallucinate up all kinds of functions that don’t exist in Clarion. For what I do, it’s generally not worth the time except maybe to get ideas to work from.

Good luck!

By Default, thats correct, but if someone has this reg setting enabled then the NTFS will be case sensitive

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]
"obcaseinsensitive"=dword:00000000

and if using WSL there is this bit on using folder specific case sensitivity, with links to DevBlogs.

Hello everyone,

I have not made any progress, after experimenting with 6 different AI engines. I tried just having them generate the class files for me, the .inc and .clw. They each gave different instructions on how to use the .clw, basically adding it to the application in Libraries, Objects and Resource Files in the Solution Explorer. Then, placing the .inc file in the Global Embeds, Inside the Global Map embed as: Include(ā€˜myClassFile.inc’),ONCE

Just to be sure of things, can someone outline the correct process here? That is, the proper way to add a new class to a C11.1.13855 app?

Thanks!

Hi Richard,

Sure, but you have to install WSL and/or change the registry for that and in general wouldn’t be something you’d do unless you REALLY need it for very specific reasons, like to force Linux filename compatibility, and I’m sure Jeff would know if he had set that up and recognized it :slight_smile: The point is, that out of the box, Windows and Clarion are case insensitive.

Best regards,

Hi Jeff,

Normally, it would be in a global DATA embed, something like:

clarionINCLUDE('MyClassFile.inc'),ONCE

That’s it.

The class declaration should have attributes to link the CLW file, it should not need to be included. Like:
clarionITCoreClass Class,TYPE,Module('ITCoreClass.clw'),Link('ITCoreClass',_ABCLinkMode_),DLL(_ABCDllMode_)

This will set the clw up to be included viat he MODULE() attribute and the LINK() attribute tells the complier/linker how to link it to the exe/dll where it is used.

This is pretty standard stuff.

Best regards,

1 Like

Do you clarion enterprise? There’s actually a SourceClass template there that sort of helps

Hi Sean,

I do Have Enterprise, but was not able to find the SourceClass template. Can you tell me where to find it?

Thanks,

Jeff