Prompt Cookbook

You can write to CodeBot naturally. You do not need magic words.

That said, a good prompt is like a good task description to another developer: say what you want, why you want it, and include anything that would catch out someone new to the codebase.

Start With Questions

What does this project do? Give me a short overview.

Explain this unit. What's it do, and what should I be careful changing?

Where is Feature X implemented? How is it used? Trace the behaviour, but in detail please, I really need to understand this part.

Research Your Code

Where is the underlying Foozlenator implemented?

Trace the code path from this button click to the data being saved.

The fact it does X and Y puzzles me. I don't understand why it's implemented like this. Can you figure out why? What did the original developer intend? What understanding am I missing?

Ask It to Reference your Code

CodeBot should look at your source code when figuring things out. If for any reason it doesn't, tell it to:

Quote the implementation.

Don't answer from memory; look at the code and refer to the implementation.

Plan Before Editing

Make a plan first; do not edit files yet.

/plan Implement X.

Do Larger Work

For real implementation work, give CodeBot the same context you would give a developer. Here is the actual real-world prompt we gave CodeBot which we used to build the slash command popup completion:

Hello. In the chat frame, which is a view over the AI conversation, we have an input memo. Currently this is just a plain TMemo, which is fine. However, we have slash commands, like /init, some of which are inbuilt and some of which can be provided by custom agents or by MCP servers. I would like to add support for 'completing' these. The design I think we need is: a TMemo descendant, where if the first non-whitespace character being typed is a slash, and we're typing it or something non-whitespace-connected to it like /foo| where | is the caret (ie, no actions when it's /foo bar baz|), is to show a popup listing the available slash commands. Now, for this to complete, I think it needs to take focus so we can cursor up and down to select; and as the user types it would get the key presses or messages and insert into the memo. Escape to cancel it. Enter or tab to insert/complete the command. Best to test this in its own VCL app, I made a blank project called CommandCompletionTest, so you can write the component in our normal Source folder (one file) but edit this app to create it at runtime with a test set of commands, so we can try it out. How's this sound?

This:

  • Introduces the issue (what the chat frame is, what slash commands are)

  • What we want: completing them

  • What I thought was the best design

  • How we want to test it (as a VCL app, I wanted a separate test app in order not to have to test within the full CodeBot client)

  • Asked for its input. CodeBot has good ideas.

It worked, and when you use slash commands that UI that is shown was built by CodeBot from this prompt. I did not specify things like a clean data separation for listing commands; CodeBot should do that by itself. Also, we did it step by step: this doesn't include underlining the slash command in the memo (which I added later) and we built and tested / bugfixed this before adding more to the feature.

A single paragraph like this can lead to great outcomes. You don't need to over-specify. Share a goal and what's important to you; let CodeBot do the rest.

Stop and Ask You Questions

If you hit areas that look uncertain, don't assume - stop and ask me instead.

Once you've analysed, pause, and ask me what to do next.

It will give you options and ask for your feedback.

Work on Forms

Let's clean this UI up. Add a page control. Move these controls into logical groups, one tab per group.

Review this form for likely runtime issues: missing event handlers, bad anchors, or controls that won't resize well.

Debug Carefully

Find the cause of this crash. Figure out several hypotheses. This only happens sometimes. Maybe there are ordering, event, threading, or lifetime issues?

The app is slow when rendering this data. Trace the code path and identify why.

Ask or Consult

I need to add Feature X. Should I do it here, or is there a better place?

What are the tradeoffs between these two approaches?

What would you be worried about if we implemented it this way?

Give CodeBot Context

This area is old and fragile. Be very careful adding the new Foozle and ask me as you do it. Figure out potential issues before changing anything.

Ask for Review

Review this against the original goal. Did we miss any requirements? Could we do it better?

Look for likely bugs, confusing code, and places where this does not match the surrounding style.

Security Review

/security Look specifically at input validation and file access.

Ask for a Summary

Summarise what you changed and what I should review.

What did you learn about this codebase that we should save in agents.md?

Ask It to Remember

Remember this in your agents.md: [team-wide project rule here]

Remember this in my personal agents.md: [personal preference here]

See Learning Your Codebase for the difference between project and personal agents.md.

See Also