OpenParable
Skip to content
← Back to skills

Add Go Test

Testing & Quality
add-go-test

Add Go Test is an Agent Skill for testing & quality published in the authgear/authgear-server repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Write or extend Go unit tests in this repo. Use when the user asks to add or update Go tests.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/authgear/authgear-server/blob/HEAD/.claude/skills/add-go-test/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/add-go-test, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Follow this skill when adding Go tests.

Critical: Match Existing Test Style First

Always inspect existing *_test.go files in the package first. This repo uses different testing styles in different packages:

  • Convey (BDD-style): Many packages use github.com/smartystreets/goconvey. Identified by import . "github.com/smartystreets/goconvey/convey" and test structure like:

    func TestFoo(t *testing.T) {
      Convey("description", func() {
        // assertions here
        So(result, ShouldEqual, expected)
      })
    }
    
  • Standard testing.T: Some packages use plain *testing.T with manual assertions.

When in doubt, use Convey if the package has any imports of it. Convey provides better error messages and matches the repo's BDD conventions.

Workflow

  1. Inspect the package's *_test.go files first to identify the testing style being used.
  2. Match the local test style exactly. Do not mix styles in the same package.
  3. Add the smallest test file that covers the behavior.
  4. Run go test on the affected package. If the change crosses packages or touches shared code, run the narrowest broader test set that proves the change is safe.

Notes

  • Prefer table-driven tests when the package already uses them.
  • Keep fixtures local to the test file unless they are reused elsewhere.
  • If the test requires generated code or assets, rerun the generator before the final test run.
  • When using Convey, use So() assertions for consistency with the package style, not manual if statements.