Code Detective Lesson Plan: Beginner Coding and Computer Safety for Kids

Teach young children the basics of coding and online safety with this engaging Code Detective lesson plan. Kids learn how computers follow instructions, sort computer clues into Safe, Ask, or Stop, practice protecting private information, and create fun pretend code sequences.

Previous Lesson
PDF

Code Detective: Safe Computer Clues

Materials Needed

  • Paper and crayons or washable markers
  • Toy keyboard, cardboard keyboard, or pretend computer
  • Large paper cards with simple symbols, such as ⭐, 🔒, ✅, and ❓
  • Three small boxes or bowls labeled “Safe,” “Ask,” and “Stop”
  • Optional: blocks, stickers, or a tablet with an adult nearby

Learning Objectives

By the end of the lesson, the child will be able to:

  • Say that computers follow special instructions called code.
  • Sort simple computer clues into “Safe,” “Ask,” or “Stop.”
  • Tell a trusted grown-up when something on a computer looks strange, confusing, or unsafe.
  • Create a simple pretend computer instruction using pictures or symbols.

Success Criteria

The child is successful when they can:

  • Explain, in their own words, that code gives instructions.
  • Correctly sort at least three of four clue cards.
  • Use the sentence: “I will stop and ask a grown-up.”
  • Make a simple instruction such as “⭐ then clap” or “🔒 then ask.”

Introduction: The Computer Detective

Time: 5 minutes

Show the pretend keyboard or computer. Ask:

  • “What can a computer do?”
  • “How does a computer know what to do?”

Say:

“Computers use instructions. Instructions for computers are called code. Today we will be code detectives. Code can be fun, but if something looks strange, we stop and ask a trusted grown-up.”

Share the lesson goals in child-friendly language:

“Today we will learn about computer instructions, practice spotting safe and strange clues, and make our own pretend code.”

Body

I Do: What Is Code?

Time: 7 minutes

Use three picture cards to model an instruction:

⭐ → clap → smile

Say each step slowly:

  1. “See the star.”
  2. “Clap your hands.”
  3. “Smile.”

Explain:

“This is pretend code. It is a set of steps. Computers also follow steps, but their steps use special computer words and symbols.”

Model a safe response:

“If I see a message I do not understand, I do not press buttons quickly. I stop and ask my trusted grown-up.”

Quick Check

Ask the child to show with a thumbs-up or thumbs-down:

  • “Code is a kind of instruction.”
  • “I should keep pressing buttons if something looks confusing.”
  • “I can ask a trusted grown-up for help.”

We Do: Safe, Ask, or Stop?

Time: 10 minutes

Place the three bowls or boxes in front of the child. Explain:

  • Safe: “This looks familiar, and my grown-up says it is okay.”
  • Ask: “I am not sure, so I ask my grown-up.”
  • Stop: “Something feels wrong or asks for private information. I do not click or type.”

Read one situation at a time. Let the child place it in a box and explain why.

  • “A grown-up opens a drawing app for you.” Safe
  • “A message has words you do not understand.” Ask
  • “A pop-up asks for your name, address, or secret password.” Stop and ask
  • “A trusted grown-up says it is time to close the computer.” Safe

Practice this safety rhyme together:

“Stop, don’t tap. Ask for help. Keep secrets safe.”

Think-Pair-Share or Talk Together

Time: 5 minutes

For homeschool use, the child talks with the adult. In a classroom, the child may talk with a partner.

Ask:

  • “What should you do if a computer message surprises you?”
  • “Who is a trusted grown-up you can ask?”
  • “Why should we not share passwords or private information?”

Accept answers such as “stop,” “ask Mommy/Daddy,” “ask my teacher,” or “keep it private.”

We Do: Make Pretend Code

Time: 8 minutes

Choose two or three action cards, such as:

  • ⭐ = touch your head
  • 🔵 = clap
  • 🟩 = stomp once
  • ❤️ = smile

Work together to make a short sequence, for example:

⭐ → 🔵 → ❤️

Say:

“The code says: touch your head, clap, then smile.”

Change the order and invite the child to follow the new instructions. Ask:

  • “What happens if we change the order?”
  • “Which step comes first?”
  • “Can you find a mistake in my pretend code?”

