15-config-center

15-config-center is a cursor rule for Cursor from neoshopcn/neo-admin. It costs 691 tokens per session, scanned A, original, MIT.

Laravel rules for reading dynamic settings through a shared ConfigCenter service or helper instead of querying the settings database table directly. Settings are addressed with dot-separated paths and converted to the expected data types.

In plain words
What is it for?
Use it when application code needs values from the admin configuration center, including individual settings, sections, or groups.
Why use it?
It keeps configuration access consistent and preserves the project’s handling of caching, defaults, and values such as numbers, booleans, JSON, and text.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when application code needs values from the admin configuration center, including individual settings, sections, or groups.

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/neoshopcn/neo-admin/15-config-center.svg)](https://agentmods.dev/rules/neoshopcn/neo-admin/15-config-center)
Your own site
<a href="https://agentmods.dev/rules/neoshopcn/neo-admin/15-config-center"><img src="https://agentmods.dev/badge/rules/neoshopcn/neo-admin/15-config-center.svg" alt="Measured on agentmods" height="20"></a>
Per session 691 This file is loaded in full into every session.
When invoked 691 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.00691 $0.00691
Opus 5 $0.00345 $0.00345
Sonnet 5 $0.00138 $0.00138
Haiku 4.5 $0.00069 $0.00069

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

Security

Grade A, and why

15-config-center 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 8d 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/15-config-center.mdc · 107 lines

What it actually says

动态配置中心读取

业务代码读取后台「配置中心」数据时,必须使用统一读取入口,禁止直接查 config_items 表。

实现位置:

  • App\Support\ConfigCenter
  • 助手函数 config_center()app/helpers.php

路径约定

配置路径使用英文 name,点号分隔:

page.group.section.item
  • pagesystem(系统配置)| api(接口配置)
  • group:分组,如 site / login / wechat / email
  • section:分区,如 default / mini / pay / aliyun
  • item:配置 key,如 site_name / mch_id

读取方式(按粒度选择)

1. 单个配置项(最常用)

use App\Support\ConfigCenter;

ConfigCenter::item('api', 'wechat', 'pay', 'mch_id', '');
config_center('api.wechat.pay.mch_id', '');

2. 按分区

ConfigCenter::section('api', 'wechat', 'pay');
config_center('api.wechat.pay');

3. 按组

ConfigCenter::group('api', 'wechat');
config_center('api.wechat');

4. 点号路径(推荐助手函数)

// 4 段 = 配置项 | 3 段 = 分区 | 2 段 = 分组
config_center('system.login.default.login_captcha', false);
config_center('api.email.default.smtp_host');

返回值类型

读取结果已按 type 转换:

type 返回
switch bool
number int / float
json array(解析失败则为 string)
其他 string
空值 null(可传默认值兜底)

缓存(必须了解)

  • 全量索引缓存键:config_center:index
  • 读取自动走 Cache::remember
  • 后台保存配置、Seeder 后会 ConfigCenter::forgetCache()
  • 若直接改库,需手动:ConfigCenter::forgetCache()

禁止行为

  • ConfigItem::query()->where('name', ...) 在业务里散落读取
  • ❌ 用 Laravel config() 读取动态配置中心数据
  • ❌ 硬编码应从配置中心获取的密钥、开关、站点信息

生成业务代码时

需要第三方密钥、站点名、登录策略、邮件 SMTP 等时:

  1. 先查 database/seeders/Admin/ConfigCenterDataSeeder.php 确认 path
  2. config_center('...')ConfigCenter::item(...) 读取
  3. 为缺失配置提供合理默认值
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. 8d ago First seen · 107 lines · 691 tokens per session scan A 852c68ef99fb

Subscribe to this mod's changes

15-config-center is a cursor rule published in the GitHub repository neoshopcn/neo-admin (12 stars, last pushed 2mo ago), licensed MIT. It adds 691 tokens to every session, about $0.0035 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.