architecture-fsd
Feature-Sliced Design — layers, import rules, and slice structure for src/renderer
Install / Use
npx skills add AK2083/DojoSphereInstalls into whichever agent you are using.
.clinerules
Cline rules
Quality Score
Category
Development & EngineeringSupported Platforms
Skill content
View source on GitHubdescription: Feature-Sliced Design — layers, import rules, and slice structure for src/renderer globs: src/renderer/**/* alwaysApply: false
Feature-Sliced Design (FSD)
Renderer code lives under src/renderer/ in five layers. Imports may only point downward — never from shared toward features, pages, widgets, or app.
app → pages, widgets, features, shared
pages → features, widgets, shared
widgets → features, shared
features → shared (+ slices of the same feature among themselves)
shared → internal only
app vs. shared — decision guide
Classify new dependencies by role, not technology:
| Question | → app | → shared |
| ----------------------------------------------------------------------- | ------- | ---------- |
| Part of the composition root (start app, register plugins)? | Yes | No |
| Swappable/mockable without rewriting features? | No | Yes |
| Features should not import SDKs directly? | — | Yes |
| Switching mainly requires wiring changes in main.ts/providers/? | Yes | No |
Rules of thumb:
- Render framework and global providers (app shell) →
app/providers/— configure directly, do not abstract. - Vendor/infrastructure clients (backend, storage bridge, …) →
shared/— wrap behind a public API (e.g.logErrorvia@shared/lib, main-process logging in@main/shared/logging/). - Thin helpers built on the framework that features use everywhere →
shared/lib/(setup stays inapp).
Split pattern: A dependency can be both — instance/wiring in app/providers/, usage API in shared/lib/ (e.g. plugin in app, composable in shared).
app
Composition root — app initialization, global providers, and framework wiring under providers/ and main.ts.
- Contains everything that composes the renderer application; not further abstracted.
- Examples (project-specific): Vue Router, Pinia instance, UI framework, i18n plugin.
- Router imports only page components from
@pages/*. - Router guards may use features/
sharedfor app-wide orchestration (e.g. auth check). - Do not register feature or widget UI directly in the router.
pages
Route components — one page per route. The router knows only @pages/*.
- Pages compose features and optionally widgets; they contain no business logic.
- Structure per page:
ui/,index.ts(public API). - Each file in
ui/is a page component: ship<Name>.vue,<Name>.stories.ts, and<Name>.e2e.spec.tstogether (seevue-frontend.md). - Example:
Login.vuebinds@features/authentication/signin-user.
widgets
Standalone UI building blocks without feature affiliation (e.g. Navigation). Not a use-case slice.
- May use features and
shared, but should not be imported by pages when mounted globally. - Structure:
ui/, optionali18n/,index.ts. - Each component in
ui/requires colocated<Name>.stories.tsand<Name>.e2e.spec.ts.
features
Business functionality divided into slices (use cases). One slice = one cohesive use case.
Ideal slice structure per use case:
features/<feature>/<slice>/
ui/ # Vue components for the use case
# Per component: <Name>.vue + <Name>.stories.ts + <Name>.e2e.spec.ts (all required)
model/ # composables, state, form logic
i18n/ # keys.ts, de.ts, en.ts, index.ts (one de/en file each — no language subfolders)
api/ # use-case API: wraps shared/api for this slice
service/ # (optional) orchestration within the slice
index.ts # public API — export only here
API layering: Generic client access lives in shared/api/ (e.g. Supabase client, generic auth functions). Each slice that needs such access gets its own api/ folder with use-case-specific functions that call shared/api and handle errors/monitoring at slice level.
-
model/andservice/import only from the sliceapi/, never directly from@shared/api. -
Example:
register-user/api/sign-up-with-mail-and-password.tscallssignUpByEmailPasswordfrom@shared/api;model/use-register.tsuses the slice function. -
Cross-slice logic within a feature belongs in
features/<feature>/service/ormodel/. -
Slices import
shared; they may use other slices of the same feature, but not other features, pages, or widgets. -
Add new functionality as a new slice; do not mix into existing slices.
shared
Abstraction of swappable dependencies. No feature or page logic. Features/widgets import only the public API — never the SDK directly.
| Segment | Level | Content |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------- |
| api/ | Low-level | Client implementations (e.g. Supabase) |
| lib/browser/, lib/validation/, lib/pinia/, lib/i18n/ | Low-level | Technical helpers, validation, store utilities |
| lib/logging/ | High-level | Error logging via logError (@shared/lib public API) |
| ui/ | — | Reusable Vue components without feature affiliation |
| model/, store/, types/, errors/ | — | Shared domain types, stores, error classes |
- Low-level: direct technology abstractions (storage, HTTP client, validators).
- High-level: domain-near abstractions (logging). Features use
@shared/liblogErrorinapi/layers instead of direct file or IPC access. - Vue components without feature affiliation →
shared/ui/, not in features. - Each component in
shared/ui/requires colocated<Name>.stories.tsand<Name>.e2e.spec.ts. sharedimports no features, pages, widgets, orapp.
Import aliases
@app/*, @pages/*, @features/*, @widgets/*, @shared/* — always import via aliases, never relative paths across layer boundaries.
Checklist for new files
- Correct layer and slice chosen?
- app vs. shared: wiring or swappable abstraction?
- Import direction respected (downward only)?
- Public API exported via
index.ts? - i18n keys in slice under
i18n/, not inshared? - Reusable UI without feature affiliation →
shared/ui/? - API access to
shared/api→ sliceapi/as intermediary, not directly inmodel/? - New or changed file in
ui/→ colocated<Name>.stories.tsand<Name>.e2e.spec.tsadded in the same change (not follow-up)?
Related Skills
claude-howto
41.4kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
ai-job-search
40.9kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
guizang-ppt-skill
25.7kAI-agent Skill for generating polished HTML slide decks: editorial magazine and Swiss layouts, image prompts, social covers, and a WebGL/low-power presentation runtime.
reactive-resume
42.2kA one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
Security Score
Audited on Invalid Date
