0.3free~15 min
Your gaps are here
Artifact: a named list of the gaps the course will close
1. Principle
A gap you can name is a gap you can close. A gap you cannot name will eat your project.
AI lets you sail past gaps without noticing: the code runs, the tests pass, you click around and it looks fine. The gap is not in what the code does — it is in what you cannot say about the code.
This unit gives you three short snippets of AI-generated code. For each, you answer three questions. If you cannot answer them, that is your gap, with a chapter attached to it.
2. Do (you try)
Snippet A — a submit handler
tsAI wrote this. It runs. It deploys.
async function submitFeedback(formData: FormData) {
const text = formData.get("text") as string;
const email = formData.get("email") as string;
await fetch("/api/feedback", {
method: "POST",
body: JSON.stringify({ text, email }),
});
return { ok: true };
}Snippet B — an env-var read
tsRuns locally. Crashes on first prod request.
const apiKey = process.env.OPENAI_API_KEY!;
export async function generate(prompt: string) {
const res = await fetch("https://api.openai.com/v1/chat/completions", {
headers: { Authorization: `Bearer ${apiKey}` },
method: "POST",
body: JSON.stringify({ model: "gpt-4", messages: [{ role: "user", content: prompt }] }),
});
return (await res.json()).choices[0].message.content;
}Snippet C — a "passing" test
tsThe test is green. The feature is broken.
test("submits feedback", async () => {
const result = await submitFeedback(makeFormData({ text: "hi" }));
expect(result.ok).toBe(true);
});3. Verify (how you know)
Reveal the canonical answers. For each question you could not answer, you have a named gap.
Locked. Try it yourself first.
4. Reference
Locked. Try it yourself first.