AgentSkillsCN

naming

为Vue项目检查或应用文件与文件夹命名规范。在新建文件或文件夹、重命名已有文件、审计模块的命名一致性,或在不确定文件名称与路径是否正确时使用此功能。

SKILL.md
--- frontmatter
name: naming
description: Check or apply file and folder naming conventions for this Vue project. Use when creating new files or folders, renaming existing ones, auditing a module for naming consistency, or any time the correct name/path for a file is unclear.

Naming Skill

Audit or apply the project's file and folder naming conventions.

Conventions

Folders

LocationCaseExample
Top-level src dirskebab-casesrc/lib/, src/modules/
Module dirskebab-casemodules/home/, modules/user-settings/
Module sub-dirsfixed namescomponents/, views/, stores/, router/, tests/
Component utilscomponents/utils/components/utils/

Files

TypePatternExample
Component{module}.{name}.component.vuehome.hero.component.vue
View{module}.{name}.view.vueauth.signin.view.vue
Store{module}.store.jstasks.store.js
Router{module}.router.jsusers.router.js
Test{target}.spec.jshome.store.spec.js
Service{name}.jsaxios.js
Helper{name}.jstools.js
Plugin{name}.jsvuetify.js
Config{name}.js or index.jsdevelopment.js

Case conventions in code

ContextConventionExample
Variable / functionlowerCamelCaseuseHomeStore, paginationRequest
Component name (JS)PascalCaseHomeHeroComponent
Store exportuse{Module}StoreuseTasksStore
Constant / env keyUPPER_SNAKE_CASEMY_MODULE_KEY

Rules

  1. Dot-notation prefix: always prefix with the module name separated by dots

    • home.hero.component.vue not hero.component.vue
    • tasks.store.js not store.js
  2. Semantic suffix: always add the type suffix

    • .component.vue for reusable components
    • .view.vue for page-level views
    • .store.js for Pinia stores
    • .router.js for route definitions
    • .spec.js for tests
  3. Singular vs plural: follow the module's data semantics

    • List of items → plural: tasks.view.vue, users.view.vue
    • Single item → singular: task.view.vue, user.view.vue
  4. Utility sub-components: place in components/utils/ and keep the module prefix

    • components/utils/home.blur.background.component.vue
  5. Shared code: files in src/lib/ use simple kebab-case, no module prefix

    • src/lib/helpers/tools.js, src/lib/plugins/vuetify.js

Steps

When creating a new file

  1. Identify the module it belongs to (e.g., users)
  2. Identify the file type (component, view, store, router, test, helper, plugin)
  3. Derive the name:
    • module prefix (kebab-case) + dot + semantic name (kebab-case) + dot + type suffix
    • Example: module=users, name=profile, type=component → users.profile.component.vue
  4. Place it in the correct sub-directory:
    • .vue components → src/modules/{module}/components/
    • .vue views → src/modules/{module}/views/
    • stores → src/modules/{module}/stores/
    • routers → src/modules/{module}/router/
    • tests → src/modules/{module}/tests/
  5. Confirm the name follows the table above before writing the file

When auditing a module

  1. List all files in src/modules/{module}/
  2. Check each file against the conventions table
  3. Report any violations with the expected name
  4. Apply renames if requested (use /feature or direct edits)
  5. Run /verify after renaming

Examples

SituationCorrect nameWrong name
Hero component in homehome.hero.component.vueHeroComponent.vue, hero.vue
Sign-in page in authauth.signin.view.vueSignIn.vue, signin.vue
Pinia store in taskstasks.store.jstasksStore.js, store.js
Router in usersusers.router.jsrouter.js, usersRouter.js
Test for home storehome.store.spec.jshomeStore.test.js, store.spec.js
Utility helpersrc/lib/helpers/tools.jssrc/lib/helpers/tools.helper.js
Utility sub-componentcomponents/utils/home.tabs.component.vuecomponents/utils/Tabs.vue