@tpmjs/tools-acceptance-criteria
Format acceptance criteria from requirements using the Given/When/Then (Gherkin) format. Ideal for defining testable requirements for user stories and features in BDD style.
Criteria array must contain at least one criterion
Last checked: 1/1/2026, 8:18:34 AM
Test @tpmjs/tools-acceptance-criteria (acceptanceCriteriaTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-acceptance-criteriapnpm add @tpmjs/tools-acceptance-criteriayarn add @tpmjs/tools-acceptance-criteriabun add @tpmjs/tools-acceptance-criteriadeno add npm:@tpmjs/tools-acceptance-criteriaimport { acceptanceCriteriaTool } from '@tpmjs/tools-acceptance-criteria';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { acceptanceCriteriaTool } from '@tpmjs/tools-acceptance-criteria';
const result = await generateText({
model: openai('gpt-4o'),
tools: { acceptanceCriteriaTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
storystringThe user story or feature description
criteriaarrayArray of criteria objects, each with given, when, and then properties following Gherkin format
Schema extracted: 1/1/2026, 8:18:34 AM
Format acceptance criteria from requirements using Given/When/Then (Gherkin) format.
npm install @tpmjs/tools-acceptance-criteria
import { acceptanceCriteriaTool } from '@tpmjs/tools-acceptance-criteria'; const result = await acceptanceCriteriaTool.execute({ story: `As a user, I want to reset my password so that I can regain access to my account if I forget my credentials.`, criteria: [ { given: 'I am on the login page', when: 'I click "Forgot Password"', then: 'I should see a password reset form', }, { given: 'I have entered my email address', when: 'I submit the password reset form', then: 'I should receive a password reset email', }, { given: 'I have clicked the reset link in my email', when: 'I enter a new password and confirm it', then: 'my password should be updated and I should be logged in', }, ], }); console.log(result.formatted); // # Acceptance Criteria // // ## As a user, I want to reset my password so that I can regain access to my account // // As a user, I want to reset my password so that I can regain access to my account // if I forget my credentials. // // --- // // ## Scenarios // // ### Scenario 1 // // **Given** I am on the login page // **When** I click "Forgot Password" // **Then** I should see a password reset form // // ### Scenario 2 // // **Given** I have entered my email address // **When** I submit the password reset form // **Then** I should receive a password reset email // // ### Scenario 3 // // **Given** I have clicked the reset link in my email // **When** I enter a new password and confirm it // **Then** my password should be updated and I should be logged in console.log(result.criteriaCount); // 3
acceptanceCriteriaTool.execute(input)Formats acceptance criteria using the Given/When/Then (Gherkin) format.
story (string, required): The user story or feature descriptioncriteria (Criterion[], required): Array of criteria objects with:
given (string): The initial context or preconditionwhen (string): The action or event that occursthen (string): The expected outcome or resultReturns a Promise<AcceptanceCriteria> with:
formatted (string): The formatted acceptance criteria in markdowncriteriaCount (number): Number of scenarios includedEach criterion follows the Gherkin format:
This structure makes requirements:
The formatted output works well with BDD frameworks like:
Simply copy the scenarios into your .feature files.
MIT
Downloads/month
0
Quality Score