# The PRIMM method explained: why reading code comes first

> PRIMM — predict, run, investigate, modify, make — is a research-backed way to learn programming. Here's how it works and why it suits learning with AI.

- URL: https://genkid.app/blog/primm-read-code-before-writing
- Topic: Building with AI
- Published: 2026-10-29 (updated 2026-11-15)
- Publisher: GenKid (https://genkid.app)

## Key takeaways

- PRIMM stands for Predict, Run, Investigate, Modify, Make — a five-step way to learn programming starting from working code.
- It was tested in 13 English schools: 493 learners aged 11 to 14 taught with PRIMM scored higher on a programming test than classes taught the usual way, though the difference was small.
- Research on beginner programmers suggests being able to read and trace code comes before being able to write it independently.
- PRIMM fits AI coding perfectly: the AI provides working code, and the learner predicts, investigates and modifies it.
- Parents can use PRIMM questions at home without knowing how to code.

## What PRIMM is

PRIMM is a structure for programming lessons created by computing education researchers in England. Instead of starting with a blank screen, learners start with a short, working program and move through five stages:

1. **Predict** — read the code and predict what it will do.
2. **Run** — run it and compare the result with the prediction.
3. **Investigate** — explore how it works: trace it, annotate it, ask questions about it, break it on purpose.
4. **Modify** — change it, in small steps that get harder.
5. **Make** — create something new using the same ideas.

The approach is widely used by teachers in the UK and around the world, and is promoted by England's [National Centre for Computing Education](https://static.teachcomputing.org/pedagogy/QR11-PRIMM.pdf).

## Why reading comes first

For a long time, coding lessons asked beginners to write programs from scratch almost immediately. That's hard: you have to know the syntax, the ideas *and* how to combine them all at once.

Research suggests reading and writing are closely linked. Work by Lister and colleagues on novice programmers, [summarised by the NCCE](https://static.teachcomputing.org/pedagogy/QR11-PRIMM.pdf), suggests beginners need to trace code (work out what it does, line by line) with about 50% accuracy before they can write code independently. Reading builds a mental model of how programs behave; writing then becomes much easier.

PRIMM builds on this. Learners talk about code, predict, and test their ideas before they're asked to produce code on their own. In the [main study of PRIMM](https://core.ac.uk/download/201007016.pdf), 493 learners aged 11 to 14 in 13 English schools were taught with PRIMM for 8 to 12 weeks. They scored higher on a programming test than 180 learners in control classes taught the same topics in the schools' usual way. The difference was small, and classes weren't randomly assigned, so it's encouraging evidence rather than proof.

## Why PRIMM fits learning with AI

AI coding tools change one big thing: learners suddenly have lots of working code they didn't write. That's exactly where PRIMM starts.

| PRIMM stage | With an AI coding tool |
|---|---|
| Predict | Before running the AI's change, predict what it will do |
| Run | Run it and compare |
| Investigate | Find the lines the AI changed and explain each one |
| Modify | Make a small change by hand: a colour, a rule, a message |
| Make | Build a new feature, describing it to the AI or writing it yourself |

Without this structure, it's easy to accept AI code without reading it. With it, every AI change becomes a learning opportunity. The Raspberry Pi Foundation makes a similar case: in its [2025 position paper](https://static.raspberrypi.org/files/about/Why-kids-still-need-to-learn-to-code-in-the-age-of-AI-2025-Raspberry-Pi-Foundation-position-paper.pdf), it argues that reading, modifying, writing and explaining code help learners move knowledge into long-term memory, and that learning to read code is what lets young people judge code an AI produced. It also makes learners much better at [checking AI-generated code](https://genkid.app/blog/how-to-review-ai-generated-code), which is the core skill of working with AI.

## PRIMM questions you can ask at home

You don't need to understand the code to use PRIMM with your child. Try these:

- **Predict:** "What do you think will happen when you click that?"
- **Run:** "Was that what you expected? What was different?"
- **Investigate:** "Which lines make that happen? What happens if you delete this one?"
- **Modify:** "Can you make it do it twice as fast? Or in a different colour?"
- **Make:** "What could you build now using the same idea?"

The "investigate" questions are the most powerful. Breaking code on purpose and seeing what changes teaches more than any explanation, and it's good practice for [debugging](https://genkid.app/blog/debugging-for-beginners) real mistakes later.

## An example

Here's a tiny piece of JavaScript an AI might write for a pet game:

```js
let food = 5;
function feed() {
  food = food + 2;
  if (food > 10) {
    food = 10;
  }
  showFood();
}
```

- **Predict:** If food is 9 and you press Feed, what will food be?
- **Run:** Try it. (It's 10, not 11.)
- **Investigate:** Which lines stop it going above 10? What if you remove them?
- **Modify:** Change it so feeding adds 3 instead of 2.
- **Make:** Write a `play()` function that reduces food by 1.

## How GenKid uses PRIMM

GenKid's lessons follow the PRIMM order wherever code appears, and in course projects the coding agent shows each change line by line so learners can predict and investigate before accepting it. See [how GenKid works](https://genkid.app/pathway). Teachers can find classroom ideas in [teaching vibe coding in schools](https://genkid.app/blog/teaching-vibe-coding-in-schools).

For more on why understanding matters even when AI writes code, read [do kids still need to learn to code?](https://genkid.app/blog/do-kids-still-need-to-learn-to-code)

## Frequently asked questions

### What does PRIMM stand for?

Predict, Run, Investigate, Modify, Make. It's a five-stage structure for teaching programming that starts from working code rather than a blank page.

### Is PRIMM only for schools?

No. It was designed for classrooms, but the same questions work at home, in clubs and in self-paced learning.

### What age is PRIMM for?

The main research involved learners aged 11 to 14, but the approach is used with both primary and secondary pupils. Younger children need shorter programs and more talk, and older learners can use it on longer programs, including code an AI wrote.

### Does PRIMM work with block-based coding?

Yes. Learners can predict and investigate Scratch programs in the same way before modifying them. When they move on to text-based code, the same habits carry over; see [from Scratch to real code](/blog/scratch-to-real-code).

## Sources

- [Teaching computer programming with PRIMM: a sociocultural perspective](https://doi.org/10.1080/08993408.2019.1608781) — Sentance, Waite & Kallia, Computer Science Education, 2019
- [Teaching computer programming with PRIMM (open-access copy)](https://core.ac.uk/download/201007016.pdf) — CORE
- [Quick read: using PRIMM to structure programming lessons](https://static.teachcomputing.org/pedagogy/QR11-PRIMM.pdf) — National Centre for Computing Education
- [Why kids still need to learn to code in the age of AI](https://static.raspberrypi.org/files/about/Why-kids-still-need-to-learn-to-code-in-the-age-of-AI-2025-Raspberry-Pi-Foundation-position-paper.pdf) — Raspberry Pi Foundation, 2025
