angular-best-practices-rule-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRule Creator Agent
规则创建Agent
You create new Angular best practice rules and optional library skills following the exact project conventions.
你可以遵循项目的精确约定,创建新的Angular最佳实践规则和可选的库技能。
Capabilities
功能特性
1. Create a New Rule
1. 创建新规则
When asked to create a rule:
- Determine the prefix from the rule filename (e.g., → prefix
material-imports.md)material - Look up the section number in →
packages/angular-best-practices-build/src/config.tssectionMap - Place the file in the correct subdirectory based on the prefix:
rules/- →
test-*rules/testing/ - ,
a11y-*,ui-*,loading-*,dialogs-*→theming-*rules/ui/ - ,
http-*→mapper-*rules/data/ - →
ts-*rules/typescript/ - ,
opt-*,bundle-*→async-*rules/optimization/ - →
arch-*rules/core/ - Everything else (signals, components, forms, rxjs, ngrx, material, primeng, spartan, transloco, etc.) →
rules/angular/
- Copy the template from
rules/_template.md - Fill in the frontmatter and content following these rules:
- Title: Verb + Subject (e.g., "Use Signal Inputs")
- Description: 1 sentence max
- Code blocks: 0-2 max (incorrect + correct, or just correct)
- Code per block: 3-5 lines max
- Total length: Under 50 lines (ideal 30-40)
- No installation commands, configuration dumps, or folder structures
- Validate with the skill
angular-best-practices-rules-reviewer
当被要求创建规则时:
- 从规则文件名中确定前缀(例如:→ 前缀
material-imports.md)material - 在的
packages/angular-best-practices-build/src/config.ts中查找章节编号sectionMap - 根据前缀将文件放置到正确的子目录中:
rules/- →
test-*rules/testing/ - ,
a11y-*,ui-*,loading-*,dialogs-*→theming-*rules/ui/ - ,
http-*→mapper-*rules/data/ - →
ts-*rules/typescript/ - ,
opt-*,bundle-*→async-*rules/optimization/ - →
arch-*rules/core/ - 其他所有类型(signals、components、forms、rxjs、ngrx、material、primeng、spartan、transloco等)→
rules/angular/
- 复制中的模板
rules/_template.md - 按照以下规则填写前置元数据和内容:
- 标题: 动词 + 主题(例如:"Use Signal Inputs" → "使用Signal输入")
- 描述: 最多1句话
- 代码块: 最多0-2个(错误示例+正确示例,或仅正确示例)
- 每个代码块的代码行数: 最多3-5行
- 总长度: 少于50行(理想范围30-40行)
- 禁止包含安装命令、配置内容或文件夹结构
- 使用技能进行验证
angular-best-practices-rules-reviewer
2. Create a New Library Skill
2. 创建新的库Skill
When asked to create a new optional library skill:
- Choose the next available section number (check in config.ts)
SECTION_TITLES - Update :
packages/angular-best-practices-build/src/config.ts- Add prefix → section number in
sectionMap - Add section title in
SECTION_TITLES - Add section impact in
SECTION_IMPACTS - Add entry in array
OPTIONAL_SKILLS
- Add prefix → section number in
- Add section definition in
rules/_sections.md - Create with frontmatter (name, description, metadata, tags, globs)
skills/<skill-name>/SKILL.md - Create initial rule files in with the skill's prefix
rules/angular/ - Run to generate AGENTS.md files
npm run build
当被要求创建新的可选库Skill时:
- 选择下一个可用的章节编号(查看config.ts中的)
SECTION_TITLES - 更新:
packages/angular-best-practices-build/src/config.ts- 在中添加前缀→章节编号的映射
sectionMap - 在中添加章节标题
SECTION_TITLES - 在中添加章节影响等级
SECTION_IMPACTS - 在数组中添加条目
OPTIONAL_SKILLS
- 在
- 在中添加章节定义
rules/_sections.md - 创建文件并填写前置元数据(名称、描述、元数据、标签、匹配模式)
skills/<skill-name>/SKILL.md - 在目录中创建带有该Skill前缀的初始规则文件
rules/angular/ - 运行命令生成AGENTS.md文件
npm run build
Prefix → Section Mapping (Current)
前缀→章节映射(当前)
| Prefix | Section | Title |
|---|---|---|
| 1 | Eliminating Waterfalls |
| 2 | Bundle Optimization |
| 3 | JavaScript Performance |
| 4 | TypeScript Best Practices |
| 5 | Signals & Reactivity |
| 6 | Component Patterns |
| 7 | RxJS Patterns |
| 8 | Change Detection |
| 9 | Template Optimization |
| 10 | SSR & Hydration |
| 11 | Forms |
| 12 | NgRx State Management |
| 13 | SignalStore |
| 14 | TanStack Query |
| 15 | Architecture |
| 16 | Testing |
| 17 | Infrastructure |
| 18 | UI & Accessibility |
| 19 | Data Handling |
| 20 | Angular Material |
| 21 | PrimeNG |
| 22 | Spartan UI |
| 23 | Internationalization |
| 前缀 | 章节 | 标题 |
|---|---|---|
| 1 | 消除请求瀑布 |
| 2 | 包体积优化 |
| 3 | JavaScript性能优化 |
| 4 | TypeScript最佳实践 |
| 5 | Signals与响应式编程 |
| 6 | 组件模式 |
| 7 | RxJS模式 |
| 8 | 变更检测 |
| 9 | 模板优化 |
| 10 | SSR与 hydration |
| 11 | 表单处理 |
| 12 | NgRx状态管理 |
| 13 | SignalStore |
| 14 | TanStack Query |
| 15 | 架构设计 |
| 16 | 测试实践 |
| 17 | 基础设施 |
| 18 | UI与可访问性 |
| 19 | 数据处理 |
| 20 | Angular Material |
| 21 | PrimeNG |
| 22 | Spartan UI |
| 23 | 国际化 |
File Placement
文件放置规则
| Subdirectory | Prefixes |
|---|---|
| signal, component, rxjs, cd, template, ssr, form, ngrx, signalstore, tanstack, material, primeng, spartan, transloco |
| test |
| ui, a11y, loading, dialogs, theming |
| ts |
| opt, bundle, async, performance |
| arch, core, di, error-handling, observability, pattern, routing, security |
| http, mapper |
| 子目录 | 前缀 |
|---|---|
| signal, component, rxjs, cd, template, ssr, form, ngrx, signalstore, tanstack, material, primeng, spartan, transloco |
| test |
| ui, a11y, loading, dialogs, theming |
| ts |
| opt, bundle, async, performance |
| arch, core, di, error-handling, observability, pattern, routing, security |
| http, mapper |
Template Reference
模板参考
markdown
---
title: Verb + Subject
impact: MEDIUM
impactDescription: Brief metric (e.g., "2-10x faster", "O(n) to O(1)")
tags: tag1, tag2
---markdown
---
title: Verb + Subject
impact: MEDIUM
impactDescription: Brief metric (e.g., "2-10x faster", "O(n) to O(1)")
tags: tag1, tag2
---Verb + Subject
Verb + Subject
One sentence explaining the rule.
Incorrect:
```typescript
// 3-5 lines max
```
Correct:
```typescript
// 3-5 lines max
```
undefinedOne sentence explaining the rule.
Incorrect:
```typescript
// 3-5 lines max
```
Correct:
```typescript
// 3-5 lines max
```
undefinedBuild Commands
构建命令
bash
npm run build # Regenerate all AGENTS.md files
npm run build:skip-validation # Skip validation during developmentbash
npm run build # Regenerate all AGENTS.md files
npm run build:skip-validation # Skip validation during development