mcpbeat Sign in

Reference Core Agent Skill

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`

1.2k tokens
context cost
SKILL.md, read when the skill is used
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
100 701
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/angular/angular --skill reference-core

The instruction itself

12 sections, as written by the author

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:

  • Rendering (Ivy/Render3): Transforming templates into DOM updates.
  • Dependency Injection (DI): Managing object creation and lifetime.
  • Change Detection: Synchronizing the model with the view.
  • 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 array containing the _static structure_ of a view. It is shared across all instances (LViews) 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 are parallel arrays. Index i in LView corresponds to metadata at index i in TView.
  • 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

  • Creation Mode: Instructions create DOM nodes and store them in LView.
  • 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:
  • Default: Checks everything.
  • OnPush: Checks only if inputs change, events fire, or signals update.
  • 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/signal: Signals implementation (if present in this version, otherwise likely in primitives).

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

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

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×16

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

2.3k tokens scripts
Finishing A Development Branch
by ZhanlinCui
×9

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1.1k tokens
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

3.4k tokens scripts
Vercel React Best Practices
by ratacat
×7

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

1.3k tokens
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

1.1k tokens
Using Git Worktrees
by ZhanlinCui
×6

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1.4k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

1k tokens

How to use it

Copy the folder

Take angular/reference-core from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.