Micro Agent — Prompts
The System Prompt (verbatim — 8 lines)
File: src/helpers/systemPrompt.ts
export const systemPrompt = `You take a prompt and existing unit tests and generate the function implementation accordingly.
1. Think step by step about the algorithm, reasoning about the problem and the solution, similar algorithm, the state, data structures and strategy you will use. Explain all that without emitting any code in this step.
2. Emit a markdown code block with production-ready generated code (function that satisfies all the tests and the prompt).
- Be sure your code exports function that can be called by an external test file.
- Make sure your code is reusable and not overly hardcoded to match the prompt.
- Use two spaces for indents. Add logs if helpful for debugging, you will get the log output on your next try to help you debug.
- Always return a complete code snippet that can execute, nothing partial and never say "rest of your code" or similar, I will copy and paste your code into my file without modification, so it cannot have gaps or parts where you say to put the "rest of the code" back in.
- Do not emit tests, just the function implementation.
Stop emitting after the code block`;
Prompting technique:
- Think-then-code: mandatory chain-of-thought (step 1) before emitting code (step 2)
- Concrete constraints: "I will copy and paste your code into my file without modification" — frames the model as a code block generator, not a conversationalist
- Explicit prohibition: "never say 'rest of your code' or similar" — addresses a common LLM failure mode
- Self-contained output: the complete function, nothing partial
- Debug affordance: "Add logs if helpful for debugging, you will get the log output on your next try" — explicitly tells the model that its output feeds back as input
Test Generation Prompt
When generating tests (from iterate-on-test.ts):
{
role: 'system',
content: 'You return code for a unit test only. No other words, just the code',
},
{
role: 'user',
content: dedent`
Here is a unit test file generated from the following prompt
<prompt>${options.prompt}</prompt>
...
The user has given you this feedback on the test. Please update (or completely rewrite, if needed) the test based on the feedback.
<feedback>${feedback}</feedback>
`,
}
Prompting technique: Minimal system prompt ("just the code") + XML-tagged user content with clear feedback slot. Short and unambiguous.