Communitygithub.com

angular-developer

生成 Angular 代码并提供架构指导。在创建项目、组件或服务,或寻求关于响应式编程(signals、linkedSignal、resource)、表单、依赖注入、路由、SSR、无障碍(ARIA)、动画、样式(组件样式、Tailwind CSS)、测试或 CLI 工具的最佳实践时触发。

angular-developer 是什么?

此技能旨在为 AI 代理(例如 Claude Code、Cursor、Codex)提供全面的 Angular 开发指导。当在 Angular 项目内工作,或执行创建组件、服务、路由等常见任务时,它会自动激活。该技能的核心价值在于它能够根据项目的 Angular 版本自动调整建议,例如优先使用 Signal Forms 或最新的响应式 API(signals、linkedSignal、resource)。它通过引用详细的参考文档(如组件、表单、依赖注入和路由指南)来指导代码生成,并严格执行构建验证(`ng build`)以确保生成代码的正确性。该技能不仅涵盖了从创建新项目(使用 `ng new` 的精确执行规则)到测试(单元测试、组件测试、E2E)的完整开发流程,还专门提供了构建无障碍组件(Angular Aria)和集成 Tailwind CSS 等现代工具的指南。同时,它明确列出了一系列反模式,帮助开发者避免常见的陷阱。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/angular-developer

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Angular 开发者指南

何时激活

  • 在任何 Angular 项目或代码库中工作时
  • 创建或搭建新的 Angular 项目、应用或库时
  • 生成组件、服务、指令、管道、守卫或解析器时
  • 使用 Angular Signals、linkedSignal 或 resource 实现响应式时
  • 使用 Angular 表单(Signal 表单、响应式表单或模板驱动表单)时
  • 设置依赖注入、路由、懒加载或路由守卫时
  • 添加无障碍(ARIA)、动画或组件样式时
  • 编写或调试 Angular 特定的测试(单元测试、组件测试工具、E2E)时
  • 配置 Angular CLI 工具或 Angular MCP 服务器时
  1. 在提供指导前,始终分析项目的 Angular 版本,因为最佳实践和可用功能在不同版本之间可能差异很大。如果使用 Angular CLI 创建新项目,除非用户要求,否则不要指定版本。

  2. 生成代码时,遵循 Angular 的风格指南以及可维护性和性能的最佳实践。使用 Angular CLI 搭建组件、服务、指令、管道和路由以确保一致性。

  3. 完成代码生成后,运行 ng build 以确保没有构建错误。如果存在错误,请分析错误消息并在继续之前修复它们。不要跳过此步骤,因为它对于确保所生成代码的正确性和功能性至关重要。

创建新项目

如果用户未提供任何指南,则在创建新的 Angular 项目时使用以下默认设置:

  1. 除非用户另有说明,否则使用最新的稳定版 Angular。
  2. 仅当目标 Angular 版本支持时,才在新项目中优先使用 Signal Forms。了解更多

ng new 的执行规则: 当要求创建新的 Angular 项目时,您必须通过以下严格步骤确定正确的执行命令:

第 1 步:检查用户是否明确指定了版本。

  • 如果用户请求了特定版本(例如 Angular 15),则绕过本地安装,严格使用 npx。
  • 命令: npx @angular/cli@<requested_version> new <project-name>

第 2 步:检查现有的 Angular 安装。

  • 如果未请求特定版本,则在终端中运行 ng version 以检查系统上是否已安装 Angular CLI。
  • 如果命令成功并返回已安装的版本,则直接使用本地/全局安装。
  • 命令: ng new <project-name>

第 3 步:回退到最新版本。

  • 如果未请求特定版本 且 ng version 命令失败(表示不存在 Angular 安装),则必须使用 npx 获取最新版本。
  • 命令: npx @angular/cli@latest new <project-name>

组件

在处理 Angular 组件时,根据任务参考以下文档:

  • 基础:组件结构、元数据、核心概念和模板控制流(@if、@for、@switch)。阅读 components.md
  • 输入:基于 Signal 的输入、转换和模型输入。阅读 inputs.md
  • 输出:基于 Signal 的输出和自定义事件的最佳实践。阅读 outputs.md
  • 宿主元素:宿主绑定和属性注入。阅读 host-elements.md

如果您需要上述参考之外更深入的文档,请阅读 https://angular.dev/guide/components 上的文档。

响应式与数据管理

在管理状态和数据响应式时,使用 Angular Signals 并参考以下文档:

  • Signals 概览:核心信号概念(signal、computed)、响应式上下文和 untracked。阅读 signals-overview.md
  • 依赖状态(linkedSignal):创建链接到源信号的可写状态。阅读 linked-signal.md
  • 异步响应式(resource):将异步数据直接获取到信号状态中。阅读 resource.md
  • 副作用(effect):日志记录、第三方 DOM 操作(afterRenderEffect)以及何时不应使用 effect。阅读 effects.md

表单

