Role prompts and constraints

Day 7 of 30 · 30 Days of AI

Role prompts and constraints

Why it matters: Role prompts help the model prioritize and keep the output aligned to a purpose.

Goals

  • Write a role prompt with constraints.
  • Add a “refuse to guess” rule.
  • Create one specialized role for your job.

Key definitions

  • Role prompt: A set of instructions that define perspective, priorities, and boundaries.
  • Constraint: A rule the model must follow (format, exclusions, evidence requirements).
  • Boundary: Where the model must stop and ask for clarification.

Workflow (step-by-step)

  1. Define the role: who you want the model to act as (editor, analyst, PM).
  2. Define priorities: accuracy, brevity, tone, safety.
  3. Define constraints: output format, allowed sources, banned behaviors.
  4. Add boundaries: “If missing info, ask questions.”
  5. Test the role on 2 tasks and refine.

Example (good vs bad)

✅ Good: The role prompt produces consistent outputs with predictable limits.

❌ Bad: The role prompt is vague (“be helpful”) with no boundaries or constraints.

Checklist

  • Role is specific.
  • Priorities are ordered.
  • Boundaries are explicit.
  • The prompt discourages guessing.

Metrics / criteria

  • Measurable: You can say whether the output is correct/complete (pass/fail or a score).
  • Effort: You can produce the result in 15–30 minutes using the workflow.
  • Clarity: Another person can run your prompt and get a similar outcome.
  • Boundary compliance: model asks questions when inputs are missing.

Common mistakes + fixes

  • Pitfall: Role conflicts with task. Fix: Put task-specific constraints after the role and make them higher priority.
  • Pitfall: Vague instructions. Fix: Add constraints, examples, and a success checklist.
  • Pitfall: One-shot prompting. Fix: Iterate: draft → critique → revise → verify.
  • Pitfall: No validation. Fix: Add QA steps, tests, and explicit “what counts as done”.

Student tasks

  1. Apply the workflow to one real work task related to role prompts and constraints.
  2. Create a small artifact: prompt, checklist, rubric, table, draft, or decision note.
  3. Run one quality check and record what changed after the check.
  4. Write a 3-sentence reflection: what worked, what failed, and what you will reuse.

Useful external sources

  • OpenAI prompt engineering guide: https://platform.openai.com/docs/guides/prompt-engineering — Prompt structure, iteration, constraints, and evaluation habits.
  • NIST AI Risk Management Framework: https://www.nist.gov/itl/ai-risk-management-framework — Risk framing, governance language, and verification mindset.
  • OWASP Top 10 for Large Language Model Applications: https://owasp.org/www-project-top-10-for-large-language-model-applications/ — Practical AI safety risks such as prompt injection, leakage, and insecure output handling.
  • Google People + AI Guidebook: https://pair.withgoogle.com/guidebook/ — Human-centered AI design, user control, feedback, and failure modes.

Bibliography

  • OpenAI prompt engineering guide. https://platform.openai.com/docs/guides/prompt-engineering
  • NIST AI Risk Management Framework. https://www.nist.gov/itl/ai-risk-management-framework
  • OWASP Top 10 for Large Language Model Applications. https://owasp.org/www-project-top-10-for-large-language-model-applications/
  • Google People + AI Guidebook. https://pair.withgoogle.com/guidebook/

30 Days of AI

30-day structured course. Enroll to unlock quizzes, track progress, and earn a certificate.

Enroll in this course

Already have an account? You can sign in and enroll from the course page.