Middle · Go with coding agents

Cursor rules and scoped edits

How would you guide Cursor while preserving an existing Go API?

Try explaining this aloud before opening the answer. State your assumptions and trace a boundary case.

Reveal a strong answer
  1. Use project rules in the documented Cursor rules mechanism for durable conventions and scope them to relevant files where useful. Supply the concrete API contract, representative callers and tests in the task context.

  2. Ask for a narrow change and review its diff before broad acceptance. Generated code can compile yet alter wrapping, JSON semantics, cancellation or synchronization; include these behaviors in the review.

  3. Run the repository's actual Go tools and check dependency/API existence. Ignore files and tool permissions serve different purposes; do not assume excluding a file from one context mechanism prevents every tool from accessing it.

Common trap

An editor suggestion fitting the local file can still break callers or introduce an unavailable dependency API.

Try it

An agent changes a public return from nil to an empty slice. What do you verify?

Worked solution

Check callers, JSON output and tests that distinguish null, empty and omitted values. Decide whether that observable change is intended; a clean compile does not settle the contract.

Change the constraint

How would you document a repository-specific no-new-dependencies policy without blocking legitimate standard-library changes?

How did you do?

Self-assessment, not a compiler pass or interview score. Explain the reasoning unaided before marking understood.

Not marked. Progress stays on this browser, separate from course completion.

Primary references

Checked 2026-10-20. Use documentation for your pinned runtime, driver and tool version.