Skip to content

heshengtao/super-agent-party / skills/sap-extension-creator

sap-extension-creator

Verified

Create Super Agent Party (SAP) extensions. This skill should be used when users want to create, build, or scaffold a new extension for Super Agent Party - including static HTML extensions (pure frontend) and Node.js backend extensions. Triggers on requests like "create a new SAP extension", "build an extension for Super Agent Party", "scaffold a plugin", "make a chat UI extension", or when working with sap extension projects.

assets/node-template/index.js

View on GitHub
/**
 * SAP Extension — Node.js Template
 * 
 * Supports both:
 * 1. Node service mode:  node index.js <port>  (managed by SAP)
 * 2. Static file mode:   node index.js         (open index.html in browser)
 */
const path = require('path');
const fs = require('fs');
const EXT_DIR = __dirname;
const HTML_FILE = path.join(EXT_DIR, 'index.html');

/* ---- Mode 1: Node service (SAP-managed) ---- */
if (process.argv[2]) {
  const PORT = parseInt(process.argv[2], 10);
  const express = require('express');
  const app = express();

  // Serve all static assets from extension directory
  app.use(express.static(EXT_DIR));

  // Root → index.html
  app.get('/', (req, res) => res.sendFile(HTML_FILE));

  // Health check for SAP readiness polling
  app.get('/health', (req, res) => res.json({ status: 'ok' }));

  // TODO: Add custom API routes here
  // app.get('/api/data', (req, res) => { ... });

  app.listen(PORT, '127.0.0.1', () => {
    const msg = `[ext] Node service ready at http://127.0.0.1:${PORT}`;
    console.log(msg);
    fs.writeFileSync(path.join(EXT_DIR, 'port.log'), String(PORT));
  });
  return;
}

/* ---- Mode 2: Standalone / double-click ---- */
const { spawn } = require('child_process');
const BROWSER = process.platform === 'darwin' ? 'open'
              : process.platform === 'win32' ? 'start'
              : 'xdg-open';
spawn(BROWSER, [HTML_FILE], { shell: true, stdio: 'ignore' });
console.log('[ext] Opening in browser:', HTML_FILE);
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall