Skip to content

RFC: Standardize Vue 3 development patterns in AGENTS.md#4865

Open
Erics1337 wants to merge 3 commits intobetaflight:masterfrom
Erics1337:docs/vue-instructions
Open

RFC: Standardize Vue 3 development patterns in AGENTS.md#4865
Erics1337 wants to merge 3 commits intobetaflight:masterfrom
Erics1337:docs/vue-instructions

Conversation

@Erics1337
Copy link
Contributor

@Erics1337 Erics1337 commented Feb 14, 2026

Vue 3 Development Instructions

These standardized instructions are adapted from the awesome-copilot Vue 3 instructions.

Modifications & deviations

These agent instruction have adopted most of the upstream instructions, with the following project-specific adjustments:

  • No Nuxt: No Nuxt. Related instructions have been removed.
  • TypeScript: While recommended, strict TypeScript usage is not currently enforced. Incremental adoption (e.g., via JSDoc) is recommended, but it is not a hard requirement for this PR. Full adoption is left for a future issue.
  • Naming Convention: We use `PascalCase` for both component names and file names.

Current State

The codebase largely complies with these instructions, with some known exceptions:

  • Styling: Some Single File Components (SFCs) still rely on external `.less` files. Future refactoring should move these styles into the `.vue` files.

This PR establishes the baseline for agent based vue 3 development standards going forward.

This RFC proposes adopting standard development instructions for AI agents
and developers to support the incremental migration to Vue 3 and TypeScript.

Key points:
- Incremental adoption of TypeScript (mix of JS/TS allowed).
- Strict adherence to Single File Components (SFC) for all new styles.
- Generic `AGENTS.md` location for broad tool compatibility (Windsurf, etc.).

Based on github/awesome-copilot instructions but adapted for the current
codebase state.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Walkthrough

Adds a new RFC-style documentation file AGENTS.md that defines Vue 3 + TypeScript development standards and guidelines (Composition API, Vite, Pinia), covering architecture, component patterns, state management, styling, data fetching, testing, performance, error handling, security, accessibility, and implementation processes.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added a new RFC/documentation specifying Vue 3 + TypeScript development standards: project context, architecture, Composition API patterns, component design, TypeScript integration and strict tsconfig guidance, state management (Pinia), styling conventions, data fetching strategies, error handling, forms/validation, routing, testing, performance optimization, security, accessibility, and implementation/process guidelines.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (19 files):

⚔️ android/app/build.gradle (content)
⚔️ android/app/src/main/AndroidManifest.xml (content)
⚔️ android/build.gradle (content)
⚔️ android/gradle/wrapper/gradle-wrapper.properties (content)
⚔️ android/variables.gradle (content)
⚔️ capacitor.config.generator.mjs (content)
⚔️ locales/es/messages.json (content)
⚔️ locales/ru/messages.json (content)
⚔️ package.json (content)
⚔️ src/components/user-session/UserSession.js (content)
⚔️ src/composables/useReboot.js (content)
⚔️ src/js/browserMain.js (content)
⚔️ src/js/fc.js (content)
⚔️ src/js/main.js (content)
⚔️ src/js/serial_backend.js (content)
⚔️ src/js/vue_components.js (content)
⚔️ src/stores/fc.js (content)
⚔️ vite.config.js (content)
⚔️ yarn.lock (content)

These conflicts must be resolved before merging into master.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an AGENTS.md file to standardize Vue 3 development patterns.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the purpose, modifications, deviations from upstream instructions, and current state of the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch docs/vue-instructions
  • Post resolved changes as copyable diffs in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 63: Remove the Nuxt-specific mention of useAsyncData from the AGENTS.md
