back to blog
    Jan 2026·9 min

    Prompt Engineering for Developers: Beyond 'Be Concise'

    Structured prompting techniques, chain-of-thought patterns, and tool-use design that turn LLMs from chatbots into reliable software components.

    Prompt EngineeringLLMsDeveloper Tools

    Treat a prompt like a function signature: typed inputs, a declared output contract, and tests. Everything else is folklore.

    Make the output a schema, not a hope

    Structured outputs remove the entire class of bugs where you parse prose with a regex at 3 a.m.

    ts
    const Ticket = z.object({
      severity: z.enum(["low", "medium", "high", "critical"]),
      component: z.string(),
      summary: z.string().max(120),
      steps: z.array(z.string()).min(1),
    });
    
    const res = await ai.chat({
      model: "google/gemini-2.5-flash",
      messages: [
        { role: "system", content: "Classify the bug report. Use only the provided enum values." },
        { role: "user", content: report },
      ],
      response_format: { type: "json_schema", json_schema: { name: "ticket", schema: toJsonSchema(Ticket), strict: true } },
    });
    
    const ticket = Ticket.parse(JSON.parse(res.choices[0].message.content));

    Version prompts like code

    ts
    export const PROMPTS = {
      "classify@3": {
        system: "Classify the bug report. Prefer 'medium' when evidence is thin.",
        temperature: 0,
      },
    } as const;
    
    // Log the version with every call so a quality regression is a diff, not a mystery.
    logger.info({ prompt: "classify@3", tokens: res.usage.total_tokens });

    Techniques that survive contact with production

    • Put the instruction before the data, and delimit the data clearly.
    • Give two or three examples of the hard cases, not the easy ones.
    • Ask for reasoning in a field you discard, rather than banning it — quality drops when you forbid thinking.
    • Set temperature 0 for anything a machine will consume downstream.
    • Keep an eval set of 30–50 labelled cases; run it on every prompt change in CI.

    'Be concise' is not a technique. A schema, an eval set, and a version number are.