H
Posts
Posts
Polls
Polls
Jobs
Jobs
Members
Members
Leaderboard
Leaderboard
Reviews
Reviews
    Happiest Startup Studio
    Posts
    High Quality Promopt - technical, repeatable, and testable
    H
    Happiest Startup Studio•6mo
    @shubhampareek

    High Quality Promopt - technical, repeatable, and testable

    Short overview: a great prompt is a precise specification — like a mini-requirements document for the model. Treat prompt-writing like product requirements: define the goal, inputs, constraints, examples, acceptance tests, and an iteration loop. 1) Define the goal (1–2 sentences) • What exact output do you want? (code, JSON, text, checklist, UI layout, testcases, bugfix) • Who is the consumer of the output? (developer, product manager, end user) • Example: “Generate a responsive React component (TSX) named UserCard that accepts props {name, avatarUrl, bio} and passes ESLint + unit tests.” 2) Specify the model role & context • Use a role line to bias tone/skill: e.g. You are an expert full-stack developer with 8 years experience in React, TypeScript and Tailwind. • Add context that matters (stack, company style guide, constraints). 3) State the input(s) and provide samples • List the inputs the model will receive (text, JSON, CSV, files, examples). • Always include at least one concrete example input and the desired output for that input (few-shot helps reliability). 4) Declare precise output format (machine-readable) • Require JSON schema, code file structure, or exact text format to avoid ambiguity. • Provide an explicit template: e.g. Return only valid JSON with keys: {"fileName": "...", "code": "...", "tests": "..."} 5) List constraints & non-functional requirements • Language, max tokens, coding style, package versions, performance constraints, security rules, banned words. • Example: Use Tailwind v3 classes only. No inline styles. Avoid external CDN links. 6) Break the task into sub-steps (if complex) • Ask the model to think and produce intermediate artifacts: plan → implement → test → docs. • Use an explicit checklist the model must follow and show progress for each step. 7) Provide few-shot examples / demonstrations • Give 2–4 short input → desired output pairs. • Prefer real examples from your domain (closest to production cases). 8) Define evaluation & acceptance tests • Provide pass/fail criteria and unit tests when applicable. • For extraction tasks: use precision/recall checks on a test set. • For code: require that returned code compiles/ passes given tests (supply tests if possible). 9) Tell the model how to handle errors & edge cases • Specify fallback behavior: “If a field is missing, return null and include a warnings array explaining why.” • Ask for a short “assumptions” section the model used. 10) Set model parameters and stopping behavior (operational hints) • Suggest temperature (low for deterministic tasks, e.g., 0–0.3), max tokens, and stop sequences. • Example: Temperature: 0.2, Max tokens: 800, Stop sequence: ###END### 11) Iterate: run → evaluate → refine • Run prompt against sample inputs, check acceptance tests, and refine: 1. Fix ambiguous language, 2. Tighten output schema, 3. Add / improve examples, 4. Lower temperature or add deterministic constraints. • Keep a changelog of prompt versions and evaluation scores.

    High Quality Promopt - technical, repeatable, and testable image 1 from Happiest Startup Studio community

    Sign in to interact with this post

    Sign In