api-conventions

api-conventions is a cursor rule for Cursor from verdikta/verdikta-applications. It costs 0 tokens per session (1,300 once invoked), scanned A, original, MIT.

A set of rules for designing backend service APIs, including URL patterns, JSON response shapes, and input validation. An API is the interface that lets software systems communicate.

In plain words
What is it for?
Use it when creating or reviewing API routes, success and error responses, required fields, data types, value ranges, and file validation.
Why use it?
It keeps endpoints and errors consistent, so clients know how to send requests and interpret responses.

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/verdikta/verdikta-applications/api-conventions
Clone the repo
git clone --depth 1 https://github.com/verdikta/verdikta-applications

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-conventions

README.md
[![agentmods](https://agentmods.dev/badge/rules/verdikta/verdikta-applications/api-conventions.svg)](https://agentmods.dev/rules/verdikta/verdikta-applications/api-conventions)
Your own site
<a href="https://agentmods.dev/rules/verdikta/verdikta-applications/api-conventions"><img src="https://agentmods.dev/badge/rules/verdikta/verdikta-applications/api-conventions.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,300 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.01300
Opus 5 $0.00000 $0.00650
Sonnet 5 $0.00000 $0.00260
Haiku 4.5 $0.00000 $0.00130

Measured 4d ago against content hash eba00cefbba4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-conventions 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 4d ago.

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/api-conventions.mdc · 228 lines

How it starts

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

API Conventions

Endpoint Structure

Job Management API

POST   /api/jobs/create              - Create new job
GET    /api/jobs                     - List jobs (with filters)
GET    /api/jobs/:jobId              - Get job details
POST   /api/jobs/:jobId/submit       - Submit work
GET    /api/jobs/:jobId/submissions  - Get all submissions

Response Format

Always return JSON with consistent structure:

Success Response:

{
  "success": true,
  "data": { ... },
  "message": "Operation completed successfully"
}

Error Response:

{
  "error": "Error category",
  "details": "Specific error message",
  "code": "ERROR_CODE" // optional
}

Request Validation

Always Validate

  1. Required fields presence
  2. Data types
  3. Value ranges (e.g., threshold 0-100)
  4. String lengths (e.g., narrative max 200 words)
  5. File sizes and types
  6. Ethereum addresses (0x + 40 hex chars)

Example Validation Pattern

// Validate required fields
if (!field1 || !field2) {
  return res.status(400).json({
    error: 'Missing required fields',
    details: 'field1 and field2 are required'
  });
}

// Validate ranges
if (threshold < 0 || threshold > 100) {
  return res.status(400).json({
    error: 'Invalid threshold',
    details: 'Threshold must be between 0 and 100'
  });
}

// Validate word count
const wordCount = text.trim().split(/\s+/).length;
if (wordCount > 200) {
  return res.status(400).json({
    error: 'Text too long',
    details: `Must be 200 words or less (current: ${wordCount})`
  });
}

File Upload Patterns

Multer Configuration

const storage = multer.diskStorage({
  destination: (req, file, cb) => {
    cb(null, path.join(__dirname, '../tmp'));
  },
  filename: (req, file, cb) => {
    const uniqueSuffix = `${Date.now()}-${Math.round(Math.random() * 1E9)}`;
    cb(null, `${uniqueSuffix}-${file.originalname}`);
  }
});

const upload = multer({
  storage,
  fileFilter: (req, file, cb) => {
    if (isValidFileType(file.mimetype, file.originalname)) {
      cb(null, true);
    } else {
      cb(new Error(`Invalid file type: ${file.mimetype}`));
    }
  },
  limits: {
    fileSize: MAX_FILE_SIZE,
    files: 10
  }
}).array('files', 10);

Read the full file on GitHub · 228 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. 4d ago First seen · 228 lines · 1,300 tokens per session scan A eba00cefbba4

Subscribe to this mod's changes

api-conventions is a cursor rule published in the GitHub repository verdikta/verdikta-applications (24 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,300 tokens. 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-30.