Работа с spartan/ui — Angular UI-библиотекой: компоненты, стили, отладка.

Звёзды3 001
Авторspartan-ng
Установок2,5K

Установка

SKILL.md

spartan/ui

spartan/ui is an Angular UI library. It uses a two-layer architecture:

  • Brain (@spartan-ng/brain) - accessible, unstyled primitives (Angular directives/components), installed from npm. This is the behavior and accessibility layer.
  • Helm (@spartan-ng/helm) - the styled layer (Tailwind + class-variance-authority). Helm code is copied into the user's project by the CLI so they own and can customize it.

You compose Helm directives/components onto host elements; Helm wires up the matching Brain primitive under the hood. Always prefer existing components over hand-written markup.

All CLI commands run through the workspace's runner. Detect it from the project:

  • Nx workspace (has nx.json): npx nx g @spartan-ng/cli:<generator> (or pnpm nx g ...).
  • Angular CLI workspace (has angular.json, no nx.json): ng g @spartan-ng/cli:<generator>.

Current project context

Before generating any code, gather the project context:

npx nx g @spartan-ng/cli:info --json     # Nx
ng g @spartan-ng/cli:info --json         # Angular CLI

This is read-only and prints JSON with:

  • workspaceType - nx | angular-cli (decides which runner to use above).
  • config.componentsPath - where Helm components are copied (e.g. libs/ui).
  • config.importAlias - the import prefix for Helm, default @spartan-ng/helm.
  • config.generateAs - library | entrypoint (Nx layout choice).
  • versions - Angular, Angular CDK, Tailwind, @spartan-ng/brain, @spartan-ng/cli.
  • iconLibrary - @ng-icons when present.
  • tailwindCssFile - the global stylesheet that imports the preset.
  • installedComponents - components already present (do not re-add these).
  • availableComponents - everything the CLI can generate.

If components.json does not exist, the project is not set up yet - run @spartan-ng/cli:init first (it installs dependencies and the theme). components.json itself is created when you add the first component with ui (see cli.md).

Principles

  1. Use existing components first. Check installedComponents, then availableComponents. Find docs via the MCP server (spartan_components_list / spartan_components_get) or the live docs at https://www.spartan.ng/components/<name>. See mcp.md.
  2. Compose, do not reinvent. Build dashboards, forms, and dialogs from existing Helm + Brain pieces rather than custom markup.
  3. Use built-in variants before custom styles. Buttons, badges, alerts, etc. ship variant and size inputs - use them instead of overriding classes.
  4. Use semantic colors, never raw values. bg-primary text-primary-foreground, not bg-blue-500. See rules/styling.md.

Critical rules

Read the rule file before doing the related work:

  • rules/styling.md - the hlm() util, semantic color tokens, layout-only classes, gap-* over space-*, size-*, dark mode, no manual z-index on overlays.
  • rules/forms.md - compose forms with hlmField (label, control, error, description) and hlmFieldSet / hlmFieldLegend on native <fieldset>/<legend>; option sets (2-7 choices) use hlm-toggle-group.
  • rules/composition.md - items belong inside their group; dialogs/sheets need a title; full Card composition; tabs triggers inside hlm-tabs-list; avatar always has a fallback; use Alert/Empty/Skeleton/Badge/Separator/Spinner instead of custom markup.
  • rules/icons.md - icons are <ng-icon name="lucide...">; register with provideIcons; no manual sizing classes inside components - use the size input.
  • rules/brain-vs-helm.md - the two-layer model (one headless library, Brain, plus the styled Helm layer); when to reach for Brain directly vs Helm, and how composition works via directives.
  • cli.md - every generator (init, ui, ui-theme, healthcheck, info, migrate-*), with Nx and Angular CLI invocations.
  • registry.md - the Brain-npm + Helm-copy-in distribution model, components.json, and the fixed component catalog (the shipped CLI uses no remote or custom registry).
  • customization.md - theming via the hlm-tailwind-preset.css, CSS variables, the ui-theme generator, and extending copied Helm components.
  • mcp.md - using the @spartan-ng/mcp tools, resources, and prompts for discovery.

Key patterns

<!-- Buttons: use variant/size inputs, not custom classes -->
<button hlmBtn variant="destructive" size="lg">Delete</button>

<!-- Icon in a button: ng-icon -->
<button hlmBtn size="icon" variant="ghost">
	<ng-icon name="lucideTrash" />
</button>

