ワンクリックで
debugging
Debug issues in the Second Brain Nuxt 4 + @nuxt/content v3 project. Use for any bug, test failure, or unexpected behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Debug issues in the Second Brain Nuxt 4 + @nuxt/content v3 project. Use for any bug, test failure, or unexpected behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Must read guide on creating/editing mermaid charts with validation tools and syntax reference for all diagram types
Generate interactive HTML walkthroughs with clickable Mermaid diagrams (flowcharts and ER diagrams) that explain codebase features, flows, architecture, and database schemas. Use when asked to "walkthrough", "explain this flow", "how does X work", "trace the code path", "annotated diagram", "code walkthrough", "explain the architecture of", "walk me through", "database schema", "explain the tables", "data model".
Create a note from any resource: URL, book, podcast, article, video, GitHub repo, Reddit thread, PDF, quote, or raw idea. Trigger on "add", "save", "capture", "note this", "take notes on", or any request to record content in the knowledge base.
Add tweets to the Second Brain. Use when the user provides a Twitter/X URL and pasted tweet content, asking to "add a tweet", "save this tweet", or "capture this tweet".
Query your Second Brain with keyword search. Use when asked to "ask my notes", "what do I know about", "query my knowledge", "/ask", or when the user has a question that their notes might answer.
Create Obsidian templates for the Second Brain vault. Use when asked to "create a template", "make a template for", "add an Obsidian template", or "template for X".
| name | debugging |
| description | Debug issues in the Second Brain Nuxt 4 + @nuxt/content v3 project. Use for any bug, test failure, or unexpected behavior. |
This skill adapts systematic debugging for the Second Brain stack:
Core principle: ALWAYS trace data flow before attempting fixes.
Before debugging, internalize these common pitfalls:
| Issue | Symptom | Cause |
|---|---|---|
| Empty graph edges | Nodes show, no connections | Missing .select('body') in query |
| Links not extracted | Backlinks/graph empty | Minimark parsed as object, not array |
| 404 on content page | Page not found | Slug mismatch (/slug vs slug) |
| Stale backlinks | Old connections shown | useAsyncData cache not invalidated |
| Silent API failure | Empty response, no error | try-catch returns {} or [] |
| Wrong mentions | Unrelated content matched | Title regex too broad |
| Graph crashes on filter | D3 error after filtering | Edge source/target type mismatch |
Data flows through these layers:
Content File (Markdown)
↓ Parsed by Nuxt Content
Minimark AST (body.value array)
↓ Queried via queryCollection
API Endpoint (server/api/*.ts)
↓ Returned as JSON
Vue Composable (useBacklinks, useMentions)
↓ Rendered in component
User Interface
First question: Which layer is broken?
[tag, props, ...children].select('body'), path matchingQuick diagnostic:
# Check if content is queryable
pnpm nuxi dev
# Visit http://localhost:3000/api/graph
# Empty edges? → Layer 2-3 issue
# Empty nodes? → Layer 1 issue
# Correct data but UI wrong? → Layer 4-5 issue
For content/link issues:
Check raw content file:
title and type?[[slug]]?/content/ directory?Check minimark extraction:
// In server/api/graph.get.ts, temporarily add:
console.log("Body structure:", JSON.stringify(item.body, null, 2));
// Verify: { type: 'minimark', value: [[...arrays...]] }
// NOT: { type: 'minimark', value: [{...objects...}] }
Check query selection:
// Must explicitly select body:
queryCollection(event, "content")
.select("path", "stem", "title", "type", "body") // ← body required!
.all();
Check API response:
curl http://localhost:3000/api/graph | jq '.edges | length'
curl http://localhost:3000/api/backlinks | jq 'keys | length'
For graph visualization issues:
Form ONE hypothesis:
Test minimally:
# Run relevant tests first
vp test --project unit -- minimark # For link extraction
vp test -- graph # For API issues
Add targeted logging:
// In extractLinksFromBody (server/utils/minimark.ts)
console.log("Body type:", body?.type);
console.log("Body value is array?", Array.isArray(body?.value));
console.log("First node:", JSON.stringify(body?.value?.[0]));
Create failing test first:
// tests/unit/utils/minimark.test.ts
it("extracts links from nested minimark", () => {
const body = {
type: "minimark",
value: [["a", { href: "/target" }, "Link text"]],
};
expect(extractLinksFromBody(body)).toContain("target");
});
Implement fix in ONE place
Verify with full test suite:
vp test
vp check && pnpm typecheck
If fix doesn't work after 3 attempts:
# Run all tests
vp test
# Run specific test file
vp test --project unit -- minimark
vp test -- graph.nuxt
# Type check
pnpm typecheck
# Start dev server for manual testing
pnpm dev
# Check API responses
curl -s http://localhost:3000/api/graph | jq '.nodes | length'
curl -s http://localhost:3000/api/graph | jq '.edges | length'
curl -s http://localhost:3000/api/backlinks | jq 'keys'
curl -s "http://localhost:3000/api/mentions?slug=test&title=Test" | jq
/content/*.md - Raw content files/content.config.ts - Collection schema (title, type required)/modules/wikilinks.ts - [[link]] to anchor transformation/server/utils/minimark.ts - Extract links from AST{ type: 'minimark', value: [...arrays...] }['a', { href: '/slug' }, 'text']/server/api/graph.get.ts - Nodes and edges for D3/server/api/backlinks.get.ts - Reverse link index/server/api/mentions.get.ts - Unlinked mentions search/app/composables/useBacklinks.ts - Fetch backlinks/app/composables/useMentions.ts - Fetch mentions/app/composables/useGraphFilters.ts - Graph filter state/app/pages/[...slug].vue - Content page/app/pages/graph.vue - Knowledge graph// Fix: Add .select('body') to query
queryCollection(event, "content")
.select("path", "stem", "title", "type", "tags", "body") // ← ADD body
.all();
// Check minimark format - must be ARRAY based
// Wrong: { tag: 'a', props: { href: '/' }, children: [] }
// Right: ['a', { href: '/' }, 'text']
// Fix extractLinksFromMinimark to handle arrays:
function extractLinksFromMinimark(node: unknown): string[] {
if (!Array.isArray(node)) return [];
const [tag, props, ...children] = node;
// ...
}
// Force refresh with key
const { data: backlinks, refresh } = await useAsyncData(
`backlinks-${Date.now()}`, // or add content hash
() => $fetch("/api/backlinks"),
);
// Check slug normalization
// Route uses: /atomic-habits (with slash)
// queryCollection expects path: '/atomic-habits' (with slash)
// Backlinks use slug: 'atomic-habits' (no slash)
// Ensure consistent normalization:
const slug = route.path.startsWith("/") ? route.path : `/${route.path}`;
If you catch yourself:
STOP. Return to Phase 1.