Skip to lesson

Path: Build with AI

Read the code the AI wrote

Run the code an assistant wrote for you, break it on purpose, and find what it silently assumed.

Starting level
Comfortable with the basics
Time
22 minutes
Public lesson guide
EN + हिंदी

You will learn to

Run AI-written code, break it on purpose, and name the assumption it silently made about your data.

Why this matters

Generated code is written for the one input it was shown. The inputs it was never shown are where it breaks, quietly, in front of a user.

Three things to remember

  • Do not ship a line you cannot explain in your own words.
  • Break it on purpose: empty, missing and unexpected input.
  • Name the assumption the code made about your data.

See one example

Task

A generated form that saves a visitor's name and phone number.

Try the judgement yourself

Both answers respond to the task above. One of them does the job better. Which, and why?

Make something yourself

Take code an assistant wrote for you. Write the three inputs you will use to break it, and the one line you could not explain until you had read it twice.

A useful starting pointFour things: three breaking inputs, the unexplained line, and what it assumed.

Read further

The source is optional. The complete teaching and practice are available inside AI2Bharat.

Read the primary or official source: GitHub Docs