go-project-structure

A set of conventions for organizing Go projects, including package names, dependencies, configuration, and tests. Go is a programming language, and Go modules record the libraries and versions a project uses.

In plain words
What is it for?
Use it when creating or reviewing Go packages, go.mod dependencies, environment-based settings, startup validation, and test files.
Why use it?
It gives developers a consistent way to find code, manage libraries, configure applications, and place tests as the project grows.

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/dstotijn/mcp-origin/go-project-structure
Clone the repo
git clone --depth 1 https://github.com/dstotijn/mcp-origin

Made for: Cursor.

Per session 520 This file is loaded in full into every session.
When invoked 520 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00520 $0.00520
Opus 5 $0.00260 $0.00260
Sonnet 5 $0.00104 $0.00104
Haiku 4.5 $0.00052 $0.00052

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

Security

Grade A, and why

go-project-structure 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.

Origin

This is a copy

100% identical to go-project-structure — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/go-project-structure.mdc · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.


description: Go Project Structure Rules globs: *.go

Description

This rule ensures that Go projects follow a consistent and idiomatic structure, making the codebase easier to navigate, maintain, and scale.

Rule

When organizing a Go project:

Package Organization

  1. Organize packages by functionality, not by type
  2. Keep package names short, clear, and descriptive
  3. Avoid package name collisions with standard library
  4. Use singular form for package names (e.g., store, not stores)
  5. Avoid deeply nested package hierarchies

Dependency Management

  1. Use Go modules for dependency management
  2. Pin dependencies to specific versions in go.mod
  3. Regularly update and audit dependencies
  4. Minimize the number of external dependencies
  5. Prefer standard library solutions when available

Configuration

  1. Use environment variables for configuration
  2. Support configuration files as an alternative
  3. Provide sensible defaults for all configuration options
  4. Validate configuration at startup

Testing

  1. Place tests in the same package as the code they test
  2. Use _test.go suffix for test files
  3. Place integration tests in a separate integration package
  4. Store test fixtures in testdata directories

Implementation

  • The Cursor IDE will enforce this rule by:
    • Suggesting appropriate locations for new files
    • Highlighting structural issues
    • Providing refactoring options to improve project organization

Benefits

  • Consistent, navigable project structure
  • Clear separation of concerns
  • Better code reusability
  • Easier onboarding for new team members
  • Alignment with Go community standards

Examples

✅ Correct Project Structure:

myproject/
├── cmd/
│   └── myapp/
│       └── main.go
├── internal/
│   ├── auth/
│   │   └── auth.go
│   └── database/
│       └── database.go
├── pkg/
│   └── validator/
│       └── validator.go
├── api/
│   └── openapi.yaml
├── configs/
│   └── config.yaml
├── scripts/
│   └── setup.sh
└── go.mod

Read the full file on GitHub · 85 lines

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. 2d ago First seen · 85 lines · 520 tokens per session scan A 2c406ea6ff84

Subscribe to this mod's changes

go-project-structure is a cursor rule published in the GitHub repository dstotijn/mcp-origin (5 stars, last pushed 1y ago), licensed Apache-2.0. It adds 520 tokens to every session, about $0.0026 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to go-project-structure, differing in 0 lines, and is treated as a copy.