# Create Playbook Component

> Create Playbook Component is an Agent Skill for development published in the OpenCTI-Platform/opencti repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when: adding a new playbook automation component, implementing a PlaybookComponent interface, or registering a new playbook step

- Skill name: `create-playbook-component`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/OpenCTI-Platform/opencti/blob/HEAD/.github/skills/create-playbook-component/SKILL.md
- Repository: OpenCTI-Platform/opencti (9,685 GitHub stars when collected)

## SKILL.md

# Create Playbook Component

## Prerequisites
- **Component ID**: Unique uppercase ID (e.g., `PLAYBOOK_MY_COMPONENT`).
- **Configuration**: List of fields required from the user.

## Procedure

### Step 1 — Create Component File
Location: `opencti-platform/opencti-graphql/src/modules/playbook/components/<name>-component.ts`.

### Step 2 — Define Configuration Schema
Define a TypeScript interface for the config and a JSONSchema for validation.

```typescript
export interface MyComponentConfig {
  key: string;
}

const SCHEMA: JSONSchemaType<MyComponentConfig> = {
  type: 'object',
  properties: {
    key: { type: 'string' },
  },
  required: ['key'],
};
```

### Step 3 — Implement Component Interface
Implement `PlaybookComponent<MyComponentConfig>`.

```typescript
export const PLAYBOOK_MY_COMPONENT: PlaybookComponent<MyComponentConfig> = {
  id: 'PLAYBOOK_MY_COMPONENT',
  name: 'My Component',
  description: 'Does something useful',
  icon: 'icon-name',
  is_entry_point: false,
  is_internal: true,
  ports: [{ id: 'out', type: 'out' }],
  configuration_schema: SCHEMA,
  schema: async () => SCHEMA,
  executor: async ({ bundle, playbookNode }) => {
    // Business logic here
    const config = playbookNode.configuration;
    
    return { output_port: 'out', bundle };
  },
};
```

### Step 4 — Register Component
Import and add to `PLAYBOOK_COMPONENTS` in `src/modules/playbook/playbook-components.ts`.

---

Source: https://www.openparable.com/skill/development/create-playbook-component (OpenParable). Cite the canonical URL above.
