
Why vague prompts fail
When a prompt is vague, the assistant fills gaps with assumptions. Sometimes those guesses match your intent; often they do not. The minimal example below shows how ambiguity quickly leads to unintended behavior.A better prompt — be explicit about intent and constraints
A good prompt explicitly states the stack, the endpoint, validation rules, authentication expectations, and desired responses. This reduces ambiguity and lets the assistant produce runnable code with fewer clarifications. Example improved prompt:Example project changes the assistant might create
Below are concise, corrected snippets that implement the requirements above. These files illustrate a minimal but production-minded Express + PostgreSQL + JWT authentication flow. package.json (created by initialization)
To use the endpoint: set up your PostgreSQL database, configure credentials in
.env, run schema.sql to create the users table, install dependencies (npm install), and start the server (npm start or npm run dev).
Prompt-writing formula: Context → Action → Details → Examples
Use a concise formula to craft prompts that minimize follow-up:- Context: Describe the environment or codebase (stack, existing endpoints, naming conventions, constraints).
- Action: Exactly what you want done (for example, “Create POST /api/auth/login endpoint”).
- Details: Validation rules, libraries to use, security requirements, response shapes, and error handling.
- Examples: Provide sample request/response payloads or short output examples to set expectations.
Tip: Put the most important constraints (stack, required libraries, validation rules, and response format) at the start of the prompt. Spending a minute to write a clear, complete prompt often saves 10+ minutes of revision.
The three C’s of good prompts
- Clear: Avoid ambiguity and name the exact behavior you expect.
- Complete: Include all requirements and constraints up front.
- Contextual: Provide relevant background—existing patterns, environment, or architecture decisions.
Summary
- Vague prompts invite incorrect assumptions—be explicit about stack, validation, security, and response formats.
- Use the Context → Action → Details → Examples structure to make prompts actionable and reproducible.
- Follow the three C’s: Clear, Complete, Contextual.
- Small time invested in writing a good prompt yields faster, more secure, and more maintainable results.
Links and references
- Express.js: https://expressjs.com/
- express-validator: https://express-validator.github.io/
- bcrypt: https://www.npmjs.com/package/bcrypt
- jsonwebtoken (JWT): https://www.npmjs.com/package/jsonwebtoken
- node-postgres (pg): https://node-postgres.com/
- PostgreSQL documentation: https://www.postgresql.org/docs/
- Kubernetes Basics (for learning deployment patterns)
- Docker Hub: https://hub.docker.com/
- Terraform Registry: https://registry.terraform.io/