IS 4010: Application Development with Artificial Intelligence

Week 02: AI copilots and comparison workflows

Brandon M. Greenwell

AI tools for programming

AI-assisted development is already here

  • Today we’ll compare AI programming tools across the browser, editor, and terminal
  • You’ll learn to work with AI as your pair programming partner
  • We’ll compare the major players and find the right tool for each job
  • By the end, you’ll understand how to “talk” to AI about code

Course motto

Augment, don’t automate!

  • AI is your co-pilot, not your autopilot
  • Think of AI as a brilliant but sometimes eccentric junior developer
  • AI provides suggestions → You review, approve, and own the code
  • Your job: Direct, verify, and integrate AI assistance
  • Remember: The pilot is always responsible for the flight

What are AI programming tools?

  • Code generation: Turn comments and prompts into working code
  • Code explanation: Break down complex functions into plain English
  • Debugging assistance: Help identify and fix errors
  • Refactoring support: Improve code structure and style
  • Learning accelerator: Get instant feedback and alternative approaches

Under the hood: LLMs

  • Large Language Models (LLMs): AI systems trained on massive amounts of text from the internet
  • Pattern recognition experts: They’ve learned patterns in human language and code
  • Statistical language models: They generate likely continuations from the prompt and available context
  • Not authoritative sources: Fluent answers can still be incomplete, outdated, or wrong
  • Surprisingly good at code: Programming languages follow patterns, just like natural language

Three working surfaces

  • Browser chat: General-purpose conversation and explanations (Gemini, ChatGPT, Claude, and others)
  • Editor assistant: Contextual completion, chat, and edits with GitHub Copilot in VS Code
  • CLI agents: Repository-aware work in the terminal with Copilot CLI and Antigravity CLI

Browser-based AI assistants

Examples: Gemini, ChatGPT, and Claude are general-purpose assistants that can help with programming.

  • Access varies - Free tiers, limits, and available models can change
  • Programming support - Useful for Python, explanations, and debugging
  • Different outputs - Compare responses against the same requirements and tests
  • Web-based interfaces - Easy to access
  • Useful for learning - Ask for explanations, examples, and review, then verify the result

Conversational coding

The CPTF framework for great prompts:

  1. Context: “Here is my Python function…”
  2. Persona: “Act as a senior software developer reviewing my code.”
  3. Task: “Find any potential bugs and suggest improvements.”
  4. Format: “Provide your answer as a numbered list.”

Five prompt patterns

1. Explain this code

"Explain this Python dictionary comprehension step by step:

{word: len(word) for word in text.split() if len(word) > 3}"

2. Generate boilerplate

"Write a Numpy-style docstring for this function that calculates the area of a circle given its radius."

3. Refactor for clarity

"Convert this for loop into a more Pythonic equivalent using list comprehension or built-in functions."

Two more prompt patterns

4. Debug assistance

"I'm getting a 'TypeError: unsupported operand type(s)' on line 15. Here's my code... What's the likely cause and how do I fix it?"

5. Architecture advice

"I need to store student information (name, ID, grades). Should I use a list of dictionaries or create a Student class? Explain the pros and cons of each approach."

Live demo: head-to-head comparison

Our challenge: Create a Python function that takes a filename and returns the number of lines in the file, handling potential FileNotFoundError exceptions.

Let’s give the exact same prompt to all three AIs:

“Write a Python function called count_lines that takes a filename as a parameter and returns the number of lines in the file. Handle the case where the file doesn’t exist by returning 0. Include a NumPy-style docstring.”


What did we learn?

  • Different models, different strengths: Each AI has its own “personality”
  • Quality varies: Same prompt can yield different code quality
  • No single winner: The “best” AI depends on your specific task
  • Explanation matters: Some models explain their reasoning better
  • Style differences: Notice variations in variable naming, comments, structure

Ethics and limitations

  • AI can hallucinate: Models sometimes generate plausible-looking but incorrect code
  • You own the code: Never submit code you don’t understand
  • Privacy matters: Be cautious about sharing sensitive info
  • Academic integrity: Document your AI usage in assignments
  • Keep learning: AI should accelerate your learning, not replace it