recommendation: clarify that the project uses Vite + Vue 3 and that useAsyncData
is not available here, and either delete the suggestion "Use `useAsyncData` or
third-party data utilities (Vue Query)" or replace it with a Vite-appropriate
alternative (e.g., recommend using Vue Query, plain fetch with reactive state,
or other composables) and add a note that useAsyncData only applies if migrating
to Nuxt (reference symbols: useAsyncData, Vue Query).
- Line 102: Replace the specific library recommendation ("VeeValidate" and
"@vueuse/form") in the AGENTS.md line that suggests declarative validation with
a generic guidance phrase; update the sentence to something like "Use validation
libraries or build custom validation composables for declarative validation" so
it no longer prescribes unadopted dependencies and avoids encouraging adding
VeeValidate or `@vueuse/form` to the project.
- Line 86: Remove the framework-specific suggestion "useFetch" and the unrelated
"Vue Query" reference and replace with guidance to either implement a
project-specific data-fetching composable (e.g., a custom useFetch built with
the Vue 3 Composition API and the browser Fetch API) or explicitly pick and
document a supported library (name it and add installation/usage notes). Update
the AGENTS.md entry that currently mentions `useFetch` and `Vue Query` to
describe building a custom composable (Composition API + Fetch API) or to state
which third‑party library the project will use, including brief setup and where
to find example usage.
- Around line 117-124: Update the "Testing" section to remove or clearly mark as
optional any tools not present in the repo: remove explicit prescriptive
references to "Cypress", "Playwright", and "axe-core" (or add a note that they
are optional external tools not configured here), and instead state that
"Vitest" is the project's configured test runner and give guidance to write unit
tests with Vue Test Utils and Vitest, mock global plugins (router, Pinia), and
optionally mention end-to-end/accessibility tools as alternatives only if the
developer adds them.
- Line 42: Update the guideline sentence in AGENTS.md that currently says "Use
PascalCase for component names and kebab-case for file names" to recommend
PascalCase for both component names and file names to match the codebase
convention (47 PascalCase Vue component files); ensure the line explicitly
states "Use PascalCase for component names and file names" and adjust any brief
explanatory note to reflect the existing project standard.
🧹 Nitpick comments (3)
AGENTS.md (3)

1-173: Consider adding a dedicated "Migration Strategy" section.

While this RFC provides excellent standards for Vue 3 + TypeScript development, it could benefit from a dedicated section on migration strategy that addresses:

  1. JS to TS Migration Path:

    • When to add JSDoc annotations vs. full TypeScript conversion
    • How to gradually type existing modules
    • Handling type inference and any types during transition
  2. Options API to Composition API Migration:

    • Step-by-step conversion patterns
    • Handling lifecycle hooks, computed properties, watchers
    • Converting mixins to composables
  3. Global to Scoped Styles Migration:

    • Identifying global style dependencies
    • Extracting component-specific styles
    • Handling shared design tokens
  4. Testing During Migration:

    • Ensuring behavioral equivalence
    • Regression testing strategy
    • Incremental testing approach

This would make the document more actionable for developers actively migrating components.


32-32: Clarify mechanism for enabling strict mode on new files only.

The guidance to "Enable strict mode in tsconfig.json for new parts of the codebase" needs clarification. TypeScript's strict mode is typically project-wide. Consider specifying the intended approach:

  • Option 1: Use per-file // @ts-check and `// `@ts-strict directives
  • Option 2: Create separate tsconfig files with different strict settings for new vs. legacy code
  • Option 3: Use ESLint rules to enforce stricter checking on new files

This clarification will help developers implement the incremental TypeScript adoption correctly.


75-140: Consider marking advanced topics as "Future Considerations."

The sections on Performance Optimization, Error Handling, Security, and Accessibility (lines 75-140) contain valuable best practices but may be too prescriptive for an incremental migration RFC. Consider:

  1. Restructuring these as "Advanced Topics" or "Future Enhancements" to distinguish them from core migration requirements
  2. Removing tool-specific recommendations (e.g., Sentry/LogRocket on line 98) unless they're actively being adopted
  3. Focusing the main RFC on migration essentials: TypeScript adoption, Composition API, scoped styles, and Pinia state management

