/qa-skills:sync-test-cases-with-testrailfrom qa-skills
Push Markdown test cases (`*.test.md`) to TestRail through its API, pull (download, export) existing TestRail cases into `*.test.md` files, list TestRail sections and cases, and push a test run's results (`results.md` from `run-test-suite`). Use when the user wants to upload, push, import, or sync test cases to TestRail, pull, download, or export cases from TestRail, check which TestRail cases already exist for a feature, push test run results, or see the status and pass rate of test runs for a ticket, milestone, or date.
Ships in qa-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Pushes *.test.md files to TestRail as sections and cases, pulls existing cases back into *.test.md files, lists existing case titles, and pushes test run results. The script is scripts/testrail.mjs (Node 18+, no dependencies). The file format is defined in the qa-write-test-cases skill's references/testrail-test-case-format.md.
The script reads these variables from the environment, then from .env in the current directory:
| Variable | Value |
|---|---|
TESTRAIL_URL | Instance URL, e.g. https://example.testrail.io |
TESTRAIL_USER | TestRail user email |
TESTRAIL_API_KEY | API key from My Settings → API Keys |
TESTRAIL_PROJECT_ID | Project ID, the number in index.php?/projects/overview/<id> |
TESTRAIL_SUITE_ID | Only for projects with several suites. Without it, the script lists their IDs |
TESTRAIL_TEMPLATE_ID | Only when no template name contains "Steps". Without it, the script lists the template IDs |
TESTRAIL_FIELDS | Metadata keys to send as case fields, as key:field_system_name pairs: smoke:custom_case_smoketest,automation:custom_automation_type,platform:custom_case_platform |
TESTRAIL_OWNER | Your name as the project's owner field writes it. New cases get it as owner, and it tells your cases from other QCs' cases |
.env. If the folder is a git repo, make sure .env is git-ignored.TESTRAIL_FIELDS and set its value once on each suite. Map the owner field under the key owner, such as owner:custom_case_owner. The field system names come from Administration → Customizations.Run from the project root. <skill> is this skill's directory.
node <skill>/scripts/testrail.mjs check <files...>
node <skill>/scripts/testrail.mjs list [--section <name>]
node <skill>/scripts/testrail.mjs list --run <id>
node <skill>/scripts/testrail.mjs pull [--section <name>] [--run <id>] [--out <dir>] [--overwrite]
node <skill>/scripts/testrail.mjs push <files...> --dry-run [--parent-section <name>]
node <skill>/scripts/testrail.mjs push <files...> [--parent-section <name>] [--confirm-others <case ids>]
node <skill>/scripts/testrail.mjs results <results.md> --dry-run
node <skill>/scripts/testrail.mjs results <results.md>
node <skill>/scripts/testrail.mjs runs [--refs <keys>] [--milestone <name>] [--since <YYYY-MM-DD>] [--active] [--details]
check validates the files offline. It needs no credentials.list prints the section tree and case titles with their C<id>. list --run prints a run's cases with their status in the run. Both add TestRail's forecast or estimate time to a case's line when it has one.pull downloads cases into *.test.md files. Pass --out with the ticket's folder (Ticket Folder); it defaults to test-cases/. --run keeps only the run's cases.results pushes a run's results. A run it creates gets the current TestRail user as owner and now as start date. An existing run gets any refs from the run block that it lacks. The run-test-suite skill owns the flow and the Results Format.runs prints status counts, executed share, and pass rate of the matching runs, plan runs included. It needs at least one filter, and filters combine with AND. --details also lists the tests that did not pass, with their latest result. It only reads TestRail.check on the files and fix what it reports.push --dry-run.qa-write-test-cases report, is that confirmation.needs --confirm-others. Show the user each one with its owner and what changes. Push it only if they say yes, by passing its ID in --confirm-others. Never confirm one on their behalf. A case they decline: leave it out of the files, or revert its local edit.push with the same files and options.testrail_section_id: and testrail_id: into them.Rules:
*.test.md files.--parent-section nests the sections under a top-level section, created if missing.testrail_id: is updated in place. A test without it is created. Never edit or remove these lines by hand.TESTRAIL_OWNER as owner. An update never changes a case's owner, and a blank owner stays blank.TESTRAIL_OWNER, every case that has an owner counts as another QC's. With no owner field mapped, every case counts as another QC's, since no owner can be read. push stops when TESTRAIL_OWNER is set but no owner field is mapped, or when the field has no option of that name.priority: matches the project's priorities by name (normal counts as Medium, important as High). push stops before writing anything if a value matches none of them, and lists the project's priorities.TESTRAIL_FIELDS are sent as case fields. push stops before writing anything on a dropdown value the field does not offer, and lists the options. It warns when smoke, automation, or platform is used but not mapped.Use list when titles are enough. Use pull when a skill needs full case content (steps, expected results, preconditions).
pull, with --section <name> to limit it to one section and its child sections.--out.Rules:
-- (trade--order-book.test.md). The suite title is the section's own name.testrail_section_id, testrail_id, priority (lowercase name), refs, the keys mapped in TESTRAIL_FIELDS, preconditions, and separated steps with *Expected*. A pulled file passes check, and push --dry-run on it shows no updates for unchanged cases.--overwrite only after the user agrees to lose the local edits.Exit code 1 is a config or validation error. Exit code 2 is an API error that names the endpoint, HTTP status, and TestRail's message.
401: wrong user or API key, or the API is disabled.403: the user lacks permission to add or edit cases in the project.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub tinyc0der/qa-skills --plugin qa-skills14 skills in this plugin
/detect-duplicate-test-casesFind duplicate, near-duplicate, and overlapping manual test cases in TestRail or local `*.test.md` files. Identifies exact matches, semantically similar cases, subsets, and variations that differ only in data. Recommends which cases to keep, merge, or remove. Use when asked to find or clean up duplicate test cases or dedupe a TestRail section. Not for pruning cases that duplicate nothing./gather-contextGather what every source says about a Jira ticket or feature and save it to a context file (`tickets/<KEY>-<slug>/context.md`) with the sources read and not read, existing TestRail cases, conflicts between sources and the side followed, and open questions. Reads the ticket with its history, comments, sub-tasks, and linked issues, plus Confluence, Figma, TestRail, the live app, and the QA workspace. It is the first step of `review-user-story` and `qa-write-test-cases`. Use when the user asks what is known about a ticket or feature, asks to collect, refresh, or re-check its context, or asks for the sources a ticket does not link./improve-test-casesAnalyze and improve existing manual test cases (`*.test.md` in TestRail format, or cases pulled from TestRail) for clarity, structure, and format compliance, then push the fixes back to TestRail. Use when the user asks to improve, clean up, review, standardize, or rewrite existing test cases or a TestRail section./message-the-qcWhen to stop and ask the QC, and how to lay out every message to them. Use before any question, approval request, or report to the QC./plan-qc-subtasksCreate, estimate, and schedule the QC's own QC subtasks in Jira. Finds the stories assigned to the QC for testing, creates a QC subtask under each story that has none, estimates story points from the story, and fills empty Start and Due dates from the Dev subtasks' Due dates and the story points, all in one approval. Use when the user asks to list the stories they test, create QC subtasks, estimate or fill story points on them, set QC start or due dates, or plan their QC work for a sprint. Not for story point or sprint reports./qa-write-test-casesGenerate checklists and manual test cases in TestRail format (`*.test.md`) from Jira tickets, Confluence pages, Figma designs, the live app, or the user prompt alone. Use this skill whenever the user asks to create or write test cases, test scenarios, test plans, checklists (high-level test cases), or QA documentation, for a ticket, a page, a design, a feature, or TestRail.