AI prompting: zero-shot Ruby
This course covers zero-shot prompting for Ruby code: getting a correct, usable answer to the first request instead of going through a correction loop. It works through three levers. Name the exact method signature and return shape, give concrete input-to-output examples, and state edge cases such as nil, empty or boundary input. A worked example compares a vague prompt with a precise one for an Article method. The course closes by explaining why even a well-prompted answer still needs a review checklist.
What you'll learn
- ✓What zero-shot means and what a correction loop costs
- ✓Naming the exact method signature and return type in a request
- ✓Using one input-to-output example per branch to fix a format
- ✓Stating edge cases like nil, empty strings and time boundaries
- ✓Comparing a vague prompt with a precise one on the same method
- ✓Reviewing a good AI response with a four-question checklist
What zero-shot means
"Write a method that checks if an article is old" gets an answer. It's rarely the right one on the first try, so a habit forms: read it, say "no, I meant based on published_at, not created_at," read the next attempt, say "no, return a boolean, not a string," and repeat. Zero-shot means something…
Read the full lesson free →Curriculum
7 lessonsWhat zero-shot means
Defines zero-shot as a correct first answer and introduces three levers: signature, examples and edge cases.
Naming the exact method signature
Shows how naming Article#stale? with no arguments and a boolean return closes three kinds of guesswork.
Return shape and concrete examples
Uses two input-to-output examples to pin down separators, date format and draft wording that prose leaves open.
Stating edge cases explicitly
Explains how one sentence about a nil published_at could have prevented the evergreen? NoMethodError bug.
Worked example: vague prompt vs. precise prompt
Compares vague and precise prompts for time_since_published, showing raw seconds and a nil crash versus matching output.
Reading an AI response critically, even a good one
Applies the four-question review checklist to a good response and explains why prompting does not replace review.
Putting it together: signature, examples, edge cases
Recaps the three levers, the worked example and how context, precise prompts and review work together.