הנדסת .cursorrules - מדריך מקצועי לכתיבת כללים שעובדים | VibeScale
חזרה לכל המאמרים
פיתוח
15 דקות קריאה
16 במאי 2026

הנדסת .cursorrules - מדריך מקצועי לכתיבת כללים שעובדים

המדריך המקיף לכתיבת קבצי .cursorrules שמכריחים את ה-AI לשמור על איכות קוד, סטנדרטים ארכיטקטוניים ואבטחה.

תובנה מרכזית

תמצית המאמר (TL;DR)

המדריך המקיף לכתיבת קבצי .cursorrules שמכריחים את ה-AI לשמור על איכות קוד, סטנדרטים ארכיטקטוניים ואבטחה.

Optimized for AI Extraction
Source: VibeScale Engineering Hub

TL;DR: .cursorrules הוא קובץ הוראות ב-root של ה-repo ש-Cursor קורא בכל קריאה ל-AI. בלעדיו, ה-AI יוצר קוד לא תחזוקתי. עם .cursorrules מקצועי - איכות שווה למפתח senior. המדריך מציג: מבנה אפקטיבי, חוקים חיוניים, תבניות מוכנות, ואכיפה.

למה .cursorrules הוא הכלי החשוב ביותר

ה-AI לא יודע איך לכתוב קוד טוב לפרויקט שלכם. הוא יודע syntax. הוא לא יודע: האם Zustand או Redux, strict typing או לא, איך מנהלים errors. .cursorrules הוא ה-system prompt שלכם.

קראו עוד: Cursor Rules Engineering

מבנה אפקטיבי

חוקיות שעובדת ב-50+ פרויקטים:

  1. Project Overview (3-5 שורות)
  2. Core Constraints (לא ניתנים להפרה)
  3. Architecture Patterns
  4. State Management
  5. Error Handling
  6. Styling
  7. Testing
  8. Anti-patterns (חשוב יותר מ-do's)

תבנית React + TypeScript

# VibeScale React .cursorrules

## Project Overview
React 19 + TypeScript + Vite + Tailwind + React Query SaaS for [domain].
Multi-tenant. Hebrew RTL. Mobile-first.

## Core Constraints

1. **MODULARITY**: NEVER exceed 200 lines per file.
2. **TYPESCRIPT**: NEVER use 'any'. Use 'unknown' + type guards.
3. **NAMING**: Components PascalCase, hooks useCamelCase.
4. **IMPORTS**: '@/...' alias. Group external/internal/types/styles.

## State Management

- **Server state**: ALWAYS TanStack Query. NEVER useEffect+fetch.
- **Global UI**: Zustand store in src/stores/.
- **Local**: useState only.
- **Forms**: react-hook-form with Zod schemas.

## Error Handling

- All API calls: try/catch OR TanStack Query.
- Error boundaries (src/components/ErrorBoundary.tsx).
- Sentry for unhandled. Never silently swallow.

## Styling

- Tailwind utility classes ONLY.
- Design tokens: bg-primary, text-on-surface, border-outline-variant.
- NEVER arbitrary values (bg-[#FF5733]) - extend theme.
- Mobile-first: base mobile, add md:/lg:.

## RTL Hebrew

- dir="rtl" on key containers.
- Logical properties: border-r (start), not border-l.

## Anti-patterns (NEVER)

-  useEffect for data fetching
-  inline styles
-  'any' type
-  console.log in production
-  async/await without try/catch
-  class components

## Comments

- WHY, not WHAT. One-line max.

תבניות לסטאקים אחרים

Next.js 14 App Router:

  • Server Components by default
  • 'use client' only for interactivity
  • Data fetching ב-Server Components או Route Handlers
  • generateMetadata() ל-SEO

Python FastAPI:

  • Pydantic models לכל schemas
  • Type hints + mypy strict
  • Dependency Injection
  • Async by default

חוקים מתקדמים - Security

## Security
- NEVER secrets in client code (no VITE_ for API keys)
- NEVER innerHTML without DOMPurify
- All inputs Zod-validated before server
- Auth via httpOnly cookies, NEVER localStorage
- RLS required on every Supabase table

איך לבדוק שעובד

  1. בקשו פיצ'ר חדש - האם פיצל לקבצים? Types?
  2. בקשו תיקון באג - בדק שאר השכבות?
  3. בקשו refactor - שמר על סטנדרטים?

טיפ: commit .cursorrules ל-repo. כל מפתח חדש מקבל את אותם הסטנדרטים ביום הראשון.

נסו את המחולל: Cursor Rules Generator

תחזוקה לאורך זמן

.cursorrules הוא מסמך חי. עדכנו כש:

  • צוות מוסיף ספרייה חדשה
  • מזהים anti-pattern נפוץ ב-PRs
  • ה-AI חוזר על אותה טעות פעמיים

מתחילים עם 30 שורות, אחרי 3 חודשים 80-100. אל תכתבו 500.

כלים נוספים

WhatsApp | Vibe Coding Rescue

הצוות של VibeScale - מומחה VibeScale
Expert Verified Content

הצוות של VibeScale

צוות הנדסה ל-Vibe Coding Rescue

צוות מהנדסי תוכנה ומומחי ארכיטקטורה עם ניסיון מצטבר של מעל עשור בליווי סטארטאפים. אנחנו מובילים את VibeScale במטרה להפוך את ה-Vibe Coding לסטנדרט הנדסי בטוח ויעיל.

Auth ID: VBS-2026-AUTH

Security

Verified Code

Expertise

Cloud Architect

בואו נדבר על הפרויקט שלכם

מאמרים קשורים