requirementbot 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -2
  3. package/bin/requirementbot.js +21 -0
  4. package/package.json +53 -4
  5. package/prompts/README.md +18 -0
  6. package/prompts/check.md +15 -0
  7. package/prompts/fix.md +4 -0
  8. package/prompts/from-code.md +12 -0
  9. package/prompts/from-docs.md +11 -0
  10. package/prompts/from-issues.md +14 -0
  11. package/prompts/mdq.md +8 -0
  12. package/prompts/partials/non-interactive.md +1 -0
  13. package/prompts/partials/subagents.md +1 -0
  14. package/prompts/report.md +8 -0
  15. package/prompts/system.md +9 -0
  16. package/skills/SOURCE.md +14 -0
  17. package/skills/catalog-features/SKILL.md +168 -0
  18. package/skills/catalog-features/references/layout.md +87 -0
  19. package/skills/detect-product-mismatches/SKILL.md +147 -0
  20. package/skills/detect-product-mismatches/references/features.md +84 -0
  21. package/skills/detect-product-mismatches/references/layout.md +99 -0
  22. package/skills/pull-request-diff-analyzer/SKILL.md +141 -0
  23. package/skills/qa-explain-behavior/SKILL.md +112 -0
  24. package/skills/qa-explain-behavior/references/answer-shapes.md +116 -0
  25. package/skills/qa-explain-behavior/references/examples.md +157 -0
  26. package/skills/qa-pr-requirements-analyzer/SKILL.md +149 -0
  27. package/skills/qa-pr-requirements-analyzer/references/summary-example.md +54 -0
  28. package/skills/qa-requirement-reviewer/SKILL.md +126 -0
  29. package/skills/qa-requirement-reviewer/references/requirements_reviewer_examples.md +128 -0
  30. package/skills/qa-thinking/SKILL.md +46 -0
  31. package/skills/requirements-from-code/SKILL.md +114 -0
  32. package/skills/requirements-from-code/references/behaviors.md +42 -0
  33. package/skills/requirements-from-code/references/layout.md +100 -0
  34. package/skills/requirements-from-expected/SKILL.md +116 -0
  35. package/skills/requirements-from-expected/references/behaviors.md +49 -0
  36. package/skills/requirements-from-expected/references/layout.md +74 -0
  37. package/skills/requirements-from-expected/references/merge.md +34 -0
  38. package/skills/write-user-story/SKILL.md +42 -0
  39. package/src/agent/agent.js +278 -0
  40. package/src/agent/auth.js +209 -0
  41. package/src/agent/prompt.js +36 -0
  42. package/src/branding.js +27 -0
  43. package/src/cli.js +26 -0
  44. package/src/commands/agent-command.js +61 -0
  45. package/src/commands/check.js +26 -0
  46. package/src/commands/command.js +40 -0
  47. package/src/commands/connect.js +33 -0
  48. package/src/commands/disconnect.js +18 -0
  49. package/src/commands/generate-from-code.js +20 -0
  50. package/src/commands/generate-from-docs.js +38 -0
  51. package/src/commands/generate-from-issues.js +41 -0
  52. package/src/commands/index.js +40 -0
  53. package/src/commands/login.js +44 -0
  54. package/src/commands/logout.js +17 -0
  55. package/src/commands/models.js +11 -0
  56. package/src/commands/pull.js +15 -0
  57. package/src/commands/push.js +29 -0
  58. package/src/commands/query.js +31 -0
  59. package/src/commands/report.js +23 -0
  60. package/src/commands/skills.js +20 -0
  61. package/src/commands/sources.js +16 -0
  62. package/src/commands/update-from-code.js +7 -0
  63. package/src/commands/update-from-docs.js +7 -0
  64. package/src/commands/update-from-issues.js +7 -0
  65. package/src/config.js +90 -0
  66. package/src/files.js +25 -0
  67. package/src/github.js +50 -0
  68. package/src/http.js +19 -0
  69. package/src/requirements.js +139 -0
  70. package/src/sources/adf.js +48 -0
  71. package/src/sources/github.js +81 -0
  72. package/src/sources/index.js +41 -0
  73. package/src/sources/jira.js +135 -0
  74. package/src/sources/pages.js +67 -0
  75. package/src/sources/source.js +60 -0
  76. package/src/transports/confluence.js +114 -0
  77. package/src/transports/git.js +90 -0
  78. package/src/transports/github.js +42 -0
  79. package/src/transports/index.js +36 -0
  80. package/src/transports/notion.js +108 -0
  81. package/src/transports/page-tree.js +119 -0
  82. package/src/transports/transport.js +41 -0
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: qa-requirement-reviewer
3
+ description: Review requirements before development. Identify ambiguity, missing information, contradictions, unclear acceptance criteria, logical gaps, edge cases, and testability issues. Determine whether the requirements are sufficiently clear for development and QA. Use this skill when a user provides requirements (BRD, user story, use case, feature ticket, specification, or prose) and asks for feedback, validation, review, or readiness assessment before implementation.
4
+ license: MIT
5
+ metadata:
6
+ author: Testomat.io
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # QA Requirement Reviewer
11
+
12
+ Review requirements as written. Report issues, gaps, risks, and open questions so stakeholders can decide whether the requirements are ready for development and testing.
13
+
14
+ Rules:
15
+ - **Work with the input as-is — do not rewrite it.**
16
+ - **Do not make assumptions or silently fill in missing information.**
17
+ - Suggest improved wording or acceptance criteria where useful.
18
+ - **Suggested improvements must not hide missing information or assumptions.**
19
+ - Accept any format: BRD, user story, use case, feature ticket, specification, acceptance criteria, email, or free-form text.
20
+
21
+ ## Review Criteria
22
+
23
+ Evaluate each requirement against:
24
+
25
+ | Criterion | What it means | Failure signals |
26
+ | -------------- | ------------------------- | --------------- |
27
+ | **Atomic** | Describes a single behavior, rule, or capability | Multiple behaviors combined in one requirement; difficult to verify independently |
28
+ | **Clear** | Meaning is understandable and specific | Vague language, undefined terms, subjective wording, multiple possible interpretations |
29
+ | **Complete** | Contains enough information for implementation and testing | Missing business rules, acceptance criteria, inputs, outputs, error handling, or edge cases |
30
+ | **Consistent** | Does not conflict with related requirements | Contradictory behavior, terminology, workflows, rules, or constraints |
31
+ | **Testable** | Can be objectively verified | No measurable outcome, unclear success criteria, impossible to determine pass or fail |
32
+
33
+ ## Workflow
34
+
35
+ ### Step 1: Gather Requirements
36
+
37
+ Accept requirements as:
38
+ - A document or file.
39
+ - A directory, repository, or collection of documents and files.
40
+ - Raw text provided in the conversation.
41
+
42
+ If the requirements are incomplete, inaccessible, or unclear, ask the user for clarification.
43
+
44
+ ### Step 2: Identify Requirements
45
+
46
+ - Identify individual requirements, rules, behaviors, and acceptance criteria.
47
+ - Assign identifiers where helpful (`R1`, `R2`, ...), or reuse existing IDs.
48
+ - Separate requirements from background, rationale, implementation details, and design discussion.
49
+
50
+ ### Step 3: Review Each Requirement
51
+
52
+ Evaluate each requirement against the review criteria. For each issue found:
53
+ 1. Identify the affected requirement.
54
+ 2. Explain the issue and its consequence.
55
+ 3. Classify it (clarity, completeness, consistency, testability, etc.).
56
+ 4. Ask the clarification question needed to resolve it.
57
+ 5. Optionally suggest improved wording.
58
+
59
+ ### Step 4: Review the Requirement Set
60
+
61
+ Evaluate the requirements as a whole for:
62
+ - Missing requirements, scenarios, or business rules.
63
+ - Missing acceptance criteria or expected outcomes.
64
+ - Missing actors, roles, states, dependencies, or constraints.
65
+ - Missing edge cases, alternative flows, or error conditions.
66
+ - Contradictions, overlaps, or inconsistencies between requirements.
67
+
68
+ ### Step 5: Produce the Review Report
69
+
70
+ Use this exact structure:
71
+
72
+ ```markdown
73
+ ## Requirements Review
74
+
75
+ ### Readiness Assessment
76
+
77
+ **Decision:** ✅ Ready for Development | ⚠️ Needs Clarification | ❌ Not Ready
78
+
79
+ **Summary:** ... (Brief assessment of overall requirement quality and readiness. 1-3 sentence verdict)
80
+
81
+ ### Key Findings
82
+
83
+ | Requirement | Issue Type | Finding | Question / Recommendation |
84
+ | ----------- | ------------ | ------- | ------------------------- |
85
+ | R1 | Completeness | ... | ... |
86
+ | R2 | Clarity | ... | ... |
87
+
88
+ (**Consolidation "Key Findings" table rule:** When multiple findings share the same "Issue Type" for one requirement, use numbered lists within Finding and Question/Recommendation columns to match issues by number (e.g., `1. Finding 1 2. Finding 2 | 1. Question 1 2. Question 2`). This avoids duplicate rows and keeps the table compact while preserving 1:1 correspondence)
89
+
90
+ ### Ambiguities & Open Questions
91
+
92
+ * ...
93
+ * ...
94
+
95
+ (Bullet list of Questions that should be answered before approval, implementation, or testing)
96
+
97
+ ### Gaps & Issues
98
+
99
+ * ...
100
+ * ...
101
+
102
+ (Missing information, scenarios, business rules, constraints, dependencies, edge cases, or error conditions)
103
+
104
+ ### Acceptance Criteria Review (optional)
105
+
106
+ * Assess whether acceptance criteria are clear, complete, and testable.
107
+ * Identify missing acceptance criteria where needed.
108
+
109
+ (Include **only if acceptance criteria exist** or are expected)
110
+
111
+ ### Risks & Impact
112
+
113
+ * ...
114
+ * ...
115
+
116
+ (Potential consequences of proceeding without clarification).
117
+
118
+ ### Recommendation
119
+
120
+ ... (Recommended next action before approval or implementation)
121
+
122
+ ```
123
+
124
+ ## Examples
125
+
126
+ See `references/requirements_reviewer_examples.md` for two worked examples: a flawed draft BRD and a set of user stories, each with input and review output.
@@ -0,0 +1,128 @@
1
+ # Requirements Review — Examples
2
+
3
+ A small, deliberately flawed draft — the kind of thing that lands in review — turned into a requirements review. The input has loose structure and mixed quality; the review works with it as-is and does not rewrite it.
4
+
5
+ ## Example 1: Draft BRD
6
+
7
+ ### Input (draft BRD excerpt)
8
+
9
+ ```
10
+ Search Feature — Business Requirements (draft)
11
+
12
+ 1. The search must be fast and return relevant results.
13
+ 2. Users can search by keyword and filter by date, and results should be exportable.
14
+ 3. The system should handle a large number of users.
15
+ 4. Search results are stored for reporting.
16
+ ```
17
+
18
+ ### Output
19
+
20
+ ```markdown
21
+ ## Requirements Review
22
+
23
+ ### Readiness Assessment
24
+
25
+ **Decision:** ❌ Not Ready
26
+
27
+ **Summary:** None of the four requirements is testable as written. R1 lacks a measurable threshold, R2 bundles three separate behaviors, and the set has no error-path coverage or acceptance criteria.
28
+
29
+ ### Key Findings
30
+
31
+ | Requirement | Issue Type | Finding | Question / Recommendation |
32
+ | ----------- | ------------ | ------- | ------------------------- |
33
+ | R1 | Testability | "fast" has no measurable threshold | What is the maximum acceptable response time, and at what data volume? |
34
+ | R2 | Atomicity | Three behaviors combined (search, filter, export) | Split into separate requirements for keyword search, date filter, and export |
35
+ | R3 | Clarity | "large number of users" is undefined | What concurrent-user count must search support? |
36
+ | R4 | Completeness | Storage scope and retention not defined | What exactly is stored, for how long, and who can see it? |
37
+
38
+ ### Ambiguities & Open Questions
39
+
40
+ * R1: What is the maximum acceptable response time, and at what data volume?
41
+ * R2: Should this be three separate requirements (keyword search, date filter, export)?
42
+ * R3: What concurrent-user count must search support?
43
+ * R4: What exactly is stored, for how long, and who can see it?
44
+
45
+ ### Gaps & Issues
46
+
47
+ * R1: No measurable threshold for "fast"
48
+ * R2: Compound requirement — three behaviors cannot pass/fail independently
49
+ * R3: "Large number of users" has no target
50
+ * R4: Storage scope and retention not defined
51
+ * No error-state or empty-state behavior defined across all requirements
52
+
53
+ ### Acceptance Criteria Review
54
+
55
+ No acceptance criteria found. Suggest:
56
+ - Response time: Search should return results within 1 second for queries under 50 characters
57
+ - Recall: Top results match expected set for known queries
58
+ - Empty state: Display "No results found" message when search returns zero matches
59
+ - Error state: Handle special characters and empty queries gracefully
60
+
61
+ ### Risks & Impact
62
+
63
+ * Implementation risk: Medium — ambiguous performance targets may lead to rework
64
+ * Testing risk: High — no measurable acceptance criteria blocks test case design
65
+ * Business impact risk: Low — core functionality is defined but not verifiable
66
+
67
+ ### Recommendation
68
+
69
+ Resolve all open questions before approval. Add measurable acceptance criteria to each requirement. Split compound requirement R2 into atomic requirements.
70
+ ```
71
+
72
+ ## Example 2: User Stories
73
+
74
+ ### Input (user stories)
75
+
76
+ ```
77
+ As a user, I want to search for products by name so I can find what I'm looking for.
78
+ As a user, I want to filter search results by category so I can narrow down choices.
79
+ As a user, I want to export search results to PDF so I can share them with others.
80
+ ```
81
+
82
+ ### Output
83
+
84
+ ```markdown
85
+ ## Requirements Review
86
+
87
+ ### Readiness Assessment
88
+
89
+ **Decision:** ⚠️ Needs Clarification
90
+
91
+ **Summary:** Stories are well-structured and pass most criteria. Minor clarification needed on export scope and empty-state behavior before approval.
92
+
93
+ ### Key Findings
94
+
95
+ | Requirement | Issue Type | Finding | Question / Recommendation |
96
+ | ----------- | ------------ | ------- | ------------------------- |
97
+ | US1 | Completeness | 1. No empty-state behavior defined | 1. What should the user see when search returns zero results? |
98
+ | US2 | Completeness | 1. No error-state behavior defined | 1. How are invalid filter values handled? |
99
+ | US3 | Clarity | 1. Export scope and format not fully specified | 1. Should export include current page or full result set? |
100
+
101
+ ### Ambiguities & Open Questions
102
+
103
+ * Export: Which format(s) — PDF only? What content — current page or full result set?
104
+ * Empty search results: What should the user see?
105
+ * Invalid input (special characters, empty query): How is this handled?
106
+
107
+ ### Gaps & Issues
108
+
109
+ * No error-state or empty-state behavior defined across all stories
110
+ * Export: scope (page vs all results) and format not specified
111
+
112
+ ### Acceptance Criteria Review
113
+
114
+ No formal acceptance criteria present. Suggest:
115
+ - Search returns results within 500ms for queries under 50 characters
116
+ - Filter reduces result set to only matching category
117
+ - Export produces valid PDF containing full result set (or specify page vs all)
118
+
119
+ ### Risks & Impact
120
+
121
+ * Implementation risk: Low — stories are independent and estimable
122
+ * Testing risk: Medium — export scope ambiguity may cause rework
123
+ * Business impact risk: Low — core search value is clear
124
+
125
+ ### Recommendation
126
+
127
+ Clarify export scope and add empty-state acceptance criteria. Otherwise ready for sprint planning.
128
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: qa-thinking
3
+ description: Analyze a feature a developer is building from a QA perspective — edge cases, negative flows, abuses, unobvious scenarios. Use when asked "what could go wrong?", "what am I missing?", or "review this as QA".
4
+ ---
5
+
6
+ # QA Thinking
7
+
8
+ Think about a feature like a senior QA engineer and surface risk scenarios.
9
+ Explain these risks to a developer who implements this feature
10
+ You are provided either with a feature specification or implementation
11
+ You must provide a critical review of it from QA perspective and ask clarifying questions
12
+ The user can explain the idea, or take it from the current branch or PR.
13
+ For a PR, gather intent with the `qa-pr-requirements-analyzer` skill first.
14
+ When the feature's current behavior is unclear, establish it with the `qa-explain-behavior` skill first.
15
+
16
+ ## Think as QA
17
+
18
+ - What is this feature is about
19
+ - How does it align with exiting features, common project patterns, business intends
20
+ - Is there already implemented a similar pattern in codebase (aren't we duplicating existing behavior)
21
+ - Negative scenarios: possible misuse and failures.
22
+ - Unobvious usage: edge cases, boundary values, cancellations during executions.
23
+ - Combinations: how this feature interacts with other features.
24
+ - Security vulnerabilities.
25
+
26
+ ## Output
27
+
28
+ Only requested section named exactly the way we provide
29
+ Information in section written as numbered lists
30
+
31
+ Requested sections:
32
+
33
+
34
+ - Section `👷 Must be aknowledged`: brief summary in bullet points. Potential correlation with other areas. Potential risks
35
+ - Section `👓 Must be clarified`: up to 5 questions to resolve important ambiguities. Start each with "What if".
36
+ - Section `🔬 Must be verified`: up to 5 most important risk scenarios, no more.
37
+ - Prefer simple wording and short sentences.
38
+
39
+ ## Next actions
40
+
41
+ Offer after the analysis:
42
+
43
+ - Draft missing or unclear user stories → `write-user-story` skill.
44
+ - Split the scenarios across testing levels → `qa-split-testing-levels-pyramid` skill.
45
+ - Turn scenarios into test cases or a checklist → `qa-write-test-cases` skill.
46
+ - Ambiguities point to requirement defects → `qa-requirement-reviewer` skill.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: requirements-from-code
3
+ description: >-
4
+ Builds product requirements from the application source code or updates them after large code changes (release, refactor, many merged PRs).
5
+ Records mismatches between code and claims about it (comments, docstrings, developer docs, API specs, configs).
6
+ Use when the user asks to build or update the requirements/wiki/specification/docs from code.
7
+ metadata:
8
+ author: Testomat.io
9
+ version: 2.0.0
10
+ ---
11
+
12
+ # Requirements from code
13
+
14
+ Requirements of **how the product works now**: one page per feature, listing its behaviors, and mismatches between the code and other repo claims.
15
+
16
+ Output folder: `requirements/actual/{source-name}/`
17
+ - `actual` is a strict name: the requirements are always a `{source-name}` folder inside `requirements/actual/`, never anywhere else
18
+ - `requirements/` is in the repo root, or given by calling skill or the user; `{source-name}` is the repository name, or given the same way
19
+ - all paths are relative inside the output folder
20
+ - if there is `wiki/` dir (the old default) → move it to the output folder
21
+ - if there is `features-catalog/` dir → move it to `features/.catalog/`
22
+
23
+ **Mismatch** is a disagreement between code and a claim about it (comment, docstring, developer docs, API spec, config, infra, test). They could differ, be not implemented, not used, etc.
24
+
25
+ ## Modes
26
+
27
+ | Mode | When |
28
+ | -------- | ----------------------------------------------------------------------------------------- |
29
+ | `build` | No `features/` or baseline in the output `README.md`, no git, or the user asks to rebuild |
30
+ | `update` | `features/` and baseline exist: change only what the code changed since the baseline |
31
+
32
+ ## Steps
33
+
34
+ ```
35
+ - [ ] 1. Catalog
36
+ - [ ] 2. Indexes
37
+ - [ ] 3. Feature pages (one subagent per area)
38
+ - [ ] 4. Merge
39
+ - [ ] 5. Validate
40
+ - [ ] 6. Report
41
+ ```
42
+
43
+ Read [references/behaviors.md](references/behaviors.md) and [references/layout.md](references/layout.md) before writing files.
44
+
45
+ ## Rules
46
+
47
+ - Source is the repository only.
48
+ - **Current-state code wins** over claims (comments, docstrings, developer docs, API specs, configs, tests, etc.). What they claim that the code lacks or does differently goes in `mismatches/` only, never as a "should" on a feature page.
49
+ - Write only paths that exist in the repo. Never guess or build them.
50
+ - Name areas and features from the product and user's perspective, NOT from the code/stack/files/classes/etc.
51
+ - Domain terms (prefer the docs' terms), one term per concept across the requirements.
52
+ - Update catalog file names and content as you get more info about the features.
53
+ - Treat and describe features as end-to-end flows or use cases, not just "actions" from code.
54
+
55
+ ## 1. Catalog
56
+
57
+ Run `catalog-features` skill on the repo: same mode, role Actual, source folder = this output folder (the catalog goes to `features/.catalog/`).
58
+
59
+ `update`: get the baseline commit > `git diff --name-status -M {baseline}..HEAD` > process updated/removed files accordingly.
60
+
61
+ ## 2. Indexes
62
+
63
+ Write the `features/` indexes before any feature page.
64
+
65
+ [layout.md](references/layout.md)
66
+
67
+ ## 3. Feature pages
68
+
69
+ One subagent per area, in parallel (`update`: affected areas only). Each subagent gets: the area, its subareas and catalog features (feature YAMLs), allowed code paths, the Domain from `features/.catalog/README.md`, the rules above, [references/behaviors.md](references/behaviors.md), [references/layout.md](references/layout.md). `update` also: the area's existing pages and mismatches, and its changed features.
70
+
71
+ Subagent, per feature, starting from its catalog links:
72
+
73
+ 1. In its catalog feature YAML: adds implementation files to `code`, and adds `tests`.
74
+ 2. Writes the feature page ([layout.md](references/layout.md) › Feature page): Description, then Behaviors ([behaviors.md](references/behaviors.md)).
75
+ 3. Returns one mismatch per disagreement: its kind and every section of a mismatch page ([layout.md](references/layout.md) › Mismatches).
76
+
77
+ Subagent writes only inside its area, in `features/` and `features/.catalog/`. Catalog features found missing, misnamed, or misplaced → fix them in the area's catalog files. Anything outside the area (mismatch pages, catalog README, other areas) → return it.
78
+
79
+ Subagent returns: files added, changed, and removed; mismatches (`update`: also resolved ones); changes outside its area; open questions; catalog errors; terms the Domain lacks.
80
+
81
+ ## 4. Merge
82
+
83
+ 1. Apply the changes subagents returned outside their areas, including links to renamed or moved pages. Terms the Domain lacks → add to the Domain in `features/.catalog/README.md`.
84
+ 2. Update every `README.md` in `features/` to list the feature pages that now exist. Write the output `README.md`: a summary of the repo, a link and purpose for each folder (not `.catalog/`), plus the baseline commit.
85
+ 3. Write the mismatch pages subagents returned. Same disagreement from several areas → one mismatch page.
86
+ 4. Two terms for one concept → keep one, fix the pages that use the other.
87
+ 5. `update`: remove resolved mismatches.
88
+ 6. In `mismatches/README.md`, write the mismatches list ([layout.md](references/layout.md) › Mismatches).
89
+ 7. Add a link and purpose for these requirements to the index `requirements/README.md`, when missing.
90
+
91
+ ## 5. Validate
92
+
93
+ ```markdown
94
+ Structure
95
+ - [ ] Output folder is `requirements/actual/{source-name}/`
96
+ - [ ] Output README.md is a summary and sitemap with the baseline commit
97
+ - [ ] Every catalog feature has a feature page, and its feature YAML lists the rest of its implementation files in `code` and its tests in `tests`; `features/` mirrors the catalog's areas and subareas
98
+ - [ ] Every `links`, `code`, and `tests` path exists in the repo
99
+
100
+ Content
101
+ - [ ] Every feature page has a Description and at least one behavior under Behaviors; every behavior passes the check in [references/behaviors.md](references/behaviors.md)
102
+ - [ ] Every disagreement between code and claims has a mismatch page
103
+ - [ ] update: resolved mismatches removed; nothing left for deleted code
104
+ ```
105
+
106
+ ## 6. Report
107
+
108
+ Where to start. Results (`update`: features added, changed, removed). Mismatches by kind, highest user impact first. Catalog errors. Open questions.
109
+
110
+ ## Next actions
111
+
112
+ - Compare with issues, requirements, user docs → `detect-product-mismatches`
113
+ - Explain a feature in QA language → `qa-explain-behavior`
114
+ - Test cases for a feature → `qa-write-test-cases`
@@ -0,0 +1,42 @@
1
+ # Behaviors
2
+
3
+ A behavior is one observable statement about how the product works now: what someone who uses it (end user, admin, API client, integrated system) can do, see, or get, and when. Feature pages list them under Behaviors.
4
+
5
+ ## From code
6
+
7
+ - Code that runs now and users can reach. Behind a flag or setting that can be turned on → a behavior with that condition.
8
+ - Comments, docstrings, developer docs, API specs, configs, and tests are claims, not behaviors. Where they disagree with the code → `mismatches/`.
9
+ - Never a behavior: internal steps with no visible effect (caching, logging, internal retries), refactoring, helpers.
10
+
11
+ ## Shape
12
+
13
+ - One behavior per bullet, one sentence, present tense.
14
+ - No `should`, `shall`, `must`, `will`: state it as a fact, present tense.
15
+ - Name who acts or what changes, in domain terms. Never "the system", "it", or "we".
16
+ - Outcome is what the actor can observe (screen, response, file, email, notification), not how the code gets there.
17
+ - Conditions stay in the behavior: role, platform, setting, state.
18
+ - Negative behaviors count: `Viewer cannot delete a project.`
19
+ - Split on "and" when each part can be checked on its own.
20
+
21
+ ## Values and words
22
+
23
+ - Exact values from the code that runs: limits, defaults, timeouts, sizes, formats.
24
+ - A value read from config or environment: its default, marked `(configurable)`.
25
+ - UI labels and messages verbatim, in quotes; navigation paths with `›`.
26
+ - No class, function, table, file, flag, or library names. Protocol details (endpoints, status codes, fields) only when the API is what users use.
27
+
28
+ ## Examples
29
+
30
+ | Code | Behavior |
31
+ | --------------------------------------------------- | ------------------------------------------------------------ |
32
+ | `if (cards.length >= 5) throw new CardLimitError()` | `Customer can save up to 5 cards.` |
33
+ | `IDLE_TIMEOUT = env.IDLE_TIMEOUT ?? 1800` (seconds) | `Session expires after 30 min of inactivity (configurable).` |
34
+ | `cache.set(user_id, cards)` | Not a behavior: no visible effect |
35
+
36
+ ## Check
37
+
38
+ - [ ] Every reachable behavior in the feature's code is listed
39
+ - [ ] One observable behavior per bullet, present tense, who or what named
40
+ - [ ] Exact values from the code; config values marked `(configurable)`
41
+ - [ ] Domain terms; no stack names unless the API is what users use
42
+ - [ ] No internal steps; nothing taken from comments, docs, or tests
@@ -0,0 +1,100 @@
1
+ # Requirements layout
2
+
3
+ `features/` mirrors `features/.catalog/`: same areas and subareas, one feature page per catalog feature. Every folder has a README. Tree may be updated while the requirements are built.
4
+
5
+
6
+ ```
7
+ requirements/
8
+ README.md # index: every source folder, mismatches
9
+ actual/ # strict name: how it works now
10
+ {source-name}/ # output folder: this repo's source folder
11
+ README.md # summary, sitemap, baseline commit
12
+ features/
13
+ README.md # areas
14
+ .catalog/ # internal: code catalog (catalog-features)
15
+ {area}/ # any depth, as in the catalog
16
+ README.md # subareas and features
17
+ {feature}.md # feature page
18
+ {subarea}/ # as in the catalog
19
+ README.md # subareas and features
20
+ {feature}.md # feature page
21
+ mismatches/ # code vs claims in this repo
22
+ README.md # index
23
+ {mismatch}.md # one behavior, every source that disagrees
24
+ expected/ # strict name: other sources (requirements-from-expected); not written here
25
+ mismatches/ # mismatches between sources (detect-product-mismatches); not written here
26
+ ```
27
+
28
+ `actual` and `expected` are strict names: every source folder is inside one of them. The index `requirements/README.md` links every source folder and `mismatches/`.
29
+
30
+ ## Feature page
31
+
32
+ - Breadcrumb that matches folders.
33
+ - Feature description.
34
+ - `## Behaviors`: [behaviors.md](behaviors.md).
35
+
36
+ ## Catalog feature YAML
37
+
38
+ - No key (cause does not exist in code).
39
+ - `links` become `code` paths.
40
+
41
+ ```yaml
42
+ # features/.catalog/checkout/pay-with-saved-card.yaml
43
+ title: Pay with saved card # catalog-feature
44
+ code: # implementation files
45
+ - src/api/cards.ts
46
+ tests: # tests that cover the feature
47
+ - test/checkout/cards.spec.ts
48
+ ```
49
+
50
+ ## Mismatches
51
+
52
+ `mismatches/README.md` missing → create it: `# Mismatches`, breadcrumb. Write the list of mismatches, grouped by kind (not implemented, differs, unwired/not used, etc.), highest impact first: page link + impact level.
53
+
54
+ ### Mismatch page
55
+
56
+ A reader learns what disagrees from the first lines, without opening the sources.
57
+
58
+ File name: follow existing file name pattern or kebab-case of the title by default.
59
+
60
+ - `# Title`: the behavior in question, as the user meets it.
61
+ - `Feature:` the feature area › title, linked to its feature page.
62
+ - `## Difference`: first a one-sentence summary of how they differ, then one bullet for the code, first, then one per claim; claims that agree grouped on one bullet. Each bullet: the source, then its behavior. Write each side so it is clear alone: the condition, then what the user gets.
63
+ - `## Impact`: level first: **High** (users blocked, data or money wrong), **Medium** (a workaround exists), **Low** (wording, cosmetic). Then who meets it, when, and what they see or cannot do.
64
+ - `## Solution`: suggested fix: change the code, or correct the claim.
65
+ - `## Sources`: evidence, one row per source; Code row always, first. Code, Comment, Docstring, README, Developer docs, API spec, Config, Infra, Test, etc.
66
+ - Other info required to explain the mismatch.
67
+
68
+ #### Example
69
+
70
+ ```markdown
71
+ # Upload retries after a network error
72
+
73
+ Feature: [Reports › Upload results](../features/reports/upload-results.md)
74
+
75
+ ## Difference
76
+
77
+ The code retries a failed upload 3 times; the docstring and developer docs say 5.
78
+
79
+ - **Code:** A failed upload is retried 3 times, then the run shows "Upload failed".
80
+ - **Docstring, developer docs:** A failed upload is retried 5 times.
81
+
82
+ ## Impact
83
+
84
+ Low. On a flaky network, "Upload failed" shows after 3 attempts, sooner than a developer reading the docs expects.
85
+
86
+ ## Solution
87
+
88
+ Correct the docstring and developer docs: 3 retries.
89
+
90
+ ## Sources
91
+
92
+ | Source | Says | Link | Updated |
93
+ | -------------- | ---------------------------- | --------------------------- | ---------- |
94
+ | Code (actual) | Retries 3 times, then fails | `src/upload/client.ts:40-52` | 2026-09-02 |
95
+ | Docstring | "Retries up to 5 times" | `src/upload/client.ts:31` | 2026-03-11 |
96
+ | Developer docs | "5 retries before giving up" | `docs/upload.md:18` | 2026-03-11 |
97
+ ```
98
+
99
+ - `Link`: repo file: `path:lines`; outside the repo: URL, with the heading when the page is long.
100
+ - `Updated`: repo file: date the cited line last changed (`git blame --date=short -L {line},+1 -- {path}`), doc section without a line: the section's last change; URL: the page's "last updated" date, else empty.