在大多数新应用中,优先使用 Signal 表单。在进行表单决策时,分析项目并考虑以下指南:

  • 如果应用版本支持 Signal Forms 并且这是一个新表单,请优先使用 Signal 表单。

  • 对于较旧的应用或现有表单,请匹配应用当前的表单策略。

  • Signal 表单:使用信号进行表单状态管理。阅读 signal-forms.md

  • 模板驱动表单:用于简单表单。阅读 template-driven-forms.md

  • 响应式表单:用于复杂表单。阅读 reactive-forms.md

依赖注入

在 Angular 中实现依赖注入时,请遵循以下指南:

  • 基础:依赖注入概述、服务和 inject() 函数。阅读 di-fundamentals.md
  • 创建和使用服务:创建服务、providedIn: 'root' 选项以及注入到组件或其他服务中。阅读 creating-services.md
  • 定义依赖提供者:自动与手动提供、InjectionToken、useClass、useValue、useFactory 和作用域。阅读 defining-providers.md
  • 注入上下文:inject() 允许使用的位置、runInInjectionContext 和 assertInInjectionContext。阅读 injection-context.md
  • 分层注入器:EnvironmentInjector 与 ElementInjector、解析规则、修饰符(optional、skipSelf)以及 providers 与 viewProviders。阅读 hierarchical-injectors.md

Angular Aria

在构建以下任何模式的可访问自定义组件时:Accordion、Listbox、Combobox、Menu、Tabs、Toolbar、Tree、Grid,请参考以下文档:

  • Angular Aria 组件:构建无头、可访问的组件(Accordion、Listbox、Combobox、Menu、Tabs、Toolbar、Tree、Grid)以及样式化 ARIA 属性。阅读 angular-aria.md

路由

在 Angular 中实现导航时,请参考以下文档:

  • 定义路由:URL 路径、静态与动态片段、通配符和重定向。阅读 define-routes.md
  • 路由加载策略:预加载与懒加载,以及上下文感知加载。阅读 loading-strategies.md
  • 使用 Outlet 显示路由:使用 <router-outlet>、嵌套 outlet 和具名 outlet。阅读 show-routes-with-outlets.md
  • 导航到路由:使用 RouterLink 进行声明式导航,使用 Router 进行程序化导航。阅读 navigate-to-routes.md
  • 使用守卫控制路由访问:实现 CanActivate、CanMatch 和其他守卫以确保安全。阅读 route-guards.md
  • 数据解析器:在路由激活前使用 ResolveFn 预取数据。阅读 data-resolvers.md
  • 路由生命周期和事件:导航事件的时间顺序和调试。阅读 router-lifecycle.md
  • 渲染策略:CSR、SSG(预渲染)和带有水合作用的 SSR。阅读 rendering-strategies.md
  • 路由过渡动画:启用和自定义视图过渡 API。阅读 route-animations.md

如果您需要更深入的文档或更多上下文,请访问 Angular 官方路由指南。

样式与动画

在 Angular 中实现样式和动画时,请参考以下文档:

  • 在 Angular 中使用 Tailwind CSS:将 Tailwind CSS 集成到 Angular 项目中。阅读 tailwind-css.md
  • Angular 动画:使用原生 CSS(推荐)或旧版 DSL 实现动态效果。阅读 angular-animations.md
  • 组件样式:组件样式和封装的最佳实践。阅读 component-styling.md

测试

在编写或更新测试时,根据任务参考以下文档:

  • 基础:单元测试、异步模式和 TestBed 的最佳实践。阅读 testing-fundamentals.md
  • 组件测试工具:用于稳健组件交互的标准模式。阅读 component-harnesses.md
  • 路由测试:使用 RouterTestingHarness 进行可靠的导航测试。阅读 router-testing.md
  • 端到端(E2E)测试:使用 Cypress 或 Playwright 进行 E2E 测试的最佳实践。阅读 e2e-testing.md

工具

在使用 Angular 工具时,请参考以下文档:

  • Angular CLI:创建应用程序、生成代码(组件、路由、服务)、提供服务和构建。阅读 cli.md
  • Angular MCP 服务器:可用的工具、配置和实验性功能。阅读 mcp.md

反模式

  • 使用 null 或 undefined 作为初始信号表单字段值——应改用 ''、0 或 []
  • 在未先调用字段的情况下访问表单字段状态标志:form.field.valid()——应使用 form.field().valid()
  • 当目标 Angular 版本支持 Signal Forms 时,在新的表单中使用较旧的表单 API
  • 在 [formField] 输入上设置 min、max、value、disabled 或 readonly HTML 属性——应将其定义为模式规则
  • 在注入上下文之外调用 inject()——必要时使用 runInInjectionContext
  • 对应该使用 computed() 的派生状态使用 effect()
  • 在嵌套的 @for 循环中引用 $parent.$index——Angular 不支持 $parent;应改用 let outerIdx = $index

相关技能

  • tdd-workflow——适用于 Angular 组件和服务的测试驱动开发工作流
  • security-review——Web 应用程序的安全检查清单,包括 Angular 特定的注意事项
  • frontend-patterns——适用于 React/Next.js 方法背景的通用前端模式

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

api-connector-builder

Build a new API connector or provider by matching the target repo

相关技能