Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

add-feature

/add-feature

Prowadzi przez dodanie nowej funkcji UI w aplikacji nvcf-ui: struktura folderów, routing, ładowanie danych, lazy-loading, testy i lista kontrolna ukończenia.

Repozytorium
nvcf ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
27.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Prowadzi przez dodanie nowej funkcji UI w aplikacji nvcf-ui: struktura folderów, routing, ładowanie danych, lazy-loading, testy i lista kontrolna ukończenia.

Wyzwalacze z opisu

t say
Oryginalny opis (EN)

Add a new UI feature to the nvcf-ui app — folder structure, routing, data loading, lazy-loading, testing, and completion checklist. Use when creating a new feature folder, adding a page or view, wiring routes, building a new screen, or deciding whether to extend an existing feature vs create a new one. Also use when the user asks to build something new in the UI, even if they don't say "feature" explicitly.

Jak działa

  1. Gotchas
  2. When to Create a New Feature Folder
  3. Feature Folder Structure
  4. Route Splitting Pattern
  5. Lazy-Loading Rules
  6. Layout Routes
  7. Steps
  8. Validate Before Finishing
Sekcje z nagłówków SKILL.md, w oryginale · 121 linii, 827 słów
Podgląd SKILL.md
---
name: add-feature
description: >
  Add a new UI feature to the nvcf-ui app — folder structure, routing, data loading,
  lazy-loading, testing, and completion checklist. Use when creating a new feature folder,
  adding a page or view, wiring routes, building a new screen, or deciding whether to extend
  an existing feature vs create a new one. Also use when the user asks to build something new
  in the UI, even if they don't say "feature" explicitly.
license: Apache-2.0
allowed-tools:
  - Bash
  - Read
  - Edit
---

# Adding a UI Feature

For all component selection, layout decisions, and styling — invoke the `kaizen-ui` skill.

## Gotchas

- This project uses **code-based routing**, not file-based. Do not use `createFileRoute` or the TanStack Router Vite plugin — use `createRoute` and `createLazyRoute`.
- View components are named by view type (e.g. `WidgetsList`, `WidgetDetail`), never with a `Page` suffix.
- `router.tsx` is pure composition — it only imports and wires route trees. Do not put route definitions or loaders in `router.tsx`.
- `rootRoute.tsx` is separate from `router.tsx` to avoid circular imports. Layout routes that span multiple features live at `src/` root, not in a feature folder.
- Generated hooks, schemas, and mocks live in `ui/src/generated/` — never edit these files. If the endpoint you need doesn't have generated hooks, update the appropriate spec in `spec/` (`control-plane-openapi.yaml`, `nvcf-openapi.yaml`, or `sis-openapi.yaml`) then run `task generate`.
- All source files need Apache 2.0 license headers. Run `task license:add` before committing.

## When to Create a New Feature Folder

- **New domain** (new data, new concepts, new API surface) → new feature folder
- **Composition of existing domains** (e.g. a home page assembling widgets) → new thin feature folder
- **Extension of an existing domain** (e.g. a "Create Function" page) → new route/component in the existing feature folder

## Feature Folder Structure

A feature is a **domain boundary**, not a route. Each feature is self-contained under `ui/src/features/<name>/`:

```text
features/<name>/
├── components/         # Smaller building blocks (badges, cards)
├── hooks/              # Feature-scoped hooks
├── types/              # Feature-scoped types
├── routes.tsx          # Route definitions, loaders, search validation (optional)
├── <View>.tsx          # Route-level view components (PascalCase, named by view type)
└── utils.ts            # Feature-scoped helpers (when needed)
```

- Not every subfolder is required — add `components/`, `hooks/`, `types/` only when needed
- A feature may not have routes at all — it may only export hooks and components for other features
- Helpers go inline in the component file by default. Extract to a feature-root file only when shared across multiple files in the same feature

## Route Splitting Pattern

Each route is split across two files:

**`routes.tsx`** — route definition, search params, loader. In the main bundle.

```tsx
import { createRoute } from "@tanstack/react-router";
import { appLayoutRoute } from "~/appLayout";
import { queryClient } from "~/lib/queryClient";
import { getGetWidgetsQueryOptions } from "~/generated/api/widgets/widgets";
import { GetWidgetsParams } from "~/generated/model/getWidgetsParams.zod";

const widgetsRoute = createRoute({
  getParentRoute: () => appLayoutRoute,
  path: "widgets",
  validateSearch: GetWidgetsParams.catch({ status: "active" }),
  loaderDeps: ({ search }) => search,
  loader: ({ deps }) =>
    queryClient.ensureQueryData({
      ...getGetWidgetsQueryOptions(deps),
      revalidateIfStale: true,
    }),
}).lazy(() => import("./WidgetsList").then((m) => m.WidgetsListRoute));

export const widgetsRouteTree = widgetsRoute;
```

