Agent skill
bdd-scenario-evolution
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/bdd-scenario-evolution
SKILL.md
BDD Scenario Evolution Skill
Version: 1.0.0 Compiler: skill-compiler/1.0.0 Last Updated: 2026-01-25
Maintain scenarios and fixtures as code evolves.
When to Activate
Use this skill when:
- Requirements changed
- Update scenarios
- Scenario maintenance
- Fixture drift detected
- Refactor step definitions
- Code review scenario feedback
Core Principles
1. Scenarios Track Requirements
When requirements change, scenarios must change; when scenarios diverge from requirements, scenarios are wrong.
Scenarios are executable requirements, not independent artifacts.
2. Preserve Regression Coverage
When updating scenarios, ensure previously-covered behaviors remain tested.
Losing coverage creates regression risk.
3. Step Definition Reuse
Similar steps across scenarios should use shared definitions.
Duplication in step definitions leads to inconsistent behavior and maintenance burden.
4. Fixture Currency
Fixtures must reflect current system state; stale fixtures cause false failures.
Tests that fail due to outdated fixtures erode trust in the test suite.
Workflow
Phase 1: Assess Change Scope
Understand what changed and its impact on scenarios.
- Review the change (new requirement, bug fix, refactor)
- Identify affected scenarios
- Determine if change adds, modifies, or removes behavior
- Check for fixture implications
Outputs: List of affected scenarios, Type of change, Fixture impact assessment
Phase 2: Update Scenarios
Modify scenarios to reflect new reality.
- For added behavior, create new scenarios
- For modified behavior, update existing scenarios
- For removed behavior, delete obsolete scenarios
- Verify prose acceptance criteria still satisfied
Outputs: Updated feature files, Obsolete scenarios removed
Phase 3: Update Step Definitions
Evolve step definitions to match scenarios.
- Add new steps for new scenarios
- Modify steps if behavior changed
- Look for reuse opportunities across features
- Remove orphan step definitions
Outputs: Updated step files, Consolidated step definitions
Phase 4: Update Fixtures
Keep fixtures current with system.
- Identify fixtures affected by change
- Update fixture data to match new schema/format
- Remove obsolete fixtures
- Add new fixtures if needed (following proposal protocol)
Outputs: Current fixtures, Fixture registry updated
Phase 5: Verify Coverage
Confirm no regression in test coverage.
- Run full test suite
- Review deleted scenarios for coverage gaps
- Check if removed scenarios were intentional
- Document any coverage reduction with justification
Outputs: All tests passing, Coverage verification
Change Types
Additive Change
Adding new functionality without modifying existing behavior.
| Step | Action |
|---|---|
| Scenarios | Add new scenarios for new behaviors |
| Steps | Add new step definitions |
| Fixtures | Add new fixtures as needed |
| Existing | Leave unchanged |
Behavioral Modification
Changing how existing functionality works.
| Step | Action |
|---|---|
| Scenarios | Update expectations in existing scenarios |
| Steps | Modify step implementations |
| Fixtures | Update fixture data if format changed |
| Coverage | Should remain unchanged |
Removal/Deprecation
Removing functionality from the system.
| Step | Action |
|---|---|
| Scenarios | Delete scenarios for removed behavior |
| Steps | Remove orphan step definitions |
| Fixtures | Archive (move to deprecated/) |
| Coverage | Document intentional reduction |
Patterns
| Pattern | When | Do |
|---|---|---|
| Additive Change | New functionality | Add scenarios, existing unchanged |
| Behavioral Modification | Changing existing | Update expectations in place |
| Removal | Deprecating | Delete scenarios, document why |
| Refactoring Steps | Duplicate steps | Extract to shared module |
| Fixture Refresh | Schema change | Update fixture data format |
Anti-Patterns to Avoid
| Anti-Pattern | Problem | Instead |
|---|---|---|
| Scenario Hoarding | Keep obsolete scenarios | Delete, use VCS for history |
| Copy-Paste Steps | Duplicate definitions | Extract shared steps |
| Fixture Neglect | Ignore validation warnings | Treat as bugs |
| Silent Coverage Reduction | Remove without documenting | Always document why |
| Scenario Drift | Diverge from requirements | Reconcile after changes |
Fixture Governance
Fixture Lifecycle
PROPOSED -> ACTIVE -> DEPRECATED -> ARCHIVED -> DELETED
Actions by State
| State | Location | Action |
|---|---|---|
| Active | tests/fixtures/ | Normal use |
| Deprecated | tests/fixtures/ + deprecated tag | Warn on use |
| Archived | tests/fixtures/deprecated/ | Don't use, keep for reference |
| Deleted | Removed | Gone (in git history) |
Deprecation Protocol
# tests/fixtures/legacy/old-format.fixture.yaml
_meta:
name: old-format
deprecated: true
deprecated_by: fixtures/new/current-format.fixture.yaml
deprecated_reason: Schema updated in v2.0
Step Definition Consolidation
Identifying Duplicates
Look for:
- Same step text in multiple files
- Similar step text with minor variations
- Steps that could be parameterized
Extraction Process
- Create
tests/steps/shared/directory - Move common steps to shared module
- Update imports in feature-specific files
- Remove duplicates
- Run tests to verify
Shared Steps Module
// tests/steps/shared/auth.rs
#[given("I am authenticated as <role:word>")]
pub fn authenticated_as(world: &mut TestWorld, role: String) {
world.auth_token = get_token_for_role(&role);
}
#[given("I am not authenticated")]
pub fn not_authenticated(world: &mut TestWorld) {
world.auth_token = None;
}
Coverage Tracking
Before Removing Scenarios
Ask:
- Why was this scenario originally added?
- Is the behavior it tests still needed?
- If not, is there documentation of the decision?
Documenting Coverage Changes
In bead notes:
COVERAGE CHANGE:
- Removed: "check payment should succeed" scenario
- Reason: Check payment support deprecated per ADR-042
- Risk Assessment: Low - feature unused for 6 months
- Approval: Product sign-off on 2026-01-15
Coverage Review Triggers
- Deleting more than 2 scenarios
- Removing an entire feature file
- Refactoring that changes step behavior
Quality Checklist
Before completing scenario evolution:
- Identified all affected scenarios
- Updated scenarios match new requirements
- Prose acceptance criteria still satisfied
- Step definitions consolidated (no duplicates)
- Fixtures updated to current schema
- Obsolete scenarios/steps/fixtures removed
- Coverage reduction documented if any
- Full test suite passes
Example: Adding Email Verification
Change: Users now require email verification before activation.
1. Assess Impact
- Affected scenarios: User creation, user login
- Change type: Behavioral modification + addition
- Fixtures: Need pending-user, update active-user
2. Update Scenarios
# Before
Scenario: Creating user with valid data should succeed
When I create a user with valid data
Then the user should be created successfully
And the user should be able to authenticate
# After
Scenario: Creating user with valid data should create pending user
When I create a user with valid data
Then the user should be created in pending state
And the user should not be able to authenticate
Scenario: User should become active after email verification
Given a pending user exists
When the user verifies their email
Then the user should become active
And the user should be able to authenticate
3. Update Steps
- Modify creation step to check pending status
- Add verification step
4. Update Fixtures
# New: tests/fixtures/users/pending-user.fixture.yaml
_meta:
name: pending-user
description: User awaiting email verification
id: "user-pending-001"
email: "[email protected]"
status: "pending"
verified_at: null
5. Verify
$ cargo test
running 15 tests
... all pass
References
- docs/fixture-registry.md - Fixture governance
- skills/bdd-scenario-design - Scenario creation
- skills/fixture-validate - Fixture validation
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?