AgentSkillsCN

Publisher

发布者

SKILL.md

Publisher

🦞 Prepares publish payloads with content and metadata. Decoupled from delivery channels.

Overview

The Publisher skill transforms skill output into standardized publish payloads. It adds metadata (timestamps and tags) to content and prepares it for delivery through various channels (webhooks, stdout, databases, etc). The actual delivery mechanism belongs to the Dockyard orchestrator, keeping this skill channel-agnostic.

Interface

typescript
interface PublisherSkill extends Skill {
  id: 'publisher';
  name: 'Publisher';
  version: '1.0.0';
  execute(context: SkillContext): Promise<SkillResult>;
}

interface PublishPayload {
  content: unknown;
  meta: {
    ts: number;
    tags?: string[];
  };
}

interface PublisherInput {
  content?: unknown;
  tags?: string[];
}

Input

SkillContext state:

KeyTypeDescription
inputPublisherInput?Optional input structure with content and tags
input.contentunknown?Content to publish (defaults to entire state if omitted)
input.tagsstring[]?Optional tags for categorizing the publish

Output

SkillResult data:

KeyTypeDescription
publishPublishPayloadComplete publish payload ready for delivery
publish.contentunknownThe content to be published
publish.meta.tsnumberUnix timestamp (milliseconds) of payload creation
publish.meta.tagsstring[]?Optional tags included in payload

SkillResult state:

KeyTypeDescription
publisher_lastobjectLast publish metadata
publisher_last.tsnumberTimestamp of last prepared payload
publisher_last.tagsstring[]Tags from last payload
publisher_last.contentTypestringType of last published content

Example

typescript
import { publisher } from 'blueclaw-skills/skills/publisher';

const result = await publisher.execute({
  env: { platform: 'linux', arch: 'x64', nodeVersion: '20.0.0', timestamp: Date.now() },
  state: {
    input: {
      content: {
        message: 'User action recorded',
        user_id: 42,
        action: 'login'
      },
      tags: ['security', 'auth']
    }
  }
});

console.log(result);
// {
//   success: true,
//   data: {
//     publish: {
//       content: { message: 'User action recorded', user_id: 42, action: 'login' },
//       meta: {
//         ts: 1707008400123,
//         tags: ['security', 'auth']
//       }
//     }
//   },
//   state: {
//     input: { ... },
//     publisher_last: {
//       ts: 1707008400123,
//       tags: ['security', 'auth'],
//       contentType: 'object'
//     }
//   }
// }

Publishing Channels

This skill only prepares payloads. The actual delivery mechanism is handled by Dockyard:

  • Webhook - HTTP POST to configured endpoints
  • Stdout - Console/log output
  • Database - Persistent storage
  • Message Queue - Async message systems
  • Stream - Real-time event streams

Notes

  • Channel-Agnostic: This skill knows nothing about delivery mechanisms
  • No Side Effects: Pure transformation, no network calls
  • State Tracking: Records metadata about each publish for audit trails
  • Flexible Content: Accepts any content type (string, object, array, etc)
  • Optional Tags: Tags are completely optional but recommended for organization

Error Handling

The skill returns success: false if:

  • Any unexpected error occurs during payload preparation

Version History

  • 1.0.0 - Initial scaffold with timestamp and tag support