bd-sink

Community

Safely write new WP data stores via sinks.

AuthorLonsdale201
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Add a dedicated sink to better-data to write DataObjects back to a WordPress data store that the library doesn't cover yet (comment meta, REST uploads, custom taxonomy hierarchy). The sink mirrors PostSink's two-mode shape, with projection methods toArgs / toMeta returning raw arrays for caller-managed writes, and convenience methods insert / update / save that commit changes internally and must pass values through wp_slash() because WP's write pipeline calls wp_unslash() on inbound data. The critical contract is that null DTO values delete meta entries while non-null values update them; encryption must route through EncryptionEngine::encrypt symmetrically with the matching source decrypt; never silently skip encryption. Use this skill when integrating writes for a new WP store. Triggers on creating a class in src/Sink/ with toArgs / toMeta / insert / update / save method shapes and references to SinkProjection or wp_slash in the diff.

Core Features & Use Cases

  • Provides a structured pattern for adding sinks under src/Sink/, sharing a pure projection layer at src/Internal/SinkProjection.php.
  • Implements the two-mode write contract (projection vs convenience), including proper slashing behavior, null-delete semantics, and symmetric encryption guarantees.
  • Enables rapid creation of new sinks for different WP data stores via a standard, tested blueprint.

Quick Start

Create a new Sink class under src/Sink/ implementing toArgs, toMeta, insert, update, and save, then delegate to SinkProjection for raw projection and apply wp_slash at the WP boundary.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: bd-sink
Download link: https://github.com/Lonsdale201/wp-agent-skills/archive/main.zip#bd-sink

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.