install
source · Clone the upstream repo
git clone https://github.com/Intense-Visions/harness-engineering
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Intense-Visions/harness-engineering "$T" && mkdir -p ~/.claude/skills && cp -r "$T/agents/skills/claude-code/vue-provide-inject" ~/.claude/skills/intense-visions-harness-engineering-vue-provide-inject && rm -rf "$T"
manifest:
agents/skills/claude-code/vue-provide-inject/SKILL.mdsource content
Vue Provide / Inject
Share data across a component tree without prop-drilling using provide/inject
When to Use
- A parent component needs to share data with deeply nested descendants
- You want to avoid passing props through intermediate components that do not use them
- Implementing theme, locale, or configuration providers at the app level
Instructions
- In the ancestor component, call
insideprovide(key, value)
.<script setup> - In any descendant, call
to receive the provided value.const value = inject(key) - Use
for type-safe provide/inject in TypeScript.InjectionKey<T> - Provide reactive values (
orref
) so descendants receive live updates.reactive - Always provide a default value or document that
may returninject()
.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'));
- Use Symbol keys to avoid naming collisions between providers.
Details
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:
- Implicit dependencies — it is not obvious from a component's props what injected values it depends on
- Debugging is harder — there is no props panel in DevTools for injected values (though Vue DevTools does show provide/inject)
- Overuse leads to "spooky action at a distance" — changes in a provider affect distant descendants
When NOT to use:
- When only one level of nesting exists — just pass a prop
- For application-wide global state — use Pinia stores instead
- When multiple providers might conflict — the closest ancestor's provide wins, which can be confusing
Source
https://patterns.dev/vue/provide-inject
Process
- Read the instructions and examples in this document.
- Apply the patterns to your implementation, adapting to your specific context.
- Verify your implementation against the details and edge cases listed above.
Harness Integration
- Type: knowledge — this skill is a reference document, not a procedural workflow.
- No tools or state — consumed as context by other skills and agents.
Success Criteria
- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.