Naming Skill
Audit or apply the project's file and folder naming conventions.
Conventions
Folders
| Location | Case | Example |
|---|---|---|
| Top-level src dirs | kebab-case | src/lib/, src/modules/ |
| Module dirs | kebab-case | modules/home/, modules/user-settings/ |
| Module sub-dirs | fixed names | components/, views/, stores/, router/, tests/ |
| Component utils | components/utils/ | components/utils/ |
Files
| Type | Pattern | Example |
|---|---|---|
| Component | {module}.{name}.component.vue | home.hero.component.vue |
| View | {module}.{name}.view.vue | auth.signin.view.vue |
| Store | {module}.store.js | tasks.store.js |
| Router | {module}.router.js | users.router.js |
| Test | {target}.spec.js | home.store.spec.js |
| Service | {name}.js | axios.js |
| Helper | {name}.js | tools.js |
| Plugin | {name}.js | vuetify.js |
| Config | {name}.js or index.js | development.js |
Case conventions in code
| Context | Convention | Example |
|---|---|---|
| Variable / function | lowerCamelCase | useHomeStore, paginationRequest |
| Component name (JS) | PascalCase | HomeHeroComponent |
| Store export | use{Module}Store | useTasksStore |
| Constant / env key | UPPER_SNAKE_CASE | MY_MODULE_KEY |
Rules
- •
Dot-notation prefix: always prefix with the module name separated by dots
- •
home.hero.component.vuenothero.component.vue - •
tasks.store.jsnotstore.js
- •
- •
Semantic suffix: always add the type suffix
- •
.component.vuefor reusable components - •
.view.vuefor page-level views - •
.store.jsfor Pinia stores - •
.router.jsfor route definitions - •
.spec.jsfor tests
- •
- •
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
- •List of items → plural:
- •
Utility sub-components: place in
components/utils/and keep the module prefix- •
components/utils/home.blur.background.component.vue
- •
- •
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
- •Identify the module it belongs to (e.g.,
users) - •Identify the file type (component, view, store, router, test, helper, plugin)
- •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
- •Place it in the correct sub-directory:
- •
.vuecomponents →src/modules/{module}/components/ - •
.vueviews →src/modules/{module}/views/ - •stores →
src/modules/{module}/stores/ - •routers →
src/modules/{module}/router/ - •tests →
src/modules/{module}/tests/
- •
- •Confirm the name follows the table above before writing the file
When auditing a module
- •List all files in
src/modules/{module}/ - •Check each file against the conventions table
- •Report any violations with the expected name
- •Apply renames if requested (use
/featureor direct edits) - •Run
/verifyafter renaming
Examples
| Situation | Correct name | Wrong name |
|---|---|---|
Hero component in home | home.hero.component.vue | HeroComponent.vue, hero.vue |
Sign-in page in auth | auth.signin.view.vue | SignIn.vue, signin.vue |
Pinia store in tasks | tasks.store.js | tasksStore.js, store.js |
Router in users | users.router.js | router.js, usersRouter.js |
| Test for home store | home.store.spec.js | homeStore.test.js, store.spec.js |
| Utility helper | src/lib/helpers/tools.js | src/lib/helpers/tools.helper.js |
| Utility sub-component | components/utils/home.tabs.component.vue | components/utils/Tabs.vue |