Prompt Engineering and Vibe Coding
Write reliable prompts and ship small features with an AI coding assistant.
Learn to write prompts that give repeatable results, then use an AI coding assistant to build a small task and notes feature in one Next.js and TypeScript practice repository. Vibe coding here means prototyping and iterating on code through conversation with an AI, then adding review and verification before anything goes towards production. You turn a fuzzy idea into a specification, work in small reviewed changes, check the assistant's assumptions, test through real entry points and ship with evidence and a rollback plan. Modules 1–3 are beginner, modules 4–8 are intermediate, and modules 9–10 cover advanced production readiness. No experience is needed for the prompt basics; module 3 introduces Git and the command line before the coding labs, and Git, GitHub & GitHub Actions and Frontend with React and Next.js fill in more depth. GitHub Copilot is taught concretely, with portable templates for other assistants; its free tier is enough for the labs, and model API calls can be replaced by saved fixture responses.
01Tasks, context and output
Beginner. How to state a task clearly, use examples and boundaries, and ask a model to show its assumptions and uncertainty. No prior experience needed.
- Write a prompt with a goal, context, constraints and formatA good prompt says what you want, who the answer is for, what background matters, what limits apply and what shape the answer should take. A model cannot read your mind, so anything you leave out it has to guess. Writing these five parts down is the quickest way to get better answers.10 min
- Few-shot examples, input boundaries and acceptance criteriaExamples show a model the pattern you want, and delimiters such as tags or fences show where your instructions end and the data begins. Acceptance criteria turn 'good answer' into a checklist. Together they make answers more consistent and easier to test.9 min
- Ask a model for assumptions, evidence and uncertaintyModels often sound sure even when the task is unclear or the facts are thin. You can ask them to list assumptions, ask questions before answering, give evidence and say how confident they are. You still check the claims yourself, because a confident tone is not proof.9 min
02Structured and reusable prompts
Beginner. Structured output you can validate, prompt templates with versions, and choosing what goes into the context window.
- Request and validate structured output from a modelWhen code reads a model's answer, free text is risky. Structured output means the model returns data that matches a JSON schema, a description of the fields and their types. Your code still validates the result, because a valid shape does not mean the values are right, and refusals or missing values must not crash the program.10 min
- Reusable prompt templates with variables and versionsA prompt template is a prompt with named blanks, called variables, that you fill in at run time. Treat it like code: give it an owner, a version, test inputs and a review step. Keep your trusted instructions apart from reference text that comes from users or documents.9 min
- Curate context and compare quality, latency and costA model can only read so much at once, and every token costs time and money. The context budget is the choice of which files, examples and notes go into the prompt. You compare prompt revisions on quality, latency and cost together, because the cheapest prompt is not always the best one.9 min
03From idea to a small prototype
Beginner. The vibe coding workflow, giving a coding assistant the right repository context, and the Git loop for small changes. Introduces Git and the command line.
- Vibe coding workflow: from feature idea to checklistVibe coding means describing what you want in plain words and letting an AI assistant write much of the code. It works best when you first turn a loose idea into a user story, acceptance criteria and a short checklist. That plan tells you what to ask for and when to stop.9 min
- Give a coding assistant the right repository contextA coding assistant only knows what you show it. If it sees the wrong files it guesses, and guesses look like real code. Giving it the relevant files, data types, examples and project rules gets answers that fit your codebase.8 min
- The Git loop for small AI-assisted changesGit records every change, so you can undo mistakes. For AI-assisted work, a safe loop is: look at the state of the repo, make a branch, read the assistant's plan, allow one small edit, then read the diff before you commit.8 min
04Measure improvement
Intermediate. Versioned evaluation fixtures, choosing between graders, and comparing prompt candidates against a baseline.
- Build versioned evaluation fixtures for promptsA fixture set is a saved list of test inputs, each with a written note about what a good answer looks like. You run every prompt version against the same set, so you can tell if a change really helped. Without fixtures you only have feelings.7 min
- Deterministic checks, human review and model gradersA grader decides if an answer passes. Use the cheapest reliable kind for each criterion: exact or schema checks first, human review for judgement, and a model grader for large volumes with a clear rubric. Check the model grader against human-reviewed examples before trusting it.8 min
- Compare prompt candidates against a baselineA regression workflow compares a new prompt, the candidate, with the current one, the baseline, on the same fixtures. You score accuracy, format validity, speed and cost, then decide with thresholds agreed in advance. This stops a change that fixes one thing from quietly breaking another.8 min
05Use focused prompts for real engineering tasks
Intermediate. Implementing from a spec, debugging with evidence, and refactoring and reviewing generated code.
- Prompt a coding assistant to implement from a specA coding assistant does its best work when you hand it a small, clear brief instead of a wish. The brief names the goal, the files it may touch, the conventions to follow and the checks that prove the result. You then reject anything outside that scope.10 min
- Debug with a coding assistant using real evidenceDebugging with an assistant works when you give it facts, not feelings. Share the steps to reproduce the bug, the exact error output, and what you expected versus what happened. Ask for ranked guesses, test the top one with a tiny diagnostic, and only then change code.9 min
- Refactor and review AI-generated code safelyA refactor changes the shape of code without changing what it does. Before you ask an assistant to refactor, write down the behaviour that must stay the same and get tests around it. Afterwards, read the diff for correctness, extra complexity, accessibility and changes you did not ask for.9 min
06Verify code through normal entry points
Intermediate. A test strategy for generated code, checking UI in a real browser, and running the repository's checks before review.
- Plan tests for AI-generated featuresGenerated code needs a test plan, because it can look right and still fail on odd input. Map each requirement to a unit, integration or end-to-end test, then add cases for invalid input, empty states and who is allowed to do what. Every bug you fix gets one regression test.9 min
- Verify UI changes in a real browserFor UI changes, running the page in a real browser is the honest check. Use Playwright to drive the flow, check keyboard access, try phone-sized screens, force loading and error states, and save screenshots. Each piece of evidence should point back to one acceptance criterion.9 min
- Run repository checks and review the pull requestBefore a pull request is reviewed, run the same checks the project runs: lint, type check, tests and the build. Then look at what the change added, especially new packages and lockfile edits. Finish with a short review that says what you checked and what you did not.9 min
07Manage workspace and data access
Intermediate. Permission boundaries for chat, edit and agent modes, handling untrusted content, and keeping data and secrets private.
- Permission boundaries for coding assistants and agentsA coding assistant can only do harm with the access you give it. Chat modes answer questions, edit modes change files, and agent modes also run commands and call tools. Set the narrowest scope that gets the job done and make the assistant ask before any action you cannot easily undo.10 min
- Keep untrusted content out of assistant instructionsAssistants read many things you did not write: web pages, tickets, README files, tool output and pasted documents. Text from these sources can contain instructions that try to steer the assistant. Treat all of it as data, keep it apart from your instructions, and limit what any single step can do.10 min
- Privacy, secrets and provenance with coding assistantsCode assistants send context to a provider, so what is in your files can leave your machine. Use synthetic data and placeholders, exclude sensitive files, check the provider's data settings, and review what the assistant adds: dependencies, secrets and database migrations.9 min
08Use external context responsibly
Intermediate. Connecting a read-only MCP context source, planned handoffs to an agent, and a shared prompt pack for a team.
- Connect a read-only MCP server to a coding assistantThe Model Context Protocol (MCP) is an open standard that lets an assistant talk to outside tools and data through small programs called servers. A server can expose tools, resources and prompts. Connect only servers you trust, give them read-only credentials, and keep a record of what they were asked to do.10 min
- Hand off a scoped task to a coding agentHanding a task to a coding agent works best when you write a small, clear plan first. Say what to change, what not to touch and how you will check it. Keep the work on its own branch or worktree, review at set points, and stop and roll back if validation fails.10 min
- Maintain a shared prompt pack for a teamA prompt pack is a small set of reusable prompt files kept in the repository, such as plan, implement, debug, review, test and document. Each file says what it expects as output and carries a version note. The team reviews changes to prompts like code and retires the ones nobody uses.9 min
09Production readiness
Advanced. Release checks and rollback for AI-assisted changes, and finding subtle risks in generated code.
- Release and roll back an AI-assisted changeA release is the moment a change leaves your laptop and meets real users. AI-assisted changes can look tidy and still break configuration, data or monitoring, so you check those things on purpose and practise the rollback before you need it.10 min
- Find subtle risks in AI-generated changesAI-generated code often passes the happy path and hides problems that only appear when a request is repeated, two users collide, or an older client calls the new code. You find these by asking sharp questions and backing each finding with evidence from the repository.8 min
10Ship a small feature with evidence
Advanced. Spec, build and release a small task or notes feature with a prompt pack, acceptance matrix, decision log and a demonstrated rollback.
- Vibe coding capstone: feature brief and test planThe capstone has you ship a small notes feature with evidence. You start with no code at all: a feature brief, first prompt versions, an acceptance matrix, a baseline test plan and the first lines of a decision log.8 min
- Vibe coding capstone: build the feature and fix a bugNow you build the feature in small reviewed steps. You keep every prompt that mattered, record one failure that made you write a better prompt, fix one real bug with a test and write notes on the diff.8 min
- Vibe coding capstone: release with evidence and rollbackThe last step is the release. You run tests and accessibility checks, open a pull request that carries the evidence, validate a preview or local release, demonstrate a rollback and tick the release checklist.8 min