1 go rules available
One Windsurf rule matches go: a Go backend rule with HTTP and concurrency guidance. Windsurf's rules documentation now redirects to Devin docs, which use .devin/rules/; legacy .windsurfrules files are still imported. The file below uses trigger: glob so it applies only to Go files.
Windsurf's rules documentation (docs.windsurf.com/windsurf/cascade/memories) now redirects to Devin documentation, which describes rules for the Devin Local agent in Devin Desktop. Current rules live in .devin/rules/*.md with a trigger setting, and the legacy Windsurf files (.windsurf/rules/*.md, .windsurf/global_rules.md and .windsurfrules) are still imported by default. AGENTS.md files are read as always-on rules.
.devin/rules/go.mdStarting point, not a tested configuration for your repository. Applied when files matching globs are involved (trigger: glob). Review the instructions, adapt the file paths and run your project's existing checks.
---
trigger: glob
globs: "**/*.go"
---
# Go instructions for Windsurf
## Focus for this project
- Every goroutine started in server code must stop when the server's context is cancelled.
- Use time.NewTicker with defer ticker.Stop() for periodic work, not time.Tick in long-lived code.
- Test periodic logic by injecting the interval or a clock, not by sleeping in tests.
## Go conventions
- Read the go directive in go.mod before using newer standard-library APIs. With go 1.22 or later, register routes with method and wildcard patterns such as mux.HandleFunc("GET /users/{id}", h) and read the value with r.PathValue("id"); on older modules keep the router the project already uses.
- Pass context.Context as the first parameter of any function that does I/O, and stop work when ctx.Done() closes.
- Wrap errors with fmt.Errorf("...: %w", err) and compare with errors.Is or errors.As; never compare error strings.
- Write table-driven tests with t.Run subtests next to the code (foo_test.go).
## Before you finish
- Run gofmt -l . (must print nothing), go vet ./... and go test -race ./... and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass.
- Summarize which of the rules above affected the change.
- If a legacy .windsurfrules or .windsurf/rules file gives conflicting guidance, point out the conflict instead of silently choosing one.
Create your own Windsurf rules for Go and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
The docs recommend keeping rules short and specific. The current docs say AGENTS.md, AGENTS.local.md and AGENT.md are read as always-on rules, including files in subdirectories. Use .devin/rules/ when you need glob, model-decision or manual triggers.
Documentation checked 2026-11-05: Devin docs: Local customizations (redirect target of Windsurf memories docs)Windsurf docs: Cascade memories (redirects)
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You use the Windsurf agent to add a background job to a Go server and want shutdown-safe goroutines and tests.
Add a job that deletes expired sessions every 10 minutes.
A function taking ctx and an interval, a ticker loop that returns on ctx.Done(), a test using a short interval or fake clock, and go vet/test output.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.