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

prism-plugin

/prism-plugin

Tworzy wtyczki dla biblioteki ng-prism zgodne z interfejsem NgPrismPlugin, gdy potrzebny jest nowy dodatek.

Repozytorium
ng-prism ↗
Licencja
MIT
Ostatnia zmiana repozytorium
20.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 20.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Tworzy wtyczki dla biblioteki ng-prism zgodne z interfejsem NgPrismPlugin, gdy potrzebny jest nowy dodatek.

Wyzwalacze z opisu

create pluginnew pluginadd pluginplugin for
Oryginalny opis (EN)

Creates ng-prism plugins following the NgPrismPlugin interface. Triggers on "create plugin", "new plugin", "add plugin", "plugin for".

Jak działa

  1. Plugin Interface
  2. Plugin Template
  3. Plugin Registration
  4. Plugin with Panels
  5. Plugin with Custom Controls
  6. Package Structure (official plugins)
  7. Conventions
  8. Checklist
Sekcje z nagłówków SKILL.md, w oryginale · 179 linii, 585 słów
Podgląd SKILL.md
---
name: prism-plugin
description: Creates ng-prism plugins following the NgPrismPlugin interface. Triggers on "create plugin", "new plugin", "add plugin", "plugin for".
---

# ng-prism Plugin Creation Guide

Create plugins that extend ng-prism via the `NgPrismPlugin` interface.

## Plugin Interface

```typescript
interface NgPrismPlugin {
    name: string;

    // Build-time hooks (run in Node.js during scanning)
    onComponentScanned?: (component: ScannedComponent) => ScannedComponent | void | Promise<ScannedComponent | void>;
    onManifestReady?: (manifest: PrismManifest) => PrismManifest | void | Promise<PrismManifest | void>;

    onPageScanned?: (page: StyleguidePage) => StyleguidePage | void | Promise<StyleguidePage | void>;

    // Runtime contributions (embedded in the Prism app)
    panels?: PanelDefinition[];
    controls?: ControlDefinition[];
    headerWidgets?: HeaderWidgetDefinition[];
    navigationDecorations?: NavigationDecorationDefinition[];
    wrapComponent?: Type<unknown>; // deprecated since 22.6.0, never had an effect
}
```

## Plugin Template

```typescript
// packages/plugin-example/src/example-plugin.ts
import type { NgPrismPlugin, ScannedComponent, PrismManifest } from '@ng-prism/core/plugin';

export interface ExamplePluginOptions {
    enabled?: boolean;
}

export function examplePlugin(options: ExamplePluginOptions = {}): NgPrismPlugin {
    return {
        name: 'example',

        onComponentScanned(component: ScannedComponent) {
            // Modify or enrich component metadata
            component.meta = {
                ...component.meta,
                example: { processed: true }
            };
            return component;
        },

        onManifestReady(manifest: PrismManifest) {
            // Post-process the full manifest
            console.log(`[example] Scanned ${manifest.components.length} components`);
            return manifest;
        }
    };
}
```

## Plugin Registration

```typescript
// ng-prism.config.ts
import { defineConfig } from '@ng-prism/core/config';
import { examplePlugin } from '@ng-prism/plugin-example';

export default defineConfig({
    plugins: [examplePlugin({ enabled: true })],
    appProviders: []
});
```

## Plugin with Panels

```typescript
import type { NgPrismPlugin, PanelDefinition, InputMeta } from '@ng-prism/core/plugin';
import { Type } from '@angular/core';

export function a11yPlugin(): NgPrismPlugin {
    return {
        name: 'a11y',

        panels: [
            {
                id: 'a11y',
                label: 'Accessibility',
                // Lazy — see the PR checklist: plugin runtime components are loaded
                // on demand, not pulled into the main bundle via `component:`.
                loadComponent: () => import('./a11y-panel.component').then((m) => m.A11yPanelComponent),
                icon: 'accessibility'
            }
        ]
    };
}
```

### PanelDefinition — full shape

