ワンクリックで
add-ws-action
Add a new outgoing WebSocket action with typed payload and API exposure
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add a new outgoing WebSocket action with typed payload and API exposure
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a new card part within a section with factory/class pattern, Card wrapper, and proper cleanup
Add a new Jotai atom to the state system with type definitions, registry, and Store API access
Create a reusable UI component with factory pattern, theme compatibility, and proper cleanup
Scaffold a new toggleable feature with full structure, storage, API exposure, and bootstrap registration
Create a reactive global variable that derives from atoms with subscription support
Create a game UI injection that modifies existing game elements with proper cleanup
| name | add-ws-action |
| description | Add a new outgoing WebSocket action with typed payload and API exposure |
| aliases | ["new-ws-action","add-websocket-action","create-ws-action"] |
/add-ws-action <actionName>
What does this action do?
Brief description:
What parameters does the action need?
List each with type:
- param1: string
- param2: number
- etc.
Expose in window.Gemini.WebSocket?
A) Yes - Users can call it
B) No - Internal only (used by features)
Does this action need middleware?
A) No - Just send
B) Yes - Intercept/modify/block
src/websocket/protocol.ts// 1. Add to enum
export enum ClientToServerMessageType {
// ... existing
<ACTION_NAME> = '<actionName>',
}
// 2. Define payload type
export interface <ActionName>Payload {
param1: string;
param2: number;
}
// 3. Add to message map (if exists)
export interface ClientToServerMessageMap {
// ... existing
[ClientToServerMessageType.<ACTION_NAME>]: <ActionName>Payload;
}
src/websocket/api.tsimport { ClientToServerMessageType } from './protocol';
import { send } from './connection';
import type { <ActionName>Payload } from './protocol';
/**
* <Description of what this action does>
* @param param1 - Description
* @param param2 - Description
*/
export function <actionName>(param1: string, param2: number): void {
send({
type: ClientToServerMessageType.<ACTION_NAME>,
data: { param1, param2 } satisfies <ActionName>Payload,
});
}
Keep API simple - Users pass parameters, not raw payloads.
src/api/index.tsimport { <actionName> } from '../websocket/api';
WebSocket: {
// ... existing
<actionName>,
}
Accessible via window.Gemini.WebSocket.<actionName>(...).
src/websocket/middlewares/<actionName>.tsimport { registerMiddleware } from './registry';
import { ClientToServerMessageType } from '../protocol';
import type { ClientToServerMessage } from '../protocol';
let unregister: (() => void) | null = null;
function processMessage(message: ClientToServerMessage): ClientToServerMessage | null {
if (message.type !== ClientToServerMessageType.<ACTION_NAME>) {
return message; // Pass through
}
console.log('[<ActionName>] Intercepted:', message.data);
// Modify
// return { ...message, data: { ...message.data, modified: true } };
// Block
// return null;
// Pass through
return message;
}
export function register<ActionName>Middleware(): void {
if (unregister) return;
unregister = registerMiddleware(processMessage);
}
export function unregister<ActionName>Middleware(): void {
unregister?.();
unregister = null;
}
ClientToServerMessageType enumsrc/websocket/api.tsunknown or any)send() from connection.tssrc/api/index.tswindow.Gemini.WebSocket.<actionName>()message or null, never throws.claude/rules/websocket/websocket.mdsrc/websocket/api.tssrc/websocket/protocol.tssrc/websocket/middlewares/