New to Claude Skills? Learn how to install them →

Chugorcd on GitHub

Create Evlog Enricher

Free

Easily add custom enrichers to your evlog events.

by hugorcd1.7k stars on hugorcd/evlog
1 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What Create Evlog Enricher does

The Create Evlog Enricher skill allows developers to seamlessly add new built-in enrichers to the evlog package. Enrichers enhance the context of wide events by providing derived information, such as deployment metadata or feature flags. This skill utilizes the defineEnricher method from the evlog/toolkit, ensuring that community enrichers maintain the same structure as built-in ones, promoting consistency and ease of integration.

To create an enricher, developers will follow a systematic approach that involves defining the enricher's source, writing tests, and updating documentation. The skill provides a checklist of touchpoints that must be addressed to ensure the enricher is properly integrated into the evlog ecosystem. This includes adding the enricher to the main index file, determining its inclusion in the default composition, and updating relevant documentation to reflect the new functionality.

This skill is particularly useful for developers working with event logging systems who need to customize the information captured in their logs. By following the provided guidelines, users can create enrichers that enhance their event data without introducing side effects, ensuring a reliable logging experience. Additionally, the skill emphasizes best practices in testing and documentation, making it a comprehensive solution for extending the evlog capabilities.

Overall, the Create Evlog Enricher skill is designed for developers looking to enhance their event logging with tailored context, providing a straightforward method to integrate new enrichers into their existing systems.

When to use it

Use this skill when you need to enrich your evlog events with additional context, such as deployment information or feature flags.

When not to use it

This skill may not be suitable for users who do not require custom enrichers or who prefer to use only built-in functionalities of the evlog package.

What you can build with it

Adding Deployment Metadata

Use the skill to create an enricher that adds deployment metadata to your event logs, providing context for when and where events occurred.

Incorporating Feature Flags

Create an enricher that captures feature flags in your events, allowing for better tracking of feature usage in production.

Customizing Event Context

Develop a custom enricher to add specific information relevant to your application's needs, enhancing the data captured in your logs.

How to install Create Evlog Enricher

View source

1. Install with the skills CLI

npx skills add hugorcd/evlog/create-enricher --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by hugorcd

Create evlog Enricher

Add a new built-in enricher to evlog. Every enricher is built on the public toolkit primitive defineEnricher from evlog/toolkit — so a community enricher has the same shape as a built-in one.

PR Title

feat(core): add the {name} enricher

Enrichers live in the core package surface (evlog/enrichers), so use the core scope unless a dedicated scope exists.

Touchpoints Checklist

#FileAction
1packages/evlog/src/enrichers/index.tsAdd enricher source (one defineEnricher call)
2Same file — createDefaultEnrichers()Decide whether the enricher belongs in the default composition (see below)
3packages/evlog/test/toolkit/enrichers.test.tsAdd tests (one describe block per enricher)
4apps/docs/content/5.use-cases/5.enrichers.mdAdd a section for the enricher + update the import list and, if applicable, the "All built-in enrichers" default composition text
5apps/docs/skills/review-logging-patterns/SKILL.mdAdd the enricher to the Built-in: line in the Enrichers section
6packages/evlog/README.mdAdd the enricher to the Built-in Enrichers section (root README.md is a symlink to it)
7.changeset/{name}-enricher.mdCreate changeset (minor)

Important: Do NOT consider the task complete until all 7 touchpoints have been addressed.

Should it join createDefaultEnrichers()?

createDefaultEnrichers() composes user agent, geo, request size, and trace context via composeEnrichers (from ../shared/compose). Add the new enricher to the composition only if it is universally applicable and reads nothing but the request (headers/env) — anything requiring service-specific setup or extra cost stays opt-in. Changing the default composition is a behavior change for every existing createDefaultEnrichers() user: call it out explicitly in the changeset.

Naming Conventions

PlaceholderExample (UserAgent)Usage
{name}userAgentcamelCase for event field key
{Name}UserAgentPascalCase in function/interface names
{DISPLAY}User AgentHuman-readable display name

Step 1: Enricher Source — built on defineEnricher

Add the enricher to packages/evlog/src/enrichers/index.ts. Read references/enricher-template.md for the full annotated template.

The contract is defineEnricher<T>({ name, field, compute }, options?). You only ship one piece of logic:

  • compute(ctx) — return the computed value (typed as T) or undefined to skip.

defineEnricher handles the rest:

  • merging via mergeEventField (respecting options.overwrite, default false)
  • error isolation (throws are caught and logged, never propagated)
  • skipping when compute returns undefined

Key rules:

  • Use the toolkit helpers: getHeader() for case-insensitive header lookup, normalizeNumber() for numeric strings — both from ../shared/headers (re-exported by evlog/toolkit).
  • Single event field — each enricher writes one top-level field on ctx.event. If the enricher must additionally pin top-level fields (like createTraceContextEnricher does for event.traceId / event.spanId), wrap the defineEnricher result in a closure — see that enricher for the pattern.
  • Factory patterncreate{Name}Enricher(options: EnricherOptions = {}) returns the result of defineEnricher(...) — directly in the normal case, or through the thin closure wrapper when the enricher also pins top-level fields (see the single-event-field rule above).
  • No side effects — never throw, never log; rely on defineEnricher's built-in error handling if something goes wrong.
  • Export the Info type{Name}Info describing the field shape, exported alongside the factory.

Step 2: Tests

Add tests to packages/evlog/test/toolkit/enrichers.test.ts, following the existing structure (one describe block per enricher) and packages/evlog/test/README.md conventions.

Required test categories:

  1. Sets field from headers — verify the enricher populates the event field correctly
  2. Skips when source data missing — verify no field is set when the required header/input is absent
  3. Preserves existing data — verify overwrite: false (default) doesn't replace user-provided fields
  4. Overwrites when requested — verify overwrite: true replaces existing fields
  5. Handles edge cases — empty strings, malformed values, case-insensitive header names
  6. Default composition — if the enricher joined createDefaultEnrichers(), extend that composition's tests

Step 3: Update the Enrichers Docs Page

Edit apps/docs/content/5.use-cases/5.enrichers.md:

  1. Add the enricher to the import list at the top
  2. Add a ## {DISPLAY} section following the structure of the existing ones:
## {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
  }
}
\`\`\`
  1. If the enricher joined the default composition, update the "All built-in enrichers" section text listing what createDefaultEnrichers() composes.

Custom-enricher authoring docs live separately at apps/docs/content/6.extend/5.custom-enrichers.md — no change needed there unless the toolkit contract itself changed.

Step 4: Update the Public Skill

In apps/docs/skills/review-logging-patterns/SKILL.md (published on evlog.dev), find the Enrichers section and add the new enricher to the Built-in: line.

Step 5: Update README

Add the enricher to the Built-in Enrichers section in packages/evlog/README.md (the root README.md is a symlink to it).

Step 6: Changeset

Create .changeset/{name}-enricher.md with a minor bump describing what the enricher sets and when to use it. Mention explicitly if the default composition changed.

Verification

cd packages/evlog
pnpm run lint
pnpm run typecheck
pnpm run test
pnpm run build

Frequently asked questions about Create Evlog Enricher

Similar skills