Get help with Godogen BDD development - step definitions, CLI commands, configuration, and troubleshooting
/plugin marketplace add lukasngl/godogen/plugin install lukasngl-godogen-claude-plugin@lukasngl/godogenThis skill inherits all available tools. When active, it can use any tool Claude has access to.
docs/installation.mddocs/project-organization.mddocs/scenario-isolation.mddocs/troubleshooting.mdGodogen is a Go code generator for godog BDD step definitions. It allows you to colocate step patterns with their implementations using directive comments.
go install github.com/lukasngl/godogen@latest
go install github.com/lukasngl/godogen/godogen-language-server@latest
For more options (Go 1.24+ tool directive, Nix flake, editor setup), see Installation.
Step definitions are Go functions with //godogen: directive comments:
//godogen:given ^I am logged in as "([^"]*)"$
func (s *Suite) iAmLoggedInAs(username string) error {
return nil
}
//godogen:when ^I click the "([^"]*)" button$
func (s *Suite) iClickButton(name string) error {
return nil
}
//godogen:then ^I should see "([^"]*)"$
func (s *Suite) iShouldSee(text string) error {
return nil
}
| Directive | Generated Code | Use Case |
|---|---|---|
//godogen:step <pattern> | ctx.Step(pattern, fn) | Matches Given/When/Then |
//godogen:given <pattern> | ctx.Given(pattern, fn) | Preconditions |
//godogen:when <pattern> | ctx.When(pattern, fn) | Actions |
//godogen:then <pattern> | ctx.Then(pattern, fn) | Assertions |
//godogen:before | ctx.Before(fn) | Before scenario hook |
//godogen:after | ctx.After(fn) | After scenario hook |
//godogen:before_step | ctx.StepContext().Before(fn) | Before step hook |
//godogen:after_step | ctx.StepContext().After(fn) | After step hook |
^ and end with $ (anchored regex)([^"]*) for quoted string captures(\d+) for integer captures\., \(, \), etc.Step functions can return:
errorcontext.Context(context.Context, error)godog.Steps# In directory with go:generate directive
go generate ./...
# Or run godogen directly
godogen
# With Go 1.24+ tool directive
go tool godogen
The generator creates *_initializer.go files with step registration functions.
The godogen-language-server provides CLI commands for analysis:
Find issues in your BDD test suite:
godogen-language-server diagnose # All issues
godogen-language-server diagnose --severity error # Only errors
godogen-language-server diagnose --format json # JSON output
Reports:
List step definitions:
godogen-language-server list-steps # All steps
godogen-language-server list-steps --kind When # Only When steps
godogen-language-server list-steps --format json # JSON output
Navigate from feature step to Go definition:
godogen-language-server find-definition features/login.feature:10
Find feature steps using a definition:
godogen-language-server find-references steps/auth.go:15:1
Get info about a position:
godogen-language-server hover features/login.feature:10:5
List symbols in a file:
godogen-language-server symbols features/login.feature
godogen-language-server symbols steps/auth.go
All commands support:
--root <dir> - Workspace root (default: .)--config <file> - Config file path--format, -f <text|json> - Output formatCreate .godogen-language-server.json in your project root:
{
"stepPatterns": ["**"]
}
The config file is optional. By default, the language server watches all files (**).
Common configurations:
{
"stepPatterns": [
"**/*_steps.go",
"**/*.feature"
]
}
For more patterns (monorepo, external features), see Project Organization.
# Fail on any errors
godogen-language-server diagnose --severity error
if [ $? -ne 0 ]; then
echo "BDD validation failed"
exit 1
fi
Exit codes:
0: No issues at the requested severity level1: Issues found or error running commandThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.