api-patterns

api-patterns is a cursor rule for Cursor from madebyaris/poinf-of-sales. It costs 10 tokens per session (1,885 once invoked), scanned A, original, MIT.

Rules for designing REST APIs, which are web interfaces that use standard HTTP requests to create, read, update, and delete data in the POS system.

In plain words
What is it for?
They guide routes for orders, products, dining tables, payments, and status changes, including plural resource names, kebab-case URLs, nested resources, and standard response structures.
Why use it?
They keep endpoints, resource names, actions, HTTP methods, and responses consistent across the application.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit They guide routes for orders, products, dining tables, payments, and status changes, including plural resource names, kebab-case URLs, nested resources, and standard response structures.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/madebyaris/poinf-of-sales/api-patterns
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.

Clone the repo
git clone --depth 1 https://github.com/madebyaris/poinf-of-sales

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/rules/madebyaris/poinf-of-sales/api-patterns/github.svg)](https://agentmods.dev/rules/madebyaris/poinf-of-sales/api-patterns)
Your own site
<a href="https://agentmods.dev/rules/madebyaris/poinf-of-sales/api-patterns"><img src="https://agentmods.dev/badge/rules/madebyaris/poinf-of-sales/api-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-patterns

Your own site · 80×15
<a href="https://agentmods.dev/rules/madebyaris/poinf-of-sales/api-patterns"><img src="https://agentmods.dev/badge/rules/madebyaris/poinf-of-sales/api-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,885 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00010 $0.01885
Opus 5 $0.00005 $0.00942
Sonnet 5 $0.00002 $0.00377
Haiku 4.5 $0.00001 $0.00188

Measured 10d ago against content hash e54a814dbf1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

api-patterns 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 10d 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-patterns.mdc · 313 lines

How it starts

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

API Development Guidelines

RESTful API Design

Endpoint Conventions

Follow the patterns established in backend/internal/api/routes.go:

Resource Naming

  • Use plural nouns for resources: /api/v1/orders, /api/v1/products
  • Use kebab-case for multi-word resources: /api/v1/dining-tables
  • Nest related resources: /api/v1/orders/{id}/payments
  • Use descriptive action names for non-CRUD operations: /api/v1/orders/{id}/status

HTTP Methods

Standard CRUD operations:

GET    /api/v1/orders           # List all orders
POST   /api/v1/orders           # Create new order
GET    /api/v1/orders/{id}      # Get specific order
PUT    /api/v1/orders/{id}      # Update entire order
PATCH  /api/v1/orders/{id}      # Partial update
DELETE /api/v1/orders/{id}      # Delete order

# Action-specific endpoints
PATCH  /api/v1/orders/{id}/status     # Update order status
POST   /api/v1/orders/{id}/payments   # Add payment to order

Request/Response Patterns

Standard Response Format

Use consistent response structure from models/models.go:

{
  "success": true,
  "message": "Order created successfully",
  "data": {
    "id": "uuid-here",
    "order_number": "ORD001",
    // ... other fields
  }
}

Error Response Format

{
  "success": false,
  "message": "User-friendly error message",
  "error": "error_code_for_clients"
}

Pagination Response Format

{
  "success": true,
  "message": "Orders retrieved successfully",
  "data": [...],
  "meta": {
    "current_page": 1,
    "per_page": 20,
    "total": 150,
    "total_pages": 8
  }
}

Authentication & Authorization

JWT Token Authentication

Follow patterns from middleware/auth.go:

Request Headers

Authorization: Bearer <jwt_token>
Content-Type: application/json
Accept: application/json

Role-Based Access Control

// Public routes - no authentication
public.POST("/auth/login", authHandler.Login)

// Protected routes - authentication required
protected.GET("/orders", orderHandler.GetOrders)

// Admin routes - specific roles required
admin.Use(middleware.RequireRoles([]string{"admin", "manager"}))
admin.GET("/dashboard/stats", getDashboardStats)

Read the full file on GitHub · 313 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. 10d ago First seen · 313 lines · 10 tokens per session scan A e54a814dbf1f

Subscribe to this mod's changes

api-patterns is a cursor rule published in the GitHub repository madebyaris/poinf-of-sales (140 stars, last pushed 1y ago), licensed MIT. It adds 10 tokens to every session and 1,885 once invoked, about $0.0001 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-30.