0Pricing
Vibe Coding · درس

الاحتفاظ أو الإصلاح أو الرفض

قرّر ما يبقى واطلب نتيجة أفضل

الاحتفاظ أو الإصلاح أو الرفض درس مجاني في Vibe Coding على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Vibe Coding، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Vibe Coding 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

The Decision That Makes You a Builder

You've read the AI's code and spotted possible issues. Now comes the part that actually ships products: deciding what to do about it.

Every chunk of AI code lands in one of three buckets: Keep it, Fix it, or Reject it. Making that call quickly and confidently is the core review skill.

This lesson gives you a simple framework so you never just blindly hit 'Accept All' again.

The Three Buckets

Here's the whole framework in one view:

  • Keep: it does what you asked, you understand it, no obvious risks. Accept it.
  • Fix: it's close but has a bug, a missing case, or messy bits. Ask AI to adjust it.
  • Reject: it's wrong-headed, overcomplicated, or doesn't match your goal. Throw it out and re-prompt.

Most code is 'Keep' or 'Fix'. Reject is rarer but powerful — don't be afraid to use it.

When to KEEP

Keep code when all three are true:

  • It does what you asked when you run or trace it.
  • You understand it enough to change it later.
  • You don't see obvious bugs or risks from your bug scan.

The function below is clean, named well, and does exactly one clear thing. This is a confident Keep.

function formatPrice(amount) {
  return '$' + amount.toFixed(2);
}

console.log(formatPrice(9.5));   // $9.50
console.log(formatPrice(12));    // $12.00

When to FIX

Fix when the code is mostly right but has a specific flaw you can name. You're not starting over — you're steering.

This code works for normal input but crashes on an empty cart. That's a clear Fix: keep the structure, patch the gap.

function cartTotal(items) {
  return items.reduce((sum, i) => sum + i.price, 0) / items.length;
  // bug: average not total, and crashes on empty cart
}

console.log(cartTotal([{ price: 4 }, { price: 6 }])); // 5, not 10!

How to Ask for a Fix

Good fixes come from specific requests. Don't say 'make it better' — name the exact problem so AI doesn't rewrite the whole thing or wander off.

Point at the precise issue, like this:

Fix two specific bugs in cartTotal, keep everything else the same:

1. It divides by length — I want the TOTAL, not the average.
2. It crashes on an empty cart — return 0 instead.

Show only the corrected function.

When to REJECT

Reject and re-prompt when fixing would be more work than restarting. Red flags for rejection:

  • It solves the wrong problem entirely.
  • It's a tangled mess you can't follow.
  • It uses invented libraries or fake functions.
  • It quietly ignored a key requirement you stated.

Rejecting isn't failure — it's faster than patching something broken at its core. In Cursor or Claude Code, just don't accept the diff and re-prompt.

Rejecting Well: Re-Prompt with Lessons

When you reject, don't just say 'try again' — tell the AI what went wrong so the next attempt is better, not the same.

Fold your finding into a sharper prompt:

That version doesn't work for me. Problems:

- It sorted oldest-first; I need NEWEST first.
- It imported a package that doesn't exist.
- It's way more complex than this needs to be.

Start over: simplest possible solution, newest-first, only built-in JavaScript, and explain your approach in one sentence first.

Small Chunks Make Decisions Easy

The secret to fast Keep/Fix/Reject calls: review in small pieces.

If you let AI write 200 lines at once, your only options are 'accept the whole mess' or 'reject everything.' But if you build one function at a time, each decision is tiny and clear.

Prompt in steps: 'First just the function to fetch data. Show me, I'll review, then we'll add the display.' Small chunks = confident reviews.

Trust Your Gut, Then Verify

If something feels off — too complex, too clever, doesn't quite match what you pictured — that instinct is worth listening to.

You don't have to prove it's broken to ask for better. A quick 'this feels overcomplicated, can you simplify?' costs nothing and often improves the code a lot.

You're the decision-maker. The AI proposes; you dispose. Comfortable saying 'no, again' is a superpower.

A Worked Example

Let's apply the framework to one real chunk. You asked AI for a function that returns the most recent post. It hands you this:

Trace it: it sorts by date but oldest-first, then grabs index 0 — so it returns the oldest post, the opposite of your goal. The structure is fine, the bug is specific and nameable.

Verdict: Fix. Keep the shape, just flip the sort. You'd reject only if it were tangled or solving the wrong task entirely.

function latestPost(posts) {
  const sorted = posts.sort((a, b) => a.date - b.date); // oldest first!
  return sorted[0]; // returns the OLDEST, not the latest
}
// Fix: sort newest-first (b.date - a.date), and guard empty list

Your Keep / Fix / Reject Checklist

Run this for every chunk of AI code:

  • Does it match my goal? If no → Fix or Reject.
  • Do I understand it? If no → ask to explain, then Fix or Reject.
  • Any bugs or risks? If yes → Fix.
  • Is it a tangled mess or wrong-headed? If yes → Reject and re-prompt.
  • All clear? → Keep, and move on.

This loop, on small chunks, is how reliable apps get built with AI.

Quick Check

AI generates a function that's mostly correct but crashes on an empty list and computes an average when you wanted a total. What's the right call?

Recap: Keep, Fix, or Reject

The decision framework you now own:

  • Keep when it matches your goal, you understand it, and it's risk-free.
  • Fix when it's close — name the exact bug and ask AI to patch just that.
  • Reject when it's wrong-headed or tangled; re-prompt with what went wrong.
  • Review small chunks so every decision stays easy and clear.
  • Trust your gut — you're the decision-maker; the AI proposes, you dispose.

You've now learned to review, read, debug-spot, and decide on AI code. That's the discipline that makes vibe coding ship real, working products.

الأسئلة الشائعة

هل درس «الاحتفاظ أو الإصلاح أو الرفض» مجاني؟

نعم — نص درس «الاحتفاظ أو الإصلاح أو الرفض» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Vibe Coding، انتقل إلى CoddyKit PRO. تتضمن دورة Vibe Coding 4 دروس في المجموع.

ماذا ستتعلم في «الاحتفاظ أو الإصلاح أو الرفض»؟

قرّر ما يبقى واطلب نتيجة أفضل تتمرن على Vibe Coding مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Vibe Coding؟

لا تُشترط خبرة سابقة. Vibe Coding على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «الاحتفاظ أو الإصلاح أو الرفض»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Vibe Coding هذا؟

نعم. كل درس في Vibe Coding يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. لماذا يجب مراجعة تعليمات AI البرمجية
  2. قراءة تعليمات برمجية لم تكتبها
  3. اكتشاف الأخطاء والأنماط السيئة
  4. الاحتفاظ أو الإصلاح أو الرفض
← العودة إلى Vibe Coding