This would keep the RFC focused on actionable migration guidance while preserving these best practices as aspirational goals.

Comment on lines +117 to +124
### Testing

- Write unit tests with Vue Test Utils and Vitest
- Focus on behavior, not implementation details
- Use `mount` and `shallowMount` for component isolation
- Mock global plugins (router, Pinia) as needed
- Add end-to-end tests with Cypress or Playwright
- Test accessibility using axe-core integration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for testing framework dependencies and configuration

echo "=== Checking package.json for testing libraries ==="
if [ -f "package.json" ]; then
  cat package.json | jq '.dependencies, .devDependencies' 2>/dev/null | grep -iE "(vitest|jest|cypress|playwright|mocha|axe|testing-library)" || echo "No matches found in package.json"
else
  echo "package.json not found"
fi

echo -e "\n=== Checking for test configuration files ==="
fd -t f "(vitest|vite|cypress|playwright|jest|mocha)\.config\.(ts|js|mjs)" -d 2 2>/dev/null || echo "No test config files found"

echo -e "\n=== Checking for test files ==="
fd -e spec.ts -e spec.js -e test.ts -e test.js 2>/dev/null | head -20 || echo "No test files found"

echo -e "\n=== Full package.json devDependencies ==="
if [ -f "package.json" ]; then
  cat package.json | jq '.devDependencies' 2>/dev/null
fi

Repository: betaflight/betaflight-configurator

Length of output: 1611


Remove or clarify testing tools not in the project setup.

The document prescribes Cypress, Playwright, and axe-core, but these tools are not in the project's devDependencies. Only Vitest is actually configured and available. Remove references to unavailable tools or clarify they are optional alternatives not set up in the project. If applicable, update the testing guidance to reflect what's actually installed (Vitest).

🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 117 - 124, Update the "Testing" section to remove or
clearly mark as optional any tools not present in the repo: remove explicit
prescriptive references to "Cypress", "Playwright", and "axe-core" (or add a
note that they are optional external tools not configured here), and instead
state that "Vitest" is the project's configured test runner and give guidance to
write unit tests with Vue Test Utils and Vitest, mock global plugins (router,
Pinia), and optionally mention end-to-end/accessibility tools as alternatives
only if the developer adds them.

Updated naming convention for file names in component design.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Line 69: Update the AGENTS.md entry that currently recommends "Tailwind CSS":
either remove the Tailwind CSS sentence entirely or reword it to be generic
(e.g., "Consider utility-first CSS or BEM conventions for class naming") or move
the recommendation into a "Future considerations" section with a note that
Tailwind is not configured in this project; ensure the change references the
existing "Tailwind CSS" text so the reviewer can locate and edit that exact
phrase.
🧹 Nitpick comments (3)
AGENTS.md (3)

15-15: Clarify that Vite is the project's build tool.

The line states "Modern build tooling (Vite recommended)" which suggests Vite is optional. Since the project uses Vite as its build system, update this to definitively state "Vite for build tooling" to avoid ambiguity for developers and AI agents following these guidelines.

📝 Suggested clarification
-- Modern build tooling (Vite recommended)
+- Vite for build tooling

1-173: Consider adding project-specific examples and context.

While this RFC provides comprehensive Vue 3 guidance, it reads as a generic framework guide. To make it more actionable for betaflight-configurator developers, consider adding:

  • References to existing migrated components (e.g., OsdTab.vue) as examples
  • Specific guidance on migrating legacy tabs from JavaScript to Vue SFCs
  • Links to actual project structure (src/components/, src/composables/)
  • Notes about coexisting with legacy code during incremental migration
  • Examples from the codebase that demonstrate recommended patterns

Based on learnings, migration PRs should focus on correctness and structure without adding new features, so the RFC could explicitly state this principle.


78-78: Clarify the experimental status of <Suspense> in Vue 3.

<Suspense> remains experimental in Vue 3 as of 2026, with no guarantee of stabilization and API subject to change. Add a note to flag this risk to users.

