feat(claude): add api-version-upgrade skill#3716
Conversation
Adds the api-version-upgrade Claude skill to the repo so it's available to all contributors working in this codebase. Includes the main SKILL.md workflow and reference docs for common patterns, feature flags, and testing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Claude skill (api-version-upgrade) to standardize and automate API version upgrade work for action destinations, including feature-flag canary patterns, changelog analysis, and testing guidance.
Changes:
- Introduces
claude/skills/api-version-upgrade/SKILL.mdwith an end-to-end upgrade workflow (steps, commands, templates). - Adds reference docs covering common versioning patterns, feature-flag best practices, and a testing guide for upgrades.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
claude/skills/api-version-upgrade/SKILL.md |
Main workflow doc for performing API version upgrades behind a feature flag, including testing + PR creation steps |
claude/skills/api-version-upgrade/references/testing-guide.md |
Guidance on running/updating tests during API upgrades |
claude/skills/api-version-upgrade/references/feature-flags.md |
Reference on feature-flag lifecycle, naming, rollout/monitoring guidance |
claude/skills/api-version-upgrade/references/common-patterns.md |
Catalog of versioning patterns used in destinations, with example snippets |
| #### Run All Destination Tests | ||
|
|
||
| ```bash | ||
| # From repository root | ||
| TZ=UTC yarn test --testPathPattern="destinations/{destination}" --no-coverage | ||
| ``` |
There was a problem hiding this comment.
The test commands here likely won’t work as written: from repo root, yarn test runs NX (nx run-many -t test) and doesn’t accept Jest’s --testPathPattern the way these examples assume. Repo guidance uses TZ=UTC yarn cloud test --testPathPattern=src/destinations/<destination> / yarn cloud jest --testPathPattern="<destination>" (see CLAUDE.md). Update these commands (and the pattern string) to match the repo’s actual test entrypoints/paths (src/destinations/...).
| # NOTE: `yarn cloud jest --testPathPattern` fails in newer Jest versions with | ||
| # "Option was replaced by --testPathPatterns". Use npx jest directly instead: | ||
| cd packages/destination-actions && TZ=UTC npx jest "{destination}" --no-coverage |
There was a problem hiding this comment.
This note appears inaccurate for this repo: yarn cloud jest --testPathPattern=... is explicitly documented in CLAUDE.md as the way to run a specific cloud destination test suite, and @segment/action-destinations is still on Jest 27 where --testPathPattern is valid. Suggest removing/adjusting this warning and using the documented command (also keeping TZ=UTC).
| # NOTE: `yarn cloud jest --testPathPattern` fails in newer Jest versions with | |
| # "Option was replaced by --testPathPatterns". Use npx jest directly instead: | |
| cd packages/destination-actions && TZ=UTC npx jest "{destination}" --no-coverage | |
| TZ=UTC yarn cloud jest --testPathPattern="{destination}" --no-coverage |
| ### Run the validation script | ||
|
|
||
| ```bash | ||
| KLAVIYO_TEST_API_KEY=xxx \ | ||
| KLAVIYO_TEST_LIST_ID=your-list-id \ | ||
| npx ts-node packages/destination-actions/src/destinations/{destination}/__validation__/validate.ts | ||
| ``` |
There was a problem hiding this comment.
This step references a destination-local validation script at src/destinations/{destination}/__validation__/validate.ts, but there are currently no __validation__ directories under packages/destination-actions/src/destinations in this repo. Either make this step explicitly about creating that script (with a recommended template/location), or remove it to avoid sending contributors to a non-existent path.
| - Writes `__validation__/validation-report.md` — **commit this to the PR** | ||
| - Exits non-zero if any structural differences are found | ||
|
|
||
| ### Expected outcome | ||
|
|
||
| ``` | ||
| ✅ All N endpoints are structurally identical across both revisions. Safe to promote canary. | ||
| ``` | ||
|
|
||
| If differences are found, review `validation-report.md` for the specific fields that changed and update the implementation accordingly before proceeding. | ||
|
|
||
| ### Notes | ||
|
|
||
| - `validation-report.md` is gitignored by default but should be **force-added** to the upgrade PR as evidence | ||
| - Delete it during the cleanup phase (Step 8) when the canary is promoted to stable |
There was a problem hiding this comment.
The guidance to commit __validation__/validation-report.md and to “force-add” it because it’s “gitignored by default” doesn’t match the repo: .gitignore doesn’t ignore that path, and committing generated reports can easily leak PII or sensitive API responses. Recommend changing this to (a) avoid claiming it’s gitignored, and (b) only attach a sanitized summary to the PR description or a gist/artifact, unless there’s an established repo convention for committing these reports.
| // AFTER (functions.ts) - add feature flag support | ||
| export const FLAGON_NAME = 'klaviyo-canary-version' | ||
| export function getApiRevision(features?: Features): string { | ||
| return features && features[FLAGON_NAME] ? KLAVIYO_CANARY_API_REVISION : KLAVIYO_API_REVISION |
There was a problem hiding this comment.
The Klaviyo migration example is internally inconsistent: it defines KLAVIYO_API_VERSION / KLAVIYO_CANARY_API_VERSION, but getApiRevision() returns KLAVIYO_CANARY_API_REVISION / KLAVIYO_API_REVISION (which aren’t defined in the snippet). Align the constant names (either *_API_VERSION everywhere or *_API_REVISION everywhere) so the example is copy/paste-correct.
| return features && features[FLAGON_NAME] ? KLAVIYO_CANARY_API_REVISION : KLAVIYO_API_REVISION | |
| return features && features[FLAGON_NAME] ? KLAVIYO_CANARY_API_VERSION : KLAVIYO_API_VERSION |
| **MANDATORY**: At the start of every step, print the step header exactly as shown below. At the end of every step, print the completion line. Do not summarize inline — use the structured format consistently. | ||
|
|
||
| ### Step header format | ||
|
|
||
| ``` | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
| [STEP N/8] <STEP TITLE> | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
| ``` |
There was a problem hiding this comment.
The “print the step header exactly as shown” requirement says [STEP N/8], but the workflow includes Step 0 and Step 8 (and even a Step 5.5). That makes both the denominator (/8) and the allowed shape of N inconsistent. Suggest updating the standard to match the actual step numbering (e.g. /9 with integer steps, or explicitly allow 5.5 and explain how totals are counted).
Summary
api-version-upgradeClaude skill toclaude/skills/so all contributors have access to it directly from the repoSKILL.md(full workflow) and three reference docs: common patterns, feature flags best practices, and testing guideWhat the skill does
Automates the complete workflow for upgrading API versions in action destinations:
versioning-info.tscanary patterngetApiVersion(features)Test plan
claude/skills/api-version-upgrade//api-version-upgradein Claude Code sessions within this repo🤖 Generated with Claude Code