Is Feature-Sliced Design Good for AI-Generated Applications?

Abul Khoyer 16 min read

A hands-on look at Feature-Sliced Design with AI coding agents: setup prompts, the references to give your agent, real Steiger output, and when it isn't worth it.

Getting an agent to build a SaaS dashboard is the easy part now. Claude Code or Cursor will give you a sidebar, a customer table and a reports page in an afternoon. The hard part shows up a few months later. You ask for a small change and the diff touches files you didn’t expect.

My short answer: Feature-Sliced Design (FSD) is a good fit for AI-built frontends you plan to keep working on. What makes it work for agents is that its rules are simple enough for a linter to check, so the agent gets told when it breaks them. The folder names matter less. But nobody has tested FSD with coding agents in a study yet, and for a small app I’d skip it.

Most of this article is a walkthrough: the prompts, the files they produce, and the linter catching an agent’s mistakes, with real output. First, a bit of why.

The problem starts after the demo

Agents copy what they see. An agent opens a handful of files, works out how things are done in this repo, and does more of the same. If your codebase has three ways of fetching data, it’ll pick one of them or invent a fourth.

OpenAI described exactly this in their harness engineering post from February. Codex wrote all the code for one of their internal products, and they noticed it copying existing patterns, bad ones included. For a while the team spent every Friday cleaning up “AI slop” by hand.

The wider research is mixed. A big preprint this year, Debt Behind the AI Boom, found that roughly a fifth of the issues AI assistants introduced on GitHub were still in the code at the latest version. The Echoes of AI experiment, on the other hand, found developers didn’t struggle more when extending AI-assisted code. And METR’s 2025 study on big open-source repos pointed at the knowledge that lives in people’s heads and that the tools simply couldn’t see.

So the question I care about is whether the repo gives the agent a good pattern to copy, and whether anything pushes back when the agent ignores it.

FSD in two minutes

FSD splits a frontend into layers. From top to bottom they are app, pages, widgets, features, entities and shared. There’s also a deprecated processes layer.

One rule does most of the work: a file can only import from layers below its own. A page can use an entity, but an entity can’t reach up into a feature.

Inside each layer you have slices named after your business domain, like pages/reports or entities/customer. Inside each slice you have segments named by purpose: ui, api, model, lib. Every slice exposes a public API, usually an index.ts, and code outside the slice imports from that file only.

Version 2.1 is the one to use. The older guidance nudged you to push logic into entities and features from day one. The v2.1 migration guide now tells you to start with pages, “and possibly even stopping there.” Code moves down a layer only when more than one page needs it.

Why the linter matters more than the folders

Predictable folders help an agent. “This is FSD 2.1, pages first” tells it that a new API call for the reports page goes in pages/reports/api, with no guessing from five other files. In a components/, hooks/, services/, types/ layout, one feature is spread across four folders, and the agent has to find all of them first. Research like RepoCoder has shown for a while that where related code lives affects how well AI tools use it. Nobody has measured this for FSD specifically, though.

The part I’d actually bet on is enforcement. “Don’t import upward” is a rule a machine can check, and FSD has an official linter for it, Steiger. This is also what OpenAI leaned on. Their codebase isn’t FSD (it’s closer to backend layering per domain), but every domain had fixed layers, dependencies could only go one way, and custom linters failed the build when the agent broke the rules.

Writing rules down without enforcing them doesn’t get you far. An ETH Zurich paper, Evaluating AGENTS.md, found that context files mostly didn’t help agents finish tasks and made runs more than 20% more expensive. OpenAI kept their AGENTS.md to about a hundred lines and treated it as a map. I’d do the same thing: a short file that points to the right references, plus a linter that says no.

Here’s what that looks like in practice.

Walkthrough: FSD with an agent, step by step

I set up a small sandbox dashboard with three pages (reports, customers and billing), a customer entity, and the usual shared folder. Everything below was run against Steiger 0.10.0 with the FSD plugin 0.8.2. The mistakes in step 4 are ones I wrote by hand, modeled on the kind of shortcuts agents take. The Steiger output is copied straight from my terminal.

Step 1: Give your agent the references, not a manual

Before any prompt, decide what your agent should read. FSD has good material for this, but you have to pick the right files:

