Use Ng22のロゴ

Use Ng22

組織
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.

概要

公開者duplocloud
リポジトリdevkit
スキル名use-ng22
スター
51
フォーク
18
同梱ファイル
1
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    duplocloudがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Use Ng22」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでUse Ng22を有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にUse Ng22を読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Use Ng22は作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「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...

TypingMindでUse Ng22を使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Use Ng22はプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにUse Ng22をインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/duplocloud/devkit/tree/main/.claude/skills/use-ng22を貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Use Ng22を使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Use Ng22で使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもUse Ng22を利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Use Ng22」は無料ですか?

はい。duplocloudがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