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/mywand/cusrsor-do-it/gogit clone --depth 1 https://github.com/mywand/cusrsor-do-itWhat 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.01857 |
| Opus 5 | $0.00000 | $0.00928 |
| Sonnet 5 | $0.00000 | $0.00371 |
| Haiku 4.5 | $0.00000 | $0.00186 |
Grade A, and why
go 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 — 199 lines — stays where its author put it; the contents beside it link to each section on GitHub.
最近更新: 2025-10-10
Go 编码与工程规约
1. 运行时与版本
- 统一使用 Go 1.21+ (如需降级说明原因)。
- 使用
go.mod管理依赖,设置合理的go版本。
2. 项目结构
project/
cmd/
app/
main.go (应用入口)
internal/
domain/
service/
repository/
handler/
config/
pkg/ (可复用包)
api/ (API 定义,如 protobuf)
web/ (静态资源)
scripts/
docs/
go.mod
go.sum
internal/包含私有代码,外部无法导入。pkg/包含可被外部项目导入的公共库。cmd/包含应用程序入口点。
3. 依赖管理
- 使用
go mod tidy保持依赖清洁。 - 优先使用标准库,选择社区主流库(gin、gorm、logrus/zap)。
- 引入第三方库需评估:维护状态、性能、安全性。
- 使用
go mod vendor固化依赖(可选)。
4. 命名规范
- PascalCase:公共类型、函数、方法、常量。
- camelCase:私有变量、函数、方法。
- 包名:小写,简短,有意义(避免
util、common)。 - 接口名:通常以
-er结尾(Reader、Writer)。 - 错误变量:以
Err开头(ErrNotFound)。
5. 注释与文档
- 公共 API 必须有注释,以类型/函数名开头。
// UserService 提供用户相关业务逻辑
type UserService struct {}
// CreateUser 创建新用户,返回用户ID
func (s *UserService) CreateUser(ctx context.Context, req *CreateUserRequest) (*User, error) {}
- 包级别注释在
doc.go或主文件顶部。 - 复杂算法需要详细注释说明思路。
6. 错误处理
- 使用标准错误处理:
if err != nil { return err }。 - 自定义错误类型实现
error接口。 - 使用
fmt.Errorf包装错误:fmt.Errorf("failed to create user: %w", err)。 - 错误信息:小写开头,不以标点结尾,包含上下文。
- 考虑使用
github.com/pkg/errors或 Go 1.13+ 的错误包装。
7. 日志
- 使用结构化日志(zap、logrus)。
- 日志级别:DEBUG、INFO、WARN、ERROR。
- 包含上下文信息:
logger.WithFields(logrus.Fields{"user_id": userID, "action": "create"})。 - 避免在循环中打印大量日志。
8. 并发与 Goroutine
- 使用
context.Context传递取消信号和超时。 - Goroutine 泄漏检查:确保所有 goroutine 能正常退出。
- 使用 channel 进行 goroutine 间通信,避免共享内存。
- 使用
sync.WaitGroup等待 goroutine 完成。 - 使用
sync.Once确保初始化只执行一次。
9. 性能
- 使用
go test -bench进行基准测试。 - 避免不必要的内存分配,复用对象(sync.Pool)。
- 字符串拼接使用
strings.Builder或fmt.Sprintf。 - 切片预分配容量:
make([]int, 0, expectedSize)。 - 使用
pprof进行性能分析。
10. 数据访问
- 数据库连接池配置合理的最大连接数。
- 使用参数化查询防止 SQL 注入。
- 事务处理:确保 commit/rollback。
- 考虑使用 ORM(GORM)或查询构建器(Squirrel)。
11. 配置管理
- 使用环境变量或配置文件(YAML、JSON)。
- 配置结构体使用 tag:
json:"database_url" env:"DATABASE_URL"。 - 敏感配置通过环境变量传递,不提交到版本控制。
- 使用
github.com/spf13/viper等配置管理库。
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 · 199 lines · 0 tokens per session scan A e6a6d9be9766
go is a cursor rule published in the GitHub repository mywand/cusrsor-do-it (2 stars, last pushed 7mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,857 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
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.