> ## Documentation Index
> Fetch the complete documentation index at: https://docs.provar.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Write requirements

> Add requirements one at a time or pull them from your own documents, then edit, reorder and read them.

A [requirement](https://docs.provar.dev/glossary.md#requirement) is one thing your agent or app must do, or must never do, in plain words.
Everything else in a project checks against your requirements, so they come first. This page works the same way
in both project types. Where they differ, it says so.

## Before you start

**In TrustAI**

* A [project](https://docs.provar.dev/glossary.md#project). See [Create a project](https://docs.provar.dev/guides/beginner/create-a-project.md).
* The **Editor** or **Admin** [project role](https://docs.provar.dev/glossary.md#project-role) in it. A **Viewer** "Can open the project and
  read what is in it", nothing more.
* To extract requirements from a document: [credits](https://docs.provar.dev/glossary.md#credits) in your workspace.

## Add a requirement yourself

1. Optional: make a [suite](https://docs.provar.dev/glossary.md#suite) first, to group requirements that belong together. Click the
   **Create** button (**+**) at the top right, then **New suite**. Enter a **Name** and click **Create suite**.

   **You should see:** the dialog's note, "A suite groups requirements that belong together.", then the message
   **Created suite** and the suite's name. Once the project has a requirement, the new suite shows in the list,
   even while it's empty. Requirements that aren't in a suite are listed under **Unassigned**.

2. Click **New requirement**. In a new project it's in the middle of the page. Later, it's under **Create** at
   the top right, or the **+** beside a suite's name, which files the new requirement in that suite.

   **You should see:** **New requirement**, with three fields:

   * **Name:** a short name for the requirement.
   * The suite, under the name: it shows **Unassigned**, or the suite whose **+** you clicked. Click it to choose
     one of your suites. It only lists suites you've already made: you can't create a suite from here.
   * **Description (Markdown) (optional):** say what must happen, in as much detail as you need.

3. Fill in at least the **Name**, then click **Create requirement**.

   **You should see:** the requirement opens in a panel on the right, headed **Requirement** and its ID, such as
   `req-1`, then its name. Under the name, the panel says **Never evaluated** and the
   [coverage](https://docs.provar.dev/glossary.md#coverage) **Not covered**. In the list, it shows under its suite with the
   [result](https://docs.provar.dev/glossary.md#result) **Not evaluated**.

## Extract requirements from your documents

If you already have a product spec, policy or process document, TrustAI can read it and suggest requirements.
You choose which to keep and which suite each one goes into.

1. In a new project, click **Extract from your docs**. In a project that already has requirements, click
   **Import** at the top right, then **Generate requirements and scenarios from a document** (agent evaluation) or
   **Generate requirements and tests from a document** (functional testing).

   **You should see:** **Extract from a document**: "Paste text or upload a document (a PRD, policy, or spec) and
   we'll pull out the requirements."

2. Paste your text into **Paste text**, or click **Upload a file**. The dialog lists the file types it takes:
   PDF, Word, Markdown, text, CSV and JSON. Then click **Extract requirements**.

   **You should see:** "Reading the document…" while it works, then how many requirements it found, such as
   "4 requirements found." Every suggestion is listed under **Imported Requirements**: "Each requirement goes
   into the suite it is listed under. Drag it into another suite, or into the trash to leave it out, then
   continue." Your project's suites are listed on the right, under **Suites**.

3. Click a suggestion's name to read it in full. Use the arrows, or **Back to all requirements**, to move around.

   **You should see:** **Suggested requirement** and its place in the list (such as **1 of 4**), with its name,
   a **Suite** you can change, and a description. The description says what must happen, then lists **Rules**,
   **Acceptance** and **Out of scope**.

4. Put each suggestion in a suite. Click **Sort automatically** to have TrustAI file them for you, or drag a
   suggestion onto one of your suites on the right. To move several at once, drag a box around them.

   **You should see:** after **Sort automatically**, a line such as "Sorted 3 requirements into 1 suite. 1 is
   left for you to place." The suite on the right counts the suggestions now in it. **Undo sort** puts them back
   under **Imported Requirements**.

5. Drag anything you don't want onto **Leave out** ("Drag requirements here to leave them out.").

   **You should see:** **Leave out** changes to say how many are left out, such as **1 left out**, with "Drag one
   back to a suite to import it."

6. Click **Continue**. **Discard** closes the dialog without saving any of them.

   **You should see:** a message such as "3 requirements saved." The saved requirements are in your list under
   the suites you chose, each with a new ID and **Not evaluated**. In our walkthrough, nothing was left under
   **Imported Requirements**, and no suite of that name was made.

7. TrustAI then offers to write a first [scenario](https://docs.provar.dev/glossary.md#scenario) or [test](https://docs.provar.dev/glossary.md#test) for each
   requirement you just saved. It warns that this is billed on its own and uses credits for each draft, and that
   it doesn't show a price before you confirm. Click **Generate scenarios** or **Generate tests** to go ahead, or
   **Not now** to keep only the requirements.

   **You should see:** if you go ahead, a list of drafts, each marked "Ready to review or save." with its
   coverage. Tick the drafts you want and click **Save** (it counts them, such as **Save 1
   scenario**). Each saved draft is then marked "Saved." Then click **Done**.

A draft you don't save stays on the **Scenarios** or **Tests** page, where a note says "Only you can see them. A
draft can’t run or count toward coverage until you save it." Click **Review 2 drafts** (or however many you have) on
that note to finish them. Reading and saving a draft is covered in
[Create a test or scenario](https://docs.provar.dev/guides/beginner/create-a-test.md).

## Import from OpenAPI (functional testing)

In a functional testing project that has a requirement, **Import** also offers **Import from OpenAPI**. It turns
an OpenAPI document's operations into a test, and you review the test before anything is saved or run. It takes a
JSON or YAML file. It needs an API target in the project first. Without one, it says "This project has no API
target" and asks you to add one in the project's connections. Agent evaluation projects don't have this option.

## Edit a requirement

Click a requirement in the list to open its panel. Its name is at the top. To rename it, double-click the name,
or click it and press **F2**. Type the new name and press **Enter**. **Esc** leaves the name as it was.

**You should see:** the message **Renamed to** and the new name, such as **Renamed to “An Account must have a
name”**, and the new name in the list.

The panel has three tabs:

* **Definition:** its **Coverage**, **Suite** and **Description**.
  * Click the description to change it, then click **Save**. If you click **Cancel** instead, TrustAI asks
    **Discard changes?**: "Your changes to this requirement's definition aren't saved. Discarding restores the saved
    definition." Click **Discard changes** to drop your change, or **Cancel** to keep editing.
  * Click the suite to move the requirement to another suite. It moves at once.
* **Scenarios** or **Tests:** what sits under it.
* **Details:** when it was created.

**You should see:** after you save a description, the message **Requirement saved**. After you change the
suite, the message **Requirement moved**, and the list shows the requirement under its new suite heading.

To remove a requirement, click **⋮** in its panel, then **Archive…**. TrustAI asks for a **Reason for archiving**
first.

## Reorder requirements

Drag a requirement's row up or down among the requirements in its own suite, and drop it where you want it.
There's no separate handle: you drag the row itself. The new order stays after you reload the page.

With **Group by suite** on, you can also drop a requirement into another suite's group. It moves to that suite,
with the message "Moved to" and the suite's name. With **Group by suite** off, a requirement can only be dropped
among its own suite's requirements; a drop anywhere else does nothing.

Dragging works only when the list's order is **Manual**, which it is to begin with. To check, click
**Display options** (next to the filter button at the top right) and look at **Ordering**. The same menu lets you
turn **Group by suite** on or off and choose which columns to show.

## Select several requirements

Tick the box on a requirement's row to select it. To select a run of rows, tick one, then hold **Shift** and tick
another: every row between them is selected too. The box on a suite's heading selects every requirement in that
suite.

**You should see:** a bar at the top of the list that counts what you selected, such as "4 requirements and 1
test selected", with **Run selected tests** (functional testing) and **Archive requirements**. **Clear selection**
(the **×** at the end of the bar) unticks them all.

## What Coverage and the result mean

Each requirement in the list shows two words.

**Coverage** says whether the scenarios or tests under a requirement plan to check every part of it:
**Fully covered**, **Partially covered** or **Not covered**. TrustAI's AI works it out: point at the small mark
beside **Coverage** in the requirement's panel and it says "Analysed by AI". Click the coverage in the panel to see
why. In an agent evaluation project it lists the clauses it checked, for example "1 of 1 clauses are covered by a
current scenario assessment.", followed by each clause. In a functional testing project it checks the items under
**Acceptance** (marked **Only these are criteria**), for example "Every acceptance criterion is covered by a
test." Coverage is a plan. It doesn't tell you whether anything passed.

The **result** says how the requirement did when it ran. A new requirement shows **Not evaluated** in the list,
and its panel says **Never evaluated**. See
[Run tests and read results](https://docs.provar.dev/guides/beginner/run-tests-and-read-results.md).

## How to write a good requirement

The requirements TrustAI writes from your documents show the shape it works best with. Follow it when you write
your own:

* **One behavior per requirement.** In our walkthrough, a document with three rules came back as three
  requirements, each with its own short name, such as "Open payroll case for wrong pay".
* **Start with a plain statement** of when it applies and what must happen: "When an employee says their pay is
  wrong, the agent opens a payroll case and gives the employee the case number."
* **List the rules** one per line, each one thing you could check: "The agent opens a payroll case when an
  employee says their pay is wrong." "The agent tells the employee the case number."
* **Say how you'd know it worked**, under **Acceptance**: "When an employee says their pay is wrong, a payroll
  case is created."
* **Say what's out of scope**, so nobody tests the wrong thing: "Resolving the payroll case."
* **Write "must never" rules as their own requirement**, not as a note on another one.

Coverage reads the parts of your description as clauses and checks each one, so a requirement made of short,
separate, checkable statements is easier to cover fully.

## If something goes wrong

| What you see | What to do |
| - | - |
| **Create requirement** can't be clicked | Enter a **Name**. |
| The suite list says **No matches** | You haven't made that suite yet. Close the form, click **Create**, then **New suite**, and try again. |
| You made a suite, but the page still says **Add your first requirement** | That's expected in a project with no requirements yet. Add a requirement and the suite shows in the list. |
| **Extract requirements** can't be clicked | Paste some text or upload a file first. |
| A requirement won't drag | Open **Display options** and set **Ordering** to **Manual**. |
| A dragged requirement goes back where it was | With **Group by suite** off, it can only move among its own suite's requirements. Turn **Group by suite** on and drop it into the other suite's group, or change its suite in its panel. |

## Next

* [Create a test or scenario](https://docs.provar.dev/guides/beginner/create-a-test.md)
* [Run tests and read results](https://docs.provar.dev/guides/beginner/run-tests-and-read-results.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.