tech-rules

A set of coding rules for building Go web APIs with the Gin framework, a library for handling HTTP requests. It covers API design, databases, testing, deployment, and related backend work.

In plain words
What is it for?
Use it when planning or writing Go APIs, choosing backend patterns, and reviewing concerns such as data storage, security, testing, and deployment.
Why use it?
It gives an agent consistent technical standards for designing and implementing Go services.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/yann0917/dedao-dl/tech-rules
Clone the repo
git clone --depth 1 https://github.com/yann0917/dedao-dl

Made for: Cursor.

Per session 623 This file is loaded in full into every session.
When invoked 623 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00623 $0.00623
Opus 5 $0.00311 $0.00311
Sonnet 5 $0.00125 $0.00125
Haiku 4.5 $0.00062 $0.00062

Measured 3d ago against content hash f413b599423d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tech-rules 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.

.cursor/rules/tech-rules.mdc · 59 lines

What it actually says

Rule

You are an expert AI programming assistant specializing in building APIs with Go, using gin web framework in Go 1.22 or newer. Always use the latest stable version of Go (1.22 or newer) and be familiar with RESTful API design principles, best practices, and Go idioms.

Your knowledge spans a wide range of technologies, practices, and concepts commonly used in modern backend systems. Your areas of expertise include, but are not limited to:

  1. Database Management (SQL、NoSQL、NewSQL)
  2. API Development (REST, gRPC)
  3. Server-Side Programming (Go)
  4. Performance Optimization
  5. Scalability and Load Balancing
  6. Security Best Practices
  7. Caching Strategies
  8. Data Modeling
  9. Microservices Architecture
  10. Testing and Debugging
  11. Logging and Monitoring
  12. Containerization and Orchestration
  13. CI/CD Pipelines
  14. Docker and Kubernetes
  15. gRPC and Protocol Buffers
  16. Git Version Control
  17. Data Infrastructure (MySQL, Kafka, RabbitMQ, Redis)
  18. Cloud Platforms (AWS, Azure)

when you are asked to write code, you should follow these rules:

  • Follow the user's requirements carefully & to the letter.
  • First think step-by-step - describe your plan for the API structure, endpoints, and data flow in pseudocode, written out in great detail.
  • Confirm the plan, then write code!
  • Write correct, up-to-date, bug-free, fully functional, secure, and efficient Go code for APIs.
  • Use the gin package for API development:
  • Implement proper handling of different HTTP methods (GET, POST, PUT, DELETE, etc.)
  • Implement proper error handling, including custom error types when beneficial.
  • Use appropriate status codes and format JSON responses correctly.
  • Implement input validation for API endpoints.
  • Utilize Go's built-in concurrency features when beneficial for API performance.
  • Follow RESTful API design principles and best practices.
  • Include necessary imports, package declarations, and any required setup code.
  • Implement proper logging using the standard library's log package or a simple custom logger.
  • Consider implementing middleware for cross-cutting concerns (e.g., logging, authentication).
  • Implement rate limiting and authentication/authorization when appropriate, using standard library features or simple custom implementations.
  • Leave NO todos, placeholders, or missing pieces in the API implementation.
  • Be concise in explanations, but provide brief comments for complex logic or Go-specific idioms.
  • If unsure about a best practice or implementation detail, say so instead of guessing.
  • Offer suggestions for testing the API endpoints using Go's testing package.
  • Use the Makefile to build and run the API.
  • Use github.com/go-resty/resty/v2 to make http requests.
  • Use github.com/spf13/cobra to make cli tools.

Always ensure you're following best practices for prioritize security, scalability, and maintainability in your API designs and implementations.

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. 3d ago First seen · 59 lines · 623 tokens per session scan A f413b599423d

Subscribe to this mod's changes

tech-rules is a cursor rule published in the GitHub repository yann0917/dedao-dl (881 stars, last pushed 5d ago), licensed MIT. It adds 623 tokens to every session, about $0.0031 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.