WhatLinkWhen the agent should read it
FSD docs for LLMshttps://fsd.how/llms-small.txtSetting up or migrating. It’s about 270 KB, so not on every task
Official FSD skillhttps://github.com/feature-sliced/skillsInstall once, the agent loads it when needed
Skill rules, rawhttps://raw.githubusercontent.com/feature-sliced/skills/master/feature-sliced-design/SKILL.mdTools that can’t install skills can fetch this instead
Steiger ruleshttps://github.com/feature-sliced/steigerWhen a lint rule fails. Every error links to its own rule page
Next.js guidehttps://fsd.how/docs/guides/tech/with-nextjs/Only on Next.js projects

One thing that caught me out: when I checked in November 2026, fsd.how/llms.txt and llms-full.txt only returned a one-line placeholder. llms-small.txt is the one with the actual docs. Check before you hand your agent a link.

Step 2: The setup prompt

This is the prompt I’d paste into Claude Code, Cursor or Codex on an existing project:

Set up Feature-Sliced Design v2.1 tooling in this project. Don't move
any existing code yet.

References (read only what you need):
- FSD docs: https://fsd.how/llms-small.txt
- Steiger: https://github.com/feature-sliced/steiger
- If this is Next.js: https://fsd.how/docs/guides/tech/with-nextjs/

1. Install the official FSD skill: npx skills add feature-sliced/skills
2. Install steiger and @feature-sliced/steiger-plugin as dev dependencies.
   Add steiger.config.ts with the recommended FSD config.
3. Add a "lint:arch" script that runs steiger on ./src.
4. Add an Architecture section to AGENTS.md (or CLAUDE.md), at most
   15 lines: the rules, the reference links above, and the commands
   to run before finishing.
5. Add lint:arch to CI next to typecheck and tests.

Show me the plan before changing anything.

Here’s what you should end up with. The Steiger config is short:

// steiger.config.ts
import { defineConfig } from "steiger";
import fsd from "@feature-sliced/steiger-plugin";

export default defineConfig([...fsd.configs.recommended]);

Watch out for one gotcha. My sandbox had a CommonJS package.json, and Steiger refused to load the TypeScript config with SyntaxError: Cannot use import statement outside a module. Adding "type": "module" fixed it. If your agent hits that error, that’s the reason.

{
  "type": "module",
  "scripts": {
    "lint:arch": "steiger ./src"
  }
}

And the AGENTS.md section, which is the part the agent reads on every task, so keep it tight:

## Architecture
This app follows Feature-Sliced Design v2.1, pages first.

- New UI and logic go in the page slice that uses it.
- Create a features/ or entities/ slice only when two or more pages
  share it. Ask me first.
- Import other slices only through their index.ts.
- Only import from layers below your own.
- Segments are named by purpose (ui, api, model, lib), never
  components/ or hooks/.

References: FSD skill (installed), https://fsd.how/llms-small.txt,
Steiger rule docs are linked in each lint error.

Before finishing: npm run lint:arch && npx tsc --noEmit && npm test

Step 3: Add a feature, pages first

Now a real task. Reports need a CSV export:

Add CSV export to the reports page. Keep it inside pages/reports:
the button in ui/, CSV conversion in lib/. Use Button from shared/ui
and downloadFile from shared/lib. Don't create a new slice.
Run lint:arch when done.

The change stays inside one slice:

src/pages/reports/
├── api/getReports.ts
├── lib/toCsv.ts                 # new
├── ui/ExportReportButton.tsx    # new
├── ui/ReportsPage.tsx           # uses the button
└── index.ts
// src/pages/reports/ui/ExportReportButton.tsx
import { Button } from "@/shared/ui";
import { downloadFile } from "@/shared/lib";
import { toCsv } from "../lib/toCsv";

export function ExportReportButton({ rows }: { rows: Record<string, unknown>[] }) {
  return (
    <Button onClick={() => downloadFile("report.csv", toCsv(rows), "text/csv")}>
      Export CSV
    </Button>
  );
}
$ npm run lint:arch
✔ No problems found!

This is the change I want in review: one folder, two new files, and imports that only point down.

Step 4: When the agent gets it wrong

Now the realistic version. Say the agent took a few shortcuts. It made the export a features/export-report slice right away, “for reuse”. It put a revenue chart in the customer entity, pulling it from a feature. On the billing page it imported the customer type straight from the file instead of the slice’s index.ts. And it added a hooks/ folder to the reports page.

