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-reactive-refs" ~/.claude/skills/intense-visions-harness-engineering-vue-reactive-refs-910f90 && rm -rf "$T"
manifest:
agents/skills/claude-code/vue-reactive-refs/SKILL.mdsource content
Vue Reactive Refs
Create and manage reactive primitive values and objects using ref and reactive
When to Use
- You need reactive state in a Vue 3 component using the Composition API
- Building composables that return reactive values
- Managing form inputs, counters, flags, or any mutable component state
Instructions
- Use
for primitives (strings, numbers, booleans) — access viaref()
..value - Use
for objects — access properties directly (noreactive()
)..value - Use
for derived values that should auto-update.computed() - Never destructure a
object — it breaks reactivity. Usereactive()
if needed.toRefs()
import { ref, reactive, computed, toRefs } from 'vue'; const count = ref(0); // ref for primitive const user = reactive({ name: 'Alice', age: 30 }); // reactive for object const greeting = computed(() => `Hello, ${user.name}!`); count.value++; // ref needs .value user.age = 31; // reactive — direct access
- In templates, refs are auto-unwrapped — use
not{{ count }}
.{{ count.value }} - Use
orshallowRef()
for large objects where deep reactivity is not needed.shallowReactive()
Details
Vue 3's reactivity system is built on ES6 Proxy.
ref() wraps a value in a reactive container with a .value property. reactive() wraps an entire object, making all properties reactive. computed() creates a cached, read-only reactive value derived from other reactive sources.
Trade-offs:
requiresref
in JavaScript (not in templates) — a common source of bugs for new Vue developers.value
loses reactivity when destructured — usereactive()
to safely destructuretoRefs()- Deep reactivity on large objects can be expensive — use
/shallowRef
for performanceshallowReactive - Replacing a
object entirely (reactive()
) does not trigger updates — mutate properties insteadstate = newObj
When NOT to use:
- For non-reactive constants — just use
without wrappingconst - For data that never changes after initialization — no need for reactivity overhead
- For large datasets rendered in lists — consider
with manual trigger viashallowReftriggerRef()
Source
https://patterns.dev/vue/reactive-refs
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.