Skip to main content
Skip to content
Menu

vibe coding Intermediate 3 parts Updated

Script an AI code-review workflow

You'll have a working script that automatically flags risky code patterns in AI-generated output before you merge or deploy it.

What you'll make

AI Code Review Script

  1. scan_ai_code() — the pattern detector: what to include
  2. load_risk_patterns() — your AI-specific rule set: what to include
  3. generate_report() — human-readable output: what to include
  4. main() — file processing and orchestration: what to include

Paste your complete Python script that can be run from command line on any code file

The 3 parts

Each part ends with a check you can see.

  1. Catalog AI Code Failures

    Generate code with AI, then manually find the safety problems it introduces

    Done when

    A list of 8-10 specific code patterns where AI failed safety checks, each with a real example

  2. Build Pattern Detection Logic

    Write the scan_ai_code() function that programmatically finds the failure patterns you cataloged

    Done when

    A working scan_ai_code() function that detects at least 5 of your cataloged patterns and returns structured results

  3. Test and Refine the Full Script

    Build the complete script with reporting, test it on fresh AI-generated code, and tune the detection rules based on real performance

    Done when

    Complete working script tested on at least 3 new AI-generated files with documented precision/recall for each detection rule

    Capstone: you put together your AI Code Review Script.

Where this helps

An elective: a single lesson that sits outside rtwo's job certificates and doesn't count toward one.

About this lesson

What you'll be able to do

  • Run a working code review script on at least one AI-generated code file
  • Identify 3-5 specific patterns where AI code typically fails safety checks
  • Have a documented checklist of red flags that require human override before merging

Who it's for

  • Developers who use AI for code generation but want to catch problems before deployment
  • Anyone who's shipped AI-generated code and wondered what they might have missed

What it won't cover

  • Setting up CI/CD pipelines or production deployment
  • Language-specific linting rules — this focuses on AI-specific failure patterns
  • Code performance optimization — this is about correctness and safety

Skills you'll practise

  • Pattern recognition for AI code failures
  • Automated safety validation design
  • Risk-based code review prioritization
  • Test-driven AI validation