Files
khatibi/.clinerules
T
2026-10-11 19:04:20 +03:30

66 lines
4.6 KiB
Plaintext

# ==========================================
# 1. Operational Style & Communication (Claude Code Style)
# ==========================================
You are an expert engineer. Deliver high-signal, structured technical execution with zero conversational fluff.
## Communication Rules
- Match the user's language (Persian or English).
- Be direct, terse, and technical. Never use pleasantries, greetings, apologies, or robotic affirmations.
- Do NOT output preamble text or explanations before invoking tools; execute immediately.
- Never run interactive or long-running commands (e.g., ensure test commands include non-blocking flags).
## Task Wrap-Up Format
- Minor fixes (single file/few lines): Output a single sentence or "Done."
- Complex or multi-step tasks: Output ONLY this structured summary:
- 1-sentence summary of the fix/feature.
- Bullet points of key modified files and core changes.
- Test/build verification status.
- Required manual actions (e.g., .env keys or migrations), only if strictly necessary.
# ==========================================
# 2. Project Operating Guidelines
# ==========================================
## Codebase Navigation & Analysis (Ripwire vs. Graphify)
- Default to Ripwire for all hands-on coding, AST, edits, call graphs, and tests.
- Reserve Graphify strictly for high-level architectural understanding, cross-artifact relations, and non-code assets.
- CLI-only (never use MCP). Route strictly by question and artifact type.
- Never query both tools for the same sub-task; never execute in parallel. Always prefer `--expand` over reading entire files.
- Trivial edits (<= 1 file, no exported symbols): Modify directly without querying either tool.
- Routing gate:
- Code, symbols, AST, usages, impact, tests -> Ripwire.
- Architecture discovery, cross-artifact concepts (PDF, media, docs, ADR/RFC), SQL schemas -> Graphify (.sql symbols use Ripwire; schema semantics use Graphify).
- Ambiguous/Mixed -> run `ripwire . --help-task="task"` to classify.
- Graphify rules: Requires `graphify-out/graph.json` (if absent, fallback to Ripwire). Match terms directly against graph vocabulary. Cross-verify graph findings against source code before editing.
- Pre-edit gate: Inspect target symbol with both `ripwire . --impact=SYM` and `ripwire . --uses=SYM`.
- Post-edit pipeline: Run `ripwire . --test-gate` followed by `ripwire . --quality-delta`.
## Dynamic Help, Self-Correction & Staleness
- Help precedence: Inspect `ripwire --help` or `ripwire --help=--FLAG` when uncertain; CLI help is authoritative.
- Retries: Cap at 1 retry on failures.
- Stale data: Run `graphify update .` or `ripwire . --no-cache` and retry once.
- Missing binary: Report missing dependency clearly; do not guess syntax.
## Git Operations & Safety
- Read-only for agent: Allowed commands are strictly `git status`, `git diff`, and `git log`.
- Human-gated: NEVER run `git add`, `commit`, `push`, `checkout`, `merge`, `rebase`, or branch commands. Ask the user to execute these and pause.
- Exception: `graphify hook install` is permitted (read-side only).
## Development Server Lifecycle
- Binding: Always bind Django to `0.0.0.0:8000` (LAN accessible). Never use `127.0.0.1` unless explicitly requested.
- Process management: Inspect port 8000 and terminate previous project server instances before launching.
- Health check: Confirm exactly one process listens on `0.0.0.0:8000`, then verify health via local fetch to `127.0.0.1:8000`.
- Asset verification: Verify served frontend content on live server before diagnosing browser cache issues.
## Environment, Frontend & PWA Safety
- Python venv: Strictly use `.venv` for all Python/Django operations (`.venv/Scripts/python.exe` on WSL, `.venv\Scripts\python.exe` on Windows). Run pip with `<venv-python> -m pip` and Django with `<venv-python> manage.py ...`.
- PyPI Mirror: Use Liara mirror: `https://package-mirror.liara.ir/repository/pypi/simple`.
- Asset versioning: Local frontend assets must include `static_asset_version` in URLs.
- PWA: Keep service worker registration URL versioned with `updateViaCache: 'none'`.
- Cache regression gate: Frontend/PWA cache changes must pass assertions in `tests/test_views.py` and `tests/e2e/test_pwa_versioning.py`.
## End-to-End Browser Tests (Playwright)
- Tests live in `tests/e2e/`, marked with `e2e`, run against Django's transactional `live_server`.
- Use Chromium and BrowserContext from `tests/e2e/conftest.py`. Function-scoped to avoid deadlocks.
- Page Objects: Encapsulate in `tests/e2e/pages/`. Assert user-visible outcomes only.
- Synchronization: Never use hardcoded sleeps; use Playwright locators and assertions.