Suggested change
-- Use `<Suspense>` for async component loading fallbacks
+- Use `<Suspense>` for async component loading fallbacks (⚠️ experimental, API may change)


- **Strictly Use SFC**: Use `<style scoped>` within Single File Components (`.vue`).
- **Avoid Global Styles**: Do not use global LESS/CSS files for component-specific styles.
- Consider utility-first frameworks (Tailwind CSS) for rapid styling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for Tailwind CSS in dependencies and configuration

echo "=== Checking package.json for Tailwind ==="
if [ -f "package.json" ]; then
  cat package.json | jq '.dependencies, .devDependencies' | grep -i tailwind || echo "Tailwind not found in dependencies"
fi

echo -e "\n=== Checking for Tailwind config files ==="
fd -t f "tailwind\.config\.(js|ts|cjs|mjs)" -d 2 || echo "No Tailwind config found"

echo -e "\n=== Checking for Tailwind imports in code ==="
rg "@tailwind|tailwindcss" --type vue --type js --type ts --type css -g '!node_modules' | head -10 || echo "No Tailwind usage found"

Repository: betaflight/betaflight-configurator

Length of output: 291


Remove or contextualize the Tailwind CSS recommendation on line 69.

Tailwind CSS is not configured in the project (verified: no dependencies, no config files, no imports). Recommending it without context suggests adopting a significant framework that isn't part of the current setup. Either remove this reference, make it more generic ("Consider utility-first CSS or BEM conventions for class naming"), or move it to a "Future considerations" section if relevant to longer-term goals.

