وضع التخطيط مقابل التنفيذ المباشر
خطّط للتغييرات الكبيرة أو الغامضة، ونفّذ التغييرات الصغيرة والواضحة
وضع التخطيط مقابل التنفيذ المباشر درس مجاني في Claude Architect على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Claude Architect، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Claude Architect 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Two Modes, One Decision
In Claude Code you constantly make one judgment call: plan first, or execute now?
Plan Mode lets Claude explore, read files, and propose a written plan that you approve before any edits land. Direct execution skips straight to making changes.
The skill isn't picking one forever. It's matching the mode to the size and clarity of the task. Big or ambiguous? Plan. Small and clear? Execute.
What Plan Mode Actually Buys You
Plan Mode gives you four concrete benefits:
- Safe exploration — Claude reads and investigates without touching files.
- Approval gate — you review the proposed plan before edits happen.
- Approach comparison — when multiple solutions exist, you see them laid out.
- Architectural framing — design decisions surface early, not mid-edit.
Use it for large changes, multiple possible approaches, and architectural decisions where a wrong turn is expensive to unwind.
When Direct Execution Wins
Plan Mode has overhead: you read a plan, you approve it. For trivial work that overhead is pure friction.
Go straight to direct execution when the change is:
- A single-file fix with an obvious edit.
- Driven by a clear stack trace that points at the exact line.
- Small, well-scoped, and low-risk to get wrong.
If you already know the file, the line, and the fix, planning just slows you down.
The Decision Heuristic
Reduce it to two questions:
- Is the change big? Many files, new modules, refactors, migrations.
- Is the change ambiguous? Unclear requirements, several valid designs, unknown blast radius.
If either is true, plan first. If both are false — small and clear — execute directly.
This mirrors the exam principle: reserve heavier process for where uncertainty and impact are high; keep light paths light.
A Clear Bug: Execute Directly
Here a stack trace names the file and the cause. There's one correct fix and no design choice. Planning adds nothing.
You'd simply ask Claude to apply the fix, letting it Read the file and make a precise Edit on the unique matching line.
# Clear stack trace -> direct execution, no plan needed
# TypeError: 'NoneType' object has no attribute 'id'
# at services/billing.py line 88: customer.id
# Prompt to Claude Code:
# "billing.py:88 crashes when get_customer returns None.
# Guard the None case and return a 404-style error. Apply the fix."
# Claude: Read billing.py -> Edit line 88 (unique match) -> done.A Big Change: Plan First
Now contrast a request like "add multi-tenant support to the API." That touches auth, the data layer, routing, and migrations. There are several valid designs and a large blast radius.
This is textbook Plan Mode: let Claude explore the codebase read-only, then propose a plan you approve before a single edit lands.
# Ambiguous + large -> enter Plan Mode first
# In Claude Code: toggle Plan Mode, then:
# "Add tenant isolation across the API. Explore the current
# auth, models, and routing. Propose 2 approaches with trade-offs.
# Do NOT edit anything until I approve a plan."
# Output: a written plan + approaches -> you approve -> edits begin.Isolate Discovery with an Explore Subagent
Planning large changes means reading lots of files, and that discovery output is verbose. Dumping it all into the main context causes lost-in-the-middle attention loss and burns tokens.
Use an Explore subagent to isolate discovery. It investigates and returns a tight summary; the planning context stays clean. Skills can do the same with context: fork to isolate verbose output.
# .claude/skills/explore-codebase/SKILL.md frontmatter
---
name: explore-codebase
description: Map files relevant to a feature and return a concise summary
context: fork # isolate verbose discovery output
allowed-tools: [Glob, Grep, Read] # read-only, least privilege
argument-hint: <feature-area>
---Plan Mode and the Approval Gate
The approval step is the whole point. A plan you can read lets you catch a bad assumption before it becomes 15 edited files.
This is deterministic, human-in-the-loop control. It pairs naturally with the architect mindset: where impact is high, you want a hard checkpoint, not a hope that the model guessed your intent. Prompts are ~90% probabilistic; an approval gate is 100% under your control.
Investigate Before You Decide
Sometimes you can't tell if a task is small until you look. Don't guess — investigate incrementally, then choose the mode.
The built-in pattern: Grep the entry points, Read the key files, Grep the usages, Read the consumers. If the blast radius turns out large, switch to Plan Mode; if it's one isolated spot, just fix it.
# Incremental investigation drives the plan-vs-execute call
# 1) find where the symbol lives
# Grep "def calculate_tax"
# 2) read it
# Read services/tax.py
# 3) find callers
# Grep "calculate_tax("
# 4) read consumers -> 1 caller? execute. 12 callers? plan.Plan Mode Pairs with TDD and CLAUDE.md
Plan Mode doesn't work alone — it sits inside your Claude Code workflow.
- A shared ./CLAUDE.md (in VCS) gives the plan your standards and conventions up front.
- TDD: have the plan write failing tests first, then implement to green.
- Slash commands / skills in
.claude/can encode a repeatable "plan this feature" flow shared with the team.
The plan becomes the contract; tests prove it was met.
# CLAUDE.md feeds the plan your rules
## Engineering rules
- Write a failing test before implementing (TDD).
- New endpoints require an integration test.
- Plan multi-file changes; approve before editing.Don't Over-Plan or Under-Plan
Both extremes cost you:
- Over-planning a one-line, stack-trace-obvious fix wastes time and adds an approval step nobody needed.
- Under-planning a sprawling refactor means edits land before anyone validates the approach — exactly the expensive mistake the approval gate exists to prevent.
Calibrate to size and clarity. When genuinely unsure, lean toward planning for big or ambiguous work, and toward executing for small clear work after a quick look.
Quick Check: Pick the Mode
Apply the decision heuristic to a realistic request.
Recap: Match the Mode to the Task
Key takeaways:
- Plan Mode for big or ambiguous work: large changes, multiple approaches, architectural decisions, and safe exploration with approval before edits.
- Direct execution for small clear work: single-file fixes and clear stack traces.
- Decision rule: if the change is big OR ambiguous, plan; if small AND clear, execute.
- Investigate incrementally (Grep -> Read -> Grep -> Read) when you can't size it up front, then choose.
- Isolate verbose discovery with an Explore subagent (or a skill with
context: fork) to protect the planning context. - The approval gate is deterministic human control — don't trade it away on high-impact changes.
الأسئلة الشائعة
هل درس «وضع التخطيط مقابل التنفيذ المباشر» مجاني؟
نعم — نص درس «وضع التخطيط مقابل التنفيذ المباشر» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Claude Architect، انتقل إلى CoddyKit PRO. تتضمن دورة Claude Architect 4 دروس في المجموع.
ماذا ستتعلم في «وضع التخطيط مقابل التنفيذ المباشر»؟
خطّط للتغييرات الكبيرة أو الغامضة، ونفّذ التغييرات الصغيرة والواضحة تتمرن على Claude Architect مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Claude Architect؟
لا تُشترط خبرة سابقة. Claude Architect على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «وضع التخطيط مقابل التنفيذ المباشر»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Claude Architect هذا؟
نعم. كل درس في Claude Architect يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- الأوامر المخصصة مقابل Skills
- Frontmatter الخاص بـ Skill
- وضع التخطيط مقابل التنفيذ المباشر
- التحسين التكراري باستخدام الأمثلة