Home / Hands-on activities / Bug Detective

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.

Hands OnAbout 20 minutesScreen-freeParent help expected

Materials and setup

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.

Difficulty 1 of 3

Steps

  1. 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').
  2. Broken instruction 2: 'Now turn around.' (Robot keeps facing the same direction.) Child says: 'You didn't actually turn!' Parent fixes it by spinning.
  3. 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).
  4. 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.
  5. Celebrate: 'You're a bug detective! Spotting mistakes is what coders do all day.'
  6. 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.

Difficulty 2 of 3

Steps

  1. 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).
  2. Child listens, finds the bug, and tells parent how to fix it (use only 2 slices of bread, with filling in the middle).
  3. Optional: actually make the sandwich the corrected way.
  4. 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.
  5. Parent reads it back step by step and tries to find the bug. Child reveals it and explains the fix.
  6. 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.

Difficulty 2 of 3

Steps

  1. 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).
  2. 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.
  3. 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.
  4. 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.
  5. For each snippet, the child writes: what the bug was, and the corrected line.
  6. Now child writes ONE buggy snippet of their own (3-6 lines) using a FOR loop, IF statement, or variable. Parent debugs it.
  7. Discuss: 'Real programmers find bugs like these every single day. Reading code carefully is a superpower.'
  8. 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.

Difficulty 3 of 3

Steps

  1. 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.
  2. Set a 5-minute timer for each project. Goal: find and fix the bug before the timer runs out.
  3. After fixing, run/trace the project to confirm it now behaves correctly.
  4. 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.
  5. 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.
  6. 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.
  7. 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

Browse all 575 activities · Explore course syllabi