overview
O que ela faz
Esta skill dá uma visão clara de como funciona a ferramenta de testes Ginkgo para Go. É para desenvolvedores que estão começando um projeto de testes com Ginkgo ou planejando uma tarefa de testes.
Quando usar
- ✓Quando você começa a trabalhar com testes Ginkgo em um projeto Go pela primeira vez.
- ✓Quando precisa decidir como abordar uma tarefa de testes em um projeto Ginkgo.
- ✓Quando seus testes Ginkgo se comportam de um jeito que você não esperava.
Link da skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Sou novo no Ginkgo para Go. Você pode explicar como os testes são organizados antes de começarmos?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
Explica que o Ginkgo primeiro monta uma lista de todos os testes e depois os executa, e aponta para outros guias sobre tópicos específicos.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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
Perguntas frequentes
O que é o Ginkgo?
O Ginkgo é um framework de testes para a linguagem Go que usa um estilo legível, parecido com frases.
Esta skill escreve os testes para mim?
Ela dá a base necessária para orientar a escrita dos testes, e outros guias do mesmo conjunto cobrem os detalhes.
Devo usar o comando ginkgo?
A skill recomenda a ferramenta de linha de comando ginkgo em vez do comando padrão go test.
Detalhes
Descrição original do autor
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
Popularidade
- Estrelas no GitHub
- 9,1 mil
- Posição no ranking
- #12303
- Licença
- MIT
- Atualizada em
- 09/10/2026
Comentários
- …
Mais skills deste repositório
ci
9,1 milAjuda seu agente a configurar testes Ginkgo para integração contínua, com flags recomendadas que pegam marcações de foco ou pendentes esquecidas e testes instáveis.
debugging-failures
9,1 milAjuda seu agente a descobrir por que testes Ginkgo falharam, lendo a linha de resumo e extraindo do relatório em JSON os testes exatos que falharam e suas mensagens.
decorators
9,1 milAjuda seu agente a usar corretamente os decoradores de teste do Ginkgo, como Serial, Ordered, Label, Focus e timeouts, explicando o que cada um faz.
filtering
9,1 milAjuda seu agente a rodar apenas alguns testes Ginkgo, usando pendentes, skip, foco, rótulos, restrições de versão e filtros de arquivo na ordem certa de precedência.
Skills parecidas
test-driven-development
311 milEnsina seu agente a escrever primeiro um teste que falha, ver a falha e depois escrever o menor código que passa, antes de criar qualquer funcionalidade ou correção.
verification-before-completion
311 milEnsina seu agente a rodar verificações reais e ler a saída antes de afirmar que uma tarefa, correção ou build está concluído ou passando.
migrate-to-shoehorn
310 milSubstitui conversões de tipo arriscadas nos seus arquivos de teste pela biblioteca shoehorn, para que os testes usem dados parciais e ainda passem na checagem de tipos.