Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
title, impact, impactDescription, type, tags
| title | impact | impactDescription | type | tags | ||||
|---|---|---|---|---|---|---|---|---|
| Always Use .value When Accessing ref() in JavaScript | HIGH | Forgetting .value causes silent failures and bugs in reactive state updates | capability |
|
Always Use .value When Accessing ref() in JavaScript
Impact: HIGH - Forgetting .value causes silent failures where state updates don't trigger reactivity, leading to hard-to-debug issues.
When using ref() in Vue 3's Composition API, the reactive value is wrapped in an object and must be accessed via .value in JavaScript code. However, in templates, Vue automatically unwraps refs so .value is not needed there. This inconsistency is a common source of bugs.
Task Checklist
- Always use
.valuewhen reading or writing ref values in<script>or.js/.tsfiles - Never use
.valuein<template>- Vue unwraps refs automatically there - When passing refs to functions, decide whether to pass the ref object or
.value - Use IDE/TypeScript to catch missing
.valueerrors early
Incorrect:
import { ref } from 'vue'
const count = ref(0)
// These do NOT work as expected
count++ // Tries to increment the ref object, not the value
count = 5 // Reassigns the variable, loses reactivity
console.log(count) // Logs "[object Object]", not the number
const items = ref([1, 2, 3])
items.push(4) // Error: push is not a function
Correct:
import { ref } from 'vue'
const count = ref(0)
// Always use .value in JavaScript
count.value++ // Correctly increments to 1
count.value = 5 // Correctly sets value to 5
console.log(count.value) // Logs "5"
const items = ref([1, 2, 3])
items.value.push(4) // Correctly adds 4 to the array
<template>
<!-- In templates, NO .value needed - Vue unwraps automatically -->
<p>{{ count }}</p>
<button @click="count++">Increment</button>
</template>