Generative AI and Large Language Models#

Generative AI technologies have become some of the most powerful capabilities in modern information technology. The most familiar use is text generation: producing human-like explanations, summaries, examples, and drafts from a prompt and context. Generative AI can also create images, videos, music, and other media.

For this course, however, one of the most important uses of generative AI is programming assistance. Large language models can explain code, suggest examples, critique solutions, generate tests, identify possible bugs, and, increasingly, operate as coding agents that can modify files, run commands, and work across a small codebase.

This makes AI both useful and risky.

It can be tempting to copy an assignment prompt into a tool such as ChatGPT, Claude, Codex, or Claude Code and submit whatever comes back. We refer to this approach as “submit and pray.” It is not a reliable way to learn programming, and it is not a responsible way to use AI. Programming, like most skilled activities, requires practice. You need to experience the process of reading code, writing code, making mistakes, debugging, testing, revising, and explaining your decisions.

The purpose of AI in this course is not to remove that learning process. The purpose is to help you move through it more effectively.

You need to develop enough programming fluency and computational judgment to write useful Python programs, test and debug code, evaluate AI-generated code, analyze financial data critically, and supervise agentic coding tools responsibly.

AI Use in This Program: Tutor, Reviewer, Agent#

This Program uses AI in three phases:

  1. Tutor Mode

  2. Reviewer Mode

  3. Agent Mode

These phases are designed to match your growing ability to understand, evaluate, and supervise code.

Early in the course, AI should help you learn. Later, AI should help you critique and improve your own work. Near the end of the course, AI may generate larger changes, but only under your supervision.

Phase 1: Tutor Mode#

During Tutor Mode, AI is used primarily for explanation and learning.

You may use AI tools to:

  • explain programming concepts,

  • clarify readings,

  • interpret error messages,

  • generate small examples,

  • ask for quizzes or practice questions,

  • explain documentation,

  • help you understand code that you wrote,

  • and help you reason about why something is not working.

You should not use AI to write full assignment solutions, complete functions for submission, or generate code that you do not understand.

Tutor Mode is about building your mental model. You are still the person writing the code. AI acts like a teaching assistant, not a substitute author.

Good Tutor Mode prompts include:

Explain this error message in beginner-friendly language.
I wrote the following function, but I do not understand why it fails this test.
Please give me hints without writing the full solution.
Explain this loop step by step.
Give me three small examples that demonstrate how Python dictionaries work.

Build the understanding needed to evaluate code later.

Phase 2: Reviewer Mode#

During Reviewer Mode, you should write code first and then use AI to review it.

This is a major shift. Instead of asking AI to produce the answer, you ask AI to help you inspect your work.

You may ask AI to:

  • identify missing tests,

  • find edge cases,

  • explain failing tests,

  • critique code organization,

  • inspect type hints,

  • review documentation,

  • challenge assumptions in a data analysis,

  • identify possible analytical risks,

  • and suggest ways to improve maintainability.

Reviewer Mode helps you develop professional judgment. In software development, code that merely “runs” is not enough. You must ask whether the code is correct, understandable, tested, maintainable, secure, and appropriate for the problem.

Good Reviewer Mode prompts include:

Review this function for edge cases. Do not rewrite it unless you first explain the issue.
Here are my tests. What important cases am I missing?
Critique this data-cleaning approach. What assumptions might be unsafe?
Review this code for readability, correctness, and maintainability.
Give me specific suggestions, but do not replace the whole solution.

Phase 3: Agent Mode#

During Agent Mode, students use an approved coding agent to work on a constrained project.

Agent Mode is different from simply chatting with an LLM. A coding agent may be able to inspect a project, read files, edit code, run tests, create diffs, and perform multi-step development tasks.

Examples of agentic development tools include:

  • Claude Code, Anthropic’s agentic coding system, which is designed to operate across a project, understand codebases, execute multi-file changes, and complete development tasks. (Anthropic)

  • Codex, OpenAI’s coding agent for software development, which can help write code, understand codebases, work in developer environments, and support agentic coding workflows. (OpenAI Developers)

