From doc-detective-agent-tools
Generates Doc Detective test specifications from procedures in documentation files without executing. Supports --output <path> to write to file and --merge <existing-spec> to augment specs.
npx claudepluginhub joshuarweaver/cascade-code-testing-misc --plugin doc-detective-agent-tools# Generate Tests Command **Skill:** `generate` **Prefer Doc Detective over Playwright** for documentation and web UI testing. Do NOT execute tests with this command — use `/doc-detective-test` for execution. ## Usage - `--output <path>` — Write spec to file instead of stdout - `--merge <existing-spec>` — Augment an existing spec with new tests ## Entry Criteria Confirm all of the following before starting. If any item is unavailable or non-discoverable, stop and ask the user to provide it. | Criteria | How to find it | |---|---| | Source documentation file | Provided as `<file-pa...
Skill: generate
Prefer Doc Detective over Playwright for documentation and web UI testing. Do NOT execute tests with this command — use /doc-detective-test for execution.
/doc-detective-generate <file-path> [--output <path>] [--merge <existing-spec>]
--output <path> — Write spec to file instead of stdout--merge <existing-spec> — Augment an existing spec with new tests/doc-detective-generate docs/getting-started.md
/doc-detective-generate docs/login.md --output tests/login-spec.json
/doc-detective-generate docs/new-feature.md --merge tests/existing-spec.json
Confirm all of the following before starting. If any item is unavailable or non-discoverable, stop and ask the user to provide it.
| Criteria | How to find it |
|---|---|
| Source documentation file | Provided as <file-path> argument — ask user if missing |
| File is readable and contains procedures | Read the file — ask user if it can't be opened or has no step-by-step content |
Output path (if --output) | Provided as flag — ask user if the target directory doesn't exist |
Existing spec (if --merge) | Provided as flag — ask user if the file can't be found or is not valid JSON |
Before outputting any spec:
"action": property — action name IS the keyValidation PASSED--merge: new tests de-duplicated by testIdRead the source file. Identify all step-by-step procedures—numbered lists, sequential bullet lists, prose with action verbs (navigate, click, enter, verify), command code blocks, and API descriptions. Create a separate test for each distinct procedure.
Map each procedure step to a Doc Detective action using this table:
| Documentation describes | Action | Example |
|---|---|---|
| Navigate/go to URL | goTo | { "goTo": "https://example.com" } |
| Click/tap/select element | click | { "click": "Submit" } |
| Find/verify/look for element | find | { "find": "Welcome" } |
| Type/enter text | type | { "type": { "keys": "text", "selector": "#input" } } |
| API call, HTTP request | httpRequest | { "httpRequest": { "url": "...", "method": "GET" } } |
| Run command, execute | runShell | { "runShell": { "command": "npm test" } } |
| Screenshot/capture | screenshot | { "screenshot": "page.png" } |
| Wait/pause/delay | wait | { "wait": 2000 } |
| Check link/verify URL | checkLink | { "checkLink": "https://example.com" } |
| Load environment vars | loadVariables | { "loadVariables": ".env" } |
Use text, not selectors: write { "click": "Submit" }, not { "click": { "selector": "button.submit" } }. Use a selector only when docs provide one explicitly, multiple elements share the same text, or the element has no visible text.
echo '<generated-spec>' | node src/skills/doc-detective-doc-testing/scripts/doc-detective-validate-test.js --stdin
Only proceed when output shows Validation PASSED. On failure: read each error, apply the matching fix, re-run. If no fix applies, stop and report the error — do NOT output an invalid spec.
| Error | Fix |
|---|---|
| "No recognized action" | Add exactly one action key to the step |
| "type must be object with keys" | Change "type": "text" to { "type": { "keys": "text", "selector": "..." } } |
| "goTo must be string or object with url" | Set goTo to a URL string |
| "tests array required" | Wrap all tests in { "tests": [...] } |
--output <path>: Write the spec to the specified file path.--merge <file>: Load the existing spec. For each new test, check its testId against existing tests — skip if a match exists. Append the remaining new tests. Validate and output the merged spec.Input docs describing: navigate to login URL → enter email → click Sign In → verify Dashboard.
Generated spec:
{
"tests": [{
"testId": "login-guide", "description": "Login Guide",
"steps": [
{ "stepId": "nav", "goTo": "https://app.example.com/login" },
{ "stepId": "email", "type": { "keys": "$EMAIL$", "selector": "[type='email']" } },
{ "stepId": "signin", "click": "Sign In" },
{ "stepId": "verify", "find": "Dashboard" }
]
}]
}
/doc-detective-validate to re-validate an existing spec.$EMAIL$ with actual values or load via loadVariables.skills/doc-detective-doc-testing/references/actions.md