agentleFS
gofr-devgofr-dev/gofr/docs/AGENTS.md

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
  1. Very specific:

    No ORM bundled: Use plain SQL via c.SQL, or pair with sqlc/gorm yourself.

    line 20

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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

  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 {name}, not :name. app.GET("/users/{id}", h).
  3. c.PathParam("id") for path; c.Param("q") for query; c.Bind(&v) for body.
  4. Don't manually wire OpenTelemetry, Prometheus, or structured logging. gofr.New() does it.
  5. Pass *gofr.Context (not context.Background()) to every downstream call so trace propagation and cancellation work.
  6. Configuration comes from configs/.env via c.Config.Get(key). No hardcoded ports / hosts / secrets.
  7. No ORM bundled. Use plain SQL via c.SQL, or pair with sqlc/gorm yourself.
  8. Middleware is standard net/http: func(http.Handler) http.Handler, registered with app.UseMiddleware(...).
  9. Health is auto-exposed at /.well-known/health and /.well-known/alive. Don't hand-roll /healthz.
  10. 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:

  1. Files live in migrations/<unix-ts>_<name>.go. Versions are int64, monotonic. Use date +%s for new ones.
  2. migrations/all.go exports All() map[int64]migration.Migrate. Wire with a.Migrate(migrations.All()) once in main.go.
  3. Each migration is migration.Migrate{ UP: func(d migration.Datasource) error { ... } }. Inside UP, act on d.SQL, d.Redis, d.MongoDB, d.Cassandra, d.Clickhouse, d.DGraph, d.SurrealDB, d.Logger.
  4. Each migration runs exactly once per environment — don't add idempotent guards. There is no down migration; rollback = new forward migration.
  5. 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:

  1. 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; set BaseURL for any other OpenAI-compatible endpoint. Or skip the call and set LLM_PROVIDER, LLM_MODEL and LLM_API_KEY (optional LLM_BASE_URL) in configs/.env.
  2. Never hardcode the API key. It comes from LLM_API_KEY, then the provider's own variable (OPENAI_API_KEY, GROQ_API_KEY, ...).
  3. 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 as c.LLM("fast"). Not every provider supports every method; handle ai.ErrEmbedNotSupported / ai.ErrStreamNotSupported as ordinary errors.
  4. Stream tokens by returning response.Stream{Source: stream} from the handler (gofr.dev/pkg/gofr/http/response).
  5. Expose handlers to agents with app.EnableMCP(). It serves the read-only handlers (GET, HEAD, OPTIONS, QUERY) as MCP tools. POST/PUT/PATCH/DELETE are never exposed. Hide a route with gofr.WithExcludedRoutes("/internal/{id}").
  6. MCP binds to loopback on MCP_PORT (default 8200). MCP_PORT=0 turns the transport off but keeps tools available in-process. A port that cannot be claimed fails startup. 8200 is also Vault's default port.
  7. 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.

Migrating to GoFr

Each migration page has the full mapping table for that source framework — fetch only the one that matches:

Other entry points

Download now (ZIP)

Trending

More talk lately.about the whole repository

Dec 2025: 5 mentionsJan 2026: 14 mentionsFeb 2026: 5 mentionsMar 2026: 3 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 4 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 8 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the gofr-dev/gofr repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about gofr-dev/gofr

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

45 more on GitHub

On Bluesky · 7

2 more on Bluesky
  • 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.