overview
What it does
This skill gives a clear picture of how the Ginkgo testing tool for Go works. It is for developers starting a Ginkgo test project or planning a testing task.
When to use it
- βWhen you start working with Ginkgo tests in a Go project for the first time.
- βWhen you need to decide how to approach a testing task in a Ginkgo project.
- βWhen your Ginkgo tests behave in a way you did not expect.
Skill link
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI am new to Ginkgo for Go, can you explain how its tests are organized before we start?β
5 new skills a week. 1 minute to read.
How it works
It explains that Ginkgo first builds a list of all the tests and then runs them, and it points to other guides for specific topics.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Ginkgo: the mental model
Ginkgo is an expressive BDD-style testing framework for Go, paired with the Gomega matcher library. You build suites out of nested container nodes (Describe/Context/When) and subject nodes (It), with setup nodes (BeforeEach/AfterEach/β¦) supplying state. You drive it with the ginkgo CLI. Strongly prefer ginkgo over go test.
Read the canonical narrative docs at https://onsi.github.io/ginkgo/ β they are the source of truth. This skill is the orientation; the other skills go deep.
The one idea: tree construction, then running
Ginkgo runs your suite in two distinct phases. Internalizing this explains nearly every Ginkgo gotcha:
- Tree-construction phase. Ginkgo invokes every container body exactly once to discover the structure of your suite. It collects β but does not run β the closures you pass to setup and subject nodes. The result is a tree it flattens into a list of specs.
- Run phase. Ginkgo walks the flattened spec list (randomized, possibly in parallel) and, for each spec, runs its setup closures, then its one subject closure, then its cleanup closures.
Container bodies run at construction time. Setup/subject closures run later, at run time. The consequences you must internalize:
- No assertions in container bodies. They'd run once during construction, with no spec active β not as part of any test. Put assertions in
ItorBeforeEach. - No initialization in container bodies. A variable set in a
Describebody is set once, shared across every spec, and mutated by whichever spec runs first. Declare in the container, initialize inBeforeEachso every spec gets a pristine copy. βginkgo:writing-specs. - Loops that build specs run at construction time β that's how you generate specs dynamically, but it also means closure-captured loop variables and any data the loop reads must be available then, not in
BeforeSuite. βginkgo:tables-and-dynamic-specs.
Spec independence β the assumption everything rests on
Ginkgo assumes every spec is independent. This is what lets it randomize order (--randomize-all), run specs in parallel across processes (-p), and run any subset (--focus/labels). The rule that keeps you honest: declare in container, initialize in setup. Deliberate cross-spec dependencies break randomization and parallelism β when you genuinely need ordering, say so explicitly with an Ordered container (β ginkgo:ordering-and-flakes) rather than relying on definition order.
The Parallelism Model
Ginkgo's parallelism model is process-based: each process runs a subset of the specs, with no shared memory.
The node taxonomy at a glance
- Containers β
Describe,Context,When(identical; pick the one that reads best). Organize the tree. - Subjects β
It,Specify(identical). The actual test; contains the assertions. - Setup β
BeforeEach/AfterEach(around every spec),JustBeforeEach/JustAfterEach(split configuration from creation),BeforeAll/AfterAll(once perOrderedcontainer),BeforeSuite/AfterSuite(once per suite),SynchronizedBeforeSuite/SynchronizedAfterSuite(for common setup, then per-process setup when parallel).DeferCleanupregisters teardown inline;DeferOnFailureregisters failure-only diagnostics that run before teardown. - Reporting β
ReportAfterEach/ReportAfterSuiteetc. observe results. βginkgo:reporting. - Decorators β modifiers attached to any node:
Serial,Ordered,Label,Focus,FlakeAttempts,SpecTimeout, β¦ βginkgo:decorators.
Failures work by panic: Fail (which Gomega calls for you) panics; Ginkgo recovers it, records the failure, and runs cleanup. A goroutine that might fail needs defer GinkgoRecover() or its panic crashes the suite. β ginkgo:timeouts-and-async.
Where to go next
- Wiring Ginkgo into a project (bootstrap,
RunSpecs, the CLI, dot-import alternatives) βginkgo:setup - Authoring specs (containers, subjects, setup/cleanup, the construction-time pitfalls) β
ginkgo:writing-specs - Table-driven and generated specs (
DescribeTable, shared behaviors) βginkgo:tables-and-dynamic-specs - Looking up a decorator β
ginkgo:decorators - Running a subset (focus, skip, labels) β
ginkgo:filtering - Running in parallel / integration suites β
ginkgo:parallelism - **Ordered containers and fl
FAQ
What is Ginkgo?
Ginkgo is a testing framework for the Go programming language that uses a readable, sentence-like style.
Does this skill write tests for me?
It gives the background needed to guide test writing, and other guides in the same set cover the details.
Should I use the ginkgo command?
The skill recommends the ginkgo command-line tool over the standard go test command.
Details
Original description by the author
The Ginkgo mental model for writing Go tests β the one idea that explains everything (Ginkgo builds a spec tree at construction time, then runs it) and its consequences for how you write specs, plus spec independence and the node taxonomy. Use this first when you start working with Ginkgo in a project, or to decide how to approach a Ginkgo task. Routes to the other ginkgo:* skills.
repo: onsi/ginkgo
Popularity
- GitHub stars
- 9.1k
- Ranking position
- #12303
- License
- MIT
- Updated
- 10/9/2026
Comments
- β¦
More skills from this repository
ci
9.1kHelps your agent set up Ginkgo tests for continuous integration, with recommended flags that catch leftover focus or pending markers and flaky tests.
debugging-failures
9.1kHelps your agent find out why Ginkgo tests failed by reading the summary line and pulling the exact failing tests and messages from a JSON report.
decorators
9.1kHelps your agent use Ginkgo test decorators correctly, such as Serial, Ordered, Label, Focus and timeouts, by explaining what each one does.
filtering
9.1kHelps your agent run only some Ginkgo tests, using pending, skip, focus, labels, version constraints and file filters in the right order of precedence.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.