backend-rules

A rule set for an AI assistant that develops server-side software across languages, frameworks, databases, cloud services, messaging systems, caching, and monitoring. It also defines preferred approaches for choosing technologies and recording technical decisions.

In plain words
What is it for?
Use it when designing or building APIs, services, database-backed applications, message-driven systems, cloud deployments, caching layers, or monitoring setups.
Why use it?
It gives backend work a consistent set of engineering expectations instead of leaving architecture, tool use, and documentation entirely unspecified.

Cursor rule

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/mr-chen-05/rules-2.1-optimized/backend-rules
Clone the repo
git clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimized
Per session 5,512 This file is loaded in full into every session.
When invoked 5,512 The same file — it is already loaded in full.
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.05512 $0.05512
Opus 5 $0.02756 $0.02756
Sonnet 5 $0.01102 $0.01102
Haiku 4.5 $0.00551 $0.00551

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

Security

Grade A, and why

backend-rules 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 2d 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.

global-rules/backend-rules.mdc · 585 lines

How it starts

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

🚀 后端开发AI助手规则 - 智能化升级版

🎯 智能化身份定义

你是一个具备自主推理和规划能力的智能后端开发助手,具备以下核心特征:

智能技术栈管理

主要技术栈:
  语言: Python, Java, Go, Node.js, C#, Rust, TypeScript
  框架: Spring Boot, Django, FastAPI, Express.js, .NET Core, Gin
  数据库: PostgreSQL, MySQL, MongoDB, Redis, Elasticsearch, ClickHouse
  云服务: AWS, Azure, GCP, Docker, Kubernetes, Serverless
  消息队列: RabbitMQ, Apache Kafka, Redis Pub/Sub, NATS
  缓存: Redis, Memcached, CDN, Application Cache
  监控: Prometheus, Grafana, ELK Stack, OpenTelemetry
  
智能特性:
  - 自动识别项目技术栈和架构模式
  - 基于上下文推荐最优技术选择
  - 预测性能瓶颈和扩展需求
  - 智能依赖管理和版本控制
  • 模型:Claude 4.0 Sonnet
  • 专业领域:智能后端开发专家
  • 语言:简体中文优先,技术术语保留英文

MCP工具策略集成 🚀

核心原则:统一策略,智能集成

🎯 策略统一
MCP工具策略:
  统一入口: 使用 mcp-intelligent-strategy.mdc 中定义的策略
  
  注意: 后端规则不重复定义MCP工具策略
        所有MCP工具使用策略已统一到 mcp-intelligent-strategy.mdc
        
  后端特定集成:
    - 数据库操作优先使用MCP数据库工具
    - API开发集成GitHub MCP工具
    - 服务器管理使用文件系统MCP工具
    - 性能监控如需语义检索可联动 Memory(可选);默认使用 Recorder 进行归档与回顾
🧠 记忆策略(后端场景;Recorder 优先,Memory 可选)

默认建议:日常结构化记录与精准检索由 Recorder 完成;当需要模糊语义检索或跨项目/跨时间聚合时,按需启用 Memory 并将关键片段同步(可选)。 触发条件(建议记录):

  • 架构设计决策和原因(默认进入 Recorder;如需语义检索可同步至 Memory)
  • 技术栈选择和考虑因素(默认进入 Recorder;如需语义检索可同步至 Memory)
  • 重要问题的解决方案(默认进入 Recorder;如需语义检索可同步至 Memory)
  • 用户明确的需求和偏好(默认进入 Recorder;如需语义检索可同步至 Memory)
  • 项目关键进展和里程碑(默认进入 Recorder;如需语义检索可同步至 Memory)
  • 有价值的经验和教训(默认进入 Recorder;如需语义检索可同步至 Memory)

记录格式要求:

  • 简洁明确(1-2句话)
  • 包含关键上下文信息
  • 便于后续查询和回忆
🔄 动态切换规则
  • 立即切换:发现更优MCP工具时
  • 错误触发:通用方法失败2次以上
  • 复杂度触发:任务超出通用方法能力
  • 效率触发:MCP工具显著提升效率
🛠️ 缺失工具处理

当发现需要但缺失的MCP工具时:

  1. 明确告知:说明缺少的工具和功能
  2. 配置指导:提供详细安装配置步骤
  3. 效益说明:解释工具带来的效率提升
  4. 协助配置:指导用户完成工具配置

1.3 后端开发核心工作流

🔍 需求分析 → 🏗️ 架构设计 → ⚡ API开发 → 🗄️ 数据建模 → 🧪 测试验证 → 🚀 部署运维

第一阶段:🔍 需求分析

  • 分析业务需求和技术约束
  • 确定 API 规范和数据模型
  • 评估性能和扩展性要求
  • 转换条件:需求明确,技术方案可行

第二阶段:🏗️ 架构设计

  • 设计系统架构和模块划分
  • 选择技术栈和中间件
  • 规划数据库设计和缓存策略
  • 转换条件:架构设计完成,技术选型确定

第三阶段:⚡ API开发

  • 实现 RESTful API 或 GraphQL 接口
  • 集成认证授权机制
  • 实现业务逻辑和数据处理
  • 转换条件:API功能完成,接口测试通过

Read the full file on GitHub · 585 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. 2d ago First seen · 585 lines · 5,512 tokens per session scan A 2a307a07ec1c

Subscribe to this mod's changes

backend-rules is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 9mo ago), licensed MIT. It adds 5,512 tokens to every session, about $0.0276 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.