PrepGenAICerts

Prompt Specificity & Precision

Core

Design prompts with explicit criteria to improve precision and reduce false positives · Difficulty 2/5

0%
specificitycriteriaprompting

Explanation

Vague prompts produce inconsistent results. Prompt specificity means replacing ambiguous instructions with precise criteria that the model can apply deterministically.

Example: Comment Analysis

Vague: "Check that comments are accurate and up-to-date"

  • Flags TODOs, descriptive comments (false positives)
  • Misses genuinely outdated comments (false negatives)

Specific: "Flag comments only when their claimed behavior contradicts actual code behavior"

  • Eliminates false positives on acceptable patterns
  • Catches genuinely misleading comments

Principles

  1. Define criteria, not goals: "Flag contradictions" not "check accuracy"
  2. Specify boundaries: What should and should NOT be flagged
  3. Use severity definitions: Concrete code examples for each severity level
  4. Test with edge cases: Verify the criteria handle ambiguous inputs

Key Takeaways

  • Replace vague goals with specific, actionable criteria
  • Define what should NOT be flagged, not just what should
  • Concrete severity criteria with examples improve consistency

Related Concepts

Test Yourself

1 / 1

Your automated review analyzes comments and docstrings. The current prompt instructs Claude to "check that comments are accurate and up-to-date." Findings frequently flag acceptable patterns while missing comments that describe behavior the code no longer implements. What change addresses the root cause?

PrepGenAICerts is an independent exam-prep site. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. Claude and Anthropic are trademarks of Anthropic, PBC. Exam details are taken from publicly available Anthropic and Pearson documentation. About PrepGenAICerts.