0Pricing
Vibe Coding · Lekcja

Skuteczne wklejanie błędów do AI

Przekaż AI informacje potrzebne do naprawienia błędu

Skuteczne wklejanie błędów do AI to bezpłatna lekcja Vibe Coding na CoddyKit. To lekcja 2 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Vibe Coding, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Vibe Coding zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

Garbage In, Garbage Out

You found an error. Now you want AI to fix it. But here's the thing: AI is only as good as the context you give it.

Paste 'it's broken pls fix' and you'll get a guess. Paste the right details and tools like Cursor, Claude Code, or Copilot can nail the fix instantly.

This lesson teaches you exactly what the AI needs to fix a bug — and how to hand it over cleanly.

The Four Things AI Needs

For a great fix, give the AI these four ingredients:

  • The full error message — including the stack trace
  • The relevant code — the function or file the error points to
  • What you expected to happen
  • What actually happened

Miss any of these and the AI has to guess. Include them and it reasons like a senior engineer looking over your shoulder.

A Bad Prompt vs A Good Prompt

Compare these two. The first wastes everyone's time. The second gets a precise fix.

Notice the second one gives the error, the code, the expectation, and the reality — all four ingredients.

BAD:
"my app crashes fix it"

GOOD:
"I'm getting this error when I click Save:

TypeError: Cannot read properties of undefined (reading 'id')
    at saveUser (api.js:22:14)

Here's the saveUser function:
[paste the function]

Expected: the user gets saved.
Actual: it crashes on click. What's wrong and how do I fix it?"

Always Include the Full Error

Beginners often paste only the first line of an error. But the stack trace below it tells the AI which functions were involved and in what order.

Copy the whole red block — from the error type down through the at ... lines. In the browser console, right-click the error and choose 'Copy'. In a terminal, select and copy the full output.

More signal = better fix. The AI can ignore what it doesn't need.

Paste the Right Code, Not Everything

You don't need to dump your entire project. Give the AI the function the error points to, plus anything it directly touches.

If the error is in saveUser on line 22, paste saveUser. If saveUser uses a variable created in another function, paste that too.

In Cursor or Claude Code, you often don't even paste — you just @mention the file and the AI reads it. But knowing which file to point at is the skill.

Describe Expected vs Actual

This is the ingredient beginners skip most — and it's the most powerful. The AI can read your code, but it can't read your intentions.

Spell out both sides clearly:

"When I submit the form, I EXPECT the new task to
appear in the list below.

What ACTUALLY happens: the page goes blank and the
console shows the error below."

// This one sentence often points AI straight to the bug.

A Reusable Debug Prompt Template

Save this template. Fill in the blanks every time you hit a bug. It guarantees you include all four ingredients.

I'm building [what your app does].

When I [action that triggers it], I get this error:

[paste full error + stack trace]

Here's the relevant code:

[paste function / file]

Expected: [what should happen]
Actual: [what happens instead]

What's the cause, and what's the smallest fix?

Ask for the Cause, Not Just the Patch

A subtle upgrade: end your prompt by asking the AI to explain the cause, not only hand you new code.

If you only ask 'fix it', you might get code you don't understand — and the next bug stumps you again. Asking 'why did this happen?' teaches you as you go, and helps you catch when the AI's reasoning is off.

"Before you give me the fix, explain in one or two
sentences WHY this error happens. Then show the
smallest change that fixes it."

Reproduce It Yourself First

The strongest thing you can hand the AI is exact steps to reproduce. If you can say 'click Save with an empty name field → crash', the AI knows precisely what path the code took.

Try this snippet: it reproduces a real bug. Run it, copy the error it prints, and imagine pasting that plus the code into your AI tool.

function saveUser(user) {
  return "Saved user #" + user.id;
}

try {
  saveUser(undefined); // reproduce: no user passed
} catch (err) {
  console.log(err.name + ": " + err.message);
}

Watch Out for Secrets

One safety rule before you paste: never include API keys, passwords, or tokens in code you send to AI or share publicly.

If your error or code shows something like API_KEY="sk-abc123...", replace it with API_KEY="REDACTED" before pasting. The AI doesn't need the real secret to fix your logic.

Most tools are safe, but this is a good lifelong habit for any builder.

Put It All Together

Here's a fully filled-in example using the template — error, code, expected, actual, and a request for the cause. This is what a 'perfect' debug prompt looks like in practice.

Internalize this shape and AI tools will feel like they read your mind.

I'm building a to-do app.

When I click 'Add', I get:
TypeError: Cannot read properties of null (reading 'value')
    at addTask (app.js:9:30)

Code:
function addTask() {
  const text = document.getElementById('taskInput').value;
  list.push(text);
}

Expected: the typed task is added to the list.
Actual: nothing adds, console throws the error above.

Why does this happen, and what's the smallest fix?

Quick Check

Which prompt will get you the best, most accurate fix from an AI tool?

Recap: Hand AI the Right Context

You now know how to turn a vague 'it's broken' into a precise request. Remember to include:

  • The full error and stack trace
  • The relevant code (the function it points to)
  • Expected vs actual behavior
  • A request to explain the cause, and redact any secrets

Use the reusable template every time. Next lesson: when the error alone isn't enough, you'll learn to narrow down a bug with AI's help.

Często zadawane pytania

Czy lekcja „Skuteczne wklejanie błędów do AI” jest bezpłatna?

Tak — pełny tekst „Skuteczne wklejanie błędów do AI” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Vibe Coding, przejdź na CoddyKit PRO. Kurs Vibe Coding zawiera 4 lekcji w sumie.

Co nauczysz się w „Skuteczne wklejanie błędów do AI”?

Przekaż AI informacje potrzebne do naprawienia błędu Ćwiczysz Vibe Coding z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Vibe Coding?

Nie wymagamy żadnego doświadczenia. Vibe Coding w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 2 z 4.

Ile czasu zajmuje lekcja „Skuteczne wklejanie błędów do AI”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Vibe Coding?

Tak. Każda lekcja Vibe Coding zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Rozumienie komunikatów o błędach
  2. Skuteczne wklejanie błędów do AI
  3. Zawężanie źródła błędu
  4. Gdy AI utknie
← Powrót do Vibe Coding