gofr
AGENTS.md21k starsChanged 19 months agoApache-2.0View on GitHub
For Claude Code, Cursor, Aider, Codex, etc. Hand https://gofr.dev/AGENTS.md to your assistant when working on a GoFr project. It points at the specific docs you'll actually need rather than inlining everything. GoFr is an opinionated Go framework for microservices. Apache 2.0. Requires Go 1.26+. Repo: <https://github.com/gofr-dev/gofr>. 1. One handler signature for HTTP / gRPC / GraphQL / WebSocket / cron / CLI: func(c gofr.Context) (any, error). Return value → {"data": ...}. Return error → error response. 2. *Path params use…
- Reads credentials
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
No ORM bundled: Use plain SQL via c.SQL, or pair with sqlc/gorm yourself.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GoFr — guide for AI coding assistants
For Claude Code, Cursor, Aider, Codex, etc. Hand https://gofr.dev/AGENTS.md to your assistant when working on a GoFr project. It points at the specific docs you'll actually need rather than inlining everything.
GoFr is an opinionated Go framework for microservices. Apache 2.0. Requires Go 1.26+. Repo: https://github.com/gofr-dev/gofr.
Core rules an assistant must know
- One handler signature for HTTP / gRPC / GraphQL / WebSocket / cron / CLI:
func(c *gofr.Context) (any, error). Return value →{"data": ...}. Return error → error response. - Path params use
{name}, not:name.app.GET("/users/{id}", h). c.PathParam("id")for path;c.Param("q")for query;c.Bind(&v)for body.- Don't manually wire OpenTelemetry, Prometheus, or structured logging.
gofr.New()does it. - Pass
*gofr.Context(notcontext.Background()) to every downstream call so trace propagation and cancellation work. - Configuration comes from
configs/.envviac.Config.Get(key). No hardcoded ports / hosts / secrets. - No ORM bundled. Use plain SQL via
c.SQL, or pair withsqlc/gormyourself. - Middleware is standard
net/http:func(http.Handler) http.Handler, registered withapp.UseMiddleware(...). - Health is auto-exposed at
/.well-known/healthand/.well-known/alive. Don't hand-roll/healthz. - Don't
panic()for control flow. Return errors.
Minimal app
package main
import "gofr.dev/pkg/gofr"
func main() {
app := gofr.New()
app.GET("/hello", func(c *gofr.Context) (any, error) {
return "Hello, world", nil
})
app.Run()
}Migrations (schema + seed data, versioned)
GoFr has a built-in migration runner — use it instead of golang-migrate / goose. Works for SQL, Redis, Mongo, Cassandra, ClickHouse, DGraph, SurrealDB.
Before writing a migration, fetch the full reference: https://gofr.dev/docs/advanced-guide/handling-data-migrations. Runnable shape: https://github.com/gofr-dev/gofr/tree/main/examples/using-migrations.
Five rules to keep in your head so you don't have to re-fetch on every change:
- Files live in
migrations/<unix-ts>_<name>.go. Versions areint64, monotonic. Usedate +%sfor new ones. migrations/all.goexportsAll() map[int64]migration.Migrate. Wire witha.Migrate(migrations.All())once inmain.go.- Each migration is
migration.Migrate{ UP: func(d migration.Datasource) error { ... } }. InsideUP, act ond.SQL,d.Redis,d.MongoDB,d.Cassandra,d.Clickhouse,d.DGraph,d.SurrealDB,d.Logger. - Each migration runs exactly once per environment — don't add idempotent guards. There is no down migration; rollback = new forward migration.
- One purpose per file. Don't combine "create table + backfill + drop column" in one
UP.
AI features: LLMs and MCP
GoFr ships LLM and agent support. Use it instead of importing a provider SDK or hand-rolling HTTP, tracing and metrics around model calls. Before writing this code, fetch the full guides: https://gofr.dev/docs/advanced-guide/llm and https://gofr.dev/docs/advanced-guide/mcp. Runnable shape: https://github.com/gofr-dev/gofr/tree/main/examples/using-ai.
Rules to keep in your head so you don't have to re-fetch on every change:
- Register a model once with
app.AddLLM(&llm.Client{Provider: llm.Groq, Model: "..."})(gofr.dev/pkg/gofr/ai/llm). Providers:llm.OpenAI,llm.Groq,llm.DeepSeek,llm.Together,llm.Ollama; setBaseURLfor any other OpenAI-compatible endpoint. Or skip the call and setLLM_PROVIDER,LLM_MODELandLLM_API_KEY(optionalLLM_BASE_URL) inconfigs/.env. - Never hardcode the API key. It comes from
LLM_API_KEY, then the provider's own variable (OPENAI_API_KEY,GROQ_API_KEY, ...). - Call the model through
c.LLM():Generate,Chat,Stream,Embed. It is already traced and metered. Extra models:app.AddLLM(m, gofr.WithName("fast")), used asc.LLM("fast"). Not every provider supports every method; handleai.ErrEmbedNotSupported/ai.ErrStreamNotSupportedas ordinary errors. - Stream tokens by returning
response.Stream{Source: stream}from the handler (gofr.dev/pkg/gofr/http/response). - Expose handlers to agents with
app.EnableMCP(). It serves the read-only handlers (GET,HEAD,OPTIONS,QUERY) as MCP tools.POST/PUT/PATCH/DELETEare never exposed. Hide a route withgofr.WithExcludedRoutes("/internal/{id}"). - MCP binds to loopback on
MCP_PORT(default8200).MCP_PORT=0turns the transport off but keeps tools available in-process. A port that cannot be claimed fails startup.8200is also Vault's default port. - Build agent loops in your own handler with
c.LLM().Tools()(List,Call,Only). GoFr has no built-in agent loop; turns, stopping conditions and memory stay in your code.
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/ai/llm"
)
func main() {
app := gofr.New()
app.AddLLM(&llm.Client{Provider: llm.Groq, Model: "llama-3.3-70b-versatile"})
app.EnableMCP() // exposes the GET handlers below to MCP clients
app.GET("/products/{id}", func(c *gofr.Context) (any, error) {
return map[string]any{"id": c.PathParam("id")}, nil
})
app.POST("/summarize", func(c *gofr.Context) (any, error) {
var in struct {
Text string `json:"text"`
}
if err := c.Bind(&in); err != nil {
return nil, err
}
return c.LLM().Generate(c, "Summarize the following:\n"+in.Text)
})
app.Run()
}Where to look (fetch only what you need)
Each link is a self-contained doc page. Fetch lazily.
- Quick start: https://gofr.dev/docs/quick-start/introduction
- Configuration: https://gofr.dev/docs/quick-start/configuration
- Routing + REST handlers: https://gofr.dev/docs/quick-start/add-rest-handlers
- Context reference (the central abstraction): https://gofr.dev/docs/references/context
- Configs reference (every env var): https://gofr.dev/docs/references/configs
- Testing patterns + mocks: https://gofr.dev/docs/references/testing
- Observability (auto-wired): https://gofr.dev/docs/quick-start/observability
- Custom OTel spans: https://gofr.dev/docs/advanced-guide/custom-spans-in-tracing
- Custom Prometheus metrics: https://gofr.dev/docs/advanced-guide/publishing-custom-metrics
- Datasources index (MySQL, Postgres, Mongo, Redis, Cassandra, ClickHouse, etc.): https://gofr.dev/docs/datasources/getting-started
- Pub/Sub (Kafka, NATS, GCP, MQTT, SQS, Azure): https://gofr.dev/docs/advanced-guide/using-publisher-subscriber
- gRPC: https://gofr.dev/docs/advanced-guide/grpc
- GraphQL: https://gofr.dev/docs/advanced-guide/graphql
- WebSockets: https://gofr.dev/docs/advanced-guide/websocket
- Cron: https://gofr.dev/docs/advanced-guide/using-cron
- Service-to-service HTTP w/ circuit breaker: https://gofr.dev/docs/advanced-guide/http-communication
- Auth (Basic / API key / OAuth-JWT): https://gofr.dev/docs/advanced-guide/authentication
- RBAC (config-driven): https://gofr.dev/docs/advanced-guide/rbac
- Migrations (SQL + NoSQL, versioned): https://gofr.dev/docs/advanced-guide/handling-data-migrations
- File storage (local / S3 / GCS / Azure / FTP / SFTP): https://gofr.dev/docs/advanced-guide/handling-file
- Startup hooks: https://gofr.dev/docs/advanced-guide/startup-hooks
- Errors: https://gofr.dev/docs/advanced-guide/gofr-errors
- Custom DB drivers: https://gofr.dev/docs/advanced-guide/injecting-databases-drivers
- Calling LLMs (
app.AddLLM,c.LLM(), env config, multiple models, embeddings): https://gofr.dev/docs/advanced-guide/llm - MCP server and agent loops (
app.EnableMCP,c.LLM().Tools()): https://gofr.dev/docs/advanced-guide/mcp - Streaming responses (SSE / NDJSON,
response.Stream): https://gofr.dev/docs/advanced-guide/streaming
Migrating to GoFr
Each migration page has the full mapping table for that source framework — fetch only the one that matches:
- From Gin: https://gofr.dev/migrate/from-gin
- From Fiber: https://gofr.dev/migrate/from-fiber
- From Echo: handler shape similar to Gin; see https://gofr.dev/comparison/gofr-vs-echo
- From Chi: see https://gofr.dev/comparison/gofr-vs-chi
- From Express (Node.js): https://gofr.dev/migrate/from-express
- From Flask (Python): https://gofr.dev/migrate/from-flask
- From Spring Boot (Java): https://gofr.dev/migrate/from-spring-boot
Other entry points
- Examples (runnable projects): https://github.com/gofr-dev/gofr/tree/main/examples
- Full docs index: https://gofr.dev/docs
- Concatenated full docs (one plaintext file): https://gofr.dev/llms-full.txt
- Curated link index: https://gofr.dev/llms.txt
- Changelog: https://gofr.dev/changelog
Trending
More talk lately.about the whole repository
Who's talking about gofr-dev/gofr
- Stack Overflow“Mockgen Error while trying to autocreate mock_interface with it”Stack Overflow · Dec 14, 2023 · 6 votes
- @davlgd.fr“gofr: an opinionated GoLang framework for accelerated microservice development. Built in support for …”Bluesky · Apr 26, 2025 · 4 likes
- @github-trending.bsky.social“🎉 Celebrating! 🎉 (500+ new stars) 📦 gofr-dev / gofr ⭐ 9,059 (+535) 🗒 Go An opinionated GoLang framework …”Bluesky · Apr 15, 2025 · 3 likes
- @golangoss.bsky.social“gofr (⭐️ 21296) An opinionated GoLang framework for accelerated microservice development. Built in support …”Bluesky · Jun 21, 2026 · 1 likes
- @golangoss.bsky.social“gofr (⭐️ 21338) An opinionated GoLang framework for accelerated microservice development. Built in support …”Bluesky · Jun 14, 2026 · 1 likes
The biggest 5 of 62 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 62
Talked about on GitHub, Bluesky, the web and Stack Overflow (62 times).
On GitHub · 50
- Feb 15, 2025Addition of GoFr in goland roadmap — nilbuild/developer-roadmap1 reaction · 1 comment
- Oct 1, 2026feat(pkg): add go-import page for traces/exporters/gcp — gofr-dev/website0 reactions
- Sep 23, 2026AACR gofr-dev__gofr@dc0b3e6 — razorpaytest/gofr0 reactions
- Sep 23, 2026AACR gofr-dev__gofr@c1a26ad — razorpaytest/gofr0 reactions
- Sep 23, 2026AACR gofr-dev__gofr@b9cdcbb — razorpaytest/gofr0 reactions
45 more on GitHub
- Sep 23, 2026AACR gofr-dev__gofr@5e284ae — razorpaytest/gofr0 reactions
- Sep 23, 2026AACR gofr-dev__gofr@49ab394 — razorpaytest/gofr0 reactions
- Sep 23, 2026AACR gofr-dev__gofr@2c0c099 — razorpaytest/gofr0 reactions
- Sep 21, 2026build(deps): Bump the go-dependencies group across 1 directory with 5 updates — dennis-dko/go-time-recording0 reactions
- Sep 7, 2026build(deps): Bump the go-dependencies group with 3 updates — dennis-dko/go-time-recording0 reactions
- Aug 19, 2026Bump the go-dependencies group across 1 directory with 4 updates — dennis-dko/go-time-recording0 reactions · 1 comment
- Jun 6, 2026Changelog page renders markdown tables as plain pipe-text — gofr-dev/website0 reactions
- Jun 6, 2026Changelog page renders markdown tables as plain pipe-text — gofr-dev/website0 reactions
- Mar 16, 2026Bump the go-deps group across 1 directory with 2 updates — gofr-dev/gofr-cli0 reactions
- Mar 2, 2026Bump gofr.dev from 1.54.4 to 1.54.5 in the go-deps group — gofr-dev/gofr-cli0 reactions · 1 comment
- Feb 23, 2026Bump the go-deps group across 1 directory with 2 updates — gofr-dev/gofr-cli0 reactions
- Feb 9, 2026Bump the go-deps group with 2 updates — gofr-dev/gofr-cli0 reactions
- Feb 6, 2026build🤖 bump gofr.dev from 1.46.3 to 1.54.3 — tomo1227/go100tips0 reactions
- Feb 3, 2026build🤖 bump gofr.dev from 1.46.3 to 1.54.2 — tomo1227/go100tips0 reactions · 1 comment
- Jan 27, 2026build🤖 bump gofr.dev from 1.46.3 to 1.54.1 — tomo1227/go100tips0 reactions · 1 comment
- Jan 19, 2026build🤖 bump gofr.dev from 1.46.3 to 1.54.0 — tomo1227/go100tips0 reactions · 1 comment
- Jan 12, 2026build🤖 bump gofr.dev from 1.46.3 to 1.53.0 — tomo1227/go100tips0 reactions · 1 comment
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/pubsub/nats — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/pubsub/eventhub — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/file/sftp — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/file/s3 — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/file/gcs — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/file/ftp — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/file/azure — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/oracle — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /pkg/gofr/datasource/dbresolver — CodeMaverick-143/goll0 reactions
- Jan 5, 2026build(deps): bump gofr.dev from 1.50.2 to 1.52.0 in /examples/using-add-filestore — CodeMaverick-143/goll0 reactions
- Jan 2, 2026build🤖 bump gofr.dev from 1.46.3 to 1.52.0 — tomo1227/go100tips0 reactions · 1 comment
- Dec 29, 2025build🤖 bump gofr.dev from 1.46.3 to 1.51.0 — tomo1227/go100tips0 reactions · 1 comment
- Dec 22, 2025build🤖 bump gofr.dev from 1.46.3 to 1.50.2 — tomo1227/go100tips0 reactions · 1 comment
- Dec 15, 2025build🤖 bump gofr.dev from 1.46.3 to 1.50.1 — tomo1227/go100tips0 reactions · 1 comment
- Dec 8, 2025build🤖 bump gofr.dev from 1.46.3 to 1.50.0 — tomo1227/go100tips0 reactions · 1 comment
- Dec 2, 2025build🤖 bump gofr.dev from 1.46.3 to 1.49.0 — tomo1227/go100tips0 reactions · 3 comments
- Nov 24, 2025build🤖 bump gofr.dev from 1.46.3 to 1.48.0 — tomo1227/go100tips0 reactions · 3 comments
- Nov 18, 2025build🤖 bump gofr.dev from 1.46.3 to 1.47.1 — tomo1227/go100tips0 reactions · 3 comments
- Nov 10, 2025build🤖 bump gofr.dev from 1.46.3 to 1.47.0 — tomo1227/go100tips0 reactions · 3 comments
- Oct 30, 2025fixed migration name into camel case — gofr-dev/gofr-cli0 reactions · 1 comment
- Oct 17, 2025build🤖 bump gofr.dev from 1.46.2 to 1.46.3 — tomo1227/go100tips0 reactions · 2 comments
- Oct 10, 2025build🤖 bump gofr.dev from 1.44.0 to 1.46.2 — tomo1227/go100tips0 reactions · 2 comments
- Oct 7, 2025build🤖 bump gofr.dev from 1.44.0 to 1.46.1 — tomo1227/go100tips0 reactions · 1 comment
- Aug 26, 2025Bump the go-deps group across 1 directory with 3 updates — gofr-dev/gofr-cli0 reactions · 1 comment
- Jun 30, 2025Redisを使ったサンプルを作る — ishisaka/golang_gofr0 reactions
- Apr 1, 2025Support to write code using GoFr — goadesign/goa0 reactions · 1 comment
- Mar 24, 2025golangci-lint v1.6.2 process killed on go v1.24 darwin — golangci/golangci-lint0 reactions · 2 comments
- Mar 3, 2025Bump gofr.dev from 1.28.2 to 1.34.1 — carverauto/eventrunner0 reactions
On Bluesky · 7
- Apr 26, 2025gofr: an opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.… — @davlgd.fr4 likes and reposts
- Apr 15, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 gofr-dev / gofr ⭐ 9,059 (+535) 🗒 Go An opinionated GoLang framework for accelerated microservice… — @github-trending.bsky.social3 likes and reposts · 1 reply
- Jun 21, 2026gofr (⭐️ 21296) An opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.… — @golangoss.bsky.social1 likes and repost
- Jun 14, 2026gofr (⭐️ 21338) An opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.… — @golangoss.bsky.social1 likes and repost
- Mar 23, 2026GoFr is an opinionated Go framework that gives you microservices with built-in observability, database support, and Kubernetes-ready… — @arifsolmaz.bsky.social1 likes and repost
2 more on Bluesky
- Nov 22, 2024Meet Gofr 🚀 "An opinionated GoLang framework for accelerated microservice development with built-in support for databases and… — @gurubase.bsky.social1 likes and repost · 1 reply
- Nov 21, 2024Whoa: an opinionated batteries-included framework *in Go*?! github.com/gofr-dev/gofr Pleasantly unexpected. — @rkofman.bsky.social1 likes and repost
On the web · 3
- Feb 8, 2026GoFr: An Opinionated Microservice Development Framework — dev.to
- Apr 27, 2024GoFr. Features and potential improvements review - Dev Genius — blog.devgenius.io
- Apr 18, 2024solr support · Issue #496 - gofr — google.com
On Stack Overflow · 2
- Dec 14, 2023Mockgen Error while trying to autocreate mock_interface with it6 votes · 2 answers
- Sep 3, 2024Integrate GraphQL api in GoFr framework in golang1 vote
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

