# Structured prompts dramatically improve LLM output

**Date:** 2025-12-13  
**Tags:** AI, LLM, Prompting  
**URL:** https://kelexine.is-a.dev/til/ai-prompt-engineering

---

TIL: Structured prompts dramatically improve LLM output. Include: role, context, task, format, and constraints. The difference between 'write code' and a detailed prompt is like the difference between a junior dev and a senior one.


```text
You are a senior TypeScript developer.

Context: Building a REST API with Express.

Task: Create a user validation middleware.

Format: TypeScript with JSDoc comments.

Constraints:
- Use zod for validation
- Return 400 on failure with error details
```




---

*This content is available at [kelexine.is-a.dev/til/ai-prompt-engineering](https://kelexine.is-a.dev/til/ai-prompt-engineering)*
