Coding activity
Bug Detective
Parent reads silly broken instructions out loud. Child spots what is wrong with each step and tells the parent how to fix it.
Materials and setup
- picture cards or drawn sequences
- paper
- markers
- maze printouts
How this changes by age
Pre-K (ages 3–4)
Parent reads silly broken instructions out loud. Child spots what is wrong with each step and tells the parent how to fix it.
Steps
- Parent reads broken instruction 1 in a robot voice: 'Walk forward, forward, forward — INTO the wall.' Child says what's wrong. Parent fixes it ('stop before the wall').
- Broken instruction 2: 'Now turn around.' (Robot keeps facing the same direction.) Child says: 'You didn't actually turn!' Parent fixes it by spinning.
- Broken instruction 3: 'Pick up the cup that is on the high shelf you can't reach.' Child explains why this won't work. Parent fixes it (use a step stool, or pick a cup you can reach).
- Try 2-3 more broken instructions: 'Put on your shoes before your socks.' 'Pour the milk into the upside-down cup.' Child finds the bug each time.
- Celebrate: 'You're a bug detective! Spotting mistakes is what coders do all day.'
- Tell a grown-up one thing that surprised you.
Learning objectives
- Listen carefully to a sequence of spoken instructions and notice what is wrong
- Explain a fix in their own words
- Understand that mistakes are a normal, fixable part of doing things
Kindergarten (ages 5–6)
Parent gives a 5-step recipe for making a sandwich with one obvious bug. Child finds and fixes it, then writes their own 5-step recipe with a hidden bug for parent to find.
Steps
- Parent reads aloud a 5-step sandwich recipe. Step 2 is the bug: 'put bread on top of bread on top of bread.' Steps 1, 3, 4, 5 are normal (get plate, add peanut butter, add jelly, cut in half).
- Child listens, finds the bug, and tells parent how to fix it (use only 2 slices of bread, with filling in the middle).
- Optional: actually make the sandwich the corrected way.
- Now switch roles. Child writes (or dictates) their OWN 5-step instructions for something simple — brushing teeth, getting dressed, building a block tower — with one intentional bug hidden in it.
- Parent reads it back step by step and tries to find the bug. Child reveals it and explains the fix.
- Tell a grown-up one thing that surprised you.
Learning objectives
- Find a single error inside a short multi-step procedure
- Distinguish broken steps from working steps
- Author a sequence of instructions that contains an intentional, locatable bug
Early elementary (ages 6–8)
Parent provides 3 short pseudocode snippets with bugs. Child finds and fixes each, then writes one buggy snippet of their own for parent to debug.
Steps
- Bug snippet 1, STEP 1 (FIND the bug): 'SET total = 0. FOR i in 0..10: total = total + 1. PRINT total.' Parent says the goal is to print 10. Child reads the code, predicts what it will print, and explains WHY it is wrong (the loop runs 11 times because i = 0, 1, 2, ... 10, so total becomes 11).
- Bug snippet 1, STEP 2 (APPLY the fix): Child writes the corrected line (change the range to 1..10), then re-traces the loop to confirm it now prints 10.
- Bug snippet 2 (missing condition): 'IF it is raining: take umbrella. ELSE: ...' (the ELSE branch is missing entirely, OR an AND condition is missing such as IF raining AND going_outside). Step 1: child identifies what's missing. Step 2: child writes the corrected code and re-reads it end-to-end to confirm it now makes sense.
- Bug snippet 3 (wrong variable): 'SET apples = 5. SET oranges = 3. PRINT apples + apples.' (Should be apples + oranges.) Step 1: child spots the duplicated variable and states what the output is vs what it should be. Step 2: child rewrites the PRINT line and re-runs it in their head to confirm it now prints 8.
- For each snippet, the child writes: what the bug was, and the corrected line.
- Now child writes ONE buggy snippet of their own (3-6 lines) using a FOR loop, IF statement, or variable. Parent debugs it.
- Discuss: 'Real programmers find bugs like these every single day. Reading code carefully is a superpower.'
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Identify three common bug types: off-by-one errors, missing conditions, and wrong variables
- Read short pseudocode snippets line by line and articulate the fix
- Write a short pseudocode snippet that contains an intentional, debuggable bug
Upper elementary (ages 8–10)
Tackle 5 broken Scratch projects (or pseudocode snippets) under time pressure. Debug each in under 5 minutes and document every bug you find.
Steps
- Parent provides a list of 5 broken Scratch projects (or 5 pseudocode snippets if Scratch isn't available). Each one has a single clear bug — wrong loop count, missing event, swapped variable, broken IF condition, or off-by-one.
- Set a 5-minute timer for each project. Goal: find and fix the bug before the timer runs out.
- After fixing, run/trace the project to confirm it now behaves correctly.
- For each of the 5 bugs, write 3 sentences in a debug log: (1) what was wrong, (2) how you spotted it, (3) what you changed to fix it.
- If you finish a project early, look at why YOU spotted the bug fast — was it reading carefully, tracing values, or running and watching? Note the strategy.
- At the end, review your debug log. Which bug type was hardest? Which strategy worked best? Keep the log as a reference for future debugging.
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Debug real broken projects within a tight time budget
- Document each bug's symptom, detection method, and fix in writing
- Reflect on personal debugging strategies to build a reusable methodology
Safety and evidence note
Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.
Related coding activities
AI Explorers
Train a pretend 'robot brain'! Show it 5 cat pictures and 5 dog pictures, then test if it can guess a new one.
Algorithm Art
Follow step-by-step drawing instructions to create a picture. The instructions are your algorithm! Each step adds one shape or line.
API Restaurant
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
App Design Workshop
Design your dream app! Draw what you'd see on a phone screen. What would your app do? What buttons would it have?