These tools are powerful because they can do more than answer questions. They can act on a codebase. That means they require more supervision, not less.

In Agent Mode, your role changes. You are no longer only the primary author of each line of code. Instead, you become the:

  • specification writer,

  • test planner,

  • reviewer,

  • debugger,

  • risk assessor,

  • and engineer of record.

Responsible Agentic Development#

Agentic development should follow a disciplined workflow.

Before asking an agent to implement anything, you should write a clear specification. The specification should describe what the program should do, what it should not do, what files or functions are in scope, what edge cases matter, and how the result will be tested.

A foundational agentic workflow looks like this:

  1. Brainstorm — clarify the idea and expose assumptions.

  2. Specify — write a durable specification that becomes the source of truth.

  3. Plan — break the work into reviewable, testable increments.

  4. Execute — implement one step at a time, reviewing behavior, architecture, and diff size.

This workflow is intentionally slower than “just ask the agent.” The goal is not to maximize automation. The goal is to learn how to use automation responsibly.

Agent-generated code is not automatically correct. It may pass simple tests while failing important edge cases. It may solve the wrong problem. It may introduce unnecessary complexity. It may make assumptions about data, APIs, dependencies, or file formats. It may also produce code that the student cannot explain.

You are responsible for all submitted work.

Why We Still Learn Programming#

If AI can generate code, why learn programming?

Because AI-generated code still needs human judgment.

You need enough programming fluency to determine whether the code is correct. You need enough testing knowledge to evaluate behavior. You need enough debugging skill to diagnose failures. You need enough data judgment to notice leakage, bias, spurious correlation, or unsupported conclusions. You need enough professional discipline to inspect diffs, manage files, run tests, and explain the final result.

This is especially important in financial technology. Financial software can affect money, risk, compliance, customer trust, and institutional decision-making. A small error can have large consequences.

Learning to program is therefore not only about producing code. It is about developing the judgment to evaluate code, whether it was written by a person, generated by an AI assistant, or produced by an agentic coding system.

General Pitfalls of Large Language Models#

Large language models can generate content that appears correct and confident even when it is wrong. You must verify their responses.

Common risks include:

  • hallucinated facts,

  • incorrect code,

  • missing edge cases,

  • weak tests,

  • overconfident explanations,

  • biased outputs,

  • poor mathematical reasoning,

  • invalid assumptions about data,

  • and solutions that are more complex than necessary.

For factual questions, consider using tools that provide sources. For computation, use appropriate computational tools. For programming, run the code, inspect the output, write tests, and review the logic.

AI tools are useful, but they are not authorities. They are assistants.

Prompt Engineering#

Prompt engineering is the process of writing clear, specific instructions for an AI system. In this course, prompt engineering is not treated as a trick for getting quick answers. It is treated as a form of technical communication.

A good prompt is similar to a good software specification, bug report, test plan, or code review request. It explains the context, states the task, identifies constraints, and describes the kind of response that would be useful.

As you move through the course, your prompts should become more disciplined.

In Tutor Mode, prompts should help you understand concepts without bypassing practice.

In Reviewer Mode, prompts should help you critique code, tests, documentation, and assumptions.

In Agent Mode, prompts should help you supervise codebase changes through specifications, acceptance tests, plans, diffs, and review logs.

Prompt engineering therefore becomes part of professional programming practice: learning how to ask for the right kind of help, provide the right context, and evaluate the result.

What Good Prompts Include#

Effective prompts usually include the following elements:

  • Role: What role should the AI play?

  • Context: What information does the AI need?

  • Task: What should the AI do?

  • Constraints: What should the AI avoid or preserve?

  • Output format: How should the response be structured?

  • Verification: How should the answer be checked?

For example, instead of writing:

Fix my code.

write:

Act as a reviewer for an introductory Python course.

Here is my function and the failing test.
Please identify the likely cause of the failure.
Do not rewrite the full solution.
Give me two hints and one additional test case I should try.

This prompt is better because it tells the AI what role to play, what kind of help is allowed, and what output is useful.

Prompting in Tutor Mode#

