agentleFS
luigi-dvluigi-dv/react-ts-vite/.claude/skills/project-architecture/SKILL.md

project-architecture

Skill1 starsChanged 27 days agoMITView on GitHub

Decide where code lives and keep imports pointing the right way in the active folder architecture (classic, feature-based, Feature-Sliced Design, clean/hexagonal or atomic). Use when creating files, resolving `npm run arch:check` violations, choosing between layers, or switching architectures.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the message: it names the importing layer, the imported layer and the allowed list.

    line 53
  2. Very specific:

    Legitimate exception?: Add "from>to" to rules.allow in rtv.config.json with a comment in the PR explaining why.

    line 57

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Project architecture

The project's shape is declared in rtv.config.json (architecture, aliases, templates). The always-on rule .agent/rules/architecture.md is generated from it and lists the layers, their purposes, the aliases and the import rules. Read it first; then use this skill to make decisions.

1. Find out where things live

npm run arch -- current      # layers, aliases, import rules of the active architecture
npm run arch -- list         # the catalogue
cat rtv.config.json          # architecture id, aliases, applied templates, rule exceptions

Role aliases exist in every architecture, so you can always reason in roles:

I am adding…Role / aliasNotes
A route-level screen@pagesDefault export, one h1, smoke test in __tests__/pages/
Reusable UI without business meaning@componentsNamed export, props-driven, no data access
Stateful logic or data access@hooksuseX; the only place components get data from
API clients, storage, side effects@servicesPlain TS, no React
Pure helpers@utilsNo side effects
Shared types@typestype/interface only
Constants, navigation, config@const
Images, fonts, svg@assets
Business capability (feature/fsd)@features/<slice>Public API through index.ts
Business entity (fsd) / domain model (clean)@entities/<slice> / @domain
Use cases and ports (clean)@applicationDepends only on @domain
Port implementations (clean)@infrastructureHTTP, storage, SDKs
Wiring, providers, router@app (feature/fsd/clean) or src/App.tsxThe composition root may import anything

2. Respect the dependency direction

Each layer declares what it may import; npm run arch:check scans every module under src/ and fails on violations. General shape:

  • classic / atomic: pages → components → hooks → services → utils/const/types. Components never import services. Atomic adds atoms → molecules → organisms → templates inside components/.
  • feature: app → pages → features → shared. Features import other features only via their public API (@features/billing, never @features/billing/components/x).
  • fsd: app → pages → widgets → features → entities → shared. Slices on the same layer never import each other.
  • clean: presentation / infrastructure → application → domain; shared is the kernel; only the composition root (src/app, main.tsx) imports infrastructure.

Inside a page or slice, import siblings with ./ or with the slice alias (@pages/Dashboard/data). Parent-relative imports (../) are an ESLint error everywhere in src/.

3. Fix a violation

Read the message: it names the importing layer, the imported layer and the allowed list.

  1. Wrong place? Move the module to the layer that matches its role (git mv, then fix imports).
  2. Upward dependency? Invert it: pass data via props, lift the call into a hook/page, or define a port (interface) in the lower layer and implement it higher up.
  3. Legitimate exception? Add "from>to" to rules.allow in rtv.config.json with a comment in the PR explaining why. Keep the list short.
  4. One-off: append // rtv-ignore to the import line (last resort; say why in a comment).

4. Switch architecture

npm run arch -- apply <id> --dry-run to preview, then without --dry-run. Role folders move (via git mv), aliases are rewritten in rtv.config.json and tsconfig.app.json, READMEs and this project's architecture rule regenerate. Afterwards: npm run typecheck (finds relative imports that crossed folders), npm run arch:check, then categorise code the new architecture expects (e.g. split into slices).

5. Extending the catalogue

Architectures are data in scripts/lib/architectures.mjs (roles, extra aliases, layers with mayImport, folders, principles). Add or adjust an entry, run npm run agent:sync and npm run test:run (the catalogue has integrity tests), and update docs/architecture.md is regenerated automatically.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.