You Do: Create a Code Card

Time: 10 minutes

Invite the child to create a simple pretend code card with drawings or stickers.

  1. Choose two or three symbols.
  2. Draw them in a row.
  3. Tell the adult what each symbol means.
  4. Have the adult follow the instructions exactly.
  5. Switch roles so the child can be the “computer” and the adult can give the instructions.

Offer choices:

  • Make a dance code.
  • Make a clean-up code.
  • Make an animal-movement code.
  • Make a snack-preparation pretend code.

Real-World Connection

Explain:

“People use instructions every day. A recipe has steps. A road sign gives directions. A computer program also has steps. We use safe choices when we follow instructions.”

Ask the child to name one set of steps they use at home, such as brushing teeth, putting on shoes, or washing hands.

Assessment

Formative Assessment

  • Listen for the child’s explanation that code gives instructions.
  • Observe whether the child sorts computer situations appropriately.
  • Ask the child to repeat the safety response: “Stop and ask a grown-up.”
  • Check whether the child can follow a two- or three-step pretend code.

Summative Demonstration

Present this pretend situation:

“You are using a computer. A strange message appears and asks you to type a secret password. What do you do?”

Look for the response:

“I stop. I do not type. I ask my trusted grown-up.”

Then ask the child to show their own code card and explain the steps.

Differentiation

For a Child Who Needs More Support

  • Use only two symbols and two actions.
  • Use gestures instead of written words.
  • Repeat the safety rhyme with motions: freeze for “stop,” shake your head for “don’t tap,” and point to the adult for “ask.”
  • Offer only two choices at a time, such as “Safe or ask?”

For a Child Ready for More Challenge

  • Create a four-step pretend code.
  • Intentionally make one step incorrect and ask the child to debug it.
  • Ask the child to invent a new symbol and teach its meaning.
  • Compare two code cards and explain how their order changes the result.

For Different Learning Settings

  • Homeschool: Use household routines as examples of step-by-step instructions.
  • Classroom: Let small groups create and perform action codes.
  • Training or childcare: Use role-play with a pretend device and a designated trusted adult.
  • Digital option: Use a supervised child-friendly coding activity, with no account creation, passwords, or personal information.

Conclusion: Tell What We Learned

Time: 5 minutes

Review the lesson with three questions:

  • “What is code?”
  • “What do you do when something on a computer looks strange?”
  • “What did your pretend code tell us to do?”

End with the key message:

“Code gives computers instructions. We can make fun pretend code. When something is confusing or asks for private information, we stop and ask a trusted grown-up.”

Invite the child to demonstrate the safety rhyme one final time:

“Stop, don’t tap. Ask for help. Keep secrets safe.”

Optional Follow-Up Activity

During the week, invite the child to draw the steps for a familiar routine, such as washing hands or feeding a pet. Call the drawings “home code,” and have the child explain each step in order.


Ask a question about this lesson

Loading...

Related Lesson Plans

How to Learn Any TikTok Dance: Easy Step-by-Step Tutorial Guide for Beginners

Master trending TikTok dances with this easy-to-follow, step-by-step guide! Learn how to choose a dance, break down move...

How to Roller Skate for Beginners: Easy Step-by-Step Lesson on Safety, Balance, Gliding & Stopping

Master the roller skating basics with our easy-to-follow guide for beginners! Learn essential safety tips, how to balanc...

Where Do Animals Live? Fun Lesson & Crafts on Animal Habitats for Kids

Discover where animals live with this fun science lesson for kids! Explore different animal homes like nests, burrows, d...

Learn Cheer Basics: Easy Guide to Motions, Jumps & Your First Cheer for Beginners

Learn fundamental cheerleading basics! This beginner's guide covers warm-ups, sharp arm motions (High V, Low V, T), a ba...

Teaching Kids Good Manners: Fun Etiquette Lesson Plan & Activities

Easily teach children etiquette and the importance of good manners with this engaging lesson plan. Includes discussion p...

Everyone is Special: Preschool Lesson on Challenging Gender Stereotypes in Play

Engage preschoolers with this fun lesson plan about gender stereotypes, play, and friendship. Includes story time, toy s...