Skip to content
Skills Library
Programming · Building & coding

walkeros-create-transformer

/walkeros-create-transformer

Use when creating a new walkerOS transformer to modify events in the pipeline (validate, enrich, or redact) at a before/next chain position. Example-driven workflow for the transformer interface, return values, and chaining.

Repository
walkerOS ↗
Licence
MIT
Last repository change
22.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
9
Scripts
7
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 7 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: examples/config.ts, examples/events.ts, examples/index.ts, templates/validation/index.test.ts, templates/validation/index.ts, templates/validation/schemas.ts, templates/validation/types.ts

What it does and when to use it

Use when creating a new walkerOS transformer to modify events in the pipeline (validate, enrich, or redact) at a before/next chain position. Example-driven workflow for the transformer interface, return values, and chaining.

Original author description

Use when creating a new walkerOS transformer to modify events in the pipeline (validate, enrich, or redact) at a before/next chain position. Example-driven workflow for the transformer interface, return values, and chaining.

How it works

  1. Prerequisites
  2. Transformer Categories
  3. Process Overview
  4. Supporting Files
  5. Phase 1: Research
  6. Phase 2: Create Examples (BEFORE Implementation)
  7. Phase 3: Scaffold
  8. Phase 4: walkerOS.json Convention
  9. Phase 5: Implement
  10. Phase 6: Test Against Examples
Original SKILL.md headings · 399 lines, 1,563 words
SKILL.md preview
---
name: walkeros-create-transformer
description:
  Use when creating a new walkerOS transformer to modify events in the pipeline
  (validate, enrich, or redact) at a before/next chain position. Example-driven
  workflow for the transformer interface, return values, and chaining.
---

# Create a New Transformer

## Prerequisites

Before starting, read these skills:

- [understanding-flow](../walkeros-understanding-flow/SKILL.md) - How
  transformers fit in architecture
- [understanding-transformers](../walkeros-understanding-transformers/SKILL.md) -
  Transformer interface
- [understanding-events](../walkeros-understanding-events/SKILL.md) - Event
  structure
- [testing-strategy](../walkeros-testing-strategy/SKILL.md) - How to test
- [writing-documentation](../walkeros-writing-documentation/SKILL.md) -
  Documentation standards (for Phase 7)

## Transformer Categories

| Category     | Purpose                       | Example                      |
| ------------ | ----------------------------- | ---------------------------- |
| **Validate** | Check event structure/content | JSON Schema, required fields |
| **Enrich**   | Add data to events            | Server timestamps, geo data  |
| **Redact**   | Remove/mask sensitive data    | Strip PII, anonymize IPs     |

## Process Overview

```
1. Research     → Understand use case (validate/enrich/redact)
2. Examples     → Create event before/after examples FIRST
3. Scaffold     → Copy template, configure package.json
4. Convention   → Add walkerOS.json metadata and buildDev
5. Implement    → Build transformer with TDD
6. Test         → Verify against example transformations
7. Document     → Write README
```

## Supporting Files

This skill includes reference files you can copy:

- **[examples/](examples/)** - Example events and configs to adapt for your
  transformer
  - [events.ts](examples/events.ts) - Before/after event examples
  - [config.ts](examples/config.ts) - Configuration examples
- **[templates/validation/](templates/validation/)** - Complete redact
  transformer template
  - [index.ts](templates/validation/index.ts) - Implementation with context
    pattern
  - [types.ts](templates/validation/types.ts) - Type definitions
  - [schemas.ts](templates/validation/schemas.ts) - Zod validation schemas
  - [index.test.ts](templates/validation/index.test.ts) - Test suite with
    helpers

---

## Phase 1: Research

**Goal:** Understand what the transformer needs to do.

### 1.1 Define Use Case

- [ ] **Category**: Validate, Enrich, or Redact?
- [ ] **Input**: What events will this process?
- [ ] **Output**: What should change? What should be blocked?
- [ ] **Configuration**: What settings does user need?

