generate-step-stubs

Generate Python Behave step stubs from Gherkin feature files.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/lilliangreenberg/gherkin-expansion --skill generate-step-stubs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-step-stubs
Source: https://github.com/lilliangreenberg/gherkin-expansion/tree/main/skills/generate-step-stubs
Command: npx skills add https://github.com/lilliangreenberg/gherkin-expansion --skill generate-step-stubs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires behave, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This tool automatically generates Python Behave step stubs from Gherkin feature files, reducing boilerplate and ensuring consistent patterns.

Core Features & Use Cases

  • Robust Gherkin parsing using Behave to extract steps, including Background, Scenario Outline, data tables, and doc strings
  • Intelligent parameter type inference (int, Decimal for monetary values, float, bool, str)
  • Detection of existing steps to suggest reuse and prevent duplication
  • Output of ready-to-implement Python stubs with proper type hints and clean naming
  • Supports multi-file feature generation and optional --check-existing workflow

Quick Start

Use this skill to generate step stubs from your feature files. Example:

  • Generate from a single feature: python skills/generate-step-stubs/scripts/generate_stubs.py features/login.feature
  • Write output to a file: python skills/generate-step-stubs/scripts/generate_stubs.py features/login.feature -o features/steps/login_steps.py
  • Check for existing steps: python skills/generate-step-stubs/scripts/generate_stubs.py features/login.feature --check-existing features/steps/

Frequently Asked Questions about generate-step-stubs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I auto-generate Behave step stubs from Gherkin feature files?

Auto-generating Behave step stubs from Gherkin feature files involves parsing the Gherkin syntax to output ready-to-implement Python stubs with type hints. This skill handles Background, Scenario Outline, data tables, and doc strings to eliminate boilerplate.

Can Behave infer parameter types when generating step stubs from Gherkin?

Yes, Behave parameter type inference can automatically detect int, Decimal for monetary values, float, bool, and str types. The generated step stubs include these proper type hints to align step definitions with the parsed Gherkin syntax.

Do I need Python 3.11 and Behave installed to generate step stubs from Gherkin?

Yes, you need Python 3.11+ and the Behave package installed to generate step stubs from Gherkin. The skill uses Behave's parser when available for robust Gherkin parsing to ensure accurate step definition extraction.

What's the best way to prevent duplicate step definitions when parsing Gherkin features?

To prevent duplicate step definitions when parsing Gherkin features, use the optional --check-existing workflow. This detects existing steps in your codebase and suggests reusing them to minimize duplication across multi-file feature generation.

Does Gherkin step stub generation handle Scenario Outline and data tables?

Yes, Gherkin step stub generation handles Scenario Outline, data tables, and doc strings. It uses robust Gherkin parsing to extract these complex structures and outputs Python stubs with clean naming and proper type hints.