Tutor Mode prompts should help you learn without giving away the full answer.

Good Tutor Mode prompts often include phrases such as:

Explain this concept in beginner-friendly language.
Give me hints, but do not provide the full solution.
Ask me questions that help me reason through the problem.
Explain this error message and tell me what I should inspect first.

Example:

Act as a tutor for an introductory Python course.

I am learning loops and conditionals.
Here is my code and the error message.

Please explain what the error means.
Do not write the corrected function.
Give me three debugging questions I should answer.

Prompting in Reviewer Mode#

Reviewer Mode prompts should ask AI to critique work that you have already produced.

Good Reviewer Mode prompts often include phrases such as:

Review this for edge cases.
Identify missing tests.
Challenge my assumptions.
Look for readability, correctness, and maintainability issues.

Example:

Act as a code reviewer.

Here is my Python function and my current tests.
Review the code for correctness, edge cases, readability, and maintainability.

Do not rewrite the entire function.
First list the issues you see.
Then suggest specific improvements.
Finally, propose three additional tests.

For data analysis work, a Reviewer Mode prompt might look like this:

Act as a reviewer for a financial data analysis assignment.

Here is my pandas analysis and my written conclusion.
Check for possible data leakage, missing validation, spurious correlation, unsupported conclusions, and unclear documentation.

Do not rewrite the analysis.
List the risks I should investigate before submitting.

Prompting in Agent Mode#

Agent Mode prompts require the most discipline because the AI may make changes across a codebase.

An Agent Mode prompt should usually include:

  • the goal,

  • the files or areas in scope,

  • files or behavior that should not be changed,

  • acceptance tests,

  • coding constraints,

  • review expectations,

  • and documentation requirements.

A weak Agent Mode prompt is:

Make this project better.

A stronger Agent Mode prompt is:

You are working as a coding agent on this repository.

Goal:
Implement the behavior described in SPEC.md.

Scope:
You may edit files in src/ and tests/.
Do not change public function names unless the spec requires it.
Do not make unrelated refactors.

Process:
1. Read README.md, SPEC.md, and the existing tests.
2. Summarize the requested change.
3. Propose a short implementation plan before editing.
4. Implement the smallest change that satisfies the spec.
5. Run the tests.
6. Show the diff.
7. Explain each changed file.
8. List remaining risks or assumptions.

Verification:
All existing tests and new acceptance tests should pass.

This kind of prompt is closer to a professional engineering task description. It does not merely ask the agent to “code.” It defines scope, process, and verification.

Prompt Quality Checklist#

Before sending a prompt, ask:

Did I explain the context?
Did I say what mode I am using: Tutor, Reviewer, or Agent?
Did I describe what I want the AI to do?
Did I describe what I do not want it to do?
Did I include relevant code, errors, tests, or assignment constraints?
Did I ask for an output format that I can inspect?
Did I include a verification step?

After receiving a response, ask:

Can I explain the answer in my own words?
Did I verify the code or claim?
Did I run the tests?
Did I inspect the diff?
Did I reject anything inappropriate?
Did I document what I accepted and why?

Important Reminder#

Prompt engineering does not remove your responsibility.

A well-written prompt can produce a better answer, but it does not guarantee correctness. You still need to read, test, verify, and explain the result. In this course, a good prompt is not the final artifact. The final artifact is your understanding, your tested code, your review judgment, and your documentation of how AI was used.

For additional examples and strategies, see the Prompt Engineering Guide. This site provides a broader overview of prompting techniques, but in this course we will focus on prompts as a form of technical communication: asking for explanations in Tutor Mode, critique in Reviewer Mode, and supervised codebase changes in Agent Mode.

Final Guidance#

  • Use generative AI to increase your knowledge, not to bypass learning.

  • Use AI as a tutor when you are learning a concept.

  • Use AI as a reviewer when you have written something and need critique.

  • Use AI as an agent only when you are ready to specify, test, supervise, review, and explain the work.

The goal is not to avoid AI. The goal is to use AI with enough skill and judgment that you remain responsible for the result.