From trunk
Best practices for configuring CI pipelines to upload test results to Trunk. Use when editing CI configuration files, setting up test reporting, or configuring JUnit XML output.
How this skill is triggered — by the user, by Claude, or both
Slash command
/trunk:trunk-ci-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When helping users configure CI pipelines or test reporting, follow these guidelines to ensure test results upload correctly to Trunk.
When helping users configure CI pipelines or test reporting, follow these guidelines to ensure test results upload correctly to Trunk.
Trunk ingests test results via JUnit XML format. Most test frameworks support this natively or via a plugin:
jest-junit reporter → npm install --save-dev jest-junit, set JEST_JUNIT_OUTPUT_DIRreporters: ['junit'] in vitest.config.ts, set outputFile--junitxml=report.xml flaggotestsum → gotestsum --junitfile report.xmlbuild/test-results/test/target/surefire-reports/rspec_junit_formatter gem--log-junit report.xml flagAlways configure the output path explicitly rather than relying on defaults — this makes the upload step reliable.
After tests run, upload results to Trunk.
Use the official trunk-io/analytics-uploader action. It downloads the CLI for you, so there's no binary URL to keep current:
- name: Upload test results to Trunk
if: ${{ !cancelled() }} # upload even when tests fail — critical for flaky data
continue-on-error: true # an upload hiccup shouldn't fail the build
uses: trunk-io/analytics-uploader@v1
with:
junit-paths: path/to/reports/**/*.xml
org-slug: <your-org>
token: ${{ secrets.TRUNK_TOKEN }}
Where the action isn't available, download the CLI from the GitHub releases page and run upload:
# Install (one-time, add to CI). Pick the asset for your runner's platform:
# Linux x86_64: trunk-analytics-cli-x86_64-unknown-linux.tar.gz
# Linux arm64: trunk-analytics-cli-aarch64-unknown-linux.tar.gz
# macOS arm64: trunk-analytics-cli-aarch64-apple-darwin.tar.gz
# macOS x86_64: trunk-analytics-cli-x86_64-apple-darwin.tar.gz
curl -fsSL https://github.com/trunk-io/analytics-cli/releases/latest/download/trunk-analytics-cli-x86_64-unknown-linux.tar.gz | tar xz
# Upload
./trunk-analytics-cli upload \
--org-url-slug <your-org> \
--token $TRUNK_TOKEN \
--junit-paths "path/to/reports/**/*.xml"
The TRUNK_TOKEN should be stored as a CI secret, never hardcoded. Use the organization token, not a repo token.
trunk-io/analytics-uploader@v1 action (see above) over a hand-rolled CLI download — it stays current with releases.if: ${{ !cancelled() }} (or if: always()) on the upload step so results are uploaded even when tests fail — this is critical for capturing flaky test data.when: always on the upload step.store_test_results as well for CircleCI's built-in reporting.after_script block or use when: always on the upload job.artifacts:reports:junit for GitLab's native reporting alongside Trunk uploads.post { always { } } block in the pipeline.if: always() / when: always.ls or find in CI to verify before the upload step.TRUNK_TOKEN must be set as a CI secret. Check the Trunk dashboard at https://app.trunk.io for your org's token.**/*.xml) to capture all of them.npx claudepluginhub trunk-io/claude-code-plugin --plugin trunkProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.