walkeros-create-transformer
Skill348 starsChanged 5 years agoMITView on GitHub
Before starting, read these skills: - understanding-flow - How transformers fit in architecture - understanding-transformers - Transformer interface - understanding-events - Event structure - testing-strategy - How to test - writing-documentation - Documentation standards (for Phase 7) This skill includes reference files you can copy: - examples/ - Example events and configs to adapt for your transformer - events.ts - Before/after event examples - config.ts - Configuration examples - templates/validation/ - Complete redact transformer template - index.ts - Implementation with…
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- walkeros-create-cmp-sourceSkill
- walkeros-create-destinationSkill
- walkeros-create-sourceSkill
- walkeros-debuggingSkill
- walkeros-mapping-configurationSkill
- walkeros-mcp-actionsSkill
- walkeros-testing-strategySkill
- walkeros-understanding-destinationsSkill
- walkeros-understanding-developmentSkill
- walkeros-understanding-eventsSkill
- walkeros-understanding-flowSkill
- walkeros-understanding-mappingSkill
- walkeros-understanding-sourcesSkill
- walkeros-understanding-storesSkill
- walkeros-understanding-transformersSkill
- walkeros-using-cliSkill
- walkeros-using-loggerSkill
- walkeros-using-step-examplesSkill
- walkeros-using-store-cacheSkill
- walkeros-using-transformer-ga4Skill
- walkeros-writing-documentationSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Before starting, read these skills:
- Very specific: line 118
Add step examples with { in, out } pairs for end-to-end step testing:
- Very specific: line 193
Every walkerOS package ships a walkerOS.json file for CDN-based schema discovery.
- Very specific: line 221
If your transformer has capabilities, behaviors, or troubleshooting patterns not obvious from schemas alone, add hints.
- Distinctive: line 251
Verify every claim against actual implementation before publishing
- Very specific: line 266
If your package wraps a third-party npm dep that cannot be ESM-bundled (uses __dirname, ships a .node binary, etc.), declare it under …
- Very specific: line 294
Schema validation: Use Zod schemas to validate settings and provide defaults (see templates/validation/schemas.ts)
- Distinctive: line 327
Examples for test data: - Don't hardcode test values
- Very specific: line 328
Return value testing: - Verify event, void, or false returns
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a New Transformer
Prerequisites
Before starting, read these skills:
- understanding-flow - How transformers fit in architecture
- understanding-transformers - Transformer interface
- understanding-events - Event structure
- testing-strategy - How to test
- writing-documentation - 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 READMESupporting Files
This skill includes reference files you can copy:
- examples/ - Example events and configs to adapt for your
transformer
- events.ts - Before/after event examples
- config.ts - Configuration examples
- templates/validation/ - Complete redact
transformer template
- index.ts - Implementation with context pattern
- types.ts - Type definitions
- schemas.ts - Zod validation schemas
- 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
# Reference implementation
ls packages/transformers/fingerprint/
# Transformer types
cat packages/core/src/types/transformer.tsGate: 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
mkdir -p packages/transformers/[name]/src/{examples,schemas,types}2.2 Create Event Examples
Adapt 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 for your transformer's settings.
2.4 Step Examples
Add step examples with { in, out } pairs for end-to-end step testing:
// 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 for the
Three Type Zones.
2.5 Export via dev.ts
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/
cp -r packages/transformers/fingerprint packages/transformers/[name]
cd packages/transformers/[name]
# Update package.json: name, description, repository.directoryDirectory 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.mdPhase 4: walkerOS.json Convention
Every walkerOS package ships a walkerOS.json file for CDN-based schema
discovery.
Add walkerOS field to package.json
{
"walkerOS": {
"type": "transformer"
},
"keywords": ["walkerOS", "walkerOS-transformer", ...]
}Use buildDev() in tsup.config.ts
Replace buildModules({ entry: ['src/dev.ts'] }) with buildDev():
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:
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:
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
walkerOSfield in package.json withtype: "transformer"buildDev()in tsup.config.ts- Build generates
dist/walkerOS.json - Keywords include
walkerOSandwalkerOS-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
for the complete contract.
Phase 5: Implement
Now write code to transform examples as expected.
5.1 Define Types
See 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 for a complete implementation example.
Key patterns:
- Context destructuring: Extract
config,logger,idfrom init context - Schema validation: Use Zod schemas to validate settings and provide defaults (see templates/validation/schemas.ts)
- Push receives pushContext: The
pushfunction gets event + push context - Return values:
{ event }(continue),void(passthrough),false(cancel)
5.3 Export
src/index.ts:
export { transformerRedact } from './transformer';
export type { Settings, Types } from './types';Gate: Implementation Compiles
npm run buildpassesnpm 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 for a complete test suite showing:
createTransformerContext()helper - Standardizes init context creationcreatePushContext()helper - Standardizes push context creation- Examples for test data - Don't hardcode test values
- Return value testing - Verify
event,void, orfalsereturns
Gate: Tests Pass
npm run verify:touched -- <transformer-name>passes (L1)- Tests verify against example outputs
Phase 7: Document
Follow the writing-documentation 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
requirements (build, test, lint, no any):
dev.tsexportsschemas(withsettings;z.object({})when the step has none) andexamples- Multi-export package (two or more
walkerOS.exports):exportExamplesandexportSchemasindev.tslist exactly those exports, the default included, and everyexportSchemasentry hassettings; the build fails otherwise (see using-step-examples) - Examples include before/after event pairs
- Return values handle all cases (event, void, false)
- Tests use examples for assertions (not hardcoded values)
walkerOS.jsongenerated at build timewalkerOSfield 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 - Transformer interface and chaining
- walkeros-testing-strategy - Testing patterns and env mocking
- walkeros-writing-documentation - Documentation standards
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

