Module 3: Effective and Responsible Use

Prompt engineering, code verification, testing strategies, agentic workflows, and Exercise 1.

Slides

View slides in full screen

Outline

  • Prompt engineering for code: vague vs. structured prompts, few-shot examples, chain-of-thought
  • Evaluating and verifying AI-generated code: what to look for, how review changes when the author is an LLM
  • Testing strategies: test-first prompting, the circular reasoning problem
  • Best practices for agentic coding: AGENTS.md files, conversation management, permission policies
  • Mitigating LLM pitfalls: eliciting pushback, reducing hallucination, when to start a fresh context
  • Exercise 1: Structured prompting and code verification in pairs

Learning Objectives

  • Apply structured prompting techniques to get substantively better code output from AI tools
  • Use verification strategies to systematically review AI-generated code for correctness, security, and hallucinated dependencies
  • Describe the test-first approach to AI-assisted coding and explain why it helps
  • Implement best practices for agentic coding workflows, including project context files, conversation management, and tool permission policies
  • Mitigate known LLM failure modes (sycophancy, hallucination, context degradation) through deliberate interaction patterns

Exercise 1: Prompting and Verification

In pairs or small groups:

  1. Structured prompting comparison (10 min): Each pair picks a small coding task. One person writes a quick, vague prompt; the other writes a detailed, well-structured prompt for the same task. Compare outputs. Which would you ship?
  2. Verification exercise (10 min): Each pair receives a snippet of AI-generated code with one or more planted bugs. Find them. How long did it take? What made them hard to spot?
  3. Brief group debrief (5 min): What worked? What surprised you?