Please enable JavaScript to use CodeHS

AI-Assisted Software Development

Vibe coding and prompt engineering

Vibe coding means describing what you want in plain language and letting AI generate the code. The better your description — your prompt — the better the code you get back.

Skills ~12 min High School
The Big Idea

What is vibe coding?

Vibe coding is a playful name for a real workflow: you describe the vibe of what you want, the AI writes code, and you refine it together. It is less about typing every semicolon and more about communicating intent clearly.

Example prompts:

  • "Make a button that changes color when I click it."
  • "Write a Python function that finds the most common word in a paragraph."
  • "Build a simple to-do list app in React."

The idea is not to let the AI drive blindly. The engineer is still the pilot. The AI is more like a very fast pair programmer who can draft, but needs guidance.


Industry Skills

What makes a good prompt?

A vague prompt gives a vague result. A good prompt usually includes:

  • Context: the language, framework, or environment.
  • Inputs and outputs: what goes in and what should come out.
  • Constraints: performance limits, edge cases, or style rules.
  • Examples: a sample input and the expected output.

Before: "Sort a list."
After: "Write a Python function that takes a list of strings and returns them sorted case-insensitively with duplicates removed. Include a docstring and handle an empty list."


Industry Skills

Iterate, do not fire-and-forget

The best results rarely come from one prompt. They come from a conversation: generate, test, explain what is wrong, and ask the AI to fix it.

Treat the AI like a teammate. If the first answer is wrong, say so. Point to the bug, ask for a simpler version, or request tests. Each round makes the output better.

Habit: the engineers who get the most out of AI are the ones who ask follow-up questions. They do not accept the first draft.


Industry Skills

Verify everything

AI-generated code can look right and still be wrong. It can use outdated libraries, introduce subtle bugs, or miss security issues. A professional engineer always:

  • Reads the code before using it.
  • Runs tests and checks edge cases.
  • Looks up any function or API they do not recognize.
  • Asks whether the output solves the actual problem.

Verification is where real skill shows up. Anyone can generate code; not everyone can tell if it is correct.


Interactive

Prompt refiner

You want a function that processes a list of students' scores. The prompt below is too vague. Add details by checking the boxes and rewriting the prompt. Then see how the "AI" response changes.

// code will appear here

Code

A structured prompt

Vibe coding works best when you give the AI a clear role, task, and constraints. This Python function builds a prompt you can send to an API.


Your Turn

Check yourself

Rewrite this prompt to make it better: "Make a login page." What details would you add?

Your answer:

Sample answer: "Make a responsive login page in HTML and CSS with username and password fields, a show-password toggle, error messages for empty fields, and a link to sign up. Use a modern, accessible style."


Check Yourself

Quick quiz

1. What is vibe coding?

2. Why should you verify AI-generated code?

3. Which of these makes a prompt better?

Keep learning about AI-assisted software development

Good prompts get better code, but the code still needs to be tested, reviewed, and integrated. Next, see how testing and code review work when AI is part of the team.

Part of the “AI-Assisted Software Development” tutorial series.