### 1.2 Check Existing Patterns

```bash
# Reference implementation
ls packages/transformers/fingerprint/

# Transformer types
cat packages/core/src/types/transformer.ts
```

### Gate: Research Complete

- [ ] Category identified (validate/enrich/redact)
- [ ] Input/output transformation defined
- [ ] Configuration options listed

---

## Phase 2: Create Examples (BEFORE Implementation)

**Goal:** Define event transformations in `dev` entry FIRST.

### 2.1 Scaffold Directory Structure

```bash
mkdir -p packages/transformers/[name]/src/{examples,schemas,types}
```

### 2.2 Create Event Examples

Adapt [examples/events.ts](examples/events.ts) for your transformer's use case.
Each example file should include:

- Events that should pass through (modified)
- Expected output after processing
- Events that should be blocked (for validators)

### 2.3 Create Config Examples

Adapt [examples/config.ts](examples/config.ts) for your transformer's settings.

### 2.4 Step Examples

Add step examples with `{ in, out }` pairs for end-to-end step testing:

```typescript
// examples/step.ts
export const step = {
  'order-passes': {
    in: { name: 'order complete', data: { id: 'ORD-123' } },
    out: { name: 'order complete', data: { id: 'ORD-123' } },
  },
  'debug-filtered': {
    in: { name: 'debug test', data: { message: 'noise' } },
    out: false, // Transformer rejects this event
  },
};
```

For transformers, both `in` and `out` are walkerOS events, except `out: false`
which indicates the transformer filters (rejects) the event. Set `title` +
`description` for public examples; mark test-only fixtures with `public: false`.
See [using-step-examples](../walkeros-using-step-examples/SKILL.md) for the
Three Type Zones.

### 2.5 Export via dev.ts

```typescript
export * as schemas from './schemas';
export * as examples from './examples';
```

### Gate: Examples Valid

- [ ] All example files compile (`npm run build`)
- [ ] Can trace: input event → expected output for each example

---

## Phase 3: Scaffold

**Template transformer:** `packages/transformers/fingerprint/`

```bash
cp -r packages/transformers/fingerprint packages/transformers/[name]
cd packages/transformers/[name]

# Update package.json: name, description, repository.directory
```

**Directory structure:**

```
packages/transformers/[name]/
├── src/
│   ├── index.ts           # Main export
│   ├── transformer.ts       # Transformer implementation
│   ├── index.test.ts      # Tests against examples
│   ├── dev.ts             # Exports schemas and examples
│   ├── examples/
│   │   ├── index.ts       # Re-exports
│   │   ├── events.ts      # Before/after event examples
│   │   └── config.ts      # Configuration examples
│   ├── schemas/
│   │   └── index.ts       # Zod schemas for settings
│   └── types/
│       └── index.ts       # Settings, Types interfaces
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── jest.config.mjs
└── README.md
```

---

## Phase 4: walkerOS.json Convention

Every walkerOS package ships a `walkerOS.json` file for CDN-based schema
discovery.

### Add `walkerOS` field to package.json

```json
{
  "walkerOS": {
    "type": "transformer"
  },
  "keywords": ["walkerOS", "walkerOS-transformer", ...]
}
```

### Use `buildDev()` in tsup.config.ts

Replace `buildModules({ entry: ['src/dev.ts'] })` with `buildDev()`:

```typescript
import { buildDev } from '@walkeros/config/tsup';
// In defineConfig array:
buildDev(),
```

This auto-generates `dist/walkerOS.json` from your Zod schemas at build time.

### Hints (Optional)

If your transformer has capabilities, behaviors, or troubleshooting patterns not
obvious from schemas alone, add hints. See `walkeros-writing-documentation`
skill for full guidelines.

Create `src/hints.ts`:

```typescript
import type { Hint } from '@walkeros/core';

export const hints: Hint.Hints = {
  'validation-behavior': {
    text: 'Describes how validation works. See settings schema for options.',
    code: [{ lang: 'json', code: '{ "settings": { ... } }' }],
  },
};
```

