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/wangqiqi/cursor-ai-rules/go-securitygit clone --depth 1 https://github.com/wangqiqi/cursor-ai-rulesWhat 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.02254 |
| Opus 5 | $0.00000 | $0.01127 |
| Sonnet 5 | $0.00000 | $0.00451 |
| Haiku 4.5 | $0.00000 | $0.00225 |
Grade A, and why
go-security 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 3d 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 — 331 lines — stays where its author put it; the contents beside it link to each section on GitHub.
🔒 Go 安全实践和最佳实践
⚠️ 执行原则
MUST 遵循以下Go安全开发准则:
- MUST 验证所有输入数据
- NEVER 在代码中硬编码密钥和凭据
- ALWAYS 使用HTTPS和安全通信
- DO NOT 忽略依赖的安全漏洞
- MUST 实施适当的认证和授权
- ALWAYS 记录安全相关事件
JWT 认证实现
NotBefore: jwt.NewNumericDate(time.Now()),
Issuer: "your-app",
},
}
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
return token.SignedString(j.secretKey)
}
func (j *JWTManager) ValidateToken(tokenString string) (*Claims, error) { token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (interface{}, error) { if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } return j.secretKey, nil })
if err != nil {
return nil, err
}
if claims, ok := token.Claims.(*Claims); ok && token.Valid {
return claims, nil
}
return nil, errors.New("invalid token")
}
## 📊 最佳实践
### 错误处理模式
```go
// ✅ 推荐:自定义错误类型
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Details string `json:"details,omitempty"`
}
func (e *Error) Error() string {
return fmt.Sprintf("[%s] %s", e.Code, e.Message)
}
func NewError(code, message string) *Error {
return &Error{
Code: code,
Message: message,
}
}
// 预定义错误
var (
ErrNotFound = NewError("NOT_FOUND", "resource not found")
ErrUnauthorized = NewError("UNAUTHORIZED", "unauthorized access")
ErrValidation = NewError("VALIDATION_ERROR", "validation failed")
)
// ✅ 推荐:错误包装和链式调用
func (r *UserRepository) GetUserByID(ctx context.Context, id int64) (*User, error) {
if id <= 0 {
return nil, fmt.Errorf("%w: invalid user ID %d", ErrValidation, id)
}
var user User
query := `SELECT id, username, email FROM users WHERE id = $1`
err := r.db.QueryRowContext(ctx, query, id).Scan(
&user.ID, &user.Username, &user.Email,
)
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.
- 3d ago First seen · 331 lines · 0 tokens per session scan A bc0eaed11006
go-security is a cursor rule published in the GitHub repository wangqiqi/cursor-ai-rules (15 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,254 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-30.
Other cursor rules, from other repositories
cursor-go-skills
Load the Go skills orchestrator before any Go task.
backend
You are an expert in Go, Gin, Gorm, Gen, Cosy (https://cosy.uozi.org/) with a deep understanding of best practices and performance optimization techniques in these technologies.
code-style
Formatting, lint, comments language.
shared-libraries
Shared libraries - condition framework, inventory containers, file-backed DB, itinerary, references.
go-conventions
Go conventions for all Go code (modules, naming, errors, logging, metrics).
unit-test-coverage-95
Unit test coverage ≥95% per Go package (binding rule).