vibecodex — Prompts
Excerpt 1 — CLAUDE.md Layer Boundary Enforcement
From CLAUDE.md:
## Architecture (MANDATORY)
The codebase has exactly four layers. Imports flow **only downward**:
Router → Service → Repository (via Protocol) → ORM/HTTP/S3
↘ Provider (via ACL) → external API
| Layer | Lives in | What it does | What it CANNOT import |
|---|---|---|---|
| **Router** | `app/routers/` | HTTP only: parse request, call service, format reply | `sqlalchemy`, `httpx`, business logic |
| **Service** | `app/services/` | Business rules, domain orchestration | `sqlalchemy`, `httpx`, `boto3`, FastAPI `Request` |
| **Repository** | `app/repositories/` | Data access (SQL, S3, Redis) | other services, FastAPI |
| **Provider** | `app/providers/<vendor>/` | External API adapter, returns ACL types | services, repositories, FastAPI |
If a quick fix would violate a rule, you say so and propose the right shape. You never silently take the shortcut.
Prompting technique: Explicit import prohibition table — each layer has a "What it CANNOT import" column that gives the model specific, verifiable constraints. The last sentence is an anti-sycophancy instruction: the model must refuse a user's "quick fix" that violates the architecture.
Excerpt 2 — new-feature SKILL.md Pre-Flight Checklist
From .claude/skills/new-feature/SKILL.md:
# new-feature
Do not open any file for editing until all 5 steps below are completed.
## Step 1 — Define the API contract
Write the contract in plain text before any code. Answer these 4 questions:
Endpoint: POST /generate/image
Request: { prompt: str, model_id: str, width: int, height: int }
Response: { task_id: str, status: "queued" }
Side effect: creates a task, holds credits
If you cannot answer all 4 in 2 sentences, the feature scope is unclear. Stop and clarify with the user.
## Step 2 — Identify layers touched
Use this decision matrix to know which files you will create or modify:
| What the feature needs | Layers touched | Files |
|---|---|---|
| New HTTP endpoint only | Router | `routers/<domain>.py` |
| Logic + credits charge | All of the above + Credits | + `services/credits/user.py` (read-only — single writer!) |
**Write the list:** "This feature touches: Router, Service, Repo."
Do not touch more layers than listed. If you discover you need more, stop and re-plan.
Prompting technique: Hard gate — "Do not open any file for editing until all 5 steps below are completed." This is a pre-implementation barrier that forces explicit upfront planning. Combined with the decision matrix (lookup table, not reasoning), it prevents scope creep.
Excerpt 3 — Single-Writer Invariant
From CLAUDE.md:
**Rule B7 — Credits are a single-writer domain.**
Only `services/credits/user.py` may deduct, refund, or hold credits.
Any router, provider, or background task that needs to touch credits MUST call the credits service via the service layer, never directly.
Prompting technique: Domain invariant as a named rule with a declarative prohibition. "Only X may do Y" is a stronger constraint than "prefer doing Y via X." The rule name (B7) makes it citable in code review ("this violates B7").