npx skills add https://github.com/hugorcd/evlog --skill create-evlog-enricher为 evlog 添加一个新的内置增强器。每个增强器都遵循相同的架构。本技能将逐步介绍所有 6 个接触点。每一个接触点都是强制性的——不要跳过任何步骤。
推荐的拉取请求标题格式:
feat: add {name} enricher
具体措辞可能因增强器而异(例如,feat: add user agent enricher,feat: add geo enricher),但应始终遵循 feat: 约定式提交前缀。
---|---|---
1 | packages/evlog/src/enrichers/index.ts | 添加增强器源码
2 | packages/evlog/test/enrichers.test.ts | 添加测试
3 | apps/docs/content/4.enrichers/2.built-in.md | 将增强器添加到内置文档
4 | | 将增强器添加到概览卡片
5 | | 在增强器部分的 行添加该增强器
6 | + | 将增强器添加到 README 的增强器部分
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
apps/docs/content/4.enrichers/1.overview.mdskills/review-logging-patterns/SKILL.mdBuilt-inREADME.mdpackages/evlog/README.md重要提示:在所有 6 个接触点都处理完毕之前,请勿认为任务已完成。
请始终一致地使用这些占位符:
| 占位符 | 示例 (UserAgent) | 用途 |
|---|---|---|
{name} | userAgent | 事件字段键名,使用 camelCase |
{Name} | UserAgent | 函数/接口名称,使用 PascalCase |
{DISPLAY} | User Agent | 人类可读的显示名称 |
将增强器添加到 packages/evlog/src/enrichers/index.ts。
请阅读 references/enricher-template.md 以获取完整的带注释的模板。
关键架构规则:
UserAgentInfo,GeoInfo)create{Name}Enricher(options?: EnricherOptions) 返回 (ctx: EnrichContext) => voidEnricherOptions —— 接受 { overwrite?: boolean } 以控制合并行为mergeEventField() —— 将计算出的数据与现有事件字段合并,并遵循 overwrite 设置getHeader() —— 不区分大小写的请求头查找辅助函数ctx.event.{name} = mergedValuectx.event,从不抛出错误或记录日志将测试添加到 packages/evlog/test/enrichers.test.ts。
必需的测试类别:
overwrite: false(默认值)不会替换用户提供的字段overwrite: true 会替换现有字段遵循 enrichers.test.ts 中现有的测试结构——每个增强器都有自己的 describe 代码块。
编辑 apps/docs/content/4.enrichers/2.built-in.md,为增强器添加一个新章节。
每个增强器章节遵循以下结构:
## {DISPLAY}
[关于增强器功能的一句话描述。]
**设置字段:** `event.{name}`
\`\`\`typescript
const enrich = create{Name}Enricher()
\`\`\`
**输出形状:**
\`\`\`typescript
interface {Name}Info {
// 字段
}
\`\`\`
**示例输出:**
\`\`\`json
{
"{name}": {
// 示例值
}
}
\`\`\`
添加任何与平台特定说明或限制相关的标注。
编辑 apps/docs/content/4.enrichers/1.overview.md,在 ::card-group 部分(在 Custom 卡片之前)为新增强器添加一个卡片:
:::card
---
icon: i-lucide-{icon}
title: {DISPLAY}
to: /enrichers/built-in#{anchor}
---
[简短描述。]
:::
skills/review-logging-patterns/SKILL.md在 skills/review-logging-patterns/SKILL.md(分发给用户的公共技能)中,找到 Enrichers 部分,并将新增强器添加到 Built-in: 行:
Built-in: `createUserAgentEnricher()`, `createGeoEnricher()`, ..., `create{Name}Enricher()` — all from `evlog/enrichers`.
将增强器添加到 packages/evlog/README.md 的增强器部分(根目录的 README.md 是其符号链接)。在增强器表格中添加该增强器,包括其事件字段和输出形状。
完成所有步骤后,运行:
cd packages/evlog
bun run build # 验证构建成功
bun run test # 验证测试通过
每周安装量
422
代码库
GitHub 星标数
962
首次出现
2026年2月8日
安全审计
安装于
codex357
opencode357
github-copilot356
gemini-cli355
amp353
kimi-cli351
Add a new built-in enricher to evlog. Every enricher follows the same architecture. This skill walks through all 6 touchpoints. Every single touchpoint is mandatory -- do not skip any.
Recommended format for the pull request title:
feat: add {name} enricher
The exact wording may vary depending on the enricher (e.g., feat: add user agent enricher, feat: add geo enricher), but it should always follow the feat: conventional commit prefix.
---|---|---
1 | packages/evlog/src/enrichers/index.ts | Add enricher source
2 | packages/evlog/test/enrichers.test.ts | Add tests
3 | apps/docs/content/4.enrichers/2.built-in.md | Add enricher to built-in docs
4 | apps/docs/content/4.enrichers/1.overview.md | Add enricher to overview cards
5 | skills/review-logging-patterns/SKILL.md | Add enricher to the Built-in line in the Enrichers section
6 | README.md + packages/evlog/README.md | Add enricher to README enrichers section
Important : Do NOT consider the task complete until all 6 touchpoints have been addressed.
Use these placeholders consistently:
| Placeholder | Example (UserAgent) | Usage |
|---|---|---|
{name} | userAgent | camelCase for event field key |
{Name} | UserAgent | PascalCase in function/interface names |
{DISPLAY} | User Agent | Human-readable display name |
Add the enricher to packages/evlog/src/enrichers/index.ts.
Read references/enricher-template.md for the full annotated template.
Key architecture rules:
UserAgentInfo, GeoInfo)create{Name}Enricher(options?: EnricherOptions) returns (ctx: EnrichContext) => voidEnricherOptions -- accepts { overwrite?: boolean } to control merge behaviormergeEventField() -- merge computed data with existing event fields, respecting overwritegetHeader() -- case-insensitive header lookup helperAdd tests to packages/evlog/test/enrichers.test.ts.
Required test categories:
overwrite: false (default) doesn't replace user-provided fieldsoverwrite: true replaces existing fieldsFollow the existing test structure in enrichers.test.ts -- each enricher has its own describe block.
Edit apps/docs/content/4.enrichers/2.built-in.md to add a new section for the enricher.
Each enricher section follows this structure:
## {DISPLAY}
[One-sentence description of what the enricher does.]
**Sets:** `event.{name}`
\`\`\`typescript
const enrich = create{Name}Enricher()
\`\`\`
**Output shape:**
\`\`\`typescript
interface {Name}Info {
// fields
}
\`\`\`
**Example output:**
\`\`\`json
{
"{name}": {
// example values
}
}
\`\`\`
Add any relevant callouts for platform-specific notes or limitations.
Edit apps/docs/content/4.enrichers/1.overview.md to add a card for the new enricher in the ::card-group section (before the Custom card):
:::card
---
icon: i-lucide-{icon}
title: {DISPLAY}
to: /enrichers/built-in#{anchor}
---
[Short description.]
:::
skills/review-logging-patterns/SKILL.mdIn skills/review-logging-patterns/SKILL.md (the public skill distributed to users), find the Enrichers section and add the new enricher to the Built-in: line:
Built-in: `createUserAgentEnricher()`, `createGeoEnricher()`, ..., `create{Name}Enricher()` — all from `evlog/enrichers`.
Add the enricher to the enrichers section in packages/evlog/README.md (the root README.md is a symlink to it). Add the enricher to the enrichers table with its event field and output shape.
After completing all steps, run:
cd packages/evlog
bun run build # Verify build succeeds
bun run test # Verify tests pass
Weekly Installs
422
Repository
GitHub Stars
962
First Seen
Feb 8, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex357
opencode357
github-copilot356
gemini-cli355
amp353
kimi-cli351
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
ctx.event.{name} = mergedValuectx.event, never throw or log