gofastr-host
Skill16 starsChanged 2 months agoMITView on GitHub
Auto-loads when working on a *host application* that imports the GoFastr framework (not the framework itself). Encodes the "don't reinvent: reach for the battery first" rule and the import paths an agent needs. Triggers on edits to Go files in repos that import `github.com/DonaldMurillo/gofastr/...`, on `main.go` files calling `framework.NewApp`, and on phrases like "login", "signup", "session", "user table", "log out", "magic link", "forgot password", "reset password", "add admin page", "back office", "audit log", "audit trail", "compliance log", "send email", "transactional email", "welcome email", "send a notification", "notify the user", "background job", "async task", "schedule", "cron", "run every hour", "retry on failure", "upload", "store images", "store files", "S3", "MinIO", "attachments", "avatar", "full-text search", "find records containing", "outbound webhook", "signed callback", "POST to a customer URL", "cache", "memoize", "remember for N seconds", "CSRF", "RBAC", "require admin", "roles", "rate limit", "throttle", "request log", "access log", "panic recovery", "structured logging", "live debug", "per-test isolated DB", "test fixture", "favicon", "app icon", "SEO", "meta tags", "Open Graph", "JSON-LD", "structured data", "sitemap", "robots.txt", "accessibility", "a11y", "WCAG", "aria-label", "upgrade gofastr", "bump the framework version", "migrate to the new version", "live updates", "auto-refresh", "real-time", "websocket", "polling", "multiple replicas", "horizontal scaling", "PostHog", "Statsig", "Plausible", "analytics", "product analytics", "A/B test", "experiment", "feature flag vendor", "ad blocker", "first-party proxy", "reverse proxy a vendor", "translate the site", "bilingual", "multilingual", "html lang", "screen reader reads the wrong language", "video call", "screen share", "camera", "WebRTC", "peer to peer", "data channel", "TURN", "STUN", "signaling", "desktop app", "native window", "menu bar", "file dialog", "clipboard", "run the app", "start the server", "dev server", "hot reload", "restart the server".
- Reads credentials
In this repository11 other files it gives its agents.
- framework/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-testsSkill
- app-introspectSkill
- chaos-testSkill
- component-buildSkill
- gofastr-docsSkill
- gofastr-mcp-debugSkill
- gofastr-uiSkill
- log-debugSkill
- plain-wordsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 55
If the project has no AGENTS.md, run gofastr agents init once to generate both the TOC and the agents/ detail files.
- Very specific: line 138
When the task is wiring a hosted analytics or experimentation vendor (PostHog, Statsig, Plausible), do not link their CDN and do not punch …
- Distinctive: line 192
Search the project's AGENTS.md for the keyword first.
- Very specific: line 193
Search the framework with grep -rn <symbol> $(go env GOMODCACHE)/github.com/DonaldMurillo/gofastr@*.
- Very specific: line 194
Run gofastr docs --grep <term> to search the embedded docs, or gofastr docs <topic> to read one.
- Very specific: line 195
Use the live /mcp introspection tools (app_routes, app_batteries, etc.) if the app is running locally with …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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
GoFastr host-app: load this before writing app code
You're in a Go app that uses the GoFastr framework. The framework already
ships ~70% of the surface a real app needs. Before writing anything new,
read this skill, the project's AGENTS.md, and the matching detail
file under agents/; they exist to keep you from reinventing what's
already there.
To run the app while you work, start gofastr dev once in the background
and leave it running: it rebuilds on every save and reloads the browser.
go run . and a hand-launched binary never reload, because only
gofastr dev sets GOFASTR_DEV=1.
For UI work, also read and complete the project's DESIGN.md before selecting
components, then open agents/ui.md and run
gofastr docs ui-composition-recipes. The app owns product intent and
information hierarchy; the framework supplies the structural and visual
primitives. Render desktop/mobile in both schemes and revise the three weakest
visible decisions before calling the UI complete.
For record, incident, and operational pages, reach first for
ui.RecordSummary + ui.MetricBand: one dominant summary, one compact signal
band, and actions in the summary's natural-width Actions slot. Do not repeat
the same state in a Banner. Keep its description to one or two sentences and
its highlight to one decision plus one short condition. Use the compact
Aside for owner/presence context, use MetricBandItem.Hint for trends, and
move the full narrative or roster later. The component keeps Actions in its
lead region so the primary path stays in the first useful phone viewport.
The site header is the app's own package (copy it with
gofastr generate package siteheader); when the desktop identity is too long for
the phone header, give it a shorter phone mark. On wide detail routes, pair related bounded modules such as
DetailLists in ui.Grid; do not leave a narrow stacked column beside an
accidental empty rail. Reflow the pair to one column on phones. ui.Cluster
wraps whole controls by default; use ClusterConfig.NoWrap only for compact
chrome that is guaranteed to fit.
A fresh scaffold already mounts the adaptive framework/ui/theme.Default()
palette, so ui.ThemeToggle and OS dark preference have complete light/dark
tokens. Keep that WithTheme call. If you replace it with an app-owned theme,
define every semantic DarkColors value before rendering a toggle. Use
ui.Link for visible text links; do not rely on browser-default <a>
colors. Links in the app's own header and footer take their look from
those packages' owned sheets.
AGENTS.md is a thin TOC of every framework primitive with its
trigger phrases. When your task matches a row, open the linked file
under agents/ (e.g. agents/battery-admin.md) for the full
shape / import / don't-reinvent breakdown.
If the project has no AGENTS.md, run gofastr agents init once to
generate both the TOC and the agents/ detail files.
Upgrading the framework: install the target CLI first (an old binary
can't know newer migration notes), run gofastr upgrade [--to vX.Y.Z]
to see every migration-relevant change between your version and the
target (with file:line hits in this app), --apply to run
go get / tidy / build / test, then gofastr agents sync to refresh the
generated guidance.
Don't reinvent: reach for these first
| Task phrasing | Use this | ||
| audit trail, who-did-what, compliance log | app.WithAuditLog(cfg) (chained *App method) | ||
| admin pages, ops dashboard, queue browser | battery/admin | ||
| login, signup, session, CSRF, bcrypt, "require admin" | battery/auth | ||
| send notification, password reset link, fan-out across channels | battery/notify | ||
| background job, scheduled task, retry-on-failure | battery/queue (use DBQueue for real workloads) | ||
| send email, SMTP, transactional mail | battery/email | ||
| file upload, S3, MinIO, attachments | battery/storage + framework.WithFileStorage | ||
| image upload wanting thumbnails, srcset, blur placeholder | framework.WithImagePipeline(imagefield.MustNew(...)): every schema.Image upload gets renditions + a BlurHash, written to <field>_blurhash / <field>_variants / <field>_placeholder sibling columns you declare. Render with image.BlurHashDataURL + ui.PipelineImage. Per-field variation via WithImagePipelineFor. Never hand-roll resize/encode in an upload handler | ||
| full-text search | battery/search | ||
| outbound signed webhooks with retry | battery/webhook | ||
| PostHog, Statsig, Plausible, product analytics, A/B test, experiment behind a vendor, ad blocker eating the vendor script, first-party proxy | battery/relay + a host-authored bootstrap: gofastr docs analytics-recipes (relay routes, uihost.ScriptHandler + RegisterExternalScript(uihost.ScriptURL(...)), one pageview per gofastr:navigate, {"id":...} endpoint over handler.GetUser) | ||
| cache key/value, memoize, "remember for N seconds" | battery/cache | ||
| UI components, page layout, forms, tables, theming, dark mode | framework/ui (~100 components): gofastr docs ui-composition-recipes for page grammar, gofastr docs ui-new-components for the catalog, live demos at /components/<slug> on the docs site (examples/site) | ||
| site header, footer, or help/docs page, "marketing chrome", "colophon", top bar with phone menu | the app's own package, copied from the canonical one: `gofastr generate package siteheader | sitefooter | docpage(owned.style.css+ tests, self-import rewritten;examples/acme-sitekeeps customised copies). Extend the theme with the package's own Tokens;gofastr gen styles` after sheet edits |
| live/auto-refreshing dashboard, counter, status ("websockets"?) | the reactivity ladder (gofastr docs reactivity): passive freshness = data-cui-poll / widget Builder.Poll (no connection, no infra); SSE bus ONLY for presence/collab/sub-second; never WebSockets, never a bespoke EventSource | ||
| stale page after mutation, "back button shows old data", bust cached screen | ui.InvalidateScreens(w, "/orders") on the mutation handler: evicts that pathname (and its query variants) from the requesting tab's screen cache; pair with data-cui-rpc-navigate when the user should land on the fresh screen; gofastr docs runtime-contract for selector rules | ||
| multi-replica deploy (sessions, live updates across replicas) | framework.WithSecret (or GOFASTR_SECRET env) + framework.WithFanout: fanout without a secret fails at boot by design; gofastr docs scaling | ||
| in-browser agent tools, WebMCP, "page tools" for Gemini-in-Chrome, modelContext | framework/experimental/webmcp (experimental): Register Tools (name, description, JSON Schema, same-origin endpoint) then Mount(app.Router(), uiHost); execute() runs as the signed-in user (session + CSRF re-enter server-side). Separate from WithMCP* (session auth vs token auth); gofastr docs webmcp | ||
| MCP prompt templates, paginated tool/resource lists, push notifications when tools or resources change | core/mcp: RegisterPrompt (+WithPromptGate), RegisterResourceTemplate, cursor pagination on every list method, and notifications/* over the SSE GET stream with resources/subscribe. Gated items stay hidden from lists AND from notifications, filtered per subscriber at delivery; gofastr docs mcp | ||
| agent client protocol, editor/harness attaching over stdio, ACP | core/acp: initialize, authenticate, session/new, session/prompt, session/cancel, session/update streaming and session/request_permission. Unimplemented client features (fs, terminal) are declared absent at initialize rather than dropped; gofastr docs acp | ||
| plugin needs a host-page permission (camera, microphone, geolocation) and silently breaks | pluginhost.Manifest.HostRequirements (permissions-policy:<feature>) plus CheckHostRequirements at boot: the default headers deny those features, so the HOST page's getUserMedia fails with a console error nobody sees. The check warns at startup instead; gofastr docs plugin-platform | ||
MCP App widget, the JS running inside a chat host's iframe, ui/initialize, calling a tool from inside a widget | core/mcp: WithMCPApp serves the widget client at mcp.WidgetClientScriptURL automatically (only when an app is registered); WidgetClientJS()/WidgetClientHandler() mount it yourself. Handshake plus the six widget-to-host requests (tools/call, resources/read, ui/open-link, ui/request-display-mode, ui/message, ui/update-model-context). GoFastr serves the widget side; it is not a chat host; gofastr docs mcp | ||
| serve agents from their own process or listener, split MCP traffic off the web app | GOFASTR_ROLE=agent (or WithRole(RoleAgent)): serves /mcp, health and the widget client script only, forwarding MCP to the app router so auth and owner scoping are identical to the serve role. No entity CRUD, OpenAPI, docs, admin or well-known discovery, and no workers; gofastr docs scaling | ||
| sidebar collapse stored per user in the database, SSR a collapsed sidebar, icon rail | ui.SidebarConfig.Collapse is tri-state like CurrentPath: the zero value keeps localStorage behaviour, SidebarCollapseCollapsed/SidebarCollapseExpanded hand the state to the server and the runtime stops touching localStorage. SidebarAutoHide is a 64px rail that opens on hover and :focus-within, no JavaScript; gofastr docs ui-new-components | ||
| plugin declares a CSP tier (wasm) in its manifest and the frame ignores it | pluginhost.ClientModule.AssetServer(prefix, specs) builds the asset server from the module, so Manifest.CSP reaches the mount instead of only the response header. NewAssetServer stays for assets belonging to no module; gofastr docs plugin-platform | ||
| sign the agent card, A2A signed cards, publish verification keys, JWKS | AgentCardConfig.SigningKeys: one JWS per key over the RFC 8785 canonical form of the card, EdDSA for Ed25519 and ES256/ES384/ES512 for EC, plus a public-keys-only JWK Set at /.well-known/jwks.json. Multiple keys mean multiple signatures, which is how rotation works. Requires a pinned BaseURL and refuses to mount without one; gofastr docs agent-ready | ||
| author an MCP App widget, the HTML that runs in a chat host's iframe | mcp.WidgetDocument: assembles the document with the client <script src> read from the same constant the server mounts, so the two cannot drift. Body and Script are author content; a Script carrying </script or <!-- is rejected at build time rather than shipping a document the parser truncates; gofastr docs agent-host | ||
| verify signed agent traffic, Web Bot Auth, RFC 9421 signatures on inbound requests | WithWebBotAuth(WebBotAuthConfig{Verify: &WebBotAuthVerifyConfig{Require: false}}) (experimental, tracks draft-meunier-webbotauth-httpsig-protocol-02): observe mode annotates and logs without blocking, Require refuses unverified traffic. framework.VerifiedAgent(ctx) gives the identity, nil for the unverified majority - treat nil as "learned nothing", never as hostility; gofastr docs web-bot-auth | ||
| expose skills to other agents, A2A task exchange, agent-to-agent tasks, SendMessage / GetTask endpoint | framework.WithA2A(framework.A2AConfig{Skills: …}) mounts the A2A v1.0 JSON-RPC exchange at /a2a through the app router, so the API's session/bearer auth and owner scoping apply; every entity with MCP tools is a skill for free, and AgentCardConfig{A2AEndpoint: "/a2a", Skills: app.A2ASkills()} advertises it. Skills are invoked by name (message.metadata.skill or a "skill" data part), never inferred from prose; gofastr docs a2a | ||
| per-agent rate limit, throttle verified agents by identity instead of IP | limiter.MiddlewareByKey(framework.AgentRateLimitKey(false)) after WithWebBotAuth: a verified agent is its own bucket (keyed by its directory URL, so key rotation does not reset it), everything else is the client IP; gofastr docs web-bot-auth | ||
| nav submenu, menu with radio rows (theme or density switch), one menu row addressable from page JS | ui.MenuItem: Children nests a submenu through the same disclosure machinery (ArrowRight/Left move in and out, Escape closes one level at a time); Radio + Checked render menuitemradio rows that check/uncheck same-group siblings client-side while the server re-render stays authoritative; ID sets the row's id (MenuItem.ExtraAttrs still drops id, the field owns it). A submenu parent is disclosure-only — Children alongside Href, RPC, or Radio panics at render time | ||
porting a Radix-style tab strip, tests pinning data-state, locators that must not match text inside hidden panels | ui.TabsConfig: StateAttrs mirrors data-state="active"/"inactive" onto tab buttons after client-side switches, ID wires tab↔panel id/aria-controls, VacateHidden ships hidden panels empty with their content parked in an adjacent data-cui-tabs-stash script and restored by the demand-loaded tabs module (armed with data-cui-prefetch="tabs"). Two caveats worth knowing before you reach for VacateHidden: a hidden panel is genuinely empty until that module loads on the first hover/focus, so a switch driven before load shows an empty panel; and nothing queues — an update targeting a vacated panel is lost permanently, not replayed on re-show, because the live nodes are detached and invisible to any document-scoped write. All three knobs are opt-in; zero values keep the default output | ||
| one dialog per row, widget chrome that depends on the entity, per-item confirm dialog | data-cui-ctx on the open trigger (data-cui-open="layout-remove" data-cui-ctx="inv-42") forwards its context on the chrome fetch, the slot reads it via widget.ChromeContext(ctx) in RenderCtx, and the runtime keys its chrome cache by (name, ctx). The context string is opaque to the framework — authorise the entity it names in the slot, against the request context | ||
own transaction plus CRUD writes, events after MY commit, db.WithTx for a hand-opened tx | db.WithTxQueue(ctx, tx) instead of bare db.WithTx, then queue.RunAfterCommit() after your Commit succeeds (drop it on rollback — held events die with it). Bare WithTx still works but the framework then polls your live tx to learn its fate (it warns once per process), and inside App.InTx none of this applies — the framework drains for you; gofastr docs hooks-and-transactions | ||
| per-user background jobs the erase plane can delete, GDPR erasure reaching the queue | set queue.Job.UserID on enqueue; App.EraseUserData deletes matching queue_jobs rows. Rows enqueued before the field existed carry '' and are treated as unowned | ||
structured request log, JSON logs to stdout for containers (log.JSONSink), panic recovery, log MCP debug tools | battery/log | ||
browser refresh on gofastr dev rebuild | auto-wired if your main.go uses framework.NewApp + uihost.New, no host code; for custom bootstraps call dev.RegisterLiveReload(router) manually | ||
agent debugging under gofastr dev | auto-wired by framework.NewApp: /mcp mount + introspection (app_routes, app_config, contracts_list/contracts_explain, …; the framework_docs_* tools need framework.WithMCPTools(mcptools.Register) from framework/docs/mcptools) + under dev the working pair contracts_verify/contracts_fix + control (app_module_enable/disable) + battery/log debug tools; opt out with GOFASTR_DEV_MCP=0; production needs explicit WithMCP/WithMCPIntrospection/WithMCPControl (and framework.WithMCPTools(mcptools.Register)) | ||
load .env files | auto-wired by framework.NewApp; do nothing | ||
| per-test isolated Postgres DB | framework/testkit.NewIsolatedDB(t, adminDSN, migrate) | ||
| favicon, app icon, PWA icons | uihost.WithAppIcon(pngBytes): one source image becomes 32/180/192/512 PNGs, /favicon.ico, head links, and the PWA manifest icons; generate placeholder art in code with framework/image.NewGradient (no committed binaries) | ||
| SEO: page title/description, Open Graph, Twitter cards, canonical, JSON-LD, sitemap, robots | uihost WithDescription/WithOpenGraph/WithSitemap/WithRobots/WithRobotsMeta + per-screen ScreenSEO/ScreenSchema interfaces; gofastr docs seo. Static export writes sitemap.xml/robots.txt from the same config | ||
| accessibility, ADA/WCAG compliance, "aria-label", a11y audit | gofastr audit a11y (static guided lint) and gofastr audit a11y --url <base> (axe-core in headless Chrome, both color schemes, pages from /sitemap.xml). Note gofastr build enforces the static lint: fix findings, don't reach for --no-a11y; gofastr docs accessibility | ||
| enforce SEO + a11y completeness, "error if a page has no SEO", strict defaults, launch checklist as code | uihost.WithStrict(): boot fails listing every page screen missing title/description, missing site description/icon/sitemap/robots, every chrome link to a path nothing serves (validated after the last route registration, so battery and plugin routes count; a catch-all GET route satisfies it unverified), and (dev only) every screen without a recorded axe scan (framework/testkit/axetest writes .gofastr/axe-coverage.json); every check tunes individually via StrictConfig (enforce/warn/off + ExemptScreens route patterns, zero value = strictest); gofastr docs strict-mode | ||
| "is this still idiomatic?", pre-merge check, lint, "did I wire this right", CI quality gate | gofastr verify: one pipeline over routing, permissions, security, rendering, a11y, architecture, performance, data, entities, testing and AI-slop rules; every finding carries an ID (GOFASTR1002), why it matters, and the fix. gofastr verify <capability> scopes it, --rule <id> --fix applies one rule's mechanical fixes, --changed narrows to this change (fixes included), --json/--sarif for machines. Strict by default; relax in gofastr.contracts.yml or per-line with //gofastr:allow(RULE) reason. Adopt on an existing app with --baseline-write; gofastr docs contracts | ||
verify flags my strings.HasPrefix on a path, my X-Forwarded-Proto read, or json.NewDecoder(r.Body) | GOFASTR1006 / GOFASTR1406 / GOFASTR1407: compare rel == root || strings.HasPrefix(rel, root+"/"), honour only "http"/"https", decode through handler.Bind or handler.DecodeStrict (envelopes, frames and buffered bodies included); gofastr verify --explain <rule> | ||
vet flags a 0644/0755/os.Create write, a fixed /tmp name, == on a token or code, an id minted from time.Now(), or _ = json.Unmarshal | worldreadable / fixedtmp / secretcompare / timestampid / discardeddecode: write 0600/0700, use os.MkdirTemp, subtle.ConstantTimeCompare, crypto/rand, check the error; a site that is the shape on purpose carries //gofastr:allow(<analyzer>) why on its line | ||
auth.NewEntityTwoFAStore no longer compiles after upgrading | it takes EntityTwoFAStoreConfig{EncryptionKey: <32 random bytes>} and returns an error; plaintext rows from older builds still verify and re-seal on their next write | ||
bilingual or multilingual site, <html lang> per page, "screen reader reads Spanish pages in English", per-language search index, translate the prev/next pager | app.WithLangFunc(func(path string) string) resolves the document language per route and a screen overrides its own page with ScreenLang() string (app.ScreenLanger, read after Load); uihost.WithLangFunc covers the shells the host builds (404, 405, embed frame); a docs pager is the app's own package (gofastr generate package docpage; examples/acme-site/helpdocs is a customised copy), so its prev/next words are the app's strings; gofastr docs i18n | ||
| upgrading the framework version, migration notes between releases | install the target CLI first, then gofastr upgrade [--to vX.Y.Z] [--apply]. It shows every migration-relevant change in range with file:line hits in your app; gofastr docs upgrading; finish with gofastr agents sync | ||
| customer-facing CLI, "ship a terminal client", stripe/gh-style CLI for my API | gofastr generate cli: standalone stdlib binary, scoped gfsk_ token auth, custom.go extension seam; gofastr docs app-cli | ||
| client SDKs, "publish an SDK", downloadable Go/JS/TS client, API docs site for customers | gofastr generate sdk (Go module zip + client.js/client.d.ts under gen/sdk/) + sdkdocs.Mount(site, app.Router(), sdkdocs.Config{Registry: app.Registry, Artifacts: os.DirFS("gen/sdk/dist")}) for the hosted docs site + downloads; gofastr docs sdk | ||
| route parameters in middleware, guard a dynamic screen, "session gone" page with a real 410 / 404 status | host.RouteMatchMiddleware() puts app.Match on the request (uiapp.MatchFromContext(ctx) → match.Param("id")); answer a guard with host.RenderScreen(w, r, screen, uihost.ScreenResponse{Status: 410}) (full chrome on a load, bare body on a client-side navigation, no-store on both); gofastr docs ui-wiring | ||
in-browser agent tools, WebMCP, navigator.modelContext, tools only on signed-in pages | webmcp.New(webmcp.WithInstructions(text), webmcp.WithObserver(fn)), host.Handle(rt, tool, handler, webmcp.WithHTTPMiddleware(auth)) binds declaration and route in one call, Mount(rt, host, webmcp.WithDocumentScope(pred), webmcp.WithAssetAuthorization(mw), webmcp.WithPrivateAssets()) gates the bridge and manifest like the endpoints; the marker header attributes, the cookie decides; gofastr docs webmcp | ||
| script only on some pages, a capability that must not survive a client-side navigation | host.RegisterDocumentScript(src, scope): the tag ships only on in-scope routes and the runtime hard-navigates across the scope edge; gofastr docs ui-wiring | ||
| worker that needs wasm or eval (OpenCV, ONNX) without widening the host page's CSP | assets.AddBytes(route, contentType, framed, bytes, pluginhost.WithWorkerCSP(pluginhost.WorkerCSP{WASM: true}), pluginhost.WithCache(pluginhost.CachePublicImmutable)): the worker's own response carries the narrow policy, the document's CSP is untouched; gofastr docs plugin-platform | ||
| realtime WebSocket state, snapshot plus events, reconnect that cannot resurrect stale state | stream.NewStateChannel(source) (per-role snapshots and sequenced events above Hub) with __gofastr.loadModule('ws') → connectWebSocket (reconnect generations) and createSequencedReducer (applies only newer sequences); gofastr docs reactivity | ||
| dropdown menu with my own styled trigger button | ui.Menu(ui.MenuConfig{TriggerElement: ui.Button(...), Items: ...}): the caller's element becomes the disclosure controller, no <summary> nesting | ||
| reference for authenticated WebMCP plus WebRTC (support console, one-time operator link, peer-to-peer camera) | examples/webmcp-remote-assist; go run ./examples/webmcp-remote-assist | ||
| video call, screen share, camera, WebRTC, peer to peer, data channel, TURN, STUN, signaling | battery/rtc: app.RegisterPlugin(rtc.New(rtc.Config{Authorize: …})) for signaling rooms with per-peer TURN credentials; browser side __gofastr.loadModule('rtc') → connectRoom (perfect negotiation, reconnect generations); media flows peer to peer or through your TURN relay, never through the Go process; gofastr docs rtc | ||
| rtc socket flood, "one user opens dozens of signaling sockets", cap WebRTC connections per user | rtc.Config.MaxSocketsPerUser: default 16 concurrent signaling sockets per Join.User across every room; a principal's next socket past the cap displaces their oldest (the replace-on-rejoin posture); callers with no Join.User share one bucket | ||
| a2a stream flood, cap concurrent task SSE streams per owner, 429 past the cap | framework.A2AConfig{MaxStreamSeatsPerOwner, StreamSeatOverflow}: 0 = 16 seats per owner, negative = unlimited; stream.SeatOverflowRefuse (default) answers 429 at connect, SeatOverflowEvictOldest closes that owner's oldest stream; gofastr docs a2a | ||
| image decode from untrusted uploads, huge or dribbling source streams pinning memory | image.Config.MaxSourceBytes (default 64 MiB): DecodeWithConfig stops buffering at the cap and returns image.ErrSourceTooLarge before the MaxPixels guard allocates anything | ||
| attach my row to another user's parent (order_items onto someone else's order), belongs_to FK on write | built into crud: a create/update whose BelongsTo FK targets an owner/tenant/read-scoped row the caller cannot read answers 404; exempt contexts are owner.AllowCrossOwner, the target's CrossOwnerRead permission, tenant.AllowCrossTenant, and crud.WithServerWrites for host-driven writes | ||
| cross-site form guard, Sec-Fetch-Site, refuse a cross-site POST, Fetch Metadata | handler.IsCrossSiteRequest(r) / handler.IsCrossSiteRequestStrict(r) (core/handler): the one shared predicate, Fetch Metadata first with an Origin-host compare fallback; Strict also refuses an opaque Origin: null with no Fetch Metadata (fetch()-only surfaces) | ||
| desktop app, native window, menu bar, file dialog, clipboard, run the app in the OS WebView | battery/desktop (experimental, macOS today): desktop.AppOptions(id) into NewApp, mount the uihost, app.RegisterBattery(desktop.New(desktop.Config{ID, Title, Menu})), d.Run(app) instead of Start; page side __gofastr.desktop.<cap>.<method>(); `gofastr desktop run | build | types; test with desktoptest.Run(t, app, d)(fake shell, real Run flow:h.Call, h.ClickMenu, h.Answer); gofastr docs desktop; reference examples/desktop-notes` |
First-party analytics and experiments
When the task is wiring a hosted analytics or experimentation vendor
(PostHog, Statsig, Plausible), do not link their CDN and do not punch
script-src/connect-src holes into the CSP. The shipped pattern:
battery/relay mounts the vendor's SDK and endpoints under one
same-origin path with fixed upstreams; your own bootstrap JS is served
via uihost.ScriptHandler and registered with
RegisterExternalScript(uihost.ScriptURL(...)), so it ships on every
full-page render and survives client-side navigation; pageviews ride the
runtime's gofastr:navigate event (fire the initial one yourself; never
count on gofastr:beforenavigate, it is cancelable and pre-commit);
identity comes from a same-origin endpoint over handler.GetUser.
gofastr docs analytics-recipes has both vendors wired end to end, plus
a featureflag.Store adapter for server-side boolean gates.
Hard rules
- Every
<form method="POST">includesauth.CSRFInputFromCtx(ctx). The CSRF middleware rejects unsigned mutations. No exceptions. _, _ = db.Exec(...)is almost always wrong. The two acceptable cases (best-effort telemetry, search-history logging) require a comment on the call line explaining why failure is tolerable.- Never hand-roll bcrypt / session cookies / the users-table schema.
auth.HashPassword,auth.CheckPassword,auth.SessionMiddleware,auth.UserEntityFields()are the contract. - Audit log writes are not best-effort. Failing audit fails the user write; that's the point.
- Strict CSP and one styling surface. Host apps ship zero bespoke CSS
outside owned style sheets, and zero hand-rolled structural markup. Themes
mutate tokens; missing visual or layout treatments are framework component
gaps to add upstream. Chrome the kit does not ship (the site header,
footer, docs page) is the app's own package with an owned sheet
(
<name>.style.css+gofastr gen styles): scoped, tokens only. The framework runtime is the only script tag; extra scripts useWithExtraScripts(externalURL). gofastr devsetsGOFASTR_DEV=1on the child process; the framework auto-wires browser reload via SSE. Don't write your own livereload. Opt out withGOFASTR_DEV_LIVERELOAD=0.
Project shape
main.gobuilds the App:framework.NewApp(WithDB, WithConfig, …); chained methods likeapp.WithAuditLog(cfg)come after.entities/declaresEntityConfigs; useSeed+SeedFSinstead of hand-rolledseedIfEmptyhelpers.screens/is one screen per page; in-page state changes are island RPCs, not new routes.- Migrations: prefer
auto-migratefor greenfield schemas; otherwise versioned migrations undermigrations/. - Tests against Postgres:
framework/testkit.NewIsolatedDB(t, adminDSN, migrate)carves a fresh DB per test. Don'tt.Skipwhen the DB is missing; hard-fail.
When in doubt
- Search the project's
AGENTS.mdfor the keyword first. - Search the framework with
grep -rn <symbol> $(go env GOMODCACHE)/github.com/DonaldMurillo/gofastr@*. - Run
gofastr docs --grep <term>to search the embedded docs, orgofastr docs <topic>to read one. - Use the live
/mcpintrospection tools (app_routes,app_batteries, etc.) if the app is running locally withframework.WithMCPIntrospection(), andframework_docs_searchwhen it also hasframework.WithMCPTools(mcptools.Register); blueprint-generated apps wire both (plusframework.WithMCP()) by default.
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.

