@kirill.konshin/lint 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -485,7 +485,7 @@ In the project root, `lint-prepare`:
485
485
  - Creates real `rules/` and `skills/` directories in `.agents/` (canonical, cross-tool — Codex reads it) and `.claude/` (Claude Code).
486
486
  - Links every `rules/*.md` file into both, except the ones the `rules` map of [`lint.config.ts`](#lintconfigts) turns off (`rules: { redux: false }`). Links point straight at the installed package's real location (`node_modules/@kirill.konshin/lint`, or the workspace package). A rule of yours with the same name in `.agents/` wins, the package one is not installed.
487
487
  - Installs the skills of the `skills` map of `lint.config.ts`, merged over the defaults, with the [`skills` CLI](https://github.com/vercel-labs/skills), into `.agents/skills/` and from there into `.claude/skills/`. The map is keyed by source, each value uses the toggle notation; `skills: { name: true | false }` picks skills of a source — with no `true` entry every skill except the `false` ones:
488
- - npm packages (`@scope/name`, or a name without `/`) are dependencies that ship skills: `skills experimental_sync -y -a codex claude-code` links every `skills/<name>/` folder of your dependencies; the map only leaves some out (`--exclude`). Default: this package's own skills (`'@kirill.konshin/lint': true`) — e.g. `lint-repo`, which sets up the tooling above and audits the repo against the rules.
488
+ - npm packages (`@scope/name`, or a name without `/`) are dependencies that ship skills: `skills experimental_sync -y -r -a codex claude-code` links every `skills/<name>/` folder of the dependencies of the root and of every workspace package; the map only leaves some out (`--exclude`). Default: this package's own skills (`'@kirill.konshin/lint': true`) — e.g. `lint-repo`, which sets up the tooling above and audits the repo against the rules.
489
489
  - Git sources (`owner/repo`) are installed with `skills add`, at `ref` when set (pin a full 40-character commit SHA). A source whose skills `skills-lock.json` already has at the same ref is not fetched again. `lint.config.ts` owns the remote skills of `skills-lock.json`: a remote skill it no longer lists is removed (`skills remove`).
490
490
  - Defaults — every project gets them, turn off what it does not need: the [Core Pack](https://skills.sh/p/DxVN7q53wGdAcZQt) (`vercel-labs/agent-skills` incl. `web-design-guidelines`, `vercel/ai`, `shadcn-ui/ui`, `heroui-inc/heroui`, `mui/material-ui` without `material-ui-tailwind`, `neondatabase/agent-skills`) and the official skills of the libraries the rules cover (`vercel/next.js`, `reduxjs/redux-toolkit`, `vercel/turborepo`, `nrwl/nx-ai-agents-config`, `expo/skills`, `microsoft/playwright-cli`). Each source lists its skills and pins a commit: `DEFAULT_LINT_CONFIG` in `src/config.ts`.
491
491
  - A skill folder of yours with the same name in `.agents/skills/` wins.
@@ -57,9 +57,10 @@ export declare function readSyncedSkills(cwd: string): Set<string>;
57
57
  */
58
58
  export declare function readUserEntries(cwd: string): Map<string, string>;
59
59
  /**
60
- * Install the skills dependencies ship (this package's own `skills/` folder among them) with the `skills` CLI, into
61
- * `.agents/skills`, linked into `.claude/skills`. `exclude`: `package` or `package#skill` patterns to leave out. On CI
62
- * nothing remote is touched (`--no-remote`). Returns whether the sync succeeded.
60
+ * Install the skills that the dependencies of the root and of every workspace package ship (this package's own
61
+ * `skills/` folder among them) with the `skills` CLI, into `.agents/skills`, linked into `.claude/skills`. `exclude`:
62
+ * `package` or `package#skill` patterns to leave out. On CI nothing remote is touched (`--no-remote`). Returns whether
63
+ * the sync succeeded.
63
64
  */
64
65
  export declare function runSkillsSync(cwd: string, run?: RunCommand, exclude?: string[]): boolean;
65
66
  /** An npm package that ships skills (`@scope/name`, or a name without `/`); anything else is a git source. */
@@ -50,6 +50,7 @@ const SKILLS_AGENTS = [
50
50
  const SKILLS_SYNC_ARGS = [
51
51
  "experimental_sync",
52
52
  "-y",
53
+ "-r",
53
54
  ...SKILLS_AGENTS
54
55
  ];
55
56
  const FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
@@ -339,9 +340,10 @@ function runSkillsCli(cwd, args, run) {
339
340
  return false;
340
341
  }
341
342
  /**
342
- * Install the skills dependencies ship (this package's own `skills/` folder among them) with the `skills` CLI, into
343
- * `.agents/skills`, linked into `.claude/skills`. `exclude`: `package` or `package#skill` patterns to leave out. On CI
344
- * nothing remote is touched (`--no-remote`). Returns whether the sync succeeded.
343
+ * Install the skills that the dependencies of the root and of every workspace package ship (this package's own
344
+ * `skills/` folder among them) with the `skills` CLI, into `.agents/skills`, linked into `.claude/skills`. `exclude`:
345
+ * `package` or `package#skill` patterns to leave out. On CI nothing remote is touched (`--no-remote`). Returns whether
346
+ * the sync succeeded.
345
347
  */
346
348
  function runSkillsSync(cwd, run = spawnSync, exclude = []) {
347
349
  const args = [...SKILLS_SYNC_ARGS];
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@kirill.konshin/lint",
3
3
  "description": "Vite+ (Oxlint + Oxfmt), ESLint + Prettier + lint-staged configs and AI agent rules/skills for monorepos",
4
- "version": "0.8.1",
4
+ "keywords": [
5
+ "tanstack-intent"
6
+ ],
7
+ "version": "0.8.3",
5
8
  "type": "module",
6
9
  "skipGenerate": true,
7
10
  "bin": {
package/rules/auth.md CHANGED
@@ -6,24 +6,16 @@ paths:
6
6
  - '**/*.ts'
7
7
  ---
8
8
 
9
- - ALWAYS use [`@kirill.konshin/auth`](https://github.com/kirill-konshin/utils/tree/main/packages/auth) ([npm](https://www.npmjs.com/package/@kirill.konshin/auth)) for authentication in Next.js apps, NEVER hand-roll `iron-session` wrappers
10
- - Follow the canonical patterns from the [package README](https://github.com/kirill-konshin/utils/blob/main/packages/auth/README.md) (session module, layout guard, login page, actions, route handlers, proxy) and its migration table when refactoring existing hand-rolled auth
11
- - ONE auth instance per app in `src/auth.ts`: `createPasswordAuth` (password-protected admin) or `createAuth` (token/OAuth)
12
- - `isValid` defaults to checking the lib-owned `AUTHENTICATED` marker field (set by `login()`, default session shape `PasswordSession`, nothing to configure) — token/OAuth apps pass their own session type + `isValid` (e.g. access token present & not expired)
13
- - Pass Next's `Route` as the routes generic (`createPasswordAuth<Route>` / `createAuth<Session, Route>`) so `urls` and the return-URL helpers are type-checked (`typedRoutes` is set by `defineNextConfig`, see [nextjs.md](nextjs.md))
14
- - Auth module MUST start with `import 'server-only'` and MUST NOT be module-level `'use server'` (that would expose session getters as callable server actions) — export `loginAction`/`logoutAction` from the SAME module as thin async wrappers with function-level `'use server'`, NO separate `actions.ts`; plain re-exports (`export const loginAction = auth.loginFormAction`) are NOT registered as actions; ENFORCED BY AGENT: no ESLint rule checks this, add on creation, flag on review (see [nextjs.md](nextjs.md))
15
- - Client Components MUST NOT import the auth module (`server-only` + function-level actions are not client-importable) — Server Components pass `loginAction`/`logoutAction` down as props
16
- - Cookie name MUST be unique per app (`<app>_session`), NEVER generic `session`
17
- - Cookie secret `SESSION_SECRET` (≥32 chars) and login password `ADMIN_PASSWORD` are SEPARATE env vars, never reuse one for the other
18
- - NEVER compare passwords with `===`, use `verifyPassword` / `timingSafeEqualStrings` (timing-safe)
19
- - Guard pages/layouts with `redirectNonAuthenticated()` (redirects to login), Server Actions and Route Handlers with `throwNonAuthenticated()` or `authenticatedRouteHandler()` (401), the whole `/api` surface with `proxyGuard()` in `proxy.ts`, login page with `redirectIfAuthenticated()`
20
- - Declare API visibility as `urls.public` / `urls.protected` globs and keep them exhaustive — `proxyGuard()` throws on overlap and warns (treating as public) on unknown paths; `allow` is only for request-level tweaks
21
- - Session lifetime via `ttl` (seconds) ONLY, NEVER set `cookieOptions.maxAge` (iron-session derives it)
22
- - Logout via `auth.logout()` (destroy + redirect) — export `logoutAction` as a function-level `'use server'` wrapper, like `loginAction`; a `FormData` argument from `<form action>` is ignored
23
- - Preserve the return URL through the `state` search param / hidden form field on login redirects; ALWAYS extract it with `auth.getState()` (accepts `await searchParams`, `URLSearchParams`, `FormData`, `NextRequest`, raw string; allows internal paths only, never the login page, falls back to `urls.afterLogin`), NEVER hand-parse `state`
24
- - NEVER store the return URL in the session — concurrent tabs share the cookie and would clash; thread it ONLY via search params, form fields and the `x-pathname` header
25
- - `proxy.ts` is two lines: `export const config = { matcher: [...] };` (a LITERAL — Next.js parses it statically) + `export const proxy = auth.proxyGuard({ matcher: config.matcher });` — the guard verifies the matcher covers all `urls.public`/`urls.protected` globs (it may be broader) and THROWS on uncovered ones
26
- - Login page is ONE Server Component file with `<form action={loginAction}>` (wrapping `auth.loginAction`) — errors return via the `?error=` search param; a Client Component (`useActionState` + `loginFormAction`) ONLY when pending/inline-error UI is actually needed
27
- - Reuse `auth.urls.*` (resolved, defaults applied) instead of repeating route literals, e.g. `redirect(auth.urls.afterLogin)`
28
- - List page routes in `urls.public` — `proxyGuard()` stamps `x-pathname` so `redirectNonAuthenticated()` returns users to the deep page after login (pages are enforced by layouts, not by the proxy)
29
- - Login page MUST live OUTSIDE the guarded layout (the guard would redirect to itself); `urls.afterLogin` pointing at the login page throws at creation
9
+ Patterns, strategies, Neon Auth setup, password login and migration: the `auth` skill of `@kirill.konshin/auth`, it installs with the package.
10
+
11
+ - ALWAYS use [`@kirill.konshin/auth`](https://github.com/kirill-konshin/utils/tree/main/packages/auth) ([npm](https://www.npmjs.com/package/@kirill.konshin/auth)) for authentication in Next.js apps, NEVER hand-roll `iron-session` or Neon Auth session wrappers
12
+ - ONE auth instance per app in `src/auth.ts`, with ONE session strategy: `ironStrategy` (the app writes a sealed cookie; `createPasswordAuth` for password admin) or `neonStrategy` (Neon Auth owns the session); NEVER wrap one session into another
13
+ - Auth module MUST start with `import 'server-only'` and MUST NOT be module-level `'use server'`; `loginAction`/`logoutAction` are function-level `'use server'` wrappers in the SAME module, plain re-exports are NOT registered as actions; ENFORCED BY AGENT: no ESLint rule checks this, add on creation, flag on review (see [nextjs.md](nextjs.md))
14
+ - Client Components MUST NOT import the auth module; Server Components pass `loginAction`/`logoutAction` down as props
15
+ - Code outside Next (agent runtimes, workers) MUST NOT import the auth module: it asks a Next Route Handler for the session, forwarding the request's `cookie` header
16
+ - Iron: cookie name unique per app (`<app>_session`); `SESSION_SECRET` (≥32 chars) and `ADMIN_PASSWORD` are SEPARATE env vars; lifetime via `ttl` ONLY, NEVER `cookieOptions.maxAge`
17
+ - NEVER compare passwords with `===`, use `verifyPassword` / `timingSafeEqualStrings`
18
+ - Guard pages/layouts with `redirectNonAuthenticated()` (inside `<Suspense>`), Server Actions and Route Handlers with `throwNonAuthenticated()` or `authenticatedRouteHandler()`, the `/api` surface with `proxyGuard()` in `proxy.ts`, the login page with `redirectIfAuthenticated()`
19
+ - `proxy.ts`: a LITERAL `config.matcher` + `auth.proxyGuard({ matcher: config.matcher })`; `urls.public` / `urls.protected` globs stay exhaustive
20
+ - ALWAYS extract the return URL with `auth.getState()`, NEVER hand-parse `state`, NEVER store it in the session
21
+ - Login page lives OUTSIDE the guarded layout; logout via `auth.logout()`
package/rules/db.md CHANGED
@@ -14,7 +14,7 @@ Migration and import procedures, Neon: the `lint-db` skill.
14
14
 
15
15
  - Use Drizzle as ORM if user asks to add ORM
16
16
  - Keep schemas, repositories, tenancy, and authorization app-owned; keep reusable driver plumbing in `@kirill.konshin/db`.
17
- - Import `@kirill.konshin/db` through focused driver, migration, URL, and type subpaths so unrelated drivers are not loaded.
17
+ - Import `@kirill.konshin/db` through focused driver, migration, URL, and type subpaths so unrelated drivers are not loaded; which subpath for which work: the `db` skill of `@kirill.konshin/db`
18
18
  - Keep database access server-only and separate the database/repository layer from API, UI, and state-management layers.
19
19
  - Preserve canonical external identifiers as strings; never coerce opaque IDs or URNs to numbers.
20
20
  - Model related state once per owner and entity when that avoids duplicate rows, and enforce invariants with keys, constraints, and indexes.
@@ -28,4 +28,4 @@ Migration and import procedures, Neon: the `lint-db` skill.
28
28
  # Neon
29
29
 
30
30
  - Only if the user asks for Neon, or the project already uses it: follow the `lint-db` skill
31
- - Fold Neon Auth into Iron Session (the `lint-db` skill); this overrides the session wrapper, callback route and middleware of the `neon-auth` skill
31
+ - Neon Auth: `neonStrategy` of `@kirill.konshin/auth` (its `auth` skill); this overrides the session wrapper, callback route and middleware of the `neon-auth` skill
package/rules/mui.md CHANGED
@@ -6,9 +6,9 @@ paths:
6
6
  - '**/*.ts'
7
7
  ---
8
8
 
9
- Details and admin pages: the `lint-mui` skill.
9
+ Details: the `lint-mui` skill; admin pages and Toolpad: the `mui` skill of `@kirill.konshin/mui`.
10
10
 
11
11
  - Import from the barrels (`@mui/material`, `@mui/icons-material`) in apps; use direct imports (`@mui/material/Button`) in libraries
12
12
  - This rule overrides `bundle-barrel-imports` of the `vercel-react-best-practices` skill and the one-level imports of the `material-ui-styling` skill
13
13
  - NEVER mix MUI and Tailwind in one interface; do not follow the `material-ui-tailwind` skill
14
- - `@toolpad/core` is archived (no longer maintained): use it only through `@kirill.konshin/mui/admin`, add no new direct Toolpad usage
14
+ - `@toolpad/core` is archived (no longer maintained): import it ONLY from `@kirill.konshin/mui/toolpad` (pinned, same names, some components fixed) or the `@kirill.konshin/mui/admin` presets; NEVER add `@toolpad/core` to an app
package/rules/nextjs.md CHANGED
@@ -16,15 +16,16 @@ Use the `lint-nextjs` skill when working with a Next.js project.
16
16
  - Prefer Route Handlers for redirects
17
17
  - Never use Pages Router
18
18
  - Always use App Router
19
- - Use `iron-session` for authentication via `@kirill.konshin/auth`, see [auth.md](auth.md)
19
+ - Use `@kirill.konshin/auth` for authentication (iron-session or Neon Auth strategy), see [auth.md](auth.md)
20
20
  - Server-only modules MUST start with `import 'server-only'`: see [typescript.md](typescript.md)
21
21
  - `package.json` MUST ALWAYS have version of Next.js, NEVER `*`, otherwise Vercel will fall into legacy mode instead of serverless
22
- - ALWAYS create `next.config.ts` with `defineNextConfig` from `@kirill.konshin/next/config` (the `/config` subpath, NEVER the barrel — Next transpiles `next.config.ts` to CJS and `require`s it outside any bundler); what it sets: the `lint-nextjs` skill
22
+ - ALWAYS create `next.config.ts` with `defineNextConfig` from `@kirill.konshin/next/config` (the `/config` subpath, NEVER the barrel — Next transpiles `next.config.ts` to CJS and `require`s it outside any bundler); what it sets: the `next` skill of `@kirill.konshin/next`
23
23
  - Use `@kirill.konshin/icons` for FontAwesome / Gravity UI icons — the barrel is safe with `optimizePackageImports` (`defineNextConfig` sets it); this overrides `bundle-barrel-imports` of the `vercel-react-best-practices` skill
24
24
  - Page and component file placement: the `lint-nextjs` skill
25
+ - App icons, favicons, manifest icons and iOS launch screens: use `@kirill.konshin/app-images`, its `app-images` skill installs with it; NEVER write icon lists by hand
25
26
 
26
27
  # Admin Pages & Login
27
28
 
28
29
  - ALWAYS use MUI for admin page layouts and login screens, see the `lint-mui` skill
29
- - ALWAYS prefer `@kirill.konshin/mui/admin` (`AdminAppProvider`, `AdminDashboardLayout`, `AdminSignInPage`) — encapsulates the Toolpad boilerplate and wires `@kirill.konshin/auth`, see the `lint-mui` skill; `@toolpad/core` is archived, add no new direct Toolpad usage
30
+ - ALWAYS prefer `@kirill.konshin/mui/admin` (`AdminAppProvider`, `AdminDashboardLayout`, `AdminSignInPage`) — encapsulates the Toolpad boilerplate and wires `@kirill.konshin/auth`, see the `lint-mui` skill; other Toolpad parts ONLY from `@kirill.konshin/mui/toolpad`, NEVER `@toolpad/core` (see [mui.md](mui.md))
30
31
  - Tailwind is ONLY for user-facing sites, NEVER for admin (see [tailwind.md](tailwind.md))
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-db
3
- description: Database procedures for the db rule - LocalStorage / IndexedDB to server migrations, transactional importers, one-off data transfers, steps after a schema change, Neon Auth folded into Iron Session. Use when migrating or importing data, changing a schema, or adding Neon Auth.
3
+ description: Database procedures for the db rule - LocalStorage / IndexedDB to server migrations, transactional importers, one-off data transfers, steps after a schema change. Use when migrating or importing data, or changing a schema.
4
4
  ---
5
5
 
6
6
  The binding rules are in [rules/db.md](../../rules/db.md). This skill holds the procedures.
@@ -14,10 +14,6 @@ The binding rules are in [rules/db.md](../../rules/db.md). This skill holds the
14
14
 
15
15
  # Neon
16
16
 
17
- Only when the user asks for Neon, or the project already uses it. Drivers, connection strings, branches and migrations: the `neon-postgres` skill and the `neon-postgres-branches` skill; the driver plumbing lives in `@kirill.konshin/db`.
17
+ Only when the user asks for Neon, or the project already uses it. Connection strings, branches and migrations: the `neon-postgres` skill and the `neon-postgres-branches` skill. Drivers, URLs and migration runs: `@kirill.konshin/db` and its `db` skill, it installs with the package.
18
18
 
19
- Neon Auth: set it up per the `neon-auth` skill, then fold it into Iron Session ([rules/auth.md](../../rules/auth.md)):
20
-
21
- 1. Link the Neon identity to the app user on the server.
22
- 2. Store the app context in the sealed Iron Session.
23
- 3. Clear the transient Neon session.
19
+ Neon Auth: the `auth` skill of `@kirill.konshin/auth` (`neonStrategy`), it installs with the package.
@@ -1,8 +1,16 @@
1
1
  ---
2
2
  name: lint-electron
3
- description: Skill for Electron-based apps - dev runner that restarts Electron (vp pack --watch), packaging a Next.js standalone server with electron-builder in a hoisted monorepo, CI builds. Use when setting up, running or packaging an Electron app.
3
+ description: Skill for Electron-based apps - packages to use (`@kirill.konshin/electron`, `@kirill.konshin/electron-builder`, `next-electron-rsc`), dev runner that restarts Electron (vp pack --watch), packaging a Next.js standalone server with electron-builder in a hoisted monorepo, CI builds. Use when setting up, running or packaging an Electron app.
4
4
  ---
5
5
 
6
+ # Packages
7
+
8
+ Use these packages before you write the same code:
9
+
10
+ - `@kirill.konshin/electron` — main-process helpers: `createWindow` (a window that loads the dev server, a static export or a remote URL; it remembers its bounds, adds the default menu, can check for updates) and `checkForUpdates` (`electron-updater` with dialogs, for a menu item)
11
+ - `@kirill.konshin/electron-builder` — `builerConfig()` for `electron-builder.ts`: DMG and zip targets (DMG only without signing), S3 and GitHub Releases publishing by CI ref, `assets` as build resources, `mac.icon` from `@kirill.konshin/app-images`; it keeps the app config you pass
12
+ - `next-electron-rsc` — runs a Next.js app with React Server Components and Server Actions in Electron, with no open port in production; install `next` as a dependency, not a devDependency: electron-builder copies only dependencies into the app
13
+
6
14
  # Dev Runner
7
15
 
8
16
  ALWAYS run the main process in development with `vp pack --watch` (Vite+, tsdown), never `tsc-watch`, `nodemon` or `electron .` alone: it rebuilds the entrypoint and restarts Electron through `onSuccess` (tsdown stops the previous process). Files outside the main process module graph that need a restart (`next.config.*`: Next.js applies config only on a restart, like `next dev`; a linked library build) go in through a plugin — the `watch` option cannot list them, `--watch` overrides it with `true`:
@@ -46,6 +54,10 @@ Scripts: `"start": "vp pack --watch"`, `"build:main": "vp pack"`.
46
54
 
47
55
  This is the `vite.config.ts` of the Electron app's own workspace package. When the app is the workspace root, the root `vite.config.ts` stays `defineConfig(vitePlusConfig())`: put the `pack` block under the `vitePlus` key of `lint.config.ts` (`vitePlus: { pack: { … } }`).
48
56
 
57
+ # Icons
58
+
59
+ App icons (macOS `.icns`, no Xcode needed; opt-in Icon Composer `.icon`), Windows and Linux icons, splash and DMG background: use `@kirill.konshin/app-images`, its `app-images` skill installs with it.
60
+
49
61
  # Packaging a Next.js Standalone Server
50
62
 
51
63
  In a hoisted workspace (see [rules/npm-yarn.md](../../rules/npm-yarn.md#hoisting)) Next.js traces the server's dependencies into `.next/standalone/node_modules`, beside the app folder; package both, without Electron:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-mui
3
- description: Our MUI conventions on top of the vendor MUI skills - class-name usage in `sx`, safe-area insets in the theme, admin pages and login with `@kirill.konshin/mui/admin`. Use when writing or reviewing code that uses MUI, or building an admin interface.
3
+ description: Our MUI conventions on top of the vendor MUI skills - class-name usage in `sx`, safe-area insets in the theme, which package to use for admin pages and login. Use when writing or reviewing code that uses MUI, or building an admin interface.
4
4
  ---
5
5
 
6
6
  The binding rules are in [rules/mui.md](../../rules/mui.md): imports, no Tailwind, Toolpad. MUI API knowledge: the `material-ui-styling` skill, the `material-ui-theming` skill and the `material-ui-nextjs` skill; where they differ, the rules win.
@@ -23,6 +23,6 @@ import { Box, Input, inputClasses } from '@mui/material';
23
23
 
24
24
  # Admin Pages and Login
25
25
 
26
- - Use `@kirill.konshin/mui/admin`: `AdminAppProvider`, `AdminDashboardLayout`, `AdminSignInPage`. It holds the Toolpad boilerplate (`@toolpad/core` is archived: add no new direct Toolpad usage).
27
- - `AdminSignInPage.loginAction` takes `loginFormAction` from `@kirill.konshin/auth` ([rules/auth.md](../../rules/auth.md)).
28
- - Use the built-ins of the admin layout (navigation, dialogs, notifications) before custom JSX.
26
+ Use `@kirill.konshin/mui`: the `/admin` presets and `/toolpad` (Toolpad, pinned and fixed). Details: the `mui` skill, it installs with the package.
27
+
28
+ When Toolpad does not cover what you need, start from the [free Material UI templates](https://mui.com/material-ui/getting-started/templates/#free-templates) (dashboard, CRUD dashboard, sign-in, sign-up, checkout, blog, marketing page): copy the parts you need into the app, do not write them from zero.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-nextjs
3
- description: Our Next.js App Router conventions on top of the vendor Next.js skills - typed `LayoutProps` / `PageProps`, auth-guarded layouts, `params` / `searchParams` in server and client pages, page and component file placement, what `defineNextConfig` sets in `next.config.ts`. Use when writing or reviewing Next.js pages, layouts, route handlers or `next.config.ts`.
3
+ description: Our Next.js App Router conventions on top of the vendor Next.js skills - typed `LayoutProps` / `PageProps`, auth-guarded layouts, `params` / `searchParams` in server and client pages, page and component file placement, where `next.config.ts` details are. Use when writing or reviewing Next.js pages, layouts, route handlers or `next.config.ts`.
4
4
  ---
5
5
 
6
6
  The binding rules are in [rules/nextjs.md](../../rules/nextjs.md). Next.js API knowledge: the docs that `next` bundles (`node_modules/next/dist/docs/`), the `next-*` skills and the `vercel-react-best-practices` skill; MUI setup: the `material-ui-nextjs` skill.
@@ -25,30 +25,7 @@ export default function Layout({ children, analytics }: LayoutProps<'/dashboard'
25
25
 
26
26
  ## Check auth in layouts pattern
27
27
 
28
- Put the auth guard in the layout of a route group, `app/(auth)/layout.tsx`: the group adds no path segment and protects every route below it.
29
-
30
- Layouts do not protect Route Handlers: check auth in each handler too.
31
-
32
- Use `@kirill.konshin/auth` (see [rules/auth.md](../../rules/auth.md)); the guard runs inside `<Suspense>`:
33
-
34
- ```tsx
35
- import { type ReactNode, Suspense } from 'react';
36
-
37
- import { auth } from '@/auth';
38
-
39
- export default function Layout({ children }: LayoutProps<'/dashboard'>) {
40
- return (
41
- <Suspense>
42
- <Protected>{children}</Protected>
43
- </Suspense>
44
- );
45
- }
46
-
47
- async function Protected({ children }: { children: ReactNode }) {
48
- await auth.redirectNonAuthenticated(); // redirects to urls.login
49
- return <>{children}</>;
50
- }
51
- ```
28
+ Put the auth guard in the layout of a route group, `app/(auth)/layout.tsx`: the group adds no path segment and protects every route below it. Layouts do not protect Route Handlers: check auth in each handler too. The guard and its `<Suspense>` boundary: the `auth` skill of `@kirill.konshin/auth`.
52
29
 
53
30
  # Pages
54
31
 
@@ -87,10 +64,4 @@ export default function Page({ params }: PageProps<'/blog/[slug]'>) {
87
64
 
88
65
  # `next.config.ts`
89
66
 
90
- `defineNextConfig` from `@kirill.konshin/next/config` (the `/config` subpath: Next transpiles `next.config.ts` to CJS and `require`s it outside any bundler) sets `cacheComponents`, `typedRoutes`, `experimental.typedEnv`, `reactStrictMode: false` and an exhaustive `experimental.optimizePackageImports` (`@mui/*`, `@toolpad/core`, `@fortawesome/*`, `@gravity-ui/*`, `lodash`, `@heroui/react`, `react-bootstrap`, `@kirill.konshin/icons`, …). Extra entries cost nothing; a missing one costs dev startup time and bundle size.
91
-
92
- ```ts
93
- import { defineNextConfig } from '@kirill.konshin/next/config';
94
-
95
- export default defineNextConfig((defaults) => ({ ...defaults, transpilePackages: ['my-lib'] }));
96
- ```
67
+ `defineNextConfig` of `@kirill.konshin/next/config`: what it sets and how to extend it is in the `next` skill, it installs with the package. The same skill lists the package's utilities (`AppLink`, `SoftLink`, `NoSSR`, …).