<!-- Loading state: compose a spinner, there is no isLoading input -->
<button hlmBtn [disabled]="loading()">
	@if (loading()) {
	<hlm-spinner />
	} Save
</button>

<!-- Layout: gap, not space-* ; size-* when width == height -->
<div class="flex items-center gap-2">
	<span hlmBadge variant="secondary">beta</span>
</div>

Component selection

NeedComponent(s)
Action / buttonbutton (hlmBtn), button-group
Text/number inputinput, textarea, input-otp, input-group, native-select
Choice inputselect, combobox, autocomplete, radio-group, checkbox, switch, slider
Toggle 2-7 optionstoggle-group
Form layout/validationfield, label
Data displaytable, card, badge, avatar, kbd, item
Navigationsidebar, navigation-menu, breadcrumb, tabs, pagination
Overlaysdialog, sheet, alert-dialog, popover, hover-card, tooltip
Menusdropdown-menu, context-menu, menubar, command
Feedbacksonner (toasts), alert, progress, skeleton, spinner
Layout/containerscard, separator, resizable, scroll-area, accordion, collapsible, aspect-ratio
Empty statesempty
Datescalendar, date-picker
Iconsicon (@ng-icons)
Typographytypography

Workflow

  1. Get context. Run @spartan-ng/cli:info --json. If the project is not set up, run :init, then add components with :ui (the first :ui run creates components.json).
  2. Check what is installed. Do not re-add anything in installedComponents.
  3. Find the component. Use the MCP tools or https://www.spartan.ng/components/<name> for the API and examples (mcp.md). Never guess selectors - confirm them.
  4. Add it. npx nx g @spartan-ng/cli:ui --name=<component> (Nx) or ng g @spartan-ng/cli:ui --name=<component> (Angular CLI). This installs the Brain dependency and copies the Helm code. Omit --name to get an interactive multiselect.
  5. Compose correctly. Import the *Imports const (e.g. HlmDialogImports) or the individual classes from the import alias, add them to the standalone component's imports, and follow the composition rules.
  6. Register icons. Any <ng-icon> you use must be passed to provideIcons(...) (see rules/icons.md).
  7. Verify. After bigger changes or upgrades, run @spartan-ng/cli:healthcheck to catch deprecated patterns and fix imports.
  8. Theme/customize. Edit the copied Helm files and the CSS variables; do not fork Brain.

Quick reference

# Initialize (creates components.json, wires Tailwind + preset)
npx nx g @spartan-ng/cli:init
ng g @spartan-ng/cli:init

# Project context as JSON
npx nx g @spartan-ng/cli:info --json

# Add components (interactive, or pass --name)
npx nx g @spartan-ng/cli:ui
npx nx g @spartan-ng/cli:ui --name=dialog

# Generate theme variables
npx nx g @spartan-ng/cli:ui-theme

# Scan + auto-fix deprecated APIs/imports after an upgrade
npx nx g @spartan-ng/cli:healthcheck --autoFix

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: spartan](https://darkplay.ru/ai/skills/spartan-ng-spartan-spartan)

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

ui-ux-pro-maxnextlevelbuilder · Профессиональные знания по UI/UX-дизайну для ИИ-ассистентов программирования. Включает…
151 010 ★
Electron Code Review Mode Instructionsgithub · Режим код-ревью для приложения Electron с бэкендом на Node.js (main), фронтендом на…
36 140 ★
a11y-auditalirezarezvani · Аудит и исправление доступности по WCAG 2.2 для React, Next.js, Vue, Angular, Svelte и…
510 комп.
code-to-prdalirezarezvani · Реверс-инжиниринг кодовой базы в полный PRD для frontend, backend и fullstack. 2…
510 комп.
auth0-sdksanthropics · Навыки интеграции Auth0 SDK для React, Next.js, Vue, Angular, Express и других.
38 комп.
cc-boostanthropics · cc-boost — открытый плагин Claude Code, снижающий расход токенов за счёт фильтрации…
38 комп.
d2canthropics · Превращает фреймы Figma в готовый код с вашими компонентами, дизайн-токенами и…
38 комп.
ff-reviewanthropics · Плагин ревью качества кода на основе четырёх принципов Frontend Fundamentals (читаемость…
38 комп.
mapboxanthropics · Навыки для Claude Code по созданию быстрых и безопасных приложений на Mapbox.
38 комп.
nganthropics · Помощник по Angular: генерация, ревью, тестирование и миграция приложений.
38 комп.

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8