agentleFS
vibestackdevvibestackdev/vibe-stack/.cursor/rules/verify-before-use.mdc

vibe-stack / rules

Cursor rule8 starsChanged 8 months agoMITView on GitHub

Verification rules — forces the AI to verify its work before declaring done

  • Reads credentials

The file

We split this verify-before-use.mdc into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After generating or modifying TypeScript files, ALWAYS run the type checker before declaring the task complete.

    line 11
  2. Distinctive:

    If types fail, fix ALL errors before moving on.

    line 18
  3. Distinctive:

    Before modifying ANY existing file, re-read it first.

    line 23
  4. Very specific:

    Before writing Supabase queries, verify the table structure by checking the migration files in supabase/migrations/.

    line 34
  5. Distinctive:

    Do NOT assume column names, types, or relationships.

    line 37
  6. Distinctive:

    After creating new API routes or pages, verify:

    line 44
  7. Very specific:

    Before using process.env.SOME_KEY, verify it exists in .env.example.

    line 58
  8. Very specific:

    If the variable is new, ADD it to .env.example with a placeholder value and document it in the setup instructions.

    line 59
  9. Very specific:

    NEVER put secrets in NEXT_PUBLIC_ variables — they are exposed to the browser.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
verify-before-use.mdc
---
description: Verification rules — forces the AI to verify its work before declaring done
globs: ["*"]
alwaysApply: true
---

# Verify Before Use

## RULE 1: Run Type Checker After Every Code Generation

After generating or modifying TypeScript files, ALWAYS run the type checker
before declaring the task complete. Do not assume code is correct — verify it.

```bash
npx tsc --noEmit
```

If types fail, fix ALL errors before moving on. Do NOT leave type errors
for the developer to fix manually.

## RULE 2: Re-Read Before Modifying

Before modifying ANY existing file, re-read it first. Do NOT generate code
based on assumptions about what the file contains.

Common failures from skipping this step:
- Importing functions that were renamed or deleted
- Overwriting changes made in a previous turn
- Adding duplicate imports or declarations
- Breaking existing patterns by not matching the file's style

## RULE 3: Verify Database Schema Before Queries

Before writing Supabase queries, verify the table structure by checking
the migration files in `supabase/migrations/`.

Do NOT assume column names, types, or relationships. Common hallucinations:
- Using `user_id` when the column is `author_id`
- Assuming a `status` column exists when it doesn't
- Using wrong relationship names in `.select('*, profile(*)')`

## RULE 4: Test Route Patterns Before Declaring Done

After creating new API routes or pages, verify:
1. The file path matches the expected URL pattern
2. The HTTP method matches the use case (GET for reads, POST for mutations)
3. The response shape matches what the client expects

```
app/api/posts/route.ts        → GET /api/posts, POST /api/posts
app/api/posts/[id]/route.ts   → GET /api/posts/123, DELETE /api/posts/123
app/dashboard/page.tsx         → /dashboard
app/posts/[slug]/page.tsx      → /posts/my-first-post
```

## RULE 5: Verify Environment Variables Exist

Before using `process.env.SOME_KEY`, verify it exists in `.env.example`.
If the variable is new, ADD it to `.env.example` with a placeholder value
and document it in the setup instructions.

NEVER put secrets in `NEXT_PUBLIC_` variables — they are exposed to the browser.

```typescript
// CORRECT — server-only secret
const stripeKey = process.env.STRIPE_SECRET_KEY!

// WRONG — exposed to all users
const stripeKey = process.env.NEXT_PUBLIC_STRIPE_SECRET_KEY!
```

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.