// src/entities/customer/ui/CustomerRevenue.tsx
import { RevenueChart } from "@/features/revenue-chart";

// src/pages/billing/ui/BillingPage.tsx
import type { Customer } from "@/entities/customer/model/types";

Every one of these compiles, and the app runs fine. Here’s what Steiger says:

$ npx steiger ./src
┌ src/entities/customer/ui/CustomerRevenue.tsx:1:31
✘ Forbidden import from higher layer "features".
│
└ fsd/forbidden-imports: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/forbidden-imports

┌ src/features/export-report
✘ This slice has only one reference in slice "pages/reports". Consider merging them.
│
└ fsd/insignificant-slice: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice

┌ src/features/revenue-chart
✘ This slice has only one reference in slice "entities/customer". Consider merging them.
│
└ fsd/insignificant-slice: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice

┌ src/pages/billing/ui/BillingPage.tsx:1:32
✘ Forbidden sidestep of public API when importing from "@/entities/customer/model/types".
│
└ fsd/no-public-api-sidestep: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-public-api-sidestep

┌ src/pages/reports/hooks
✘ This segment's name should describe the purpose of its contents, not what the contents are.
│
└ fsd/segments-by-purpose: https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/segments-by-purpose

────────────────────────────────────────────────
 Found 5 errors (none can be fixed automatically)

It also exits with code 1, so CI fails. I like this output for agents. Every error comes with a file, a line, a plain sentence and a link to the rule’s docs, which is everything an agent needs to fix the problem without you explaining it.

The fix prompt can stay short:

npm run lint:arch is failing. Fix every error by moving code, not by
disabling rules or editing steiger.config.ts. Open the rule link in
each error if you're unsure what it wants. Run it again until it passes.

That last bit about not touching the config matters. Given the chance, an agent will sometimes “fix” a lint error by switching the rule off.

The fixes are what you’d hope for. The export moves back into pages/reports. The revenue chart moves into pages/billing/ui, because billing is the only page that uses it. The billing page imports Customer from @/entities/customer. And hooks/useReports.ts moves into model/.

$ npx steiger ./src
✔ No problems found!

Step 5: Promote code when a second page needs it

A month later, billing needs the same export. Now it has earned a slice:

Billing needs the same CSV export as reports. Move the export code from
pages/reports into features/export-report with a public API in index.ts.
Update both pages to import from "@/features/export-report" and delete
the old copy. Run lint:arch, typecheck and tests.
// src/features/export-report/index.ts
export { ExportReportButton } from "./ui/ExportReportButton";
// src/pages/billing/ui/BillingPage.tsx
import type { Customer } from "@/entities/customer";
import { ExportReportButton } from "@/features/export-report";
import { RevenueChart } from "./RevenueChart";

Steiger is happy this time, because the slice now has two consumers:

$ npx steiger ./src
✔ No problems found!

It’s the same code that failed in step 4. The difference is that it’s now actually shared. That’s pages-first in one example.

Step 6: Change a model everyone uses

Now customers get a plan field. Because everything goes through the slice’s public API, finding every consumer is a single search:

$ grep -rn "@/entities/customer" src
src/pages/billing/ui/BillingPage.tsx:1:import type { Customer } from "@/entities/customer";
src/pages/customers/ui/CustomersPage.tsx:1:import { getCustomers } from "@/entities/customer";
Add a required `plan: "free" | "pro"` field to Customer in
entities/customer/model/types.ts. Find every consumer by searching for
"@/entities/customer", update them, and run tsc until it passes. Don't
change the slice's public API beyond the new field.

An agent can do the same search on its own, and it can trust the result. In a types/index.ts codebase, anything could be importing anything from anywhere.

Step 7: Lock it in CI, then review like a human

# .github/workflows/ci.yml (steps)
- run: npm ci
- run: npm run lint:arch -- --fail-on-warnings
- run: npx tsc --noEmit
- run: npm test

Then review. I like doing it in a fresh session, or with a different model from the one that wrote the code, because an agent reviewing its own work tends to like it:

Review the current diff against our FSD rules in AGENTS.md. List
upward imports, imports that skip a slice's index.ts, new slices with
only one consumer, and code that duplicates something in shared/.
Don't fix anything. Report file and line only.

