/harlan-agent-kit:nuxt-improve-codebase-architecturefrom harlan-agent-kit
Reviews Nuxt codebase architecture and proposes refactors using Nuxt-native seams like modules, layers, plugins, composables, server routes, and Nitro. Useful for improving testability and AI-navigability.
Ships in harlan-agent-kit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Surface architectural friction in a Nuxt codebase and propose deepening opportunities — refactors that turn shallow modules into deep ones, using Nuxt's own extension points as seams. The aim is testability and AI-navigability.
Before any edit, read and follow the worktree isolation contract.
Keep mutation in a task-owned wt worktree with a live claim. Keep the primary checkout read only.
Use the terms in LANGUAGE.md exactly — module, interface, implementation, depth, seam, adapter, leverage, locality. Don't drift into "component," "service," "API," or "boundary."
Load-bearing principles (full list in LANGUAGE.md):
shared/, composables, server utils.composables/useFoo.ts or components/Foo.vue is a claim of app-wide ownership; the rename blast radius and naming-collision risk make global auto-import the most expensive seam decision. Colocate + _-prefix until ≥2 unrelated features consume it.This skill is informed by the project's domain model (GLOSSARY.md, docs/arch/, docs/adr/): the domain language names good seams; ADRs record decisions not to re-litigate.
shared/ → packages/* → Nuxt module/layer), testing strategy.provide + use, component thinness).$fetch as port, async resource composables, useState for SSR-safe app-wide state, client policy mirror).Always run ripast first. Every claim about depth, caller counts, locality, or cross-scope leaks must cite a ripast invocation. Text search misses shadowed identifiers, type-only imports, Vue template refs, and Nuxt auto-imported callers.
Pass --tsconfig .nuxt/tsconfig.json on tree/rename/move/rename-file so auto-imports resolve. Run nuxi prepare first if .nuxt/ is stale. For scan (rg-driven) and when trimming tree, scope with --glob:
--glob 'app/**,server/**,composables/**,plugins/**,modules/**,layers/**,shared/**,nuxt.config.ts'
Adjust per project: drop app/** pre-Nuxt-4 (use pages/**,components/**), drop layers/** if none, add packages/** or a module's src/**.
Opening pass — run before forming any candidate:
| Command | What it surfaces |
|---|---|
pnpm dlx @ripast/cli unused --tsconfig .nuxt/tsconfig.json --exports local | Top-level declarations with zero project references → deletion-test slam-dunks |
pnpm dlx @ripast/cli tree --exports exported --tsconfig .nuxt/tsconfig.json | Public surface per file → shallow modules (tiny interface + tiny impl) |
pnpm dlx @ripast/cli tree --exports local --tsconfig .nuxt/tsconfig.json | Internals per file → locality opportunities |
pnpm dlx @ripast/cli css-class-scan --glob 'app/**,layers/**,components/**,pages/**' | Class-token inventory → design-token consolidation candidates |
Per-candidate, before listing (scan is rg-driven — use --glob here):
| Command | What it surfaces |
|---|---|
pnpm dlx @ripast/cli scan <symbol> --glob ... | Caller count + kind classification → drives deletion test + §2 thresholds |
pnpm dlx @ripast/cli scan <symbol> --kind identifier-reference,import-specifier --glob ... | Same, minus string-literal noise |
pnpm dlx @ripast/cli scan <symbol> --graph mermaid --glob ... | Importer graph → cross-scope leaks (graph spanning server/ + composables/ + plugins/) |
Cite numbers when presenting ("scan returns 2 callers, both in server/api/ — single-scope, deletion test fails").
Read the project's domain glossary and any ADRs in the area first. Then orient on the Nuxt shape of the project:
modules/, layers/, plugins/, composables/, server/api, server/middleware, nitro plugins, runtimeConfig, app:*/nitro:*/build:* hooks, addImports, addServerHandler, addComponent, addPlugin?Then use subagent_type=Explore to walk the codebase. Friction signals:
composables/, plugins/, server/api, runtimeConfig — scan --graph mermaid spanning ≥3 Nuxt scopes = no central seam.useState, plugin providing one untyped value, server util that's a one-line $fetch passthrough. Spot via tree --exports exported.app/, server/, nitro instead of sitting behind one hook/module.types//utils//constants/ imported from both server/ and composables/ — move to shared/. Detect with scan --graph mermaid: importer set straddling both = leak.shared/, composables, or server utils — fire in every consumer, break SSR/treeshaking/tests.Present a numbered list of deepening opportunities. For each candidate:
modules/foo.ts, layers/billing/, server/api/x.post.ts, plugins/auth.client.ts, composables/useBar.ts, nuxt.config.ts)addImports for the public composables and an app:created hook for the singleton wiring")@nuxt/test-utils against a fixture; today the plugin's behaviour can only be observed through a full app boot")Use GLOSSARY.md for the domain, LANGUAGE.md for the architecture, NUXT-SEAMS.md for the framework seam, and the relevant convention file + section number when the candidate is a convention gap. Example phrasings: "the Order intake module exposed as a Nuxt layer", "establish NITRO-CONVENTIONS.md §1 for the Order create handler" — not "the FooBarHandler", not "the Order service".
Reject before listing. Bias toward fewer, sharper candidates. Validate caller counts with scan --kind identifier-reference,import-specifier scoped to the whole project (no --glob narrowing to the candidate's own layer/dir), and confirm the shape they consume — a uniform interface for the wrapper is a precondition for collapsing it. Cross-layer callers with a different state shape break the candidate. No guesswork.
defineApiHandler earns its keep only when ≥2 of {validation, auth, presenter, domain-error mapping} fire per call.h() calls / column defs / template output with little reactive state. Acceptable at ≥4 callers; otherwise inline or slot-scope.scan --tsconfig .nuxt/tsconfig.json shows callers in a single feature dir — keep colocated + _-prefixed. Promote only at ≥2 unrelated feature consumers. See NUXT-SEAMS.md §"Internal vs global scope".scan <Wrapper> --kind identifier-reference,import-specifier (no --glob) has been run and every caller's consumed-shape verified. Wrappers in most cases have cross-layer callers (admin pages, ad-hoc usages) that don't share the "obvious" caller's state shape; collapsing on a partial census produces a narrower interface that breaks the outliers at typecheck.runtimeConfig key. Confirm with scan --kind property,member-access; one hit = fails unless genuinely env-overridable at deploy.event behind a global accessor. Server abstractions thread H3Event through — reject module-level singletons, ambient useRuntimeConfig() without event, implicit getRequestEvent().Forbidden patterns — always flag, never propose. Full lists in NITRO-CONVENTIONS.md and NUXT-APP-CONVENTIONS.md "Forbidden patterns". Headline: never wrap an authenticated route in defineCachedEventHandler — the cache wrapper strips request headers, breaking session/auth. Hoist auth to an outer defineEventHandler and cache the data fetch via defineCachedFunction keyed on the resource.
ADR conflicts: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly (e.g. "contradicts ADR-0007 — but worth reopening because…"). Don't list every theoretical refactor an ADR forbids.
Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive. For Nuxt candidates, also walk: which Nuxt hook fires when, SSR vs client behaviour, build-time vs runtime, where runtimeConfig ends and component state begins.
Side effects happen inline as decisions crystallize:
Naming a deepened module after a concept not in GLOSSARY.md? Read the installed Brundlefly glossary Skill and add the term there: the term, one sentence of meaning in this codebase, and where it lives.
Sharpening a fuzzy term during the conversation? Update GLOSSARY.md right there.
User rejects the candidate with a load-bearing reason? Offer an ADR, framed as: "Want me to record this as an ADR so future architecture reviews don't re-suggest it?" Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing — skip ephemeral reasons ("not worth it right now") and self-evident ones. Write it to docs/adr/NNNN-slug.md with context, decision, and consequences.
Want to explore alternative interfaces for the deepened module? See INTERFACE-DESIGN.md. Sub-agents are pre-seeded with Nuxt-native shapes (module + hooks, layer, plugin + composable, nitro plugin) so the design space is grounded in what Nuxt already offers.
Need to know the true blast radius of a rename/move before committing? pnpm dlx @ripast/cli scan <symbol> (counts) or pnpm dlx @ripast/cli scan <symbol> --graph mermaid (importer graph). Quote numbers before promising scope.
Decision crystallized into a concrete refactor? Execute through ripast (--tsconfig .nuxt/tsconfig.json rewrites auto-imported callers too):
| Refactor | Command |
|---|---|
| Rename symbol | pnpm dlx @ripast/cli rename <from> <to> --tsconfig .nuxt/tsconfig.json --apply (--scope <file> if multi-declared) |
| Move exported declaration | pnpm dlx @ripast/cli move <symbol> --from <a> --to <b> --tsconfig .nuxt/tsconfig.json --apply |
| Move a file | pnpm dlx @ripast/cli rename-file <old> <new> --tsconfig .nuxt/tsconfig.json --apply |
| Design-token / class migration | pnpm dlx @ripast/cli css-class-rename --map tokens.json --apply (seed via css-class-scan) |
All mutating commands default to dry-run; preview, then --apply. --verify blocks on new type diagnostics — fix them, never --no-verify. Edit is only correct for single-file or <5-match changes.
What SKILL.md sets; muted values are Claude Code's defaults
highnpx claudepluginhub harlan-zw/harlan-agent-kit --plugin harlan-agent-kit35 skills in this plugin
/adversarial-reviewReview one pull request adversarially, hand permitted defects to Repair, verify the remote head, and publish the Harlan Agent Kit bot status. Use for rigorous pre-merge PR review./agent-feedbackImprove one Agent skill from explicit Review feedback. Use only for the agent-feedback Routine./agent-retroWeekly retro of Harlan GitHub Agent sessions. Group transcripts by goal, find repeated and wasted work, and rank fixes to the controller, prompts, skills, or model. Use for agent retro, session review, agent efficiency, or self-improvement runs./brand-labExplore brand directions for a product on one private HTML page: a logo and small UI motifs, three or more variations each, with picks and rationale. Use when the user wants to rethink or strengthen a brand, logo, or brand motif, compare brand variations side by side, or says the branding feels basic./browserUse Harlan's browsers with the correct identity. Use before browser testing, signed-in automation, screenshots, or Chrome connection recovery. Covers prompt-free Clients and Agent Chrome, shared Harlan Chrome, dev-browser, and tab cleanup./ci-reviewInspect GitHub Actions logs for warnings and errors, triage their causes, and repair actionable findings. Use for the ci-review Routine and its Issue work.Other plugins' skills for the same job