ai-backends / rules
Cursor rule146 starsChanged 14 months agoApache-2.0View on GitHub
This document outlines coding standards and best practices for the AI Backends project.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,157 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- .cursor/rules/folder-guidelines.mdcCursor rule
- .cursor/rules/project-structure.mdcCursor rule
The file
Show its rules and text
We split this coding-standards.mdc into the rules it gives an agent
15 rules. About 0 are common, 14 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use proper TypeScript types and avoid any when possible
- Distinctive: line 13
Create interfaces for complex data structures
- Distinctive: line 14
Use type guards when necessary for type narrowing
- Distinctive: line 19
Follow RESTful principles for resource-based endpoints
- Distinctive: line 20
Use consistent naming conventions for endpoints
- Distinctive: line 21
Document APIs using OpenAPI/Swagger via Hono's built-in support
- Distinctive: line 28
Use consistent error handling patterns
- Distinctive: line 30
Create custom error classes when appropriate
- Distinctive: line 32
Don't expose sensitive information in error messages
- Distinctive: line 36
Avoid blocking operations when possible
- Distinctive: line 37
Use caching where appropriate
- Distinctive: line 38
Consider rate limiting for resource-intensive operations
- Distinctive: line 47
Follow the principle of least privilege
- Distinctive: line 55
Consider streaming responses for long-running AI operations
- Distinctive: line 58
Use the reusable AI service layer when connecting from API routes
≈ “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.
Files
--- description: globs: alwaysApply: true --- # Coding Standards This document outlines coding standards and best practices for the AI Backends project. ## TypeScript Usage - Use proper TypeScript types and avoid `any` when possible - Create interfaces for complex data structures - Use type guards when necessary for type narrowing - Leverage TypeScript's utility types (Pick, Omit, Partial, etc.) ## API Design - Follow RESTful principles for resource-based endpoints - Use consistent naming conventions for endpoints - Document APIs using OpenAPI/Swagger via Hono's built-in support - Return appropriate HTTP status codes - Implement proper error handling and validation - Routes should be in the src/routes folder and named with dash-separated lowercase words ## Error Handling - Use consistent error handling patterns - Provide meaningful error messages - Create custom error classes when appropriate - Log errors with sufficient context for debugging - Don't expose sensitive information in error messages ## Performance Considerations - Avoid blocking operations when possible - Use caching where appropriate - Consider rate limiting for resource-intensive operations - Implement pagination for large data sets - Implement exponential backoff for all external API calls to avoid hitting rate limits ## Security Best Practices - Sanitize and validate all user input - Store sensitive information in environment variables - Implement proper authentication and authorization - Follow the principle of least privilege - Keep dependencies updated ## AI Integration - Handle AI model responses appropriately - Set reasonable timeouts for AI model calls - Implement fallbacks for when AI services are unavailable - Consider streaming responses for long-running AI operations - Validate AI output before returning to clients - Implement exponential backoff for all external API calls to avoid hitting rate limits - Use the reusable AI service layer when connecting from API routes
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
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.