After that, I read the diff myself. I check which layers it touched first and the behaviour second.

Does this save tokens?

I don’t know, and nobody has measured it. FSD could cut down on searching, since the agent knows where to look and can read a slice’s index.ts instead of every file in it. But the walkthrough above also shows the other side: the agent runs the linter, reads the errors, opens the rule docs, fixes the code and runs it again. That costs tokens too. If cost matters to you, run ten real tasks on your current structure and on an FSD branch, and compare what your tool reports.

How FSD compares with other frontend architectures

File-type foldersFeature foldersFSDAtomic DesignClean Architecture
Groups code byKind of fileFeatureLayer, then domain, then purposeUI size (atoms up to pages)Policy layers
Dependency rulesNoneWhatever the team agreesWritten down, with a linterOnly for UI compositionStrict, if your tooling enforces them
Setup costLowestLowMediumLowHigh for a frontend
How agents might doFine while small, messy laterGood locality, rules varyShared vocabulary, checkable rulesHelps UI consistency, ignores logicClear boundaries, lots of indirection

These mix fine. Atomic Design works well inside shared/ui, and FSD’s downward imports are basically Clean Architecture’s dependency rule applied to folders. A tidy feature-folder codebase is often most of the way to FSD already. What it lacks is the shared vocabulary and the linter.

When I wouldn’t bother

For a landing page or a weekend prototype, I wouldn’t. If the whole app is three screens and a form, a folder per route is easier for you and for the agent.

The bigger risk is over-engineering. Step 4 shows it: left alone, an agent will happily create a feature slice for something used once. Pages-first plus insignificant-slice is the combination that keeps that in check. The official skill puts it well: “Code used in two places does not, by itself, earn a layer.”

There’s also the learning curve, some framework setup, and a linter that’s still in beta. The FSD docs themselves say that if your current architecture works, it might not be worth changing.

What FSD won’t fix

Steiger passed in step 5, and the export could still produce a broken CSV. Nothing in my sandbox escapes commas in toCsv. A green lint run means the structure is fine. It says nothing about whether the code is right.

The same goes for a token leaking into client code, a missing auth check, an agent calling a library method that doesn’t exist, broken focus management, or a slow page. Those index.ts barrel files can even hurt bundle size in big projects, which the FSD docs admit. For all of that you still need tests and a person clicking through the feature.

Questions people ask

Is FSD good for vibe coding?

It’s good for vibe-coded projects that are turning into real products. For a throwaway prototype it just slows you down. Start with a folder per page, then run the setup prompt from step 2 once you know you’ll be maintaining the thing.

Does FSD reduce AI token usage?

Nobody knows yet. It might mean less searching, but the lint-and-fix loop adds steps of its own.

Can Claude Code and Cursor follow FSD?

Mostly, especially with the skill installed and the references in AGENTS.md. They won’t follow it every time, which is why step 7 puts the linter in CI.

Does FSD work with Next.js and React?

Yes. Next.js needs the FSD layers renamed to _app and _pages so they don’t clash with the router. The official guide covers it, and it’s worth adding to your agent’s references.

Does FSD make AI-generated code more maintainable?

I think it helps, because the boundaries are enforced, and that’s what OpenAI credits too. No study has shown it for FSD directly.

Should every AI-built app use FSD?

No. Small apps and short-lived prototypes are better off with something simpler.

Can I migrate an existing AI-built app to FSD?

Yes, gradually. Ask for a plan first:

Read src/ and propose a pages-first FSD v2.1 structure. Map every file
to app/, pages/<slice>/ or shared/. Only suggest entities/ or features/
when two or more pages share a real business responsibility, and say
why. Output a table of current path -> new path. Don't move anything.

Then move one page per PR, with Steiger running from the start. Let the agent do the moving. You decide where the slice boundaries go.

So, would I use it?

For a frontend I expect to maintain for years with agents doing a lot of the typing, yes. I’d go pages first, with a short AGENTS.md that points to the right references, and Steiger, types and tests blocking in CI. Step 4 is the reason: five mistakes that all compiled, all caught by the linter, each with a link explaining the fix.

For anything smaller, I’d use a folder per route and strict TypeScript, and wait until the app gives me a reason to add more.

AI made writing code cheap. Keeping it maintainable is still on us.


Further reading