- Use generated Zod schemas for `validateSearch` when params map to API query params. For UI-only search params, define inline.
- `loaderDeps` declares which search params the loader depends on — the loader re-runs when these change.
- `ensureQueryData` with `revalidateIfStale: true` avoids flashing stale content.
- For multiple data sources: `ensureQueryData` (awaited) for primary data, `prefetchQuery` (no await) for below-the-fold data.

**`<View>.tsx`** — lazy-loaded component, pending, and error states.

```tsx
import { createLazyRoute } from "@tanstack/react-router";
import { useGetWidgetsSuspense } from "~/generated/api/widgets/widgets";

function WidgetsList() {
  const { status } = widgetsRoute.useSearch();
  const { data } = useGetWidgetsSuspense({ status });
  // render...
}

export const WidgetsListRoute = createLazyRoute("/widgets")({
  component: WidgetsList,
  pendingComponent: () => <div>Loading...</div>,
});
```

- Use suspense hook variants (`useGetWidgetsSuspense`) — the loader already ensured data, so these resolve immediately or suspend if cache is stale.
- For prefetched (non-blocking) data, wrap the consumer in a `<Suspense>` boundary with a fallback.

## Lazy-Loading Rules

- Page routes with view code → always lazy-load via `createLazyRoute`
- Layout routes that just render `<Outlet />` → keep in main bundle
- Components within a page → never lazy-load; already in the route's chunk

## Layout Routes

- Single feature → in that feature's `routes.tsx`
- Multiple features → at `src/` root alongside `rootRoute.tsx`

**Tabbed views**: use a layout route with `<Outlet />`, each tab is a child route with its own loader and lazy-loaded component.

## Steps

1. Check for existing components/patterns that could be reused or graduated before building new ones
2. Create `features/<name>/` with the relevant files — a view component and `routes.tsx` if the feature has routes, or just `components/`/`hooks/` if routeless
3. If the feature has routes: define routes in `routes.tsx` using `createRoute` with `.lazy()`, then wire the subtree into `router.tsx`. If it introduces a new top-level route, add a `NavItem` entry in `rootRoute.tsx`
4. Use generated hooks and query options for data fetching
5. Add tests for view components and any non-trivial logic. Use `renderWithRouter` from `~/testing/render` for route-level views, standard `render` for standalone components
6. Add MSW scenarios in `mocks/scenarios/<name>/` for key UI states
7. Run `task license:add` to apply license headers to new files

## Validate Before Finishing

1. Run `task ui:lint:fix` and fix any errors
2. Run `task ui:test` and verify tests pass
3. If either fails, fix the issues and rerun until clean

Wersje

RepozytoriumWynikLicencja
Ta strona · nvidia/nvcf100Apache-2.0
gosodax/sodax-sdks100MIT
opusgamelabs/game-creator100MIT
Q-Sharp/CloudGround100MIT
fullstackhero/dotnet-starter-kit100MIT
ialameh/sift-coder100MIT
onewave-ai/open-agent-stack90MIT
JamieMason/syncpack90MIT
gazi-faysal-jubayer/shapebridge86Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki 3cef7a68fa4b (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90ios-feature-implementation
    Prowadzi wdrożenie nowej funkcji w istniejącej aplikacji iOS: najpierw analiza kodu, potem zmiany i lista kontrolna.
  • 100acp-feature-add
    Prowadzi przez dodanie nowej funkcji, API, endpointu lub komponentu: plan przed kodem, zakres poza celem i weryfikacja nowego zachowania od początku do końca.
  • 100angular-architecture
    Ustala standardy struktury projektu Angular, modułów funkcji i lazy loadingu.
  • 100mobile-app-structure
    Opisuje układ folderów funkcji, konwencję states/ i zasady przepływu danych w aplikacji mobilnej Agenta (web/mobile), przy tworzeniu i przenoszeniu plików oraz podłączaniu danych do komponentów.
  • 100lazy-loading-implementer
    Prawdopodobnie wdraża leniwe ładowanie zasobów i komponentów w projektach frontendowych.
  • 100clean-arch-new-feature
    Prowadzi przez dodanie nowej funkcji lub ekranu do aplikacji Flutter w Clean Architecture z Bloc: kolejne warstwy, testy i wybór kształtu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.