Logotipo de Use Ng22

Use Ng22

Organización
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.

Descripción general

Editorduplocloud
Repositoriodevkit
Nombre de la habilidaduse-ng22
Estrellas
51
Forks
18
Archivos incluidos
1
LicenciaApache-2.0
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 1

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por duplocloud en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Use Ng22 en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese 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
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Use Ng22 en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Use Ng22 automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Use Ng22 no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo 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

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de 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...

¿Por qué usar Use Ng22 en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Use Ng22 está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Use Ng22 en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Use Ng22?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Use Ng22?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Use Ng22 con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Use Ng22?

Sí. duplocloud la ha publicado en GitHub bajo la licencia Apache-2.0. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