api

USE WHEN: Defining HTTP requests, endpoints, and handling API 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/omergulcicek/omergulcicek.com/api
Clone the repo
git clone --depth 1 https://github.com/omergulcicek/omergulcicek.com

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 408 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00408
Opus 5 $0.00000 $0.00204
Sonnet 5 $0.00000 $0.00082
Haiku 4.5 $0.00000 $0.00041

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

Security

Grade A, and why

api scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

* **Architecture:** No `axios.create` inside features, no cross-feature API imports, no hardcoded endpoint strings in queries.
.cursor/rules/api.mdc · 45 lines

What it actually says

API Layer

Constraints

  • Location: Place all HTTP calls under features/[feature]/api.
  • Validation: Use Zod for input/output validation when data is external or untrusted. Parse responses before they reach UI or state.
  • Return Type: Return typed data, not raw responses.
  • Error Handling: Normalize all API errors to a consistent AppError format (code, message) before throwing.
  • Config: Load baseURL from env. Use a single axios instance (src/lib/api.ts).
  • Interceptors: Handle cross-cutting concerns (auth, headers) via interceptors.
  • Naming: verb-entity.api.ts (e.g., get-users.api.ts). Function: getUsers.
  • SSR Safety: Use only whitelisted internal URLs or absolute paths for server-to-server calls to prevent SSRF.

Bans

  • Raw Exposure: Forbidden to use fetch/axios or raw API data inside UI components, hooks, or state without validation.
  • Logic Leaks: Forbidden to leak internal error stack traces or raw axios/fetch errors to the client.
  • Security: Forbidden to construct dynamic URLs using unsanitized user inputs.
  • Architecture: No axios.create inside features, no cross-feature API imports, no hardcoded endpoint strings in queries.

Correct Implementation

Incorrect Implementation

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 · 45 lines · 0 tokens per session scan A b3772571bc9d

Subscribe to this mod's changes

api is a cursor rule published in the GitHub repository omergulcicek/omergulcicek.com (15 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 408 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.

Related

Other cursor rules, from other repositories

jsx-and-tsx

When writing React code, use this guide for React best practices and guidance.

janhesters/react-router-saas-template · 0 tokens

facades

When writing facade functions, use this guide for facade functions best practices and guidance.

janhesters/react-router-saas-template · 0 tokens

storybook-stories

Guides the creation and modification of Storybook files specifically within the 'packages/docs' package. It covers conventions, best practices, and helps answer questions about existing story implementations within 'packages/core'.

mondaycom/vibe · 0 tokens

new-component-implementation

Provides a systematic, research-driven workflow for implementing new Vibe components - for the @vibe/core library (located in "packages/core") - from initial research through final validation. Emphasizes studying existing patterns, following established conventions, and systematic progression through types, component…

mondaycom/vibe · 2,471 tokens

base-components

Comprehensive guide for base components in @vibe/core library (BaseInput, BaseList, BaseListItem, InfoText, FieldLabel). Documents their usage patterns, accessibility requirements, form integration patterns, and what consumers need to provide for optimal accessibility and UX. These components serve as foundational…

mondaycom/vibe · 107 tokens

layout-components

Guidelines for using Box and Flex layout components in the @vibe/core library instead of custom CSS for spacing, borders, and flexbox layouts.

mondaycom/vibe · 2,182 tokens