mis-nextjs-fsd

Enforces Feature-Sliced Design, strict TypeScript, and docstring standards in Next.js applications.

Updated Oct 7, 2023
One-click install
npx skills add https://github.com/AhmedElbialy148/Portfolio --skill mis-nextjs-fsd-ahmedelbialy148
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: mis-nextjs-fsd
Source: https://github.com/AhmedElbialy148/Portfolio/tree/main/.cursor/skills/mis-nextjs-fsd
Command: npx skills add https://github.com/AhmedElbialy148/Portfolio --skill mis-nextjs-fsd-ahmedelbialy148

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill requires eslint-plugin-jsdoc, eslint-plugin-import, @feature-sliced/steiger-plugin, steiger, typescript-eslint, eslint-plugin-react, eslint-plugin-react-hooks, zod, and includes references (resource) and assets (resource) components.

What problem does it solve? Teams building Next.js apps often end up with inconsistent folder structures, untyped code, anonymous hook callbacks, and undocumented files. This Skill provides a single enforceable contract covering Feature-Sliced Design layering, strict TypeScript settings, TSDoc docstrings, and named function expressions in React hooks. ## Core Features & Use Cases - FSD Architecture Enforcement: Defines the layer hierarchy (app, views, widgets, features, entities, shared) with an allow/deny import matrix, public API rules via slice index.ts files, and Steiger/ESLint configs that fail the build on violations. - Strict TypeScript Contract: Ships a ready-to-use tsconfig with strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, and verbatimModuleSyntax, plus rules banning any and mandating Zod validation at boundaries. - Documentation & Hook Standards: Requires @file docstrings on every file, TSDoc on every export, and named function expressions in useEffect/useMemo/useCallback, enforced by eslint-plugin-jsdoc and no-restricted-syntax rules. - Use Case: When bootstrapping a new Next.js app, drop in the provided tsconfig.json, eslint.config.mjs, and steiger.config.ts assets, scaffold the FSD directory tree, and every subsequent component, hook, or route handler follows the standard automatically. ## Quick Start Ask the AI to bootstrap a new Next.js app following the MIS FSD standard and scaffold the initial folder structure with the provided config files.

Frequently Asked Questions about mis-nextjs-fsd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Next.js app with Feature-Sliced Design?โ–ผ

Organize src/ into layers: app (Next.js routing only), views (page compositions), widgets (reusable UI blocks), features (user actions), entities (business models), and shared (generic infra). Imports flow downward only, and each slice exposes a public index.ts.

Why can't I create a src/pages folder in a Next.js FSD project?โ–ผ

Next.js reserves src/pages/ for the legacy Pages Router, so creating it alongside src/app/ causes a routing conflict and build errors. The FSD pages layer is renamed to src/views/ in this standard to avoid the collision.

How do I enforce named functions in React useEffect hooks?โ–ผ

Pass a named function expression instead of an arrow: useEffect(function syncUserProfile() { ... }, deps). The provided ESLint config uses no-restricted-syntax selectors to fail the build on anonymous arrows in useEffect, useMemo, useCallback, and related hooks.

What TypeScript strict settings should a Next.js project use?โ–ผ

Enable strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride, and verbatimModuleSyntax. Ban any in favor of unknown with narrowing, require import type for type-only imports, and validate all boundary data with Zod schemas.

Can features import from other features in Feature-Sliced Design?โ–ผ

No, same-layer cross-imports are forbidden. If two features share logic, push that logic down to the entities or shared layer instead. The Steiger linter and ESLint import rules flag these violations automatically.

When are default exports allowed in this Next.js standard?โ–ผ

Default exports are only allowed in Next.js convention files such as page.tsx, layout.tsx, loading.tsx, error.tsx, and route handlers. Everywhere else uses named exports, enforced by the import/no-default-export ESLint rule.