10-backend

10-backend is a cursor rule for Cursor from neoshopcn/neo-admin. It costs 844 tokens per session, scanned A, original, MIT.

Backend development rules for Laravel Admin applications, including route locations, controller structure, permissions, API responses, and list filtering. Laravel is a PHP framework for building web applications.

In plain words
What is it for?
Use it when adding or changing Laravel Admin routes, page or API controllers, permission checks, JSON responses, and searchable or filterable lists.
Why use it?
It gives developers consistent conventions for separating admin pages from admin APIs and for applying permissions to each operation.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or changing Laravel Admin routes, page or API controllers, permission checks, JSON responses, and searchable or filterable lists.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/neoshopcn/neo-admin/10-backend
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/neoshopcn/neo-admin

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 10-backend

README.md
[![agentmods](https://agentmods.dev/badge/rules/neoshopcn/neo-admin/10-backend/github.svg)](https://agentmods.dev/rules/neoshopcn/neo-admin/10-backend)
Your own site
<a href="https://agentmods.dev/rules/neoshopcn/neo-admin/10-backend"><img src="https://agentmods.dev/badge/rules/neoshopcn/neo-admin/10-backend/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 10-backend

Your own site · 80×15
<a href="https://agentmods.dev/rules/neoshopcn/neo-admin/10-backend"><img src="https://agentmods.dev/badge/rules/neoshopcn/neo-admin/10-backend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 844 This file is loaded in full into every session.
When invoked 844 The same file — it is already loaded in full.
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.00844 $0.00844
Opus 5.5 $0.00338 $0.00338
Sonnet 5.5 $0.00169 $0.00169
Haiku 4.5 $0.00084 $0.00084

Measured 1mo ago against content hash fd1f4454c6d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

10-backend 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 1mo 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/10-backend.mdc · 226 lines

How it starts

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

🧠 路由规范(必须遵守)

  • 后台所有路由统一定义在:

    routes/admin.php

  • 不允许写在:

    • routes/web.php
    • routes/api.php
  • 必须使用:

    Route::prefix('admin')->name('admin.')->group(function () {

  • admin 仅作为 URL 前缀,不作为目录结构


🧩 路由分层

页面路由(content)

  • 路径:/admin/content/*
  • 使用 Controller::__invoke
  • 返回 Blade 页面

示例:

Route::get('users', UserManageController::class)


API 路由(api)

  • 路径:/admin/api/*
  • 返回 JsonResponse
  • 使用标准 CRUD 方法

🔐 权限规范(必须)

权限命名统一:

  • list → xxx:list
  • view → xxx:view
  • create → xxx:create
  • edit → xxx:edit
  • delete → xxx:delete

使用方式

  • 页面路由:

    ->middleware('admin.perm:xxx:list')

  • API 路由:

    每个操作单独权限控制


🧱 Controller 规范

Content Controller(页面)

  • 命名:*ManageController / *Controller
  • 使用 __invoke()
  • 返回 view()

示例:

return view('admin.xxx.index', [ 'neo' => $config ]);


API Controller

  • 命名空间:App\Http\Controllers\Admin\Api

  • 返回 JsonResponse

  • 使用标准方法:

    • index
    • show
    • store
    • update
    • destroy

📦 响应规范(必须统一)

使用 ApiResponse trait:

  • 成功:

    return $this->ok($data);

  • 失败:

    return $this->fail(message, code)


🔍 列表查询规范

必须支持:

  • keyword 模糊搜索
  • 精确筛选(status 等)
  • 时间范围(created_at)

统一使用:

  • applyKeyword
  • applyExact
  • applyDateRange

📄 分页规范

  • 参数:

    • page
    • page_size(默认 15,最大 100)
  • 返回必须包含:

    • list
    • pagination

🧾 数据校验规范

  • 所有写操作必须使用:

    $request->validate()

  • 唯一性:

    Rule::unique(...)

  • 数组字段:

    role_ids.* exists:roles,id


🔄 CRUD 规范

标准接口:

  • index(列表)
  • show(详情)
  • store(创建)
  • update(更新)
  • destroy(删除)

扩展接口:

  • resetPassword
  • assignMenus

⚠️ 安全规则(必须)

  • 禁止删除当前登录用户
  • 所有 ID 必须 whereNumber
  • 不存在数据必须返回 fail

🧠 数据处理规范

  • 不信任前端输入
  • 必须类型转换(int / string)
  • 数组必须去重、过滤

🔗 关联关系

  • 使用 with() 预加载
  • 多对多使用 sync()

🚫 禁止行为

  • 在 Controller 写复杂业务逻辑
  • 直接返回未处理的模型数据
  • 不做校验直接写入数据库

🚀 生成规则(高优先级)

当生成后台模块时,必须:

  1. 注册 routes(content + api)
  2. 创建 Content Controller(__invoke)
  3. 创建 API Controller(CRUD)
  4. 添加权限控制(list / view / create / edit / delete)
  5. 使用统一响应结构(ok / fail)

Read the full file on GitHub · 226 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. 1mo ago First seen · 226 lines · 844 tokens per session scan A fd1f4454c6d8

Subscribe to this mod's changes

10-backend is a cursor rule published in the GitHub repository neoshopcn/neo-admin (13 stars, last pushed 3mo ago), licensed MIT. It adds 844 tokens to every session, about $0.0034 per session on Opus 5.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.