344 lines
9.5 KiB
Markdown
344 lines
9.5 KiB
Markdown
---
|
|
name: acceptance-criteria-generator
|
|
description: Creates testable acceptance criteria in Given/When/Then format for user stories
|
|
allowed-tools: mcp__atlassian__*
|
|
mcpServers:
|
|
- atlassian
|
|
---
|
|
|
|
# Acceptance Criteria Generator Skill
|
|
|
|
This skill generates comprehensive, testable acceptance criteria in Given/When/Then (Gherkin) format for user stories, ensuring clarity for both human reviewers and AI-assisted development.
|
|
|
|
## When This Skill is Invoked
|
|
|
|
Claude will automatically use this skill when you mention:
|
|
- "generate acceptance criteria"
|
|
- "create AC for story"
|
|
- "write acceptance criteria"
|
|
- "add Given/When/Then"
|
|
- "make criteria testable"
|
|
|
|
## Capabilities
|
|
|
|
### 1. AC Structure Generation
|
|
Generate acceptance criteria in standard Gherkin format:
|
|
|
|
```gherkin
|
|
Scenario: [Descriptive scenario name]
|
|
Given [precondition/initial state]
|
|
When [action/trigger]
|
|
Then [expected outcome]
|
|
And [additional outcome]
|
|
```
|
|
|
|
### 2. Coverage Categories
|
|
Ensure comprehensive test coverage:
|
|
|
|
| Category | Description | Example |
|
|
|----------|-------------|---------|
|
|
| Happy Path | Normal successful flow | User completes checkout successfully |
|
|
| Edge Cases | Boundary conditions | Empty cart, max items |
|
|
| Error Handling | Failure scenarios | Invalid input, timeout |
|
|
| Security | Auth/authorization | Unauthorized access attempt |
|
|
| Performance | Non-functional | Response under 2 seconds |
|
|
|
|
## How to Use This Skill
|
|
|
|
### Step 1: Analyze Story Content
|
|
|
|
**Extract testable requirements from story:**
|
|
```
|
|
Story: As a user, I want to export my dashboard to PDF
|
|
|
|
Key Requirements:
|
|
1. User can trigger export
|
|
2. PDF contains dashboard data
|
|
3. Download happens within reasonable time
|
|
4. Error handling for failures
|
|
```
|
|
|
|
### Step 2: Generate Happy Path Scenarios
|
|
|
|
**Start with the primary success scenario:**
|
|
|
|
```gherkin
|
|
Scenario: Successful dashboard export to PDF
|
|
Given I am logged in as a dashboard user
|
|
And I am viewing my dashboard with data
|
|
When I click the "Export to PDF" button
|
|
Then a PDF file should download to my device
|
|
And the PDF should contain the dashboard title
|
|
And the PDF should contain all visible widgets
|
|
And the PDF should include the current date range
|
|
```
|
|
|
|
### Step 3: Generate Edge Case Scenarios
|
|
|
|
**Cover boundary conditions:**
|
|
|
|
```gherkin
|
|
Scenario: Export empty dashboard
|
|
Given I am logged in as a dashboard user
|
|
And my dashboard has no data for the selected period
|
|
When I click the "Export to PDF" button
|
|
Then a PDF file should download
|
|
And the PDF should display "No data available for selected period"
|
|
|
|
Scenario: Export dashboard at maximum data size
|
|
Given I am logged in as a dashboard user
|
|
And my dashboard contains the maximum allowed data points
|
|
When I click the "Export to PDF" button
|
|
Then a PDF file should download within 30 seconds
|
|
And the PDF should contain all data points
|
|
|
|
Scenario: Export with special characters in title
|
|
Given I am logged in as a dashboard user
|
|
And my dashboard title contains special characters "&<>/"
|
|
When I click the "Export to PDF" button
|
|
Then the PDF filename should sanitize special characters
|
|
And the PDF title should display correctly
|
|
```
|
|
|
|
### Step 4: Generate Error Handling Scenarios
|
|
|
|
**Cover failure cases:**
|
|
|
|
```gherkin
|
|
Scenario: Export fails due to network error
|
|
Given I am logged in as a dashboard user
|
|
And the network connection is unstable
|
|
When I click the "Export to PDF" button
|
|
And the export request fails
|
|
Then I should see an error message "Export failed. Please try again."
|
|
And I should be able to retry the export
|
|
|
|
Scenario: Export times out
|
|
Given I am logged in as a dashboard user
|
|
And the server is responding slowly
|
|
When I click the "Export to PDF" button
|
|
And the export takes longer than 60 seconds
|
|
Then I should see a message "Export is taking longer than expected"
|
|
And I should have the option to cancel or continue waiting
|
|
|
|
Scenario: Export fails due to insufficient permissions
|
|
Given I am logged in as a guest user
|
|
And guest users do not have export permissions
|
|
When I click the "Export to PDF" button
|
|
Then I should see a message "You don't have permission to export"
|
|
And the export should not proceed
|
|
```
|
|
|
|
### Step 5: Generate Security Scenarios (if applicable)
|
|
|
|
**Cover security requirements:**
|
|
|
|
```gherkin
|
|
Scenario: Export requires authentication
|
|
Given I am not logged in
|
|
When I attempt to access the export endpoint directly
|
|
Then I should be redirected to the login page
|
|
And the export should not proceed
|
|
|
|
Scenario: User cannot export another user's dashboard
|
|
Given I am logged in as user A
|
|
And I attempt to export user B's dashboard
|
|
When I trigger the export
|
|
Then I should see a "Permission denied" error
|
|
And no PDF should be generated
|
|
```
|
|
|
|
### Step 6: Generate Performance Scenarios (if applicable)
|
|
|
|
**Cover non-functional requirements:**
|
|
|
|
```gherkin
|
|
Scenario: Export completes within acceptable time
|
|
Given I am logged in as a dashboard user
|
|
And my dashboard has typical data volume (500 data points)
|
|
When I click the "Export to PDF" button
|
|
Then the export should complete within 5 seconds
|
|
And the progress indicator should be accurate
|
|
|
|
Scenario: Large export shows progress
|
|
Given I am logged in as a dashboard user
|
|
And my dashboard has large data volume (5000+ data points)
|
|
When I click the "Export to PDF" button
|
|
Then I should see a progress indicator
|
|
And the progress should update at least every 5 seconds
|
|
```
|
|
|
|
### Step 7: Validate AC Quality
|
|
|
|
**Checklist for good acceptance criteria:**
|
|
|
|
- [ ] **Specific:** No ambiguous terms ("should work well")
|
|
- [ ] **Measurable:** Can verify pass/fail objectively
|
|
- [ ] **Testable:** Can be automated or manually verified
|
|
- [ ] **Complete:** Covers happy path, edge cases, errors
|
|
- [ ] **Independent:** Each scenario is self-contained
|
|
- [ ] **Atomic:** One behavior per Then statement
|
|
|
|
**Quality Score:**
|
|
- 6/6: Excellent - Ready for development
|
|
- 4-5/6: Good - Minor improvements needed
|
|
- 2-3/6: Fair - Needs refinement
|
|
- 0-1/6: Poor - Requires rewrite
|
|
|
|
## Output Format
|
|
|
|
Always structure skill output as:
|
|
|
|
```markdown
|
|
# Acceptance Criteria for: [Story Title]
|
|
|
|
## Happy Path Scenarios
|
|
|
|
### Scenario 1: [Primary success case]
|
|
```gherkin
|
|
Given [precondition]
|
|
When [action]
|
|
Then [outcome]
|
|
```
|
|
|
|
### Scenario 2: [Secondary success case]
|
|
...
|
|
|
|
## Edge Case Scenarios
|
|
|
|
### Scenario 3: [Edge case 1]
|
|
...
|
|
|
|
## Error Handling Scenarios
|
|
|
|
### Scenario 4: [Error case 1]
|
|
...
|
|
|
|
## Security Scenarios (if applicable)
|
|
|
|
### Scenario 5: [Security case 1]
|
|
...
|
|
|
|
## Performance Scenarios (if applicable)
|
|
|
|
### Scenario 6: [Performance case 1]
|
|
...
|
|
|
|
---
|
|
|
|
## Quality Assessment
|
|
- **Total Scenarios:** X
|
|
- **Coverage Score:** X/6 categories covered
|
|
- **Testability Score:** X/6 quality criteria met
|
|
|
|
## Recommendations
|
|
- [Any suggestions for additional scenarios]
|
|
```
|
|
|
|
## Common Patterns
|
|
|
|
### CRUD Operations
|
|
```gherkin
|
|
# Create
|
|
Scenario: Successfully create [entity]
|
|
Given I am an authorized user
|
|
When I submit valid [entity] data
|
|
Then the [entity] should be created
|
|
And I should see a success confirmation
|
|
|
|
# Read
|
|
Scenario: View [entity] details
|
|
Given an [entity] exists with ID "123"
|
|
When I navigate to the [entity] detail page
|
|
Then I should see all [entity] information
|
|
|
|
# Update
|
|
Scenario: Update [entity] successfully
|
|
Given an [entity] exists
|
|
And I have edit permissions
|
|
When I modify the [entity] data
|
|
And I save changes
|
|
Then the changes should be persisted
|
|
And I should see an update confirmation
|
|
|
|
# Delete
|
|
Scenario: Delete [entity] with confirmation
|
|
Given an [entity] exists
|
|
And I have delete permissions
|
|
When I click delete
|
|
Then I should see a confirmation dialog
|
|
When I confirm deletion
|
|
Then the [entity] should be removed
|
|
```
|
|
|
|
### Form Validation
|
|
```gherkin
|
|
Scenario: Submit form with missing required field
|
|
Given I am on the [form] page
|
|
And I have not filled in the required [field] field
|
|
When I click submit
|
|
Then I should see a validation error for [field]
|
|
And the form should not be submitted
|
|
|
|
Scenario: Submit form with invalid format
|
|
Given I am on the [form] page
|
|
And I enter "[invalid value]" in the [field] field
|
|
When I click submit
|
|
Then I should see "[field] format is invalid"
|
|
And the form should not be submitted
|
|
```
|
|
|
|
### API Endpoints
|
|
```gherkin
|
|
Scenario: API returns success response
|
|
Given I have a valid API token
|
|
When I send a GET request to /api/[endpoint]
|
|
Then the response status should be 200
|
|
And the response body should contain [expected data]
|
|
|
|
Scenario: API returns 401 for invalid token
|
|
Given I have an invalid API token
|
|
When I send a GET request to /api/[endpoint]
|
|
Then the response status should be 401
|
|
And the response body should contain "Unauthorized"
|
|
```
|
|
|
|
## Error Handling
|
|
|
|
### Incomplete Story
|
|
```markdown
|
|
**Warning:** Story lacks sufficient detail for comprehensive AC.
|
|
|
|
**Missing Information:**
|
|
- [What's missing]
|
|
|
|
**Generated AC:** Partial (happy path only)
|
|
|
|
**Recommendation:** Add more context to story for edge case and error scenarios.
|
|
```
|
|
|
|
### Ambiguous Requirements
|
|
```markdown
|
|
**Warning:** Requirements are ambiguous.
|
|
|
|
**Ambiguous Terms:**
|
|
- "[term]" - could mean [interpretation 1] or [interpretation 2]
|
|
|
|
**Assumptions Made:**
|
|
- Interpreted "[term]" as [chosen interpretation]
|
|
|
|
**Recommendation:** Clarify with stakeholders.
|
|
```
|
|
|
|
## Integration with Other Skills
|
|
|
|
This skill works with:
|
|
- **story-creator**: Receives story to generate AC for
|
|
- **dor-validator**: Validates AC meets DoR requirements
|
|
- **ac-verifier**: Verifies code meets AC during review
|
|
- **test-generator**: Uses AC to generate test cases
|
|
|
|
---
|
|
|
|
When invoked, this skill will analyze the story content and generate comprehensive, testable acceptance criteria suitable for TDD development and automated testing.
|