AGENTS.md templates / Vue

AGENTS.md template for Vue

A ready AGENTS.md for a Vue 3 app built with Vite and TypeScript. It fixes the component style, the store, the commands that verify a change, and the Vue 2 habits agents still carry.

Updated 3 December 2026 · 64 lines · 2.5 KB
AGENTS.md
# AGENTS.md

A Vue 3 single-page app built with Vite and TypeScript, with Pinia for state and Vitest for tests.

## Commands

- `npm run dev`: start Vite on http://localhost:5173
- `npm run build`: type-check and build for production
- `npm run type-check`: run `vue-tsc` without building
- `npm run lint`: ESLint
- `npm run test:unit`: run Vitest

## Project structure

- `src/components/`: shared single-file components
- `src/views/`: route-level components
- `src/stores/`: Pinia stores, one per domain
- `src/composables/`: reusable logic as `useX` functions
- `src/router/`: route definitions

## Rules for agents

- Every component uses `<script setup lang="ts">` and the Composition API. No Options API, no `this`.
- Do not destructure a `reactive()` object or a store directly. Use `toRefs` or `storeToRefs`.
- Pinia is the only store. Do not add Vuex or another state library.
- Never mutate a prop. Emit an event or use `defineModel`.

## Conventions

### Vue 3

- Composition API with `<script setup lang="ts">`. Options API only in legacy files.
- `ref` for primitives, `reactive` for objects, `computed` for derived state, `watchEffect` for side effects.
- Pinia for stores. Don't share state via globals.
- Scoped styles by default (`<style scoped>`) to avoid CSS leaks.
- Emit typed events with `defineEmits<{ ... }>()`.

### TypeScript

- Prefer `type` for object shapes, `interface` only when extending third-party types.
- Never use `any` — use `unknown` and narrow, or write a proper type.
- No non-null assertions (`!`) except in tests or when a type guard just ran.
- Use `readonly` for props, return types, and array params that don't mutate.
- Prefer discriminated unions over enums. Enums only for stable public APIs.
- Import types with `import type { ... }` to avoid runtime import cost.

### Vitest

- Co-locate test files (`*.test.ts`) with the code they test.
- Prefer `describe` only when grouping helps. Flat tests are fine.
- Mock at the boundary (network, fs, clock) — never mock the unit under test.

## Avoid

- Declaration-merging global namespaces.
- Using `Function`, `Object`, or `{}` as types.

## Guardrails

- Never commit secrets, API keys, or credentials. If you spot one in a diff, stop and flag it.
- Do not invent dependencies. If a package is not already in the manifest, confirm before adding it.
- When a command fails, read the actual error. Do not retry blindly or bypass with `--force`.
- Prefer editing existing files over creating new ones.
- Run the tests and the linter before saying a task is done, and say what you ran.

The commands and folders are the common defaults for Vue. Change them to match your project before you commit the file: an agent will run exactly what is written here.

Make it yours in the generator Add your database, test runner and other tools, pick your coding style, and get matching CLAUDE.md, Cursor and Copilot files. Free, runs in your browser. Already have instruction files? Context Doctor scans your repo and shows which files each coding tool is silently not loading. $19.

How to use it

Save the file as AGENTS.md in the root of your repository and commit it. Then check each tool you use:

ToolWhat to do
Claude CodeReads AGENTS.md only when no CLAUDE.md exists in or above the folder. If you have a CLAUDE.md, put @AGENTS.md on its first line.
CursorReads AGENTS.md from the project root, in the desktop app and the terminal. In the app, rules in .cursor/rules must be .mdc files. The terminal reads only plain .md files there.
CodexReads AGENTS.md from the root down to the folder you are in, with a shared 32 KiB limit across all of them.
GitHub CopilotReads AGENTS.md on some surfaces only. Keep a .github/copilot-instructions.md as well if your team relies on Copilot.

Details and sources: the AGENTS.md compatibility matrix.

What agents get wrong in Vue projects

These are the reasons the “Rules for agents” section says what it says.

Writing Options API components

Most Vue code a model has seen is Vue 2. Left alone, an agent adds data(), methods and this to a codebase that uses <script setup>, and you end up with two styles in one app.

Losing reactivity by destructuring

Agents destructure a reactive() object or a store and the values stop updating. The screen goes stale with no error. The template names storeToRefs and toRefs as the way to do it.

Reaching for Vuex

Vuex is in years of tutorials, so agents import it or write mutation-style code. The template states that Pinia is the only store.

Mutating props

Changing a prop inside the child works for a moment and then the parent overwrites it. The template asks for an emitted event or defineModel instead.

Questions

Where does AGENTS.md go in a Vue project?

In the root of the repository, next to your manifest file. Tools read it from the folder you start them in and, for most tools, from parent folders too.

Does Claude Code read AGENTS.md?

Only when there is no CLAUDE.md in or above the working folder. If you already have a CLAUDE.md, keep it and make its first line @AGENTS.md so both tools read the same rules.

How long should the file be?

Short enough that every line is something the agent would get wrong without it. Codex shares a 32 KiB budget across all the AGENTS.md files it loads, and long files get followed less closely by every tool.

Does this work for Nuxt?

Partly. The component and store rules carry over, but Nuxt has its own folders, auto-imports and server routes. Add those to the Project structure section and say that imports for components and composables are automatic, otherwise agents add import lines Nuxt does not need.

Templates for other stacks

Next.jsReactNode.js and TypeScriptExpressPythonFastAPIDjangoGoRuby on RailsLaravelSvelteKitAstroNestJSFastifyHonoFlaskRustElectronSupabase