스킬 angular-20-standalone-component

angular-20-standalone-component

안전 🌐 네트워크 접근📁 파일 시스템 액세스⚙️ 외부 명령어

建立 Angular 20 獨立元件

Angular 20 引入了重大的語法改進,提升了效能和開發者體驗。本技能幫助開發者使用 Signals、新的 input/output 函式以及現代控制流語法來建構生產就緒的獨立元件。

지원: Claude Codex Code(CC)
📊 69 적절함
1

스킬 ZIP 다운로드

2

Claude에서 업로드

설정 → 기능 → 스킬 → 스킬 업로드로 이동

3

토글을 켜고 사용 시작

테스트해 보기

"angular-20-standalone-component" 사용 중입니다. Create an Angular 20 standalone component for displaying a product list with loading state

예상 결과:

  • Component selector: app-product-list
  • Uses signal() for products, loading, and error state
  • Uses computed() for hasProducts derived state
  • Implements inject() for ProductService
  • Uses @if/@for control flow syntax
  • OnPush change detection enabled
  • Proper error handling with nz-alert

"angular-20-standalone-component" 사용 중입니다. Create a presentational button component with loading indicator

예상 결과:

  • Standalone component with OnPush change detection
  • input.required() for button properties
  • output() for click events
  • Loading state with @if control flow
  • No service dependencies or business logic

보안 감사

안전
v3 • 1/16/2026

This skill is a pure documentation resource containing only TypeScript code examples and instructional content for Angular 20 component patterns. Static scanner flagged 62 pattern matches as high-risk, but all are false positives: backticks in TypeScript function names (signal, computed, effect), GitHub URLs in metadata, and Angular terminology misidentified as C2/crypto keywords. No executable scripts, network calls, file system access, or code execution capabilities exist.

2
스캔된 파일
549
분석된 줄 수
3
발견 사항
3
총 감사 수
감사자: claude 감사 이력 보기 →

품질 점수

38
아키텍처
100
유지보수성
87
콘텐츠
20
커뮤니티
100
보안
91
사양 준수

만들 수 있는 것

新元件架構

根據專案標準和現代模式快速產生 Angular 20 元件

模式參考指南

參考正確的語法以將傳統 Angular 程式碼遷移至 Angular 20 模式

團隊標準執行

透過三層架構確保團隊程式碼庫中元件架構的一致性

이 프롬프트를 사용해 보세요

基本元件
建立一個名為 UserCardComponent 的 Angular 20 獨立元件,使用 input() 接收使用者資料並使用 output() 來發送事件,以顯示使用者資訊。
智慧元件
建立一個名為 TaskDashboardComponent 的 Angular 20 智慧元件,使用 Signals 從服務載入資料,並管理載入和錯誤狀態。
表單元件
建立一個使用 FormBuilder、驗證和 proper error handling 的 Angular 20 表單元件,搭配 nz-form 元件。
展示元件
建立一個具有 OnPush 變更檢測的 Angular 20 展示元件,透過 input() 接收資料並透過 output() 發送變更,且不包含商業邏輯。

모범 사례

  • 對所有元件狀態使用 signal() 並透過 asReadonly() 暴露以實現不可變存取
  • 獨立元件一律使用 OnPush 變更檢測以提升效能
  • 使用 inject() 函式注入服務而非建構函式以獲得更簡潔的程式碼
  • 關注點分離:智慧元件處理資料載入,展示元件僅渲染資料

피하기

  • 使用 @Input()/@Output() 裝飾器而非 input()/output() 函式
  • 使用 *ngIf/*ngFor 而非 @if/@for 控制流語法
  • 在元件中直接注入儲存庫而非服務
  • 將商業邏輯放在元件而非服務層中

자주 묻는 질문

獨立元件需要什麼 Angular 版本?
Angular 14+ 支援獨立元件,但 input()/output() 函式和控制流語法需要 Angular 17.2+。
我可以在 Angular 17 或 18 中使用此技能嗎?
可以,但某些功能如 input()/output() 函式需要 Angular 17.2+。對於較舊版本,請使用基於裝飾器的 @Input/@Output。
此技能是否適用於 nx 單體儲存庫專案?
可以,這些模式與 Nx 單體儲存庫相容。請根據您的工作區結構調整匯入路徑。
使用此技能時我的資料安全嗎?
是的,這是一個基於提示的技能,不會執行程式碼或存取網路。它僅提供指導。
為什麼我的元件在資料變更時沒有更新?
確保您使用 OnPush 變更檢測並呼叫 signal.set() 或 signal.update() 來正確觸發變更檢測。
這與 Angular CLI 產生有何不同?
此技能應用現代 Angular 20 模式。Angular CLI 預設產生需要手動更新的傳統語法。

개발자 세부 정보

작성자

7Spade

라이선스

MIT

참조

main

파일 구조

📄 SKILL.md