messages
Instructions for adding new message types to the safe-output messages system
Install
mkdir -p .claude/skills/messages && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5777" && unzip -o skill.zip -d .claude/skills/messages && rm skill.zipInstalls to .claude/skills/messages
About this skill
Adding New Message Types Guide
This guide explains how to add a new message type to the GitHub Agentic Workflows safe-output messages system. Follow these steps to ensure the new message is available in frontmatter, parsed by the compiler, available in JavaScript, and properly bundled.
Overview
The messages system allows workflow authors to customize messages displayed in safe-output operations. Messages flow through:
- Frontmatter (YAML) → 2. JSON Schema → 3. Go Compiler → 4. JavaScript Modules → 5. Bundler
Step 1: Update JSON Schema
Add the new message field to pkg/parser/schemas/main_workflow_schema.json in the messages object:
{
"messages": {
"properties": {
"my-new-message": {
"type": "string",
"description": "Description of when this message is used. Available placeholders: {placeholder1}, {placeholder2}.",
"examples": [
"Example message with {placeholder1}"
]
}
}
}
}
Key points:
- Use
kebab-casefor the YAML field name (e.g.,my-new-message) - Document all available placeholders in the description
- Provide helpful examples
- Run
make buildafter changes (schema is embedded in binary)
Step 2: Update Go Struct
Add the new field to SafeOutputMessagesConfig in pkg/workflow/compiler.go:
type SafeOutputMessagesConfig struct {
// ... existing fields ...
MyNewMessage string `yaml:"my-new-message,omitempty" json:"myNewMessage,omitempty"` // Description of the message
}
Key points:
- Use
CamelCasefor Go field name - Use
kebab-casefor YAML tag (matches frontmatter) - Use
camelCasefor JSON tag (used in JavaScript) - Add
omitemptyto both tags
Step 3: Update Go Parser
If needed, update the parser in pkg/workflow/safe_outputs.go:
func parseMessagesConfig(messagesMap map[string]any) *SafeOutputMessagesConfig {
config := &SafeOutputMessagesConfig{}
// ... existing parsing ...
if myNewMessage, ok := messagesMap["my-new-message"].(string); ok {
config.MyNewMessage = myNewMessage
}
return config
}
Note: The parser uses reflection for most fields, so this step may not be needed for simple string fields.
Step 4: Create JavaScript Message Module
Create a new file pkg/workflow/js/messages_my_new.cjs:
// @ts-check
/// <reference types="@actions/github-script" />
/**
* My New Message Module
*
* This module provides the my-new-message generation
* for [describe when it's used].
*/
const { getMessages, renderTemplate, toSnakeCase } = require("./messages_core.cjs");
/**
* @typedef {Object} MyNewMessageContext
* @property {string} placeholder1 - Description of placeholder1
* @property {string} placeholder2 - Description of placeholder2
*/
/**
* Get the my-new-message, using custom template if configured.
* @param {MyNewMessageContext} ctx - Context for message generation
* @returns {string} The generated message
*/
function getMyNewMessage(ctx) {
const messages = getMessages();
// Create context with both camelCase and snake_case keys
const templateContext = toSnakeCase(ctx);
// Default message template
const defaultMessage = "Default message with {placeholder1} and {placeholder2}";
// Use custom message if configured
return messages?.myNewMessage
? renderTemplate(messages.myNewMessage, templateContext)
: renderTemplate(defaultMessage, templateContext);
}
module.exports = {
getMyNewMessage,
};
Key points:
- File naming:
messages_<category>.cjs(flat structure, not subfolder) - Import from
./messages_core.cjsfor shared utilities - Use JSDoc for type definitions
- Provide sensible default message
- Support both custom and default templates
Step 5: Add Tests
Create pkg/workflow/js/messages_my_new.test.cjs:
import { describe, it, expect, beforeEach, vi } from "vitest";
// Mock core global
const mockCore = {
warning: vi.fn(),
};
global.core = mockCore;
describe("getMyNewMessage", () => {
beforeEach(() => {
vi.clearAllMocks();
delete process.env.GH_AW_SAFE_OUTPUT_MESSAGES;
});
it("should return default message when no custom message configured", async () => {
const { getMyNewMessage } = await import("./messages_my_new.cjs");
const result = getMyNewMessage({
placeholder1: "value1",
placeholder2: "value2",
});
expect(result).toBe("Default message with value1 and value2");
});
it("should use custom message when configured", async () => {
process.env.GH_AW_SAFE_OUTPUT_MESSAGES = JSON.stringify({
myNewMessage: "Custom: {placeholder1}",
});
const { getMyNewMessage } = await import("./messages_my_new.cjs");
const result = getMyNewMessage({
placeholder1: "test",
placeholder2: "ignored",
});
expect(result).toContain("Custom: test");
});
});
Run tests with make test-js.
Step 6: Update Core Module TypeDef
Add the new property to the SafeOutputMessages typedef in pkg/workflow/js/messages_core.cjs:
/**
* @typedef {Object} SafeOutputMessages
* @property {string} [footer] - Custom footer message template
* // ... existing properties ...
* @property {string} [myNewMessage] - Custom my-new-message template
*/
Also update the getMessages() function return object:
return {
footer: rawMessages.footer,
// ... existing fields ...
myNewMessage: rawMessages.myNewMessage,
};
Step 7: Update Barrel File
Add the re-export to pkg/workflow/js/messages.cjs:
// Re-export my new messages
const { getMyNewMessage } = require("./messages_my_new.cjs");
module.exports = {
// ... existing exports ...
getMyNewMessage,
};
Step 8: Register in Go Embeddings
Add to pkg/workflow/js.go:
//go:embed js/messages_my_new.cjs
var messagesMyNewScript string
Add to GetJavaScriptSources():
func GetJavaScriptSources() map[string]string {
return map[string]string{
// ... existing entries ...
"messages_my_new.cjs": messagesMyNewScript,
}
}
Step 9: Use in Consumer Scripts
Import directly from the specific module in scripts that need it:
const { getMyNewMessage } = require("./messages_my_new.cjs");
// Use the message
const message = getMyNewMessage({
placeholder1: actualValue1,
placeholder2: actualValue2,
});
Step 10: Update Documentation
Update scratchpad/safe-output-messages.md:
- Add the new message to the "Message Categories" section
- Document placeholders and usage
- Add examples
Update the Message Module Architecture table:
| Module | Purpose | Exported Functions |
|--------|---------|-------------------|
| `messages_my_new.cjs` | My new message description | `getMyNewMessage` |
Verification Checklist
Before committing:
- JSON Schema updated in
pkg/parser/schemas/main_workflow_schema.json - Go struct updated in
pkg/workflow/compiler.go - Go parser handles new field (if needed) in
pkg/workflow/safe_outputs.go - JavaScript module created:
pkg/workflow/js/messages_my_new.cjs - Tests created:
pkg/workflow/js/messages_my_new.test.cjs - TypeDef updated in
messages_core.cjs - Barrel file updated:
messages.cjs - Go embed directive added in
js.go - Added to
GetJavaScriptSources()map - Consumer scripts updated to use minimal imports
- Documentation updated in
scratchpad/safe-output-messages.md - Tests pass:
make test-js - Build succeeds:
make build - Linting passes:
make lint
File Summary
| File | Purpose | Changes Needed |
|---|---|---|
pkg/parser/schemas/main_workflow_schema.json | JSON Schema | Add field definition |
pkg/workflow/compiler.go | Go struct | Add struct field |
pkg/workflow/safe_outputs.go | Parser | Add parsing logic (if needed) |
pkg/workflow/js/messages_my_new.cjs | JavaScript module | Create new file |
pkg/workflow/js/messages_my_new.test.cjs | Tests | Create new file |
pkg/workflow/js/messages_core.cjs | Core utilities | Update typedef |
pkg/workflow/js/messages.cjs | Barrel file | Add re-export |
pkg/workflow/js.go | Go embeddings | Add embed directive |
scratchpad/safe-output-messages.md | Documentation | Document new message |
Example: Adding close-older-discussion Message
This message type was added following this process:
- Schema: Added
close-older-discussionfield with placeholders{new_discussion_number},{new_discussion_url},{workflow_name},{run_url} - Go struct: Added
CloseOlderDiscussion stringfield - JavaScript: Created
messages_close_discussion.cjswithgetCloseOlderDiscussionMessage() - Tests: Added corresponding test file
- Bundler: Registered in
GetJavaScriptSources() - Consumer: Used in
close_older_discussions.cjsvia direct import
See these files for a working implementation example.
More by githubnext
View all skills by githubnext →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversSend and receive WhatsApp messages directly from Claude and other AI assistants. Search conversations, manage contacts,
Boost productivity on macOS with Apple Native Tools—search contacts, manage notes, and message easily in your favorite p
Powerful MCP server for Slack with advanced API, message fetching, webhooks, and enterprise features. Robust Slack data
AppleScript MCP server lets AI execute apple script on macOS, accessing Notes, Calendar, Contacts, Messages & Finder via
Connect AI with Telegram using our telegram bot for efficient message monitoring, organizing, and handling via powerful
Use Mac Messages, the top iMessage app for PC, to send and read iMessages from your desktop with contact and group chat
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.