Export from `src/dev.ts`:

```typescript
export * as schemas from './schemas';
export * as examples from './examples';
export { hints } from './hints';
```

Guidelines:

- Expand awareness — describe capabilities ("supports X, Y, Z"), don't prescribe
  one path
- Reference schemas and examples, don't duplicate them
- Verify every claim against actual implementation before publishing
- Key naming: kebab-case, group with prefixes (validation-\*, enrichment-\*,
  troubleshoot-\*)
- Most transformers don't need hints — schemas and examples cover the common
  case

### Gate: Convention Met

- [ ] `walkerOS` field in package.json with `type: "transformer"`
- [ ] `buildDev()` in tsup.config.ts
- [ ] Build generates `dist/walkerOS.json`
- [ ] Keywords include `walkerOS` and `walkerOS-transformer`

### Runtime-only npm dependencies

If your package wraps a third-party npm dep that **cannot be ESM-bundled** (uses
`__dirname`, ships a `.node` binary, etc.), declare it under
`walkerOS.bundle.external` in your `package.json`. See
[walkeros-using-cli → Bundle externals](../walkeros-using-cli/SKILL.md#bundle-externals-per-package-walkerosbundleexternal)
for the complete contract.

---

## Phase 5: Implement

**Now write code to transform examples as expected.**

### 5.1 Define Types

See [templates/validation/types.ts](templates/validation/types.ts) for the
pattern. Define `Settings` and `Types` interfaces.

### 5.2 Implement Transformer (Context Pattern)

Transformers use the **context pattern** - they receive a single `context`
object containing `config`, `env`, `logger`, `id`, and `collector`.

See [templates/validation/index.ts](templates/validation/index.ts) for a
complete implementation example.

**Key patterns:**

1. **Context destructuring**: Extract `config`, `logger`, `id` from init context
2. **Schema validation**: Use Zod schemas to validate settings and provide
   defaults (see
   [templates/validation/schemas.ts](templates/validation/schemas.ts))
3. **Push receives pushContext**: The `push` function gets event + push context
4. **Return values**: `{ event }` (continue), `void` (passthrough), `false`
   (cancel on purpose: a deliberate drop, not a failure)
5. **A failure is a throw**: throw a `StepError` from `@walkeros/core` with a
   `code`. `missing-input` is the code for an event or an ingest that lacks the
   input the transformer needs (do not drop it silently); `config` for a missing
   setting. `init` throws instead of returning `false` or returning early, and a
   transformer never logs a failure itself: the collector turns the throw into
   `ok: false` with the transformer named and writes the one ERROR line. A
   transformer that throws a plain error fails with the code `transformer`.

### 5.3 Export

`src/index.ts`:

```typescript
export { transformerRedact } from './transformer';
export type { Settings, Types } from './types';
```

### Gate: Implementation Compiles

- [ ] `npm run build` passes
- [ ] `npm run verify:touched -- <transformer-name>` passes (L1: typecheck +
      lint + test)

---

## Phase 6: Test Against Examples

**Verify implementation produces expected outputs.**

See [templates/validation/index.test.ts](templates/validation/index.test.ts) for
a complete test suite showing:

1. **`createTransformerContext()` helper** - Standardizes init context creation
2. **`createPushContext()` helper** - Standardizes push context creation
3. **Examples for test data** - Don't hardcode test values
4. **Return value testing** - Verify `event`, `void`, or `false` returns
5. **Conformance** - `conformance('transformer', transformer, options)` from
   `@walkeros/collector/dev` (profile `transformer`) runs it on a real
   collector. A transformer needs no `page`. A transformer whose input is the
   ingest and not an event declares its failure with a `missing-input` example
   (an event as `in`, `out: []`, a description).

### Gate: Tests Pass

- [ ] `npm run verify:touched -- <transformer-name>` passes (L1)
- [ ] Tests verify against example outputs

---

## Phase 7: Document

Follow the [writing-documentation](../walkeros-writing-documentation/SKILL.md)
skill for:

- README structure and templates
- Quality checklist before publishing

Key requirements for transformer documentation:

- [ ] Use case description (validate/enrich/redact)
- [ ] Configuration options table
- [ ] Working code example with imports
- [ ] Installation instructions
- [ ] Link to website docs

---

## Transformer-Specific Validation

Beyond
[understanding-development](../walkeros-understanding-development/SKILL.md)
requirements (build, test, lint, no `any`):

- [ ] `dev.ts` exports `schemas` (with `settings`; `z.object({})` when the step
      has none) and `examples`
- [ ] Multi-export package (two or more `walkerOS.exports`): `exportExamples`
      and `exportSchemas` in `dev.ts` list exactly those exports, the default
      included, and every `exportSchemas` entry has `settings`; the build fails
      otherwise (see
      [using-step-examples](../walkeros-using-step-examples/SKILL.md))
- [ ] Examples include before/after event pairs
- [ ] Return values handle all cases (event, void, false)
- [ ] A failure is a thrown `StepError` (`missing-input` for absent input),
      `init` throws instead of returning `false`, conformance test passes
- [ ] Tests use examples for assertions (not hardcoded values)
- [ ] `walkerOS.json` generated at build time
- [ ] `walkerOS` field in package.json

---

## Reference Files

| What           | Where                                    |
| -------------- | ---------------------------------------- |
| Template       | `packages/transformers/fingerprint/`     |
| Types          | `packages/core/src/types/transformer.ts` |
| Chaining logic | `packages/collector/src/transformer.ts`  |

## Related Skills

- [walkeros-understanding-transformers](../walkeros-understanding-transformers/SKILL.md) -
  Transformer interface and chaining
- [walkeros-testing-strategy](../walkeros-testing-strategy/SKILL.md) - Testing
  patterns and env mocking
- [walkeros-writing-documentation](../walkeros-writing-documentation/SKILL.md) -
  Documentation standards
Files in this package (9)
  • SKILL.md 13 KB
  • TESTING.md 2 KB
  • examples/config.ts 1 KB
  • examples/events.ts 1 KB
  • examples/index.ts 1 KB
  • templates/validation/index.test.ts 2 KB
  • templates/validation/index.ts 2 KB
  • templates/validation/schemas.ts 1 KB
  • templates/validation/types.ts 1 KB

Versions

The database has no other skills named walkeros-create-transformer.

Database snapshot: 13.11.2026 · package version 181c46932ece (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95walkeros-understanding-transformers
    Use when working with walkerOS transformers, understanding event validation/enrichment/redaction, or learning about transformer chaining. Covers interface, return values, and pipeline integration.
  • 100walkeros-using-transformer-ga4
    Use when wiring `@walkeros/transformer-ga4` into a server flow, overriding default GA4 event mappings, dropping events, adding custom event keys, or troubleshooting GA4 Measurement Protocol decoding. Covers the `before`-chain wiring contract, configuration recipes, and per-field…
  • 100response-transformer
    Transform response transformer operations. Auto-activating skill for API Integration. Triggers on: response transformer, response transformer Part of the API Integration skill category. Use when working with response transformer functionality. Trigger with phrases like "response…
  • 86transformer
    Entry point for Transformer (transformer.gg), the marketplace for paid partnerships on X (Twitter) built for AI agents. Use when the user mentions Transformer or wants to run, find or take paid X creator deals; it decides whether they're a brand or a creator and hands off to…
  • 100pyspark-transformer
    Transform pyspark transformer operations. Auto-activating skill for Data Pipelines. Triggers on: pyspark transformer, pyspark transformer Part of the Data Pipelines skill category. Use when working with pyspark transformer functionality. Trigger with phrases like "pyspark…
  • 100create-adapter
    Author a new Routecraft adapter (source, destination, enricher, transformer, or multi-role). Use when the user asks to add a new integration, connector, endpoint type, or producer or consumer of exchanges.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.