FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Getting Better Code from AI: Why I Always Start with Clear Coding Rules*
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Getting Better Code from AI: Why I Always Start with Clear Coding Rules*
Posted: Tue Dec 30, 2025 08:41 AM

Hello friends,

I use ChatGPT as an AI coding assistant, and I’ve had very good results with one simple principle:
always define clear coding rules at the very beginning of the conversation.

The key is to write these rules explicitly, as bullet points, and in an imperative form—ideally as a separate block at the top of your prompt.

Example:

Coding rules (must be strictly followed):

  • DBF field names: max. 10 characters
  • All LOCAL/STATIC variables must be declared at the beginning of a function
  • Before APPEND BLANK or SKIP, the correct workarea must be explicitly SELECTed
  • Use SET DELETED ON, never SET EXCLUSIVE ON
  • No implicit workarea assumptions

👉 This is the most important rule:
don’t hide constraints in prose—state them clearly and technically.

Why this works

A block like this is not treated as a “preference,” but as hard constraints, similar to:

  • compiler constraints
  • style-linter rules
  • fixed project guidelines

If the AI violates them, it’s considered an error—not a stylistic choice.
The result is more consistent code, less cleanup afterward, and solutions that truly match your established coding style.

This approach is especially valuable when working with legacy environments (for example DBF, Harbour/FiveWin), where precision and discipline matter much more than creative freedom.

Best regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Getting Better Code from AI: Why I Always Start with Clear Coding Rules*
Posted: Tue Dec 30, 2025 09:49 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion