Logo di Use Ng22

Use Ng22

Organizzazione
duplocloud
use-ng22

The Angular 22 patterns a DuploCloud extension frontend must be written in — standalone components, signals, the OnPush default, inject(), the @if/@for/@switch block syntax, and a Routes export instead of an NgModule. Use when writing or reviewing any component, service, route or template in an extension's frontend/, when scaffolding a new extension's UI, or when deciding whether an Angular 22 API (resource, httpResource, signal forms, zoneless) is allowed in the extension context. Also the source of the rules that duplo-extension-dev scaffolds to and duplo-extension-ng22-migration modernizes toward.

Panoramica

Pubblicato daduplocloud
Repositorydevkit
Nome della skilluse-ng22
Stelle
51
Fork
18
File inclusi
1
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 1

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da duplocloud su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Use Ng22 in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/duplocloud/devkit.git /tmp/devkit
mkdir -p .claude/skills
cp -r /tmp/devkit/.claude/skills/use-ng22 .claude/skills/use-ng22
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Use Ng22 in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Use Ng22 non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Use Ng22 non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

use-ng22 — how extension frontends are written on Angular 22

Every DuploCloud extension remote runs inside the portal's Angular 22 host, sharing its @angular/core, its NgZone and its injector. That makes some Angular 22 patterns mandatory, some merely available, and a few actively wrong here even though they are current Angular elsewhere. This skill is the ruling on all three.

The exhaustive per-API catalogue is reference/patterns.md. This file is the short version: the default shape, the rules that bite, and the verification gate.

Both are reconciled against Angular's own shipped guidance (node_modules/@angular/core/resources/best-practices.md, what ng mcp's get_best_practices serves) and every API was verified present in the pinned @angular/*@22.1.0. Where the platform overrides Angular's default advice — forms, chiefly — the catalogue says so explicitly rather than quietly differing.

The worked reference is the helloworld template in duplo-extension-dev/templates/helloworld/frontend/.


The one that silently breaks everything

Angular 22 defaults a component with no changeDetection property to OnPush — the enum is OnPush = 0, Eager = 1, where Eager is the old Default.

This does not error. The build passes, unit tests pass, the shell renders — and then a field assigned from a subscribe/setTimeout/promise never repaints. A list sits empty forever while the network tab shows the data arrived. It is invisible until you load the page in the host.

The fix is not to add Eager. Hold async state in signal() and leave the property off — a signal write marks the view dirty, which is what makes the modern default correct rather than a trap. (Eager is a bulk-migration shim; duplo-ui/portal uses it on 898 of 904 components because retrofitting them to signals was not feasible. A new extension has no such excuse.)


Default component shape

Scaffold every new component like this. No standalone, no changeDetection, no constructor DI.

ts
import { Component, OnInit, inject, signal } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { SearchableDatatableModule } from '@duplocloud-internal/ng-common-lib';
import { ThingService, Thing } from '../thing.service';

@Component({
  selector: 'xx-list',
  imports: [SearchableDatatableModule],   // NgModules are fine in a standalone imports[]
  template: `
    @if (loading()) {
      <div class="card p-2 text-muted">Loading…</div>
    } @else {
      <searchable-datatable [rows]="rows()" columnMode="force">…</searchable-datatable>
    }
  `,
})
export class ListThingComponent implements OnInit {
  private readonly svc = inject(ThingService);
  private readonly router = inject(Router);
  private readonly route = inject(ActivatedRoute);

  protected readonly rows = signal<Thing[]>([]);
  protected readonly loading = signal(true);

  ngOnInit(): void {
    this.svc.list().subscribe({
      next: rows => { this.rows.set(rows ?? []); this.loading.set(false); },
      error: () => { this.rows.set([]); this.loading.set(false); },
    });
  }
}

Routes replace the NgModule entirely — loadChildren accepts a Routes array, and the host's extension-route-registrar.ts resolves the export named Extension:

ts
// src/app/extension.routes.ts  — federation.config.js: exposes { './Extension': './src/app/extension.routes.ts' }
export const Extension: Routes = [
  { path: '',          component: ListThingComponent },
  { path: 'add',       component: AddThingComponent },
  { path: 'edit/:id',  component: AddThingComponent, data: { action: 'Edit' } },
  { path: 'view/:id',  component: ViewThingComponent },
];

Rules

  1. Standalone components, no standalone: true — it is the default in Angular 19+; writing it is noise. Each component declares its own imports.
  2. No changeDetection property. All async state in signal(). See above.
  3. inject(), not constructor parameters — including for the platform's string tokens: private readonly http = inject<any>(REMOTE_DuploHttpClient as any) — the token cast is required, since these are string keys and inject() is typed for ProviderToken (a bare string is TS2345).
  4. input() / output() / model() / viewChild(), not the @Input/@Output/@ViewChild decorators. viewChild() returns a signal — call it: this.formErrors()?.reportError(err).
  5. computed(), never a getter, for derived template values. A getter re-runs on every check; a computed recomputes only when an input signal changes.
  6. @if / @for / @switch / @let, not *ngIf / *ngFor / [ngSwitch]. @for requires track. Block syntax needs no CommonModule import.
  7. A Routes export, not an NgModule. Delete extension.module.ts.
  8. Template-driven forms stay — see the constraint below.

Constraints specific to running inside the portal

These are the ones a generic Angular 22 guide will get wrong.

Angular 22 APIVerdict hereWhy
Zoneless (provideZonelessChangeDetection)ForbiddenThe host bootstraps with provideZoneChangeDetection() and the remote shares its NgZone. Never provide either in a remote — a second zone forks change detection.
Signal Forms (@angular/forms/signals)Forbidden for platform formsReal and exported in 22.1.0, but the platform's form-field, validation-state, validation-errors and form-group-errors are built on NgModel. Signal Forms bypass all of them and the form stops looking and behaving like the suite.
[(ngModel)]="someSignal"BrokenTwo-way binding compiles to sig = $event, which cannot assign to a signal. Use [ngModel]="sig()" (ngModelChange)="sig.set($event)".
httpResourceNot usable@publicApi 22.0, but it needs Angular's HttpClient from provideHttpClient. Extensions get the host's REMOTE_DuploHttpClient token, not that provider. Use rxResource or toSignal over the token's observables.
resource / rxResourceAllowed@publicApi 22.0. Good fit for view/:id loads. Plain subscribe + signal.set is equally correct and is what the template uses.
provideZoneChangeDetection in the remoteForbiddenHost-only concern; see zoneless row.
@deferAllowed, rarely usefulThe whole remote is already lazy-loaded by route.
ng mcp → onpush_zoneless_migrationIgnore its outputIt plans a zoneless migration and tells you to add ChangeDetectionStrategy.Eager — contradicting Angular's own best-practices and re-adding the shim. Extensions run in a zone-based host.

Verification gate

A green build proves nothing about change detection. The OnPush trap, unresolved attribute directives, and a missing imports entry can all compile cleanly.

Run these from frontend/. Everything under src/app — including the shared detail shell and every result-view panel component (reference/17, reference/19) — is your code and must pass this gate.

bash
OWN=$(find src/app -name '*.ts')

# 1. no component silently relying on the OnPush default while assigning plain fields
for f in $OWN; do
  grep -q "@Component(" "$f" || continue
  grep -q "changeDetection:" "$f" && continue
  grep -q "this\.[A-Za-z_]* = " "$f" && echo "CHECK: $f — no strategy, assigns plain fields"
done

# 2. no legacy structural directives or decorator queries left
grep -nE "\*ngIf|\*ngFor|ngSwitch|@Input\(|@Output\(|@ViewChild\(" $OWN || echo clean

# 3. two-way ngModel onto a signal — compiles, then silently fails to write
#    (the second grep drops comment lines, which legitimately mention the anti-pattern)
grep -nE "\[\(ngModel\)\]" $OWN | grep -vE ":[[:space:]]*(//|\*)" || echo clean

# 4. build
npm run build

All three checks return clean on the helloworld template.

Then load the page in the portal and watch a list actually populate after its request resolves. That is the only check that catches the failure this skill exists to prevent.


Related

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Use Ng22?

The Angular 22 patterns a DuploCloud extension frontend must be written in — standalone components, signals, the OnPush default, inject(), the @if/@for/@switch block syntax, and a Routes export instead of an NgModule. Use when writing or reviewing any component, service, route or template in an extension's frontend/, when scaffolding a new extension's UI, or when deciding whether an Angular 22 API (resource, httpResource, signal forms, zoneless) is allowed in the extension context. Also the source of the rules that duplo-extension-dev scaffolds to and duplo-extension-ng22-migration moderniz...

Perché usare Use Ng22 su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Use Ng22 è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Use Ng22 in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Use Ng22?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Use Ng22?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Use Ng22: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Use Ng22 è gratuita?

Sì. È pubblicata su GitHub da duplocloud con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