🤖 Prompt for AI Agents
In `@AGENTS.md` at line 69, Update the AGENTS.md entry that currently recommends
"Tailwind CSS": either remove the Tailwind CSS sentence entirely or reword it to
be generic (e.g., "Consider utility-first CSS or BEM conventions for class
naming") or move the recommendation into a "Future considerations" section with
a note that Tailwind is not configured in this project; ensure the change
references the existing "Tailwind CSS" text so the reviewer can locate and edit
that exact phrase.

@haslinghuis haslinghuis moved this to App in 2026.6.0 Feb 14, 2026
@haslinghuis haslinghuis added this to the 2026.6 milestone Feb 14, 2026
@Erics1337 Erics1337 changed the title RFC: Standardize Vue 3 & TS development patterns in AGENTS.md RFC: Standardize Vue 3 development patterns in AGENTS.md Feb 16, 2026
@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

🎉 Do you want to test this code? 🎉

⚠️ CAUTION: The build may be unstable and result in corrupted configurations or data loss. Use only for testing! ⚠️

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@AGENTS.md`:
- Around line 31-33: Update the AGENTS.md guidance to explain exactly how to
enable strict mode only for new/TS parts: state that you should add per-folder
or per-package tsconfig.json files that extend the base config and set
"compilerOptions": { "strict": true }, or use TypeScript Project References (add
"composite": true and a "references" entry) for new subprojects; mention that
these per-folder tsconfig files will be picked up by editors/tsc and that the
root tsconfig.json remains unchanged, and optionally note using editor/CI
overrides (tsconfig.json inheritance) to enforce the new strict settings for new
.ts/.vue files.
- Around line 144-146: Update Step 2's wording to avoid implying a fresh Vite
init: replace the line "Initialize Vite project with Vue 3 and TypeScript" with
a phrase that directs contributors to use or verify the existing Vite
configuration (e.g., "Use the repository's existing Vite setup configured for
Vue 3 and TypeScript" or "Ensure Vite is configured for Vue 3 and TypeScript"),
so contributors understand they should adapt or confirm current config rather
than re-initialize a new project.

Comment on lines +31 to +33
- **Incremental Adoption**: Existing JS files are common. When modifying them, prefer JSDoc for types. When creating new files, use `.ts` or `.vue` with `lang="ts"`.
- Enable `strict` mode in `tsconfig.json` for new parts of the codebase.
- Use `defineComponent` or `<script setup lang="ts">` with `defineProps` and `defineEmits`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clarify how “strict mode for new parts” is enforced.

tsconfig.json is project-wide; “strict for new parts” typically requires a separate tsconfig (e.g., via project references or per-folder config). Consider spelling out the mechanism to avoid confusion.

🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 31 - 33, Update the AGENTS.md guidance to explain
exactly how to enable strict mode only for new/TS parts: state that you should
add per-folder or per-package tsconfig.json files that extend the base config
and set "compilerOptions": { "strict": true }, or use TypeScript Project
References (add "composite": true and a "references" entry) for new subprojects;
mention that these per-folder tsconfig files will be picked up by editors/tsc
and that the root tsconfig.json remains unchanged, and optionally note using
editor/CI overrides (tsconfig.json inheritance) to enforce the new strict
settings for new .ts/.vue files.

Comment on lines +144 to +146
1. Plan component and composable architecture
2. Initialize Vite project with Vue 3 and TypeScript
3. Define Pinia stores and composables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid implying a fresh Vite initialization in an existing repo.

Step 2 says “Initialize Vite project,” which reads like a greenfield setup. Consider reframing to “use the existing Vite setup / config” to avoid misleading contributors.

🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 144 - 146, Update Step 2's wording to avoid implying
a fresh Vite init: replace the line "Initialize Vite project with Vue 3 and
TypeScript" with a phrase that directs contributors to use or verify the
existing Vite configuration (e.g., "Use the repository's existing Vite setup
configured for Vue 3 and TypeScript" or "Ensure Vite is configured for Vue 3 and
TypeScript"), so contributors understand they should adapt or confirm current
config rather than re-initialize a new project.

@Erics1337
Copy link
Contributor Author

I recently saw an analysis suggesting AGENTS.md / CLAUDE.md style files often hurt more than help. The gist was that extra repo-level “agent instructions” can add noise, misdirect models, and benchmark worse than just using the code + a focused prompt. Developer-written context was usually neutral at best, and auto-generated context sometimes made results worse.

So this PR is mainly to spark discussion: do we want any agent-specific instruction files here at all? If yes, I’d argue for the smallest, least-prescriptive version possible, and lean on README/CONTRIBUTING plus code structure for “context” instead of long MD guidance.

Curious what others have seen in practice.

@haslinghuis
Copy link
Member

Agree instead of trying to control the whole process minimal constraints would be probably more effective.
Tried with writing local md for planning and learnings during migration, but quickly gets ignored.

What non-obvious, enforceable constraints are not already expressed in code?

Perhaps a minimal file with directional constraints:

# Agent Constraints (Migration Phase)

## Architectural Direction
- The app is being migrated from jQuery to Vue 3 + Pinia.
- Do NOT introduce new jQuery usage.
- New UI functionality must be implemented in Vue components.

## State Management
- Application state must live in Pinia stores.
- Do not store application state in the DOM, global variables, or ad-hoc event buses.
- Do not derive state by querying the DOM.

## Cross-Paradigm Rules
- Do not extend legacy jQuery modules for new features.
- Do not mix Vue reactive state with jQuery DOM mutation.
- If modifying legacy jQuery code, prefer refactoring it into Vue instead of expanding it.

## Layering
- MSP / device communication logic must not live inside Vue components.
- Keep protocol / transport logic separate from presentation logic.

## Build / Generated Artifacts
- Do not modify generated or build output files.

Post migration we could use structural constraints:

# Agent Constraints

## UI Architecture
- All UI must be implemented using Vue 3.
- Do not use direct DOM mutation for application state.

## State Management
- Application state must live in Pinia stores.
- Do not introduce global mutable state outside Pinia.

## Layering
- MSP / device communication logic must remain separate from Vue components.
- Presentation logic and protocol logic must not be coupled.

## Build / Generated Artifacts
- Do not modify generated or build output files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: App

Development

Successfully merging this pull request may close these issues.

3 participants