agentleFS
redf0x1redf0x1/camofox-browser/.cursor/rules/060-routes-dev.mdc

camofox-browser / rules

Cursor rule438 starsChanged 8 months agoMITView on GitHub

Conventions for developing camofox-browser REST API routes

The file

We split this 060-routes-dev.mdc into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep core API in src/routes/core.ts and OpenClaw compatibility in src/routes/openclaw.ts.

    line 10
  2. Very specific:

    Keep user-scoped tab lookup consistent (findTabById(tabId, userId)).

    line 15
  3. Very specific:

    Use withUserLimit and withTimeout for heavy tab operations.

    line 19
  4. Very specific:

    Use withTabLock for tab-mutating actions.

    line 20
  5. Distinctive:

    Keep responses stable for CLI and OpenClaw clients.

    line 29
  6. Distinctive:

    Avoid returning raw internal errors.

    line 31
  7. Very specific:

    Keep user ownership checks on download lookup/content/delete.

    line 34
  8. Very specific:

    Use structured log() calls with req context when available.

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 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
060-routes-dev.mdc
---
description: "Conventions for developing camofox-browser REST API routes"
globs: "src/routes/**"
alwaysApply: false
---

# Route Development Conventions

## Route Files
- Keep core API in `src/routes/core.ts` and OpenClaw compatibility in `src/routes/openclaw.ts`.
- Preserve endpoint compatibility unless a versioned migration is planned.

## Request Validation
- Validate required fields early and return `400` on malformed input.
- Keep user-scoped tab lookup consistent (`findTabById(tabId, userId)`).
- Enforce request body limits for evaluation endpoints.

## Concurrency and Timeouts
- Use `withUserLimit` and `withTimeout` for heavy tab operations.
- Use `withTabLock` for tab-mutating actions.
- Respect config-driven limits from `loadConfig()`.

## Auth and Security
- Apply conditional API-key checks where currently defined.
- Apply admin-key checks for destructive server controls (`/stop`).
- Sanitize cookie payloads and enforce bounds.

## Response Shape
- Keep responses stable for CLI and OpenClaw clients.
- Include `ok` and useful context fields when practical.
- Avoid returning raw internal errors; use safe error wrappers.

## Download/Resource Routes
- Keep user ownership checks on download lookup/content/delete.
- Enforce limits on blob resolution arrays and payload sizes.

## Logging
- Use structured `log()` calls with req context when available.
- Log operation failures with concise, non-sensitive details.

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.