Separate Out Specs
When a cart spec grows to cover several Features, finding the discount rules can mean scrolling past everything about adding and removing products. Giving each Feature its own file makes the subject easier to find and gives its scenarios a test class of their own when the spec is wired in abstract mode.
Use separate-out-specs when a .specb or .feature file already contains several top-level blocks. A block can start with Feature, Ability, Business Need, Narrative, or the equivalent keyword in the file's language. If you have one broad Feature, divide it first: a spec review can propose where, and Move Under a New Spec moves the part you pick under a new Feature in the same file.
Ask the agent to separate out the specs
Give the agent the spec path and optionally name the Features to move, or give their lines with --only-lines. With neither, it moves every block after the first. Any block can move, the first one included, but one always stays in the original file, which keeps its name. If the first block moves out, the agent suggests a name that fits the block now at the top, for you to give the file with the IDE's Rename.
For example, ask the agent to separate out the Cart discounts Feature of ShoppingCart.specb into its own file. The file starts with two top-level blocks like these.
Feature: Shopping cart
Out of scope: discounts — see Cart discounts
Scenario: add a product to the cart
Given the cart is empty
When I add a "Coffee mug" at "€12.00"
Then the cart total is "€12.00"
Feature: Cart discounts
Scenario: apply a valid discount code
Given the cart total is "€40.00"
When I apply the discount code "SAVE10"
Then the cart total is "€36.00"
The agent creates CartDiscounts.specb next to ShoppingCart.specb. The cart's out-of-scope note now points to CartDiscounts, and the discount scenarios live together in that file.
cart/
├── ShoppingCart.specb
└── CartDiscounts.specb
What moves with each Feature
The agent moves the block with its tags, description, backgrounds, rules, and scenarios. It keeps the language header and relevant file comments with the moved block and rewrites links that now point to a different file.
In a Java project with JUnit 5, the agent also checks that the marker class discovers the new files. In abstract mode, it moves step implementations into the corresponding test classes and keeps shared steps in the project's existing shared location. In concrete mode, the step implementations stay on the marker or its ancestors.
The agent rebuilds the test sources and reports the new files, rewritten links, and any test code it moved. The compile check catches a misplaced step implementation while the change is still small.
To group spec files into folders across the suite, use Reorganize Spec Folders.