A quick note on docstrings

  • Before our lab, we need to introduce a key concept: the docstring
  • A docstring is a string literal, enclosed in triple quotes ("""), that occurs as the first statement in a module, function, class, or method definition
  • Its purpose is to explain what the code does
  • We are learning about them now because they are the primary way you will communicate your intent to AI assistants
  • A good docstring leads to good AI-generated code
  • In Lab 02 the docstrings are written for you. Each one states a contract, and your job is to make the function satisfy it
  • You will write your own, in the fuller style this course uses, in Week 05

Where this is heading

  • In Lab 02 you will implement three small Python functions: make_greeting, is_even, and count_vowels
  • Read every suggestion, run the provided tests, and revise the result instead of accepting code blindly
  • This is a preview of Python and testing; formal Python instruction begins in Week 03
  • First we need the other two surfaces: the editor and the terminal

AI in your editor and terminal

From browser to editor

Why integration matters

  • Stay in your flow state: No context switching!
  • Keep your hands on the keyboard: Faster than copy-paste workflows
  • Context awareness: AI can see your entire project
  • Real-time assistance: Get help as you type
  • Workflow integration: Suggestions appear beside the code and tools being used

What’s GitHub Copilot?

  • Purpose-built for coding and integrates directly into VS Code!
  • Generates code and explanations from the prompt and available editor context
  • Provides two main modes of assistance:
    • Inline suggestions: “Ghost text” appears as you type
    • Copilot Chat: Conversational interface within your editor
  • Context-aware: Can use current files and repository context according to the selected mode and permissions

Inline suggestions

How it works:

  • Write a descriptive comment about what you want to accomplish
  • Start coding…
  • Copilot appears as gray “ghost text”
  • Press Tab to accept, Esc to reject
  • Use Alt + ] (Windows) or Option + ] (Mac) to cycle through alternatives

Inline suggestion practices

Best practices:

  • Clear comments are key:

    # Calculate the factorial of a positive integer

  • Descriptive function names:

    calculate_factorial not calc_fact

  • Type hints help:

    def factorial(n: int) -> int:


Copilot Chat modes

Your conversational partner

Common interaction modes (labels can change):

  • Planning mode: Architectural decisions and project structure
  • Ask mode: Questions, explanations, and debugging help
  • Agent mode: Autonomous task completion and complex operations

When to use each Copilot Chat mode

Your conversational partner

When to use each mode:

  • Planning: “How should I structure a student gradebook application?”
  • Ask: “Explain this regex pattern” or “Why am I getting this error?”
  • Agent: “Refactor this class to use data classes” or “Add error handling to all functions”

Live demo

Building a Python utility with AI assistance:

  1. Start with a comment: # A function that calculates compound interest
  2. Let Copilot generate the function: Accept or refine the suggestion
  3. Use Chat to enhance:
    • /explain the generated code
    • “Add a NumPy-style docstring and type hints”
    • Ask for candidate pytest cases derived from the function contract
  4. Refactor and debug: Name the behavior to preserve or provide a failing test

Command-line AI assistants

Why use terminal-based AI?

  • Stay in your workflow: No need to switch between terminal and browser
  • Quick queries: Fast answers without leaving the command line
  • Repository context: Can inspect relevant files when permission is granted
  • Repeatable checks: Can help run the same local validation commands
  • Permission boundaries: Review requested file access, commands, and data handling

Antigravity CLI

Google’s coding agent in your terminal

  • Launch with agy from inside the repository you want it to inspect.
  • Ask questions, request a plan, inspect files, and propose edits from one session.
  • Review requested permissions and commands before approval.
  • Use the official setup guide because installation and authentication flows can change.
cd ~/is4010/is4010-labs
agy

GitHub Copilot CLI

GitHub’s coding agent in your terminal

  • Install the standalone tool from the current official GitHub documentation.
  • Launch with copilot from inside the repository you want it to inspect.
  • It can reason about repository context, propose edits, and help run checks.
  • Review its plan, permissions, commands, and final diff.
cd ~/is4010/is4010-labs
copilot

Draft your shared prompt

Write one prompt here before opening either CLI. Keeping the prompt fixed makes the comparison more meaningful.

Replace this line with your CPTF prompt.

Your turn: implement count_vowels

Use the approach you selected after comparing both CLI agents.

def count_vowels(text: str) -> int:
    """Replace this body with the approach you selected and reviewed."""
    raise NotImplementedError

Run the checks below. They are evidence, not decoration.

# These checks are evidence, not decoration. Add one case of your own.
assert count_vowels("OpenAI") == 4
assert count_vowels("rhythms") == 0
assert count_vowels("") == 0

The comparison protocol

  1. Start both agents in the same repository.
  2. Give both the exact same small, testable prompt.
  3. Compare correctness, assumptions, clarity, and proposed commands.
  4. Select or combine an approach; do not accept changes merely because they look plausible.
  5. Run uv run --directory week02 python -m pytest tests/ -v.
  6. Inspect git diff before committing.

Choosing your AI toolkit

Required working surfaces for this course:

After Lab 02:

  • Keep both CLIs installed so you can compare when useful.
  • Use whichever browser, editor, and CLI combination best fits the task.
  • Tool preference never replaces tests, inspection, or your responsibility for the result.

One file, every tool: AGENTS.md

You just set up three agents. They can all read the same file.

  • AGENTS.md is an open format: a README written for coding agents instead of for people
  • Plain Markdown, no schema, no required headings; the agent simply reads the text you wrote
  • It lives in the repository root, so any agent you launch there starts with the same briefing
  • Over 20 tools read it, including GitHub Copilot, VS Code, Antigravity CLI, and Codex
  • More than 60,000 open-source projects publish one

You already have one. Your fork of is4010-labs contains an AGENTS.md telling any agent that tests, workflows, and lab instructions are read-only.


When a tool wants its own filename

Some agents also look for a name of their own:

  • AGENTS.md, the common format, read by most tools including both CLIs you just installed
  • .github/copilot-instructions.md, GitHub Copilot’s own custom-instructions file in VS Code
  • CLAUDE.md, read by Claude Code

The practical rule: write AGENTS.md, then point the others at it.

  • Copilot in VS Code reads AGENTS.md too, so the extra file is often unnecessary
  • When a tool insists, make its file one line that references AGENTS.md rather than a second copy
  • This course’s own website repository does exactly that: CLAUDE.md contains @AGENTS.md and nothing else
  • Two copies of your project’s rules drift apart; one copy cannot

AI workflow: implementation

Daily development:

  1. Start with comments: Describe your intent clearly
  2. Use Copilot inline: Accept, modify, or reject suggestions
  3. Chat for complex problems: Switch to conversational help when stuck
  4. Command-line for quick help: Terminal-based queries for efficiency

AI workflow: review and submission

Code review and submission:

  1. Repository task: Give a scoped task to a CLI agent started inside the repository
  2. AI-assisted debugging: Use chat to identify and fix issues
  3. Documentation: Generate NumPy-style docstrings and comments with AI help
  4. Testing: Propose test cases, then inspect and run them

Remember: you are the pilot

  • AI provides suggestions → You make decisions
  • AI explains possibilities → You choose the best approach
  • AI generates code → You understand and verify it
  • AI finds patterns → You apply domain knowledge
  • Always maintain responsibility for the final product

Submission rule: Do not submit code you cannot explain and verify.


Time for Lab 02

  • Install and authenticate both CLI tools using their official documentation
  • Give both agents the exact same count_vowels task, then select, test, and revise an implementation
  • Complete week02/lab02.py and week02/lab02_prompts.md
  • Run the provided tests, inspect git diff, push your work, and confirm the Lab 02 README badge is green
  • The automated check validates both the Python behavior and the completed journal
  • Navigate to week02/lab02.md for step-by-step instructions