🏠 Home / Hub

AI Vibe 03 — Repo & Context Management

AI only knows what you tell it. Learning to curate and maintain the right context for your project is what separates developers who get great AI results from those who get generic ones.

1. Why Context Matters

An AI model has no knowledge of your specific codebase unless you provide it. Without context, it generates generic solutions that may:

Providing 50 lines of the right context is worth more than 1000 lines of the wrong files. Relevance beats volume.

2. CLAUDE.md and .cursorrules Files

These files sit in your project root and are automatically loaded by Claude Code and Cursor as persistent instructions. They act as a standing system prompt for every AI interaction in your project.

# CLAUDE.md — for Claude Code
# .cursorrules — for Cursor IDE
# (Both use similar markdown format)

# Project: MedStore Web App
# Stack: Vue 3 + TypeScript, Laravel 11 API, Tailwind CSS

## Tech Stack
- Frontend: Vue 3, Pinia, Vue Router, Tailwind CSS
- Backend: Laravel 11, Sanctum, MySQL 8
- Testing: Vitest (frontend), PHPUnit (backend)
- Deployment: Laravel Forge + Nginx

## Conventions
- Vue components: PascalCase, Composition API only
- Composables: use prefix, e.g. useAuth, useCart
- API calls: through /src/api/ service files, never in components
- Env vars: VITE_ prefix for frontend, no .env in git

## Do NOT
- Use Options API
- Use inline styles (always Tailwind)
- Import lodash (use native JS)
- Use any deprecated Laravel features

3. What to Include in Project Context

IncludeWhy
Tech stack with versionsPrevents wrong API suggestions
Naming conventionsGenerated code matches existing style
Folder structure overviewAI puts files in the right place
Patterns to useConsistency with existing code
Patterns to avoidPrevents banned approaches
Existing utilitiesAI reuses them instead of duplicating
Auth mechanismCorrect handling of protected routes/requests
# Example folder structure section in CLAUDE.md:
## Project Structure
src/
  api/         # Axios service files (one per domain)
  components/  # Reusable UI components
  composables/ # Vue composables (use prefix)
  pages/       # Page-level components (route targets)
  stores/      # Pinia stores
  types/       # TypeScript interfaces and types

## Key Files
src/api/auth.ts       # Auth API calls
src/stores/auth.ts    # Auth Pinia store
src/composables/useApi.ts  # Base Axios composable with auth header

4. Selective Context Sharing

When asking AI to work on a specific task, paste only the files relevant to that task — not the whole codebase.

# When asking about a cart feature, share:
- The Pinia cart store
- The CartItem component
- The relevant API service file
# Do NOT paste: auth store, user profile, unrelated pages

# Template for sharing context in a prompt:
"Here are the relevant files for this task:

--- src/stores/cart.ts ---
[paste file contents]

--- src/api/orders.ts ---
[paste file contents]

Now: add a coupon code field to the cart store that
calls /api/validate-coupon and applies the discount."
Pasting too many files wastes context window space and can confuse the model. Focus on what is directly relevant to the task at hand.

5. Git as Context

Your git history and branch names communicate intent to both humans and AI tools.

# Meaningful commit messages help AI understand what changed:
git log --oneline
# Good:
a1b2c3 feat: add product search with debounce composable
d4e5f6 fix: cart total not recalculating after item removal
g7h8i9 refactor: extract API error handling to useApiError

# Bad:
a1b2c3 update
d4e5f6 fix bug
g7h8i9 changes

# Meaningful branch names:
feature/cart-coupon-codes
fix/checkout-validation-error
refactor/product-api-layer

# Claude Code can read your git log — the more descriptive
# your history, the better context it has for your codebase.

6. Memory Systems

Claude Code Memory

# Claude Code reads CLAUDE.md automatically from:
~/.claude/CLAUDE.md          # Global (all projects)
/your/project/CLAUDE.md      # Project-level
/your/project/src/CLAUDE.md  # Directory-level (rare)

# To add a memory during a session:
/memory "Always use axios.create() instance from src/api/client.ts"
# Writes to CLAUDE.md for future sessions

Cursor Rules

# .cursorrules in project root
# Supports glob-based rules for different file types:
---
name: Vue Components
globs: ["src/components/**/*.vue"]
rules:
  - Use Composition API with script setup
  - Props must have TypeScript types
  - Emit events must be defined with defineEmits

---
name: API Services
globs: ["src/api/**/*.ts"]
rules:
  - Use the axios instance from src/api/client.ts
  - All functions must be async
  - Handle errors and return typed responses

7. Context Management Best Practices

# Quick context refresh template:
"Reminder of project context:
- Stack: Vue 3 + Laravel 11 + Tailwind
- No Options API, no inline styles
- See src/stores/auth.ts for auth pattern

Now: [your actual task here]"

📌 Study Checklist