Claude Code — פיתוח עם AI
שיעור 8 מתוך 8 100%
שיעור 08 25 דקות

טיפים מתקדמים, MCP Servers ו-Custom Hooks

הגעתם לשיעור האחרון. עד עכשיו כיסינו את כל הבסיס — עכשיו הופכים אתכם למשתמשי power. MCP Servers, Custom Hooks, ואוסף הטיפים שאספתי מחודשי עבודה אמיתית עם Claude Code.

MCP Servers — כשClaud Code מתחבר לעולם

MCP (Model Context Protocol) הוא תקן פתוח שמאפשר לClaude Code להתחבר לכלים חיצוניים. במקום לכתוב כל מידע ידנית — Claude Code מושך אותו ישירות מהמקור.

MCP Server לפרויקט Github

claude mcp add github -- npx -y @modelcontextprotocol/server-github

אחרי החיבור, Claude Code יכול:

> create a GitHub issue for the bug we just found, assign it to me
> list the last 5 PRs and summarize what changed

MCP Server לדפדפן

claude mcp add playwright -- npx -y @executeautomation/playwright-mcp-server

Claude Code יכול לפתוח דפדפן ולבדוק את האתר בפועל:

> open jonny.local, take a screenshot, and tell me if the mobile menu works

MCP Server למסד נתונים

claude mcp add sqlite -- npx -y @modelcontextprotocol/server-sqlite --db-path ./db.sqlite
> show me all contact form submissions from the last week

ניהול MCP Servers

claude mcp list          # רשימת כל הservers
claude mcp remove github # הסרת server
claude mcp get github    # פרטים

Custom Hooks — אוטומציה אמיתית

Hooks הם scripts שרצים לפני או אחרי כל פעולה שClaude Code עושה. מוגדרים ב-.claude/settings.json:

Post-Edit Hook — Build אוטומטי

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "if echo '$FILE' | grep -qE 'src/(css|js)/'; then npm run build; fi"
          }
        ]
      }
    ]
  }
}

כל פעם שClaude Code עורך קובץ ב-src/css/ או src/js/ — npm run build רץ אוטומטית.

Pre-Write Hook — גיבוי אוטומטי

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write",
        "hooks": [
          { "type": "command", "command": "git add -A && git stash" }
        ]
      }
    ]
  }
}

CLAUDE.md מתקדם — Auto-Permissions

במקום לאשר כל פקודה, אפשר לרשום ב-CLAUDE.md:

## Allowed Commands (no confirmation needed)
- npm run build
- npm run dev
- git status
- git diff
- git add -A
- git commit

## Ask Before Running
- git push
- wp db export
- rm -rf

טיפים מניסיון אמיתי

1. Commit אחרי כל feature קטן

Claude Code עושה שינויים מהר. בלי commits תכופים — קשה לחזור אחורה.

> after each working change, commit with a descriptive message

2. "Explain as you go"

> as you make changes, add a brief comment explaining WHY (not what)

מלמד אתכם תוך כדי עבודה.

3. /compact לפני task גדול

Context מלא = slow. /compact לפני task חדש = faster responses ופחות טעויות.

4. –model לפי task

  • Opus — architecture decisions, complex bugs, code review
  • Sonnet — פיתוח יומיומי, refactoring
  • Haiku — שינויים קטנים, formatting, simple fixes (זול ומהיר)

5. Context windows וניהול עלויות

Claude Code מראה token usage בcorner. כשמגיעים ל-80%+ — /compact או session חדש. Tokens = כסף.

6. CLAUDE.md כ-living document

עדכנו CLAUDE.md כשמגלים משהו שClaude Code צריך לדעת:

> add to CLAUDE.md: "always use wp_send_json_success() for AJAX responses, never echo directly"

בניית Workflow שבועי עם Claude Code

  1. ראשון בבוקר: claude --continue — ממשיכים מאיפה שהפסקנו
  2. לפני feature חדש: /compact → תאר מטרה
  3. באמצע עבודה: commit כל 30 דקות
  4. בסוף יום: > summarize what we built today and what's left

✅ סיכום הקורס — מה למדתם

  • שיעור 1: מה זה Claude Code ולמה הוא שונה
  • שיעור 2: התקנה ואימות על כל מערכת הפעלה
  • שיעור 3: פקודות וניסוח בקשות שעובדות
  • שיעור 4: CLAUDE.md — הזיכרון הקבוע של הפרויקט
  • שיעור 5: Agentic Workflows — אוטומציה של tasks שלמים
  • שיעור 6: Case Study WordPress — מה-idea ועד commit
  • שיעור 7: Debugging מורכב בשיטתיות
  • שיעור 8: MCP, Hooks, וטיפים מתקדמים

Claude Code הוא כלי שמשתפר ככל שאתם משתמשים בו יותר. ה-secret: תנו לו context, תאמינו בתהליך, ואל תפחדו לבקש הסברים. בהצלחה! 🚀

שיעור קודם
Debugging ופתרון בעיות מורכבות עם Claude…
התקשרו עכשיו
דלגו לתוכן הראשי