/fx-dev:upstream-contribfrom fx-dev
Contributes local UI component changes from a consumer repository upstream to a shared UI library. Handles cloning, branching, PR creation, and post-merge cleanup.
Ships in fx-dev. 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.
Contribute local UI component changes from a consumer repository upstream to the shared @fx/ui library (https://github.com/fx/ui). Handles the full lifecycle: clone, branch, implement, test, PR, link-verify, and post-merge cleanup.
fx/ui is a PUBLIC repository. The consumer repo that triggers this workflow is likely PRIVATE. Never leak source project details into fx/ui:
This applies to ALL fx/ui artifacts: commits, PR body, code comments, Storybook story descriptions, test names, and CSS variable comments. Treat the consumer project as if it does not exist when writing anything that touches fx/ui.
Also: no
#<number>in the fx/ui PR title (#4,(#4),#123) unless N is a real PR/issue on fx/ui that this PR references — a consumer-repo issue number would link to an unrelated fx/ui issue. No wave/phase/step/change-doc numbers in the title either. See thefx-dev:githubskill's "#<number>PR-Title Rule".
gh auth status must succeed@fx/uiExecute these phases in order. Each phase must complete before the next begins.
# Save consumer repo root and current branch
CONSUMER_ROOT=$(git rev-parse --show-toplevel)
CONSUMER_BRANCH=$(git branch --show-current)
Clone fx/ui alongside the consumer repo. Reuse if already present.
UI_DIR="$(dirname "$CONSUMER_ROOT")/ui"
if [ -d "$UI_DIR/.git" ]; then
# Already cloned — fetch and reset to main
cd "$UI_DIR"
git fetch origin
git checkout main
git pull origin main
else
gh repo clone fx/ui "$UI_DIR"
cd "$UI_DIR"
fi
cd "$UI_DIR"
git checkout -b feat/<descriptive-name>
Use a descriptive branch name matching the change (e.g., feat/badge-status-variants).
Read the consumer repo's local component to understand what needs to be upstreamed. Identify:
cat "$UI_DIR/AGENTS.md" 2>/dev/null \
|| cat "$UI_DIR/CLAUDE.md" 2>/dev/null \
|| echo "No AGENTS.md or CLAUDE.md in $UI_DIR — proceed with the conventions below"
Follow all conventions documented there. Key rules:
data-slot attribute on every componentsrc/components/ui/__tests__/src/components/ui/*.stories.tsxsrc/index.tssrc/styles/globals.css for new theme tokensLaunch an Implementer sub-agent (fx-dev:dev, Implementer role):
Agent tool:
prompt: "Load the dev skill (Skill tool: skill='fx-dev:dev') and act in its Implementer role, then:
In the fx/ui repo at [UI_DIR], implement [DESCRIPTION].
CRITICAL: fx/ui is a PUBLIC repo. NEVER reference the source/consumer
project name, URL, author, or org in any commit message, comment,
story description, or code. Describe changes generically.
Follow these conventions:
- [Include key rules from AGENTS.md]
- Add/update the component in src/components/ui/
- Add tests in src/components/ui/__tests__/
- Add/update Storybook story
- Export new items from src/index.ts
- Add CSS variables to src/styles/globals.css if needed
- Use conventional commits
- Run: bun run test && bun run build && bun run lint
- Do NOT create a PR"
description: "Implement changes in fx/ui"
CRITICAL: When upstreaming variants that use custom CSS variables (e.g., --color-status-working), add them as neutral/semantic defaults in fx/ui's globals.css. Consumer repos override these with their own theme colors. Do NOT copy consumer-specific color values.
cd "$UI_DIR"
bun run test
bun run build
bun run lint
Fix any failures before proceeding.
cd "$UI_DIR"
bun link
cd "$CONSUMER_ROOT"
bun link @fx/ui
This makes the consumer repo use the local fx/ui build instead of the published version.
Start the consumer dev server or run its tests to confirm the new exports work:
cd "$CONSUMER_ROOT"
bun --bun run build
bun --bun run test
Now that fx/ui has the upstreamed changes, update the consumer repo to:
@fx/ui insteadLaunch an Implementer sub-agent (fx-dev:dev, Implementer role):
Agent tool:
prompt: "Load the dev skill (Skill tool: skill='fx-dev:dev') and act in its Implementer role, then:
In [CONSUMER_ROOT], update the local component to use the
new exports from @fx/ui (currently linked locally).
- Replace the local implementation with a re-export from @fx/ui
(or remove it entirely if no local extensions remain)
- Update any imports across the codebase if needed
- Run tests and build to verify
- Commit with: refactor(<component>): use upstreamed <component> from @fx/ui
- Do NOT push yet"
description: "Update consumer to use new fx/ui exports"
After verification, restore the published @fx/ui version:
cd "$CONSUMER_ROOT"
bun install --force
The consumer repo now has commits that use the new fx/ui exports, but still depends on the current published version. These commits will work once the fx/ui PR is merged and a new version is published.
Switch working directory to fx/ui and run the dev skill:
Skill tool: skill="fx-dev:dev"
Execute Steps 5-7 of the SDLC workflow (PR creation, review, CI) within the fx/ui repo. Steps 0-4 are already done (auth, branch, requirements, plan, implementation).
IMPORTANT: The PR description must NOT reference the consumer repo by name (fx/ui is a public repo). Describe the changes generically:
fx/ui PR #[NUMBER] ready: [URL]
Changes:
- [summary]
⚠️ Do NOT merge the consumer repo PR until this fx/ui PR is merged
and a new version is published.
This phase runs ONLY after the fx/ui PR is confirmed merged.
Do NOT proceed with this phase automatically. Wait for user confirmation that the fx/ui PR has been merged.
gh pr view [FX_UI_PR_NUMBER] --repo fx/ui --json state -q '.state'
Must return MERGED. If not, STOP and inform the user.
Many upstream projects (including fx/ui) publish preview releases automatically on every push to main. These use a commit-SHA-based version like 0.0.0-<short-sha> and are tagged preview in the registry.
Check for a preview version first — this avoids waiting for a formal release:
# Get the merge commit SHA from the merged PR
MERGE_SHA=$(gh pr view [FX_UI_PR_NUMBER] --repo [OWNER/REPO] --json mergeCommit --jq '.mergeCommit.oid' | head -c 7)
# Check if a preview version exists for this commit
NODE_AUTH_TOKEN=$(gh auth token) npm view @fx/ui versions --json --registry https://npm.pkg.github.com 2>/dev/null | jq -r '.[] | select(contains("'$MERGE_SHA'"))'
If a matching preview version is found (e.g., 0.0.0-44c2d7d), use it immediately. If not, wait 1-2 minutes for the preview workflow to complete, then check again.
If no preview version appears after retrying, check the upstream project's CI workflows to understand its release strategy. Some projects may only publish on formal releases — in that case, inform the user:
No preview release found. A release PR may need to be merged manually.
⛔ NEVER merge release PRs (release-please, semantic-release, changeset, etc.). These control versioning and must be merged manually by the user.
Install the specific preview version (or released version if available):
cd "$CONSUMER_ROOT"
NODE_AUTH_TOKEN=$(gh auth token) bun add @fx/ui@[VERSION]
bun --bun run test
bun --bun run build
If passing, commit the dependency update:
git add package.json bun.lock
git commit -m "chore: update @fx/ui to [VERSION]"
git push
| Error | Action |
|---|---|
| fx/ui clone fails | Check gh auth status, retry |
| fx/ui tests fail | Fix in fx/ui before proceeding |
| Link verification fails | Check export names match, rebuild fx/ui |
| Consumer tests fail after update | Debug import paths, check for missing exports |
| fx/ui PR CI fails | Use fx-dev:resolve-ci-failures skill in fx/ui context |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fx/cc --plugin fx-dev25 skills in this plugin
/coderabbit-reviewExplicit-use only — invoke when the user explicitly names this skill, or when an active explicitly invoked workflow calls it. Handles CodeRabbit's PR-level review as an optional review adapter with Scope Brief triage and rate-limit degradation./codex-reviewExplicit-use only — invoke when the user explicitly names this skill, or when an active explicitly invoked workflow calls it. Runs a scoped one-shot Codex CLI branch review as an external review adapter./copilot-feedback-resolverExplicit-use only — invoke when the user explicitly names this skill, or when an active explicitly invoked workflow calls it. Processes and resolves existing GitHub Copilot review threads without creating PR-level comments.Other plugins' skills for the same job