Skip to content

Create spec

create spec - Generate Gherkin specifications from natural language descriptions

The create spec command uses AI to transform natural language feature descriptions into properly formatted Gherkin specifications following Rules/Scenarios patterns. The generated specifications include Feature, Rule, and Scenario blocks with appropriate tags and structure. All specifications are validated against the specification contract to ensure they meet quality standards. The command automatically saves the specification to the specs/ directory, organized by module. Use --debug to inspect intermediate outputs and understand how the AI generates specifications.

Flags

Flag Description
-d, --debug (default: false) Save intermediate outputs (prompts, raw AI responses, validation results) to the 'out' directory for debugging and analysis
-m, --module Target module for the specification (e.g., eac-commands, eac-core). If not provided, the module will be inferred from the description
-o, --output Custom output path for the specification file. If not provided, the path is determined from the feature name and module
--prompt Path to a custom system prompt file. Overrides both user override prompts and built-in prompts

Notes

Expected Output:

  • Gherkin .feature file in specs/ directory
  • Feature, Rule, and Scenario blocks with tags
  • Validated against specification contract

How It Works

The command uses AI generation with Gherkin format support:

  • Format: Generates .feature files in valid Gherkin syntax (Feature, Scenario, Given/When/Then)
  • Validation: Multi-layer validation ensures quality:
  • Gherkin syntax validation (proper feature file structure)
  • Step definition validation (steps match implemented step functions)
  • Quality standards validation (follows specification best practices)
  • Retry: If any validation fails, AI receives error feedback and regenerates improved specifications
  • Customization: Uses three-tier prompt system for domain-specific specification styles

Supported formats: Gherkin BDD specifications with scenario outlines and examples tables.

Custom Prompts

The spec generation supports three-tier prompt system for customization:

  1. Command Flag: --prompt /path/to/custom.md (highest priority)
  2. Team Override: .r2r/eac/templates/ai/specs/specs.md (team-wide customization)
  3. System Default: templates/ai/specs/specs.md (fallback)

See commit-message for detailed customization guide or:

cat .r2r/eac/templates/ai/README.md

See Also


Tutorials | How-to Guides | Explanation | Reference

You are here: Reference — information-oriented technical descriptions of the system.