domain-readme

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Domain README Generator

领域README生成器

Generate or update a
README.md
for the domain library at
$ARGUMENTS
.
为位于
$ARGUMENTS
的领域库生成或更新
README.md
文件。

Step 1 — Resolve the Target Path

步骤1 — 解析目标路径

$ARGUMENTS
can be:
  • A relative path:
    libs/widget-chat
  • A domain name:
    widget-chat
    → look for
    libs/widget-chat
  • An import path:
    @myapp/widget-chat
    → look it up in the Domain Registry in
    CLAUDE.md
If the path cannot be resolved, ask the user.
$ARGUMENTS
可以是:
  • 相对路径:
    libs/widget-chat
  • 领域名:
    widget-chat
    → 查找
    libs/widget-chat
  • 导入路径:
    @myapp/widget-chat
    → 在
    CLAUDE.md
    的领域注册表中查找
如果无法解析路径,请询问用户。

Step 2 — Inventory the Library

步骤2 — 清点库内容

Read the following files (skip those that don't exist):
<path>/
  index.ts                  ← public API surface
  src/lib/                  ← all source files
  src/index.ts              ← re-exports
  project.json              ← name, tags, importPath
  package.json              ← name, version, peerDeps
  ng-package.json           ← Angular package config
For each subdirectory in
src/lib/
:
  • Identify the layer type:
    domain
    ,
    feature
    ,
    ui
    ,
    util
  • List key exported symbols: services, stores, components, directives, pipes, types
Focus on:
  • NgRx Stores: read the store file, extract state interface, computed signals, methods
  • Facade services: extract public methods and their signatures
  • Angular components: extract
    @Input()
    /
    @Output()
    properties and selector
  • Public types/interfaces: exported from
    index.ts
读取以下文件(不存在的文件直接跳过):
<path>/
  index.ts                  ← public API surface
  src/lib/                  ← all source files
  src/index.ts              ← re-exports
  project.json              ← name, tags, importPath
  package.json              ← name, version, peerDeps
  ng-package.json           ← Angular package config
对于
src/lib/
下的每个子目录:
  • 识别层类型:
    domain
    ,
    feature
    ,
    ui
    ,
    util
  • 列出核心导出符号:services, stores, components, directives, pipes, types
重点关注:
  • NgRx Stores:读取store文件,提取state接口、计算信号、方法
  • Facade services:提取公共方法及其签名
  • Angular components:提取
    @Input()
    /
    @Output()
    属性和选择器
  • 公共类型/接口:从
    index.ts
    导出的内容

Step 3 — Generate the README

步骤3 — 生成README

Write a
README.md
with this exact structure:
markdown
undefined
按照以下固定结构编写
README.md
markdown
undefined

<Library Name>

<Library Name>

<One-sentence description. What this library does and why it exists.>
<One-sentence description. What this library does and why it exists.>

Architecture

Architecture

<Describe the layer structure. Include a text diagram if the library has multiple layers.>
``` <path>/ ├── domain/ → NgRx store, facade, services ├── feature/ → Container components, routing ├── ui/ → Presentational components └── util/ → Types, helpers ```
<Describe the layer structure. Include a text diagram if the library has multiple layers.>
``` <path>/ ├── domain/ → NgRx store, facade, services ├── feature/ → Container components, routing ├── ui/ → Presentational components └── util/ → Types, helpers ```

Public API

Public API

<ServiceName>

<ServiceName>

import { ServiceName } from '<importPath>'
Method / PropertyTypeDescription
methodName(arg)
ReturnType
What it does
import { ServiceName } from '<importPath>'
Method / PropertyTypeDescription
methodName(arg)
ReturnType
What it does

<StoreName> (NgRx Signal Store)

<StoreName> (NgRx Signal Store)

Signal / MethodTypeDescription
items
Signal<Item[]>
List of items
loadItems()
void
Fetches items from API
Signal / MethodTypeDescription
items
Signal<Item[]>
List of items
loadItems()
void
Fetches items from API

<ComponentName>

<ComponentName>

Selector:
<app-component-name>
InputTypeDescription
data
Item[]
Data to display
OutputTypeDescription
selected
EventEmitter<Item>
Emits on selection
Selector:
<app-component-name>
InputTypeDescription
data
Item[]
Data to display
OutputTypeDescription
selected
EventEmitter<Item>
Emits on selection

Key Patterns

Key Patterns

<Document any conventions specific to this domain:> - State shape and update strategy - Error handling approach - How the facade wraps the store - Any domain-specific patterns
<Document any conventions specific to this domain:> - State shape and update strategy - Error handling approach - How the facade wraps the store - Any domain-specific patterns

Usage Example

Usage Example

```typescript import { FeatureComponent } from '<importPath>/feature'; import { DomainService } from '<importPath>/domain';
// Minimal example showing how to consume this library ```
```typescript import { FeatureComponent } from '<importPath>/feature'; import { DomainService } from '<importPath>/domain';
// Minimal example showing how to consume this library ```

Dependencies

Dependencies

Depends on:
  • @scope/shared/...
    — description
Consumed by:
  • apps/aero-host
    — used as widget
Depends on:
  • @scope/shared/...
    — description
Consumed by:
  • apps/aero-host
    — used as widget

Development

Development

```bash npx nx test <project-name> # Run unit tests npx nx build <project-name> # Build library npx nx lint <project-name> # Lint ```
undefined
```bash npx nx test <project-name> # Run unit tests npx nx build <project-name> # Build library npx nx lint <project-name> # Lint ```
undefined

Step 4 — Handle Existing README

步骤4 — 处理已有的README

If
README.md
already exists:
  • Preserve any manually written sections that are not auto-generated
  • Update sections that reflect code (Public API, Dependencies)
  • Add a comment at the top of auto-generated sections:
    <!-- auto-generated by domain-readme skill, do not edit manually -->
如果
README.md
已存在:
  • 保留所有非自动生成的手动编写章节
  • 更新反映代码的章节(公共API、依赖)
  • 在自动生成章节的顶部添加注释:
    <!-- auto-generated by domain-readme skill, do not edit manually -->

Step 5 — Write the File

步骤5 — 写入文件

Write the generated content to
<path>/README.md
.
Confirm to the user:
✓ README.md written to <path>/README.md
  Documented: N services, N stores, N components
将生成的内容写入
<path>/README.md
向用户返回确认信息:
✓ README.md written to <path>/README.md
  Documented: N services, N stores, N components

Arguments

参数

$ARGUMENTS
— path or name of the domain to document.
Examples:
  • /domain-readme libs/widget-chat
  • /domain-readme widget-chat
  • /domain-readme libs/shared/sidebar
  • /domain-readme
    ← no args: ask the user which domain to document
$ARGUMENTS
— 要生成文档的领域的路径或名称。
示例:
  • /domain-readme libs/widget-chat
  • /domain-readme widget-chat
  • /domain-readme libs/shared/sidebar
  • /domain-readme
    ← 无参数:询问用户要生成文档的领域