Agent skill

Migrate Component

by asyncapi in asyncapi/generator

Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package.

Apache-2.0Auto-check passedDevelopment

Install Migrate Component

skills CLI
$ npx skills add asyncapi/generator --skill migrate-component -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install asyncapi/generator migrate-component --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/asyncapi/generator.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/migrate-component .claude/skills/migrate-component && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
migrate-component
GitHub stars
1.1k
Token cost
~3k tokens
SKILL.md length
1,198 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
Apache-2.0

At a glance

Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package.

  • Works in 12 steps: Two-template threshold check → No naming collision → Catalog the template files → …
  • The user asks to migrate
  • SKILL.md covers Invocation, Preconditions (fast gate), Research & design (produce the… and Execution steps, plus 1 more section
  • Calls npm, git and turbo

What it does

Migrate Component is an agent skill from asyncapi/generator. Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package. Use this skill whenever the user asks to "migrate", "move", "promote", "extract", "share", or "consolidate" a component into generator-components (or shared components / the components package). Also trigger for phrases like "it's used in multiple templates now, let's share it" or "avoid duplication across clients". Do not fire for unrelated React refactors or for moving code between apps/.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering React components and Refactoring. It works with React and Node.js. The repository describes itself as: Use your AsyncAPI definition to generate literally anything. Markdown documentation, Node.js code, HTML documentation, anything! The licence is Apache-2.0.

When your agent uses it

  • The user asks to migrate
  • Consolidate a component into generator-components (or shared components / the components package)
  • Phrases like its used in multiple templates now
  • Avoid duplication across clients

Example prompts

  • “migrate”
  • “promote”
  • “extract”
  • “/migrate-component”

Requirements

  • Python 3

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. Two-template threshold check
  2. No naming collision
  3. Catalog the template files
  4. Read every copy and tabulate
  5. Derive the prop signature (union rule)
  6. Author the shared component
  7. Export it
  8. Write the test
  9. Generate the snapshot
  10. Delete the template files
  11. Update each consuming template
  12. Regenerate integration snapshots

What it can do on your machine

Read from SKILL.md and the folder at commit ab1f79a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • git
    • turbo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm and git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Migrate Component loads about 3k tokens when it runs. Until then it costs about 131 tokens; SKILL.md has 1,198 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~131
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from asyncapi/generator at commit ab1f79a, republished under its Apache-2.0 licence (© asyncapi). 1,198 words, ~2,950 tokens.

Download SKILL.mdSave it as .claude/skills/migrate-component/SKILL.md (or your agent's skills folder).
name
migrate-component
description
Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package. Use this skill whenever the user asks to "migrate", "move", "promote", "extract", "share", or "consolidate" a component into generator-components (or shared components / the components package). Also trigger for phrases like "it's used in multiple templates now, let's share it" or "avoid duplication across clients". Do not fire for unrelated React refactors or for moving code between apps/.

Migrate Component to @asyncapi/generator-components

You are migrating a duplicated React/JSX template-local component out of packages/templates/clients/<protocol>/<lang>[/<framework>]/components/ (the <framework> segment is present for stack-specific templates like java/quarkus, omitted for single-stack languages like python) into the shared packages/components/src/components/ package.

Important: Always edit src/ files. The lib/ directory is generated at publish time by Babel — never edit files there.

Invocation

The user has named the component to migrate, e.g. "migrate HandleError". If they did NOT name one, ask which component.

Preconditions (fast gate)

1. Two-template threshold check

Use the Glob tool with pattern packages/templates/clients/**/components/<Component>.js to find all template-local copies of this component.

Decide based on the result count:

Result countAction
0Stop and report "no template files found" — nothing to promote.
1Report "only one template uses this component; CLAUDE.md section 4.5 recommends 2+ before promotion" and prompt the user via AskUserQuestion: continue anyway?
2+Continue automatically — threshold satisfied.

The 1-template case is the only judgment call — do not stop unilaterally; let the user make the call.

2. No naming collision

Use the Glob tool with pattern packages/components/src/components/<Component>.js — if it returns a result, stop and report that the component already exists in the shared package.

Research & design (produce the migration plan)

Before touching any files, work through these three steps in order. Each produces an artifact the execution steps consume directly:

  1. The template files — the canonical list of files to migrate from templates into the shared package.
  2. The props table — file × props × render-shape × indent/newLines.
  3. The union signature — the shared component's prop list, with required/optional/defaults.
1. Catalog the template files

The Glob results from precondition 1 are the canonical list — call it "the template files" in subsequent steps. Every later step (read sources, delete files, update imports) refers back to these exact paths. Echo the list back to the user as a fenced block so it stays visible; do not re-run Glob.

2. Read every copy and tabulate

Read every path in the template files — one read per file, no skipping. For each, record one row in a markdown table:

FileProps (with defaults)Render shapeIndentnewLines
…/javascript/.../<Component>.js{ methodName, methodParams = ['msg'] }<Text>…</Text>21
…/python/.../<Component>.js{ methodName, methodParams = ['self','msg'], preExecutionCode }<Text>…</Text>42
…/dart/.../<Component>.js{ methodName }<MethodGenerator … />21

This table is the source of truth for the next two research steps. Print it back to the user.

3. Derive the prop signature (union rule)

The shared component's props are the union of props across the template files:

  • Prop in every template file → required (no default).
  • Prop in some template files → optional, with a default matching the omitting file's current behavior.
  • Prop with different defaults per language → keep required; push the per-language value into the consuming template's JSX usage.

Worked example (using the table above):

js
// Per-copy props:
//   javascript → { methodName, methodParams = ['msg'] }
//   python     → { methodName, methodParams = ['self','msg'], preExecutionCode }
//   dart       → { methodName }
//
// Union → { methodName, methodParams, preExecutionCode }
//   methodName       → required          (in every copy)
//   methodParams     → optional, ['msg'] (JS/Dart omit; Python overrides at the call site)
//   preExecutionCode → optional, ''      (only Python uses it; default is a no-op for JS/Dart)

export function <Component>({
  methodName,
  methodParams = ['msg'],
  preExecutionCode = '',
}) { /* … */ }

Python's consuming template then renders <<Component> methodName='onMessage' methodParams={['self','msg']} preExecutionCode='…' />; JS/Dart pass only what they need.

Choose the abstraction shape based on the table and signature:

  • Method-shaped — delegates to MethodGenerator with a websocket<X>Config map. Use when per-language differences are mostly method-body strings (the config object holds the language-specific logic; the component itself is thin). See packages/components/src/components/RegisterErrorHandler.js.
  • Structural — config object keyed by language returning Text code blocks. Use when the rendering structure itself varies across languages (different indentation, different block shapes, framework sub-keys). See packages/components/src/components/QueryParamsVariables.js.

Execution steps

Execute strictly in this order; each step must succeed before the next.

1. Author the shared component

Create packages/components/src/components/<Component>.js using the signature and abstraction shape from research step 3.

Two things to enforce (everything else — named export, body code, imports, EOF newline — copy from the canonical example for your chosen shape):

  • JSDoc — @typedef for the Language union, @param for every prop in the research step 3 union (matching required/optional/defaults exactly), @returns {JSX.Element}, and a @example block. This is what jsdoc2md publishes to apps/generator/docs/api_components.md in step 9; missing or malformed tags produce an empty diff there.
  • Validate constrained props — for language/framework (or any prop with a supported set), throw using helpers from packages/components/src/utils/ErrorHandling.js. Use unsupportedLanguage(language, supportedList) for the language prop; use unsupportedFramework(language, framework, supportedList) when the component also accepts a framework prop (e.g. java/quarkus). See QueryParamsVariables.js for the full pattern.
2. Export it

Edit packages/components/src/index.js: append one line export { <Component> } from './components/<Component>';.

Show full SKILL.md (509 more words)Show less
3. Write the test

Create packages/components/test/components/<Component>.test.js. Test cases come directly from the artifacts of research steps 2 and 3:

  • One snapshot test per row in research step 2's table (i.e. per (language, framework?) pair). Pass the per-language props from that row.
  • One variant test per optional prop in research step 3's union — proves the prop is wired through, not hardcoded.
  • One negative test: omit all optional props and confirm no undefined leaks in the snapshot.
4. Generate the snapshot
bash
npm run components:test -- -u

Output: packages/components/test/components/__snapshots__/<Component>.test.js.snap. Open it and sanity-check that the rendered output looks like what each language template emits today. The real correctness check happens in step 8 — git diff on the regenerated per-client integration snapshots.

5. Delete the template files

For each path in "the template files" (research step 1):

  • git rm <path>
  • If a sibling test exists at packages/templates/clients/<protocol>/<lang>[/<framework>]/test/components/<Component>.test.js (same <lang>[/<framework>] segments as the source file — e.g. java/quarkus/test/components/…): git rm it and its .snap.

Do not re-run Glob — the list from research step 1 is canonical.

6. Update each consuming template

For each path in "the template files" (research step 1), find the file that imported it. Use the Grep tool with pattern from './<Component>' scoped to that file's template root — the directory immediately above components/, which is <lang>/ for single-stack languages or <lang>/<framework>/ for stack-specific ones (e.g. packages/templates/clients/websocket/python/ or packages/templates/clients/websocket/java/quarkus/).

In each match:

  • Remove the local import line.
  • Add <Component> to the existing @asyncapi/generator-components import (match the file's existing order convention; alphabetical not required).
  • At each <<Component> /> JSX usage, pass the props from that language's row in research step 2's table plus language='<lang>'. The rendered output must be identical to what the deleted local file emitted — that's what keeps the integration snapshot churn minimal in step 7.

Example (using the worked example from research step 3):

jsx
// JS template — methodParams default matches the table, so only pass required props.
<<Component> language='javascript' methodName='onMessage' />

// Python template — override per-language values from the table.
<<Component>
  language='python'
  methodName='on_message'
  methodParams={['self', 'msg']}
  preExecutionCode={'...'}
/>

// Dart template — only methodName per the table.
<<Component> language='dart' methodName='onMessage' />
7. Regenerate integration snapshots

Run from the integration-test package — much faster than repo root since it skips the rest of the pipeline:

bash
cd packages/templates/clients/<protocol>/test/integration-test && npm run test:update

Or to update a single client: cd packages/templates/clients/<protocol>/test/integration-test && npm run test:<lang>:update

Rebuilds __snapshots__/integration.test.js.<lang>.snap (one per client).

8. Diff the regenerated snapshots

git diff is the migration's correctness check — the new snapshots vs. the committed ones tell you whether the migration changed any rendered output:

bash
git diff packages/templates/clients/<protocol>/test/integration-test/__snapshots__/

Expect modest whitespace/indent churn. Large semantic diffs (different method names, missing lines, body content changes) mean step 1 (component implementation) or step 6 (consumer props) is wrong → fix the offending step, then re-run step 4 (component snapshot) and steps 7–8 (integration snapshots + diff). Skip steps 2/3/5/6 unless they're what you're fixing.

9. Regenerate the API docs

apps/generator/docs/api_components.md is a committed jsdoc2md artifact and CLAUDE.md section 2.4 requires it be regenerated in the same PR as any public-signature change:

bash
turbo run docs --filter=@asyncapi/generator-components

Then git diff apps/generator/docs/api_components.md and commit alongside the source changes. Empty diff = JSDoc tags in step 1 are missing or malformed → fix and rerun.

10. Run all tests and lint

From repo root:

  • npm run components:test — passes.
  • npm run templates:test — passes (the integration snapshot is now in sync).
  • npm run lint — passes.

Reference materials

  • Canonical method-shaped example: packages/components/src/components/RegisterErrorHandler.js.
  • Canonical structural example: packages/components/src/components/QueryParamsVariables.js.
  • Test idioms: packages/components/test/components/RegisterErrorHandler.test.js.
  • Error handling utilities: packages/components/src/utils/ErrorHandling.js.

© asyncapi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/migrate-component of asyncapi/generator.

Open the folder on GitHubat commit ab1f79a

Compare with similar skills

Migrate Component next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Migrate Component compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Migrate Component this skillasyncapi/generator1.1k—~3kAutomated safety check: PassApache-2.0
No Use Effectmattiacerutti/supernova1872 repos~1.7kAutomated safety check: PassMIT
React Best Practicesshapeshift/web2061 repos~2kAutomated safety check: PassMIT
Project Form PatternsAkaraChen/aghub272—~1.1kAutomated safety check: PassMIT
React Performanceaffaan-m/ECC274k1 repos~4.5kAutomated safety check: PassMIT
Feature Archpproenca/dot-skills214—~2kAutomated safety check: PassMIT

Similar skills

  • No Use Effect

    mattiacerutti/supernova

    Enforce the no-useEffect rule when writing or reviewing React code.

    187 GitHub starsUsed in 2 repos~1.7k tokens
    DevelopmentAuto-check passed
  • React Best Practices

    shapeshift/web

    Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.

    206 GitHub starsUsed in 1 repo~2k tokens
    DevelopmentAuto-check passed
  • Project Form Patterns

    AkaraChen/aghub

    Form implementation guidance for the aghub desktop app. An agent skill from AkaraChen/aghub.

    272 GitHub stars~1.1k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • React Performance

    affaan-m/ECC

    React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills).

    274k GitHub starsUsed in 1 repo~4.5k tokens
    DevelopmentAuto-check passed
  • Feature Arch

    pproenca/dot-skills

    React feature-based architecture guidelines for scalable applications.

    214 GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • React

    pproenca/dot-skills

    React 19/19.2 modern patterns for concurrent rendering, Server Components, actions, ref-as-prop, document metadata, resource hints, hooks, and memoization — plus a category-major review/refactor…

    214 GitHub stars~4.1k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from asyncapi/generator

  • A skill your agent uses when editing, adding, or reviewing any file under .github/workflows/, or when a CI step installs a CLI tool (npm i -g, npx, pipx, uses: /setup-).

    1.1k GitHub stars~1.9k tokensUpdated 2 days ago
    Auto-check passed
  • Port Client Component

    asyncapi/generator

    Port a component or feature that already exists in one protocol client template to sibling clients under packages/templates/clients/<protocol/ that are missing it.

    1.1k GitHub stars~4.6k tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Migrate Component

What does Migrate Component do?

Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package. Migrate Component is an agent skill from asyncapi/generator. Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package.

When should I use Migrate Component?

Migrate Component fits situations like: the user asks to migrate; consolidate a component into generator-components (or shared components / the components package); phrases like its used in multiple templates now; avoid duplication across clients.

How do I install Migrate Component in Claude Code?

Run `npx skills add asyncapi/generator --skill migrate-component -a claude-code`. Or copy the skill folder (.claude/skills/migrate-component in asyncapi/generator) into .claude/skills/migrate-component in your project. Claude Code loads it when a task matches its description.

How do I install Migrate Component in Codex?

Run `npx skills add asyncapi/generator --skill migrate-component -a codex`. Or copy the skill folder (.claude/skills/migrate-component in asyncapi/generator) into .agents/skills/migrate-component in your project. Codex loads it when a task matches its description.

Can I use Migrate Component in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add asyncapi/generator --skill migrate-component -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/migrate-component, .gemini/skills/migrate-component, .github/skills/migrate-component and .opencode/skills/migrate-component in your project.

What does Migrate Component need to run?

Going by SKILL.md and its folder, Migrate Component needs the command-line tools its instructions call (npm, git and turbo). Our summary lists: Python 3.

Does Migrate Component access the network?

SKILL.md contains no URLs. Its commands use npm and git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Migrate Component safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Migrate Component use?

Migrate Component is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Migrate Component use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Migrate Component?

Skills that share tags, products or a category with Migrate Component: No Use Effect (mattiacerutti/supernova, 187 stars), React Best Practices (shapeshift/web, 206 stars), Project Form Patterns (AkaraChen/aghub, 272 stars) and React Performance (affaan-m/ECC, 274k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Migrate Component?

asyncapi (a GitHub organization) maintains it in asyncapi/generator, which has 1,080 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 5, 2026.

Source: asyncapi/generator on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.