```typescript
interface PanelDefinition {
    id: string;
    label: string;
    component?: Type<unknown>; // eager — prefer loadComponent
    loadComponent?: () => Promise<Type<unknown>>; // lazy, the default choice
    overlayComponent?: Type<unknown>; // canvas overlay
    loadOverlayComponent?: () => Promise<Type<unknown>>;
    icon?: string;
    position?: 'bottom' | 'right'; // deprecated since 22.6.0, never had an effect
    placement?: 'addon' | 'view';
    providers?: Provider[];
    isVisible?: (component: RuntimeComponent) => boolean;
    badge?: (component: RuntimeComponent) => PanelBadge | null;
    keepAlive?: boolean;
}
```

## Plugin with Custom Controls

```typescript
export function colorPlugin(): NgPrismPlugin {
    return {
        name: 'color-controls',

        controls: [
            {
                matchType: (input: InputMeta) => input.type === 'string' && (input.name.includes('color') || input.name.includes('Color')),
                component: ColorPickerControlComponent
            }
        ]
    };
}
```

## Package Structure (official plugins)

```
packages/plugin-example/
  src/
    index.ts                   # Node entry (build-time hooks)
    index.browser.ts           # Browser entry (runtime panels/controls)
    example-plugin.ts          # Build-time plugin factory
    example-plugin.browser.ts  # Runtime plugin factory
    example-plugin.spec.ts
    example-panel.component.ts # plus .html / .css next to it
    example.types.ts
    __fixtures__/
    test-setup.ts
    schematics/                # ng-add schematic
  schematics/collection.json
  package.json                 # name: @ng-prism/plugin-example
  project.json
  tsconfig.lib.json
  jest.config.cjs
  .spec.swcrc
```

Note the flat `src/` — there is no `src/lib/`. The `.browser.ts` split is the
load-bearing part: `package.json`'s `exports` maps the `browser` condition to
`index.browser.js`, which keeps Node-only build-time code out of the bundle the
Prism app ships.

## Conventions

- Plugin factory function returns `NgPrismPlugin` (Vite-style)
- Options object as parameter with sensible defaults
- `name` must be unique — used for debugging and conflict detection
- Build-time hooks are async-compatible (can return Promise)
- Runtime components (panels, controls, header widgets) must be standalone
- Official plugins: `packages/plugin-*/` → npm: `@ng-prism/plugin-*`

## Checklist

- [ ] Plugin factory function with options parameter
- [ ] Unique `name` property
- [ ] Build-time hooks return modified object or void
- [ ] Runtime components are standalone Angular components
- [ ] Exported from package index
- [ ] Tests for hook behavior
- [ ] Registered via `defineConfig({ plugins: [...] })`

Wersje

W bazie nie ma innych skilli o nazwie prism-plugin.

Migawka bazy z 13.11.2026 · wersja paczki a09ca2c82ca2 (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

  • 100write-plugin
    Pisze własną wtyczkę ng-prism na bazie NgPrismPlugin: hooki budowania, panele, nakładki i akcje w nawigacji, także do pakowania na npm.
  • 100setup
    Konfiguruje ng-prism w Angularze lub Nx: ng add, plik konfiguracji, cele prism i prism-build, wtyczki oraz motyw katalogu komponentów.
  • 95prism
    Rozwiązuje lub rozwija benchmark rozmieszczania modeli na GPU w projekcie Prism.
  • 84prism-advise
    Pobiera od PRISM rekomendacje dotyczące pliku CLAUDE.md i wskazuje, co w nim wymaga poprawy.
  • 84prism-analyze
    Analizuje kondycję sesji Claude Code przez PRISM: zużycie tokenów, przyczyny błędów, plik CLAUDE.md i listę projektów.
  • 100prism-ui
    Implementuje kompletny ekran lub funkcję interfejsu na podstawie wizualnej specyfikacji Form, przy budowie strony, ekranu lub frontendu funkcji.

Uwagi i zgłoszenia

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