К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

reference-core — скилл для Claude Code: что делает и как установить

Объясняет архитектуру рантайма Angular в packages/core. Скилл нужен при работе с кодом движка Ivy, инжекторами и реактивностью.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add angular/angular --skill reference-core -a claude-code
Открыть на GitHub

Что делает reference-core

Скилл задаёт ментальную модель для рантайма Angular внутри packages/core. Он описывает устройство рендерера Ivy (packages/core/src/render3), где шаблоны компилируются в инструкции вроде ɵɵelementStart и исполняются в режимах создания и обновления. Состояние конкретного вида хранится в массиве LView, а статическая структура и метаданные находятся в параллельном массиве TView.data.

Архитектура оптимизирована под минимальный объём памяти и скорость исполнения. Внутри движка применяются битовые маски и плоские массивы вместо объектов, а контекст берут из глобальных функций вроде getLView(). Иерархия внедрения зависимостей разделена на модульный инжектор R3Injector и Node Injector на уровне узлов, в котором фильтры Блума в TView.data проверяют наличие токена перед обходом дерева.

Код чувствителен к структуре памяти: добавление новых данных меняет раскладку LView по секциям HEADER, DECLS, VARS и EXPANDO. Для проверки любых изменений в ядре фреймворка придётся запускать тесты через Bazel.

Какие задачи решает

  • разобраться в структуре параллельных массивов LView и TView
  • модифицировать инструкции рендеринга Ivy в packages/core/src/render3
  • отладить разрешение зависимостей через Node Injector и фильтры Блума
  • добавить состояние компонента с учётом секций памяти LView

Примеры запросов агенту

  • Помоги добавить новую инструкцию рендеринга в packages/core/src/render3/instructions
  • Объясни, как устроен Node Injector в LView и где в нём используются фильтры Блума
  • Как правильно добавить значение в массив LView, чтобы не сломать разметку памяти?

Как установить reference-core

1Через Skills CLI (Vercel)

npx skills add angular/angular --skill reference-core -a claude-code

2Вручную: положить файлы

~/.claude/skills/reference-core/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/reference-core/

Из того же набора5

Весь набор →
reference-signal-forms angular Разбирает архитектуру signal-based forms в Angular и помогает безопаснее работать с packages/forms/signals, где форма строится вокруг сигнала. Claude Code CX Codex Cursor +1 969установок adev-writing-guide angular Скилл задаёт правила технического писательства Google и разметку для документации Angular в adev/. Он нужен при создании, правке и ревью страниц в каталоге adev/src/content. Claude Code CX Codex Cursor +1 912установок reference-compiler-cli angular Скилл объясняет внутреннее устройство Angular Compiler (ngtsc) — как работает компиляция декораторов, система traits и трансформация кода. Подключайте его перед работой с packages/compiler-cli. Claude Code CX Codex Cursor +1 909установок PR Review angular Скилл для глубокой проверки pull request в репозитории Angular. Включает гайдлайны по совместимости, производительности, качеству кода и коммитов, а также рабочий процесс для локальной или удалённой рецензии. Claude Code CX Codex Cursor +1 526установок

Похожие

typescript-review metabase Проверяет изменения в TypeScript и JavaScript по правилам Metabase. Пригодится для ревью pull request и diff с фронтенд-кодом. Claude Code CX Codex Cursor +1 2 300установок site-md официальный google-labs-code Скилл разбирает бриф или описание проекта и формирует файл .stitch/SITE.md для рабочего цикла Stitch Build Loop. Claude Code CX Codex Cursor +1 3 600установок ima-sdk-client-side официальный Google LLC Скилл помогает подключать Google IMA SDK для клиентской вставки видео- и аудиорекламы по VAST или VMAP. Подойдёт для сайтов, приложений и ТВ-платформ. Claude Code Gemini CLI CX Codex 4 500установок nextjs-supabase-auth sickn33 Скилл настраивает Supabase Auth в Next.js App Router: клиенты, middleware, OAuth callback и Server Actions. Пригодится для защиты маршрутов и работы с сессиями. Claude Code CX Codex Cursor +1 6 500установок e2e-tests-studio mastra-ai Скилл автоматически генерирует Playwright E2E тесты при изменении компонентов playground. Тестирует не состояние интерфейса, а реальное поведение: сохранение данных, потоки данных, эффекты действий. Claude Code CX Codex Cursor +1 2 500установок frontend-design официальный anthropics Скилл задаёт осмысленное визуальное направление для новых интерфейсов и редизайна. Подойдёт, когда стандартный шаблонный UI не устраивает. Claude Code Claude.ai 1 025 790установок design-taste-frontend Leonxlnx Скилл задаёт арт-дирекцию для публичных страниц и рабочих экранов, а затем проверяет результат в браузере по скриншотам. Нужен, когда интерфейс выглядит шаблонным или недоработанным. Claude Code CX Codex Cursor +1 673 100установок prototype Matt Pocock Создаёт временный прототип, чтобы проверить логику, модель состояния или вид интерфейса до работы над основным кодом. Claude Code 986 201установок

Вопросы о reference-core

Как установить reference-core в Claude Code?

Выполните в терминале команду npx skills add angular/angular --skill reference-core -a claude-code. Файл навыка сохранится по пути ~/.claude/skills/reference-core/SKILL.md.

Зачем нужен скилл reference-core?

Он передаёт агенту архитектурные правила пакета packages/core фреймворка Angular. Это помогает модели понимать структуру движка Ivy, устройство LView, стратегии обнаружения изменений и сигналы.

Чем Node Injector отличается от Module Injector?

Node Injector устроен не как отдельный класс, а как структура данных внутри секции Expando массива LView. Перед обходом дерева он проверяет наличие токена через фильтры Блума в TView.data, тогда как Module Injector опирается на иерархию классов R3Injector.

Исходный текст

SKILL.md · MIT
---
name: reference-core
description: Explains the mental model and architecture of the code under `packages/core`. You MUST use this skill any time you plan to work with code in `packages/core`
---

# Angular Core (`packages/core`) Mental Model

This document outlines the architecture and mental model for `packages/core`, the heart of the Angular framework.

## 1. High-Level Architecture

`packages/core` contains the runtime logic for Angular. Its primary responsibilities are:

1.  **Rendering (Ivy/Render3)**: Transforming templates into DOM updates.
2.  **Dependency Injection (DI)**: Managing object creation and lifetime.
3.  **Change Detection**: Synchronizing the model with the view.
4.  **Reactivity**: Signals and Zone.js integration.

## 2. Rendering Engine (Ivy / Render3)

The rendering engine (located in `packages/core/src/render3`) uses an **instruction-based** approach.

### Key Concepts

- **Instructions**: The Angular compiler transforms templates into a sequence of instruction calls (e.g., `ɵɵelementStart`, `ɵɵtext`, `ɵɵproperty`). These instructions are executed at runtime to create and update the view.
  - _Location_: `packages/core/src/render3/instructions`

- **LView (Logical View)**: An array containing the _state_ of a specific view instance. It holds:
  - DOM nodes (`RElement`, `RText`).
  - Binding values (for change detection).
  - Directive/Component instances.
  - _Context_: `packages/core/src/render3/interfaces/view.ts`

- **TView (Template View)**: An object describing the _static structure_ of a view; its parallel array is `TView.data`. It is shared across all instances (`LView`s) of the same component/template. It holds:
  - Property names for bindings.
  - Node relationship information.
  - Compiled directive definitions.
  - _Context_: `packages/core/src/render3/interfaces/view.ts`

- **Memory Layout**: `LView` and `TView.data` are parallel arrays. Index `i` in `LView` corresponds to metadata at index `i` in `TView.data`.
  - `HEADER`: Fixed size, contains context (Parent, Host, etc.).
  - `DECLS`: Static nodes (elements, text, pipes).
  - `VARS`: Binding values.
  - `EXPANDO`: Dynamic data (host bindings, injectors).

### The Render Cycle

1.  **Creation Mode**: Instructions create DOM nodes and store them in `LView`.
2.  **Update Mode**: Instructions check current values against previous values stored in `LView`. If changed, they update the DOM.

## 3. Dependency Injection (DI)

DI in Angular is hierarchical and split into two systems that interact:

### Module Injector (`R3Injector`)

- Configured via `@NgModule.providers` or `providedIn: 'root'`.
- Stored in a hierarchy of `R3Injector` instances.
- _Location_: `packages/core/src/di/r3_injector.ts`

### Node Injector

- Configured via `@Component.providers` or `@Directive.providers`.
- **Not a class**, but a data structure embedded in the `LView` ("Expando" section).
- Uses **Bloom Filters** (`TView.data`) to quickly check if a token is present at a specific node index before traversing up the tree.
- Resolves tokens starting from the current node, walking up the view tree (Element Injector hierarchy), and falling back to the Module Injector if not found.

## 4. Change Detection

- **Dirty Checking**: Angular checks if values bound in templates have changed.
- **Strategies**:
  - `OnPush`: The default. Checks when inputs change, events fire, template signals update, or the view is explicitly marked for checking.
  - `Eager`: Checks whenever the change detection traversal reaches the component. (`Default` is the deprecated alias for `Eager`.)
- **Signals**: The new reactivity primitive. Signals notify the scheduler when they change, potentially allowing for fine-grained updates (Zoneless).

## 5. Key Directories to Know

- `src/render3`: The Ivy rendering engine.
  - `instructions`: The runtime instructions called by compiled code.
  - `interfaces`: `LView`, `TView`, `TNode` definitions.
- `src/di`: Dependency injection system.
- `src/change_detection`: Change detection logic.
- `src/zone`: Zone.js integration.
- `src/render3/reactivity`: Signals implementation (`signal`, `computed`, `effect`), built on the reactive graph in `primitives/signals`.

## 6. Conventions & Gotchas

- **Prefixes**: Private/Internal exports often start with `ɵ`.
- **Global State**: Ivy relies heavily on global state (e.g., `getLView()`) during instruction execution to avoid passing context arguments everywhere. This is for performance and code size.
- **Performance**: The code is highly optimized for performance and memory. You will see arrays used instead of objects, bitmasks, and manual memory management patterns. **Respect these patterns.**

## 7. How to Modify Core

1.  **Understand the Instruction**: If modifying runtime behavior, find the corresponding instruction in `src/render3/instructions`.
2.  **Check `LView`/`TView` Impact**: If adding state, understand where it fits in the `LView` array.
3.  **Tests**: Core has extensive tests. Run them using Bazel.

© angular · MIT · angular/angular

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой