Responsible AI Use ยท Lesson 1 of 3

Owning AI-generated code

Study notesAbout 3 minutes. A full lesson with quick checks is on its way.

In short

AI-generated code is your code once you accept it. Understand it, review it and test it as you would anything else.

In your work

An AI assistant writes a date-handling function for a client's booking system, and the tests pass. Reading it line by line, you notice it ignores British Summer Time, so you add tests for the clock change before merging.

What the UK rules say

  • The UK's Software Security Code of Practice expects software vendors to follow an established secure development framework.
  • It also expects a clear process for testing software and updates before they're released.

What to do

  1. Read and understand every line before you commit it.
  2. Test the cases AI tends to miss, such as time zones, empty inputs and permissions.
  3. Run the usual review, linting and security checks.
  4. Note in the pull request where AI helped, if your team asks for that.

Watch out for

  • Accepting code because it passes the tests you already had.
  • Using packages or functions an AI suggests without checking they exist and are trusted.

In your organisation

What does your organisation's AI policy say about AI-generated code and how it's reviewed?

Your employer's own policies come first.

Sources

UK law and guidance, explained for learning. Not legal advice.