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.
git clone --depth 1 https://github.com/golid-ai/golidWrote 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.
[](https://agentmods.dev/rules/golid-ai/golid/go-service)<a href="https://agentmods.dev/rules/golid-ai/golid/go-service"><img src="https://agentmods.dev/badge/rules/golid-ai/golid/go-service/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.
<a href="https://agentmods.dev/rules/golid-ai/golid/go-service"><img src="https://agentmods.dev/badge/rules/golid-ai/golid/go-service.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01031 |
| Opus 5 | $0.00000 | $0.00515 |
| Sonnet 5 | $0.00000 | $0.00206 |
| Haiku 4.5 | $0.00000 | $0.00103 |
Grade A, and why
go-service 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 9d 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 — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Go Service Layer Patterns
Thesis: Services own business logic and data access. They are framework-agnostic, verify resource membership, and never trust the caller to have checked permissions.
Refrain:
Validate → Authorize → Execute → Respond
Reference files: auth/auth.go, user/user.go
Structure
type XService struct {
pool *pgxpool.Pool
paginationDefault int
paginationMax int
}
func NewXService(pool *pgxpool.Pool, paginationDefault, paginationMax int) *XService { ... }
This is the canonical shape for paginated CRUD services. Real services
diverge based on their dependencies — NewUserService(pool, publicBaseURL),
NewAuthService(pool, jwtSecret, jwtIssuer, accessDuration, refreshDuration, passwordResetTTL),
NewFeatureService(pool) — but every
service follows the same "concrete struct + constructor + framework-agnostic
methods" rule. Match the constructor shape that fits the dependencies, not the
template literally.
Before modifying a module's service (changes to status transitions, cross-module
calls, or the API surface), read docs/modules/{module}/spec.md for state machine
constraints and business rules. If available, also check docs/dependency-graph.md
for blast radius and docs/flows.md for cross-module transaction boundaries.
- Constructor takes
*pgxpool.Poolplus whatever the service genuinely needs (pagination config for list endpoints, external service handles, frontend URL for redirects, etc.). - No Echo imports — services must be framework-agnostic. No
echo.Context, noecho.NewHTTPError. Useapperrorfor errors, plaincontext.Contextfor context. - Define input/output structs in the same file (e.g.,
CreateItemInput,ItemDetail). - Return
*Detailstructs with formatted timestamps (time.RFC3339), not raw DB types.
Auth Pattern
Every method that operates on a scoped resource must verify membership, not just role:
// Resolve user → entity relationship
access, err := s.verifyResourceAccess(ctx, resourceID, userID)
// Then check specific permissions
if !access.IsAdmin { return apperror.Forbidden("...") }
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.
- 9d ago First seen · 99 lines · 0 tokens per session scan A 136bfe78e53b
go-service is a cursor rule published in the GitHub repository golid-ai/golid (40 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,031 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
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.
cursor-rule-template
A Cursor rule template for gospec, a set of software-development rules for Go backends. It routes different tasks to the relevant architecture, API, data, security, testing, and migration guidance.
go-backend-scalability-cursorrules-prompt-file
Cursor rules for Go development with backend scalability.
go-servemux-rest-api-cursorrules-prompt-file
Cursor rules for Go development with ServeMux REST API integration.
internal-interface
Interface Definition Rules for internal/.
usecase
Claude Rules - Use Case Pattern.