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.
npx agentmods add rules/singchia/gospec/cursor-rule-templategit clone --depth 1 https://github.com/singchia/gospecWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01234 |
| Opus 5 | $0.00000 | $0.00617 |
| Sonnet 5 | $0.00000 | $0.00247 |
| Haiku 4.5 | $0.00000 | $0.00123 |
Grade A, and why
cursor-rule-template 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.
How it starts
The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.
gospec —— Go 后端 SDLC 规范(Cursor 单文件入口)
本文件由 gospec 自动生成,作为 Cursor 的唯一入口。 完整规范在
~/.claude/skills/gospec/spec/或.claude/skills/gospec/spec/。 Cursor 已通过globs自动附加,无需用户每次选择。
任务路由(先看这个表,再决定要不要展开 spec/)
| 任务 | 最少必读 |
|---|---|
写 HTTP / gRPC handler(service/) |
spec/03-api/proto.md + spec/03-api/http.md + spec/05-coding/errors.md |
写业务用例(biz/) |
spec/02-architecture/layering.md + spec/05-coding/errors.md |
| 写 goroutine / 用锁 / 传 context | spec/05-coding/concurrency.md |
| 写 MySQL 模型 / DAO | spec/04-data-model/mysql.md |
| 写 Redis 缓存 / 分布式锁 | spec/04-data-model/redis.md |
| 写测试 | spec/06-testing/unit.md |
| 写 migration | spec/13-database-migration/migration.md |
| 加日志 / 指标 / 追踪 | spec/10-observability/{logging,metrics,tracing}.md |
| 实现登录 / 鉴权 | spec/11-security/auth.md |
| 写 PRD / RFC / ADR / HLD | docs/templates/ 对应模板 |
| PR 自查 | spec/07-code-review.md |
核心约束(不可违反,无需打开 spec 也要遵守)
架构
- 单服务:
cmd → server → service → biz → data → model,禁止跨层(service不能直连data) - monorepo:
cmd/按 service 切、internal/按 Bounded Context 切;跨 BC 走 API / 事件 /internal/pkg/ - 接口在消费方定义,禁止循环依赖
- 依赖通过构造函数注入
编码
- 禁止
_ = fn()忽略错误 - 共享状态必须加锁,测试必须
-race - 错误用
%w包装;不重复记录 - 涉及 IO 的函数第一个参数
context.Context init()仅做注册(pprof / collector / driver),禁止 IO 或可能 panic- 避免
any/interface{}出现在公共 API 边界
API
- 所有变更先改
.proto,禁止改生成代码 - Handler 必须有 Swagger 注释(
@Summary/@Router/@Success) - 响应统一
{code, message, data} - 破坏性变更走新版本
测试
- 新功能必须有单元测试
- CI 强制
-race - E2E 必须清理数据
Git
- 提交格式:
<type>(<scope>): <desc> - 禁止提交敏感信息
- 禁止 force push main/master
构建 / 交付
- 所有构建 / 产物 / 部署目标必须走根 Makefile(
make build/make image/make deploy-*) - CI / README / 本地开发统一调
make <target>,禁止直接go build/docker build/kubectl - 生产部署 target 有审批保护
可观测性
- 暴露
/healthz/readyz/metrics - 日志结构化 +
trace_id - 高基数字段(user_id / email / url)禁止做 Prometheus label
- 敏感字段禁止明文入日志
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.
- 2d ago First seen · 95 lines · 0 tokens per session scan A f752d1d3c618
cursor-rule-template is a cursor rule published in the GitHub repository singchia/gospec (5 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,234 tokens. 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-31.
Other cursor rules, from other repositories
cursorrules
AGENTS.md.
cursorrules
For any information about the codebase (structure, logic, or usage), you MUST use RagCode MCP tools. Never guess code details from memory; always search the local index first using searchcode or getfunctiondetails.
miro-best-practices
MCP server for controlling Miro whiteboards with AI assistants.
plan-execution-loop
Execute a docs/plans/.md slice with subagent implement → evidence-based audit → fix until 90+ — invoke manually when running a plan.
plan-feature
Framework for planning a new feature end-to-end — use when asked to plan or design a new module.
refactor-large-files
Guidance for splitting large route files into maintainable pieces.