Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
beginner GitHub Copilot IMCSEIAN Prompting Specificity Tutorial

Specificity: Why 'Write a Function' Fails and 'Write a Function That…' Works

Reviewed & accurate
AI Summary
IMCSEIAN · GitHub Copilot Master Course

Specificity: Why 'Write a Function' Fails and 'Write a Function That…' Works

Specific prompts produce useful output; vague prompts produce vague output.

Phase 1 — Beginner Lesson BE-16 Difficulty: Beginner 7 min read
Course: GitHub Copilot Phase 1 — Beginner 7 min read Last verified: 2026-08-30

What You Will Learn

  • Recognize the specificity ladder.
  • Upgrade vague prompts into specific ones.
  • Use constraints, examples, and context to add specificity.
  • Avoid over-specifying into micromanagement.
  • Measure the impact of specificity on output quality.

Why This Matters

A vague prompt is a slot machine — sometimes good, often bad. A specific prompt is a precision tool. The difference between 'write a function' and 'write a function that takes a Date and returns an ISO 8601 string in UTC' is the difference between useless and useful.

Concept Explained

Specificity is the practice of telling Copilot exactly what you want: inputs, outputs, constraints, conventions, examples, edge cases. The specificity ladder goes from one-word prompts ('sort') to fully-specified prompts with examples and constraints.

How It Works

Specificity works because it narrows the model's probability distribution. 'Write a function' could mean thousands of things; 'write a TypeScript function that takes a Date and returns an ISO 8601 UTC string, throwing on invalid input' means essentially one thing. Narrower distributions produce more useful outputs.

Step-by-Step Tutorial

1. Identify vague prompts

Spot prompts like 'do this', 'fix', 'add tests'. They're too vague.

2. Apply the specificity ladder

Add: input types, output types, constraints, edge cases, examples, conventions.

3. Use constraints

'Don't use external libraries', 'must handle null', 'throw on invalid'.

4. Provide examples

One example often beats ten constraints.

5. Stop before micromanaging

Don't dictate implementation step-by-step; let Copilot fill in patterns.

Real-World Example

A developer asked Copilot to 'write a function to validate email'. Copilot produced a 30-line regex monster that failed on edge cases. The developer upgraded: 'write a TypeScript function isValidEmail(s: string): boolean that returns true for RFC 5322-compliant emails, false otherwise, no external dependencies, with a single test case showing it accepts user@example.com and rejects user@'. Copilot produced a clean 5-line function using a focused regex, plus the test case.

Example Prompts / Commands / Code

Specificity ladderimcseian
Level 0 (vague):     'write a sort function'
Level 1:             'write a TypeScript function that sorts an array of numbers ascending'
Level 2:             'write a TypeScript function sortAsc(nums: number[]): number[] that returns a new sorted array, doesn't mutate input, throws on null'
Level 3:             same as Level 2 + 'use quicksort, here's an example: sortAsc([3,1,2]) → [1,2,3]'
Level 4 (micromanage): 'write a sort function. Define a function called sortAsc. Take one parameter called nums. Use quicksort. The pivot should be the middle element...' ← TOO MUCH

Common Mistakes

  • Stopping at Level 0 or 1 — too vague for useful output.
  • Jumping to Level 4 — micromanaging kills Copilot's pattern-matching value.
  • Adding constraints without examples — constraints alone are ambiguous.
  • Specifying implementation instead of behavior.

Best Practices

  • Aim for Level 2–3: types, constraints, one example.
  • Specify behavior, not implementation.
  • Use examples to clarify ambiguous constraints.
  • Iterate: start specific, add more if needed.

Troubleshooting

ProblemHow to Fix
Output still wrong despite specificityTry a different model. Or attach a reference file showing the desired style.
Output feels genericAdd a constraint or an example.

Practical Exercise

Your Turn

Take a vague prompt you've used ('add error handling'). Rewrite it at Level 2 (types + constraints) and Level 3 (with an example). Compare outputs.

Key Takeaways

  • Specificity = the practice of telling Copilot exactly what you want.
  • Ladder: vague → typed → constrained → with example.
  • Aim for Level 2–3.
  • Specify behavior, not implementation.
  • One example often beats ten constraints.

Frequently Asked Questions

How specific is too specific?
When you're dictating line-by-line implementation, you've gone too far. Specify behavior and let Copilot fill patterns.
Should I always provide examples?
Not always, but they help for ambiguous tasks. See BE-19 on few-shot.
Does specificity cost more credits?
Marginally — longer prompts use more input tokens. Worth it for the quality gain.

Further Reading

Official References

Related lessons: BE-15, BE-19

SEO Metadata

SEO title: Specificity: Why 'Write a Function' Fails and 'Write a Function That…'

Meta description: Specific prompts produce useful output; vague prompts produce vague output.

Primary keyword: specificity

Secondary keywords: specificity: why 'write a function' fails and 'write a function that…' works

Search intent: Informational

URL slug: /copilot-prompt-specificity-ladder

Categories: AI Tools, GitHub Copilot

Tags: GitHub Copilot, Beginner, Prompting, Specificity, IMCSEIAN, Tutorial, IMCSEIAN

Featured image concept: IMCSEIAN lesson card for Specificity: Why 'Write a Function' Fails and 'Write a Function That…' Works

Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments