From harness-claude
Shares reactive data across Vue component trees using provide/inject, avoiding prop-drilling for deeply nested descendants like themes or locales.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Share data across a component tree without prop-drilling using provide/inject
Provides patterns for Vue components including props validation with TypeScript, defaults, emits, slots, and provide/inject. Use when building reusable Vue components.
Implements JavaScript Provider pattern to share data like themes, locales, or user info across modules without prop-drilling. Use when multiple components need the same data.
Share bugs, ideas, or general feedback.
Share data across a component tree without prop-drilling using provide/inject
provide(key, value) inside <script setup>.const value = inject(key) to receive the provided value.InjectionKey<T> for type-safe provide/inject in TypeScript.ref or reactive) so descendants receive live updates.inject() may return undefined.// Parent — provides theme
import { provide, ref } from 'vue';
const theme = ref('light');
provide('theme', theme);
// Deep child — injects theme
import { inject } from 'vue';
const theme = inject('theme', ref('light'));
Vue's provide/inject is a dependency injection mechanism scoped to the component tree. A provider makes a value available to all its descendants, regardless of depth. Unlike props, the intermediate components do not need to know about or forward the value.
Trade-offs:
When NOT to use:
https://patterns.dev/vue/provide-inject