ai-collaboration

A set of instructions for how an AI coding agent should plan, write, and check code. The workflow requires reading the relevant project files first, following applicable rules, and reviewing the result afterward.

In plain words
What is it for?
Use it to guide feature work through planning, implementation, and checks such as safe input handling, current authentication methods, and correct framework conventions.
Why use it?
It reduces coding mistakes caused by guessing about the existing project and creates a clear check before a change is considered finished.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/vibestackdev/vibe-stack/ai-collaboration
Clone the repo
git clone --depth 1 https://github.com/vibestackdev/vibe-stack

Made for: Cursor.

Per session 813 This file is loaded in full into every session.
When invoked 813 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00813 $0.00813
Opus 5 $0.00407 $0.00407
Sonnet 5 $0.00163 $0.00163
Haiku 4.5 $0.00081 $0.00081

Measured yesterday against content hash 39de764d2ae5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-collaboration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/ai-collaboration.mdc · 106 lines

How it starts

The opening of the file, as written. The whole thing — 106 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Collaboration Guidelines

The 3-Stage Agentic Loop

Every code generation task MUST follow this loop:

Stage 1: PLAN (gather context first)

Before writing ANY code, the AI MUST:

  1. Read the relevant source files to verify current state — do NOT rely on memory
  2. Identify which .cursor/rules/ files apply to this task
  3. List the files to modify and explain why
  4. Do NOT write code yet

Prompt template:

Analyze the current codebase and plan how to implement [feature]. 
List the files you'll modify and why. Don't write code yet.

Stage 2: IMPLEMENT (follow constraints)

When generating code:

  • Follow ALL active .cursor/rules/ constraints
  • If unsure about auth patterns, re-read supabase-auth-security.mdc
  • If unsure about params/layouts, re-read nextjs15-params.mdc
  • Use unknown + Zod validation instead of any for external data
  • Return ActionResponse<T> from all Server Actions (see below)

Stage 3: VERIFY (confirm before declaring done)

After generating code, the AI MUST self-check:

  • No getSession() on the server (MUST be getUser())
  • No synchronous params or searchParams access
  • No @supabase/auth-helpers-nextjs imports
  • No any types — use unknown + type narrowing
  • Every API route has Zod validation
  • Every error is caught and returns { error: string }
  • New tables have RLS enabled
  • loading.tsx and error.tsx exist for data-fetching pages

Report issues BEFORE the developer runs the code.

Skeptical Retrieval Rule

NEVER trust stored knowledge about the codebase. Before modifying a file:

  1. Re-read the file to verify its current contents
  2. Check imports and exports to ensure they match expectations
  3. Verify that function signatures haven't changed

This prevents generating code that references stale function signatures, deleted files, or renamed exports.

Standard Patterns

ActionResponse Type (use for all Server Actions)

type ActionResponse<T = void> = 
  | { success: true; data: T }
  | { success: false; error: string }

Read the full file on GitHub · 106 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 106 lines · 813 tokens per session scan A 39de764d2ae5

Subscribe to this mod's changes

ai-collaboration is a cursor rule published in the GitHub repository vibestackdev/vibe-stack (7 stars, last pushed yesterday), licensed MIT. It adds 813 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.