Claude-skill-registry angular-v21-development
Develop Angular v21 components, services, and directives with signals. Use when implementing standalone components, OnPush change detection, inject() function, and input()/output() functions.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/angular-v21-development" ~/.claude/skills/majiayu000-claude-skill-registry-angular-v21-development && rm -rf "$T"
manifest:
skills/data/angular-v21-development/SKILL.mdsource content
Angular v21 Development
Development guide for components, services, and directives based on Angular v21 modern patterns.
When to Use This Skill
- Creating new components, services, or directives
- Implementing signals-based state management
- Implementing Reactive Forms
- Refactoring existing code to Angular v21 patterns
- Using inject() function for dependency injection
When NOT to use:
- Styling only →
tailwindcss-v4-styling - Page routing configuration →
analogjs-development - UI/UX design application →
material-design-3-expressive
Core Principles
- Standalone First: All components are standalone (do NOT write
in decorator, it's default)standalone: true - OnPush Detection: Always set
changeDetection: ChangeDetectionStrategy.OnPush - Signals-First: Prefer
,signal()
,computed()effect() - Modern DI: Use
function instead of constructor injectioninject() - Function-Based APIs: Use
/input()
functions instead ofoutput()
/@Input()
decorators@Output() - Host Bindings in Decorator: Use
object instead ofhost
/@HostBinding@HostListener - Native Control Flow: Use
/@if
/@for
instead of@switch
/*ngIf
/*ngFor*ngSwitch - Class Binding: Use
binding instead of[class]ngClass - Style Binding: Use
binding instead of[style]ngStyle
Implementation Guidelines
Component Creation
Patterns to apply when creating components:
- Set
inchangeDetection: ChangeDetectionStrategy.OnPush
decorator@Component - Define inputs/outputs with
/input()
functionsoutput() - Calculate derived state with
computed() - Use
/@if
/@for
control flow in templates@switch
→ Details: Component Examples
Service Creation
Patterns to apply when creating services:
- Use
for singleton@Injectable({ providedIn: 'root' }) - Inject dependencies with
functioninject() - Manage state with
, expose withsignal()asReadonly() - Define derived state with
computed() - Update state with
orset()
(do NOT useupdate()
)mutate()
→ Details: Signal Patterns
Reactive Forms
Patterns to apply when implementing forms:
- Get
viaFormBuilderinject() - Use typed forms for type safety
- Get values with
getRawValue() - Add
to importsReactiveFormsModule
→ Details: Component Examples
Host Bindings
Host binding implementation patterns:
- Do NOT use
/@HostBinding
decorators@HostListener - Use
object inhost
/@Component
decorator@Directive
→ Details: Component Examples
Image Optimization
Patterns to apply when displaying images:
- Use
(not for inline base64 images)NgOptimizedImage - Always specify
/width
attributesheight - Add
attribute for above-the-fold imagespriority
→ Details: Component Examples
Workflow
- Requirement Check: Define component responsibility and inputs/outputs
- TDD Red Phase: Create test cases first
- TDD Green Phase: Minimal implementation to pass tests
- TDD Refactor Phase: Optimize code
- Pattern Verification:
- Is
set?changeDetection: ChangeDetectionStrategy.OnPush - Are
/input()
functions used?output() - Is DI done with
function?inject() - Are signals (
,signal()
) used?computed()
- Is
- Accessibility: Check ARIA attributes, keyboard navigation
Related Skills
- analogjs-development: Use together when creating page components (*.page.ts)
- tailwindcss-v4-styling: When styling is needed
- material-design-3-expressive: When applying UI/UX design patterns
Reference Documentation
For detailed patterns and code examples, see:
- Signal Patterns - Detailed signal usage
- Component Examples - Various component patterns