/react18-upgrade:react18-legacy-contextfrom react18-upgrade
Migrates React legacy context API (contextTypes, childContextTypes, getChildContext) to modern createContext. Coordinates cross-file updates to providers and consumers to avoid React 18 warnings and React 19 failures.
Ships in react18-upgrade. 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.
Coordinate the cross-file migration from React legacy context to modern createContext by finding the provider, every consumer, the new context module, and verification steps before editing any single file.
| Legacy API | Modern replacement | Rule |
|---|---|---|
childContextTypes plus getChildContext | A createContext object and provider value. | Update the provider and exported context together. |
contextTypes on class consumers | static contextType = SomeContext for one context, or <SomeContext.Consumer> for multiple contexts. | Every consumer must move to the same context object. |
| Function component legacy access | useContext(SomeContext). | Use hooks only in function components. |
this.context usage | Modern this.context through contextType, or render-prop consumer for multiple contexts. | Audit each usage because it may be legacy or already modern. |
Legacy context was deprecated in React 16.3, warns in React 18.3.1, and is removed in React 19.
# Find all providers
grep -rn "childContextTypes\|getChildContext" src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
# Find all consumers
grep -rn "contextTypes\s*=" src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
# Find this.context usage (may be legacy or modern - check which)
grep -rn "this\.context\." src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
childContextTypes and getChildContext.contextTypes and related this.context usage.references/context-file-template.md.value.contextType or a context consumer, and each function component to useContext.| Situation | Required handling |
|---|---|
| One legacy context | Use references/single-context.md and migrate provider plus all consumers in one change set. |
| Multiple legacy contexts | Use references/multi-context.md; avoid assigning multiple contextType values to one class. |
| Provider only found | Do not stop after provider migration; consumers will read from the wrong context or undefined. |
| Consumer only found | Locate the matching provider before replacing context access. |
| Tests excluded from scan | Exclude .test. files in discovery, then update tests only if they instantiate changed components. |
references/single-context.md: complete migration for one context such as theme or auth, including provider, class consumer, and function consumer.references/multi-context.md: nested providers and consumers of different contexts.references/context-file-template.md: standard file structure for a new context module.contextType: use consumers or wrapper components for multiple contexts.this.context is ambiguous: inspect whether it comes from legacy contextTypes or modern contextType before editing.### React legacy context migration
**Status:** complete | needs consumers | blocked
**Context:** `<context name>`
**Provider:** `<file path>`
**Consumers updated:** `<count>`
| File | Role | Change |
| --- | --- | --- |
| `<path>` | provider | `getChildContext` to provider `value` |
| `<path>` | class consumer | `contextTypes` to `contextType` |
| `<path>` | function consumer | legacy access to `useContext` |
**Validation**
- Provider scan: `<command/result>`
- Consumer scan: `<command/result>`
- React warnings: none | remaining
childContextTypes and getChildContext was run.contextTypes was run.this.context usage was audited for legacy versus modern context.createContext.contextType or consumers; function components use useContext.references/multi-context.md rather than invalid multiple contextType assignments.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/react18-batching-patternsDiagnose and fix React 18 automatic batching regressions in class components. Use when multiple setState calls occur after await, inside setTimeout, Promise .then() or .catch(), native addEventListener callbacks, or when tests fail because they assert intermediate state after a React 18 upgrade./react18-dep-compatibilityCheck React 18.3.1 and React 19 dependency compatibility before npm installs, peer-dependency resolutions, or upgrade plans. Use when reviewing a React upgrade matrix, resolving npm peer conflicts, choosing minimum compatible package versions, deciding on --legacy-peer-deps, or separating a react-router v5 to v6 migration./npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin react18-upgradeOther plugins' skills for the same job