SuperAPI AI Directory

social-media-automation

Marketing & growth

View repository

Updated 10-15 21:50

About this skill

Self-media operation automation skill

Trigger Conditions

Automatically triggered when the user mentions the following:

  • "Generate Xiaohongshu note"
  • "Publish to Xiaohongshu"
  • "Generate self-media content"
  • "Publish to Douyin/Official Account/Video Account"
  • "Self-media operation"
  • "Social media content generation"
  • "Batch generate content"
  • "Daily trending recommendations"
  • "Trending content recommendations"
  • "Generate content based on trends"

MCP Configuration Instructions

Important Principles

This Skill is generic and does not contain any hardcoded MCP configuration or key information.

MCP Usage Process

  1. User provides MCP configuration

    • The user will provide the MCP configuration information for the HAP application
    • MCP configuration format:{"hap-mcp-{应用名称}": {"url": "https://api.mingdao.com/mcp?HAP-Appkey=...&HAP-Sign=..."}}
    • Or the user explicitly specifies which MCP to use
  2. Confirm the currently connected MCP

    • Before performing operations, you must first call mcp_hap-mcp-_get_app_info() to confirm the currently connected HAP application
    • If the user provides an MCP configuration, confirm whether it matches
  3. Dynamically read configuration from HAP

    • All API keys and configurations are stored in the HAP "API Service Configuration" table
    • Read dynamically from the table when in use, not hardcoded in the code
    • Via get_app_worksheets_list() dynamically obtain the worksheet list
    • Prefer matching worksheets by alias; if the alias does not exist, use name matching
    • Never use hardcoded worksheet IDs
  4. Dynamic worksheet identification (important)

    • Do not assume worksheet IDs are fixed; they must be matched by alias or name
    • Via get_app_worksheets_list() obtain the worksheet list
    • Prefer matching via the alias field; if it does not exist, use the name field for matching
    • Via get_worksheet_structure() obtain the worksheet structure
    • Match required fields by field name or alias

MCP Confirmation Process

用户请求
    ↓
1. 识别用户提供的 MCP 配置或指定的 MCP
    ↓
2. 调用 get_app_info() 确认当前连接的 MCP 应用
    ↓
3. 对比:当前连接 vs 用户指定的 MCP
    ↓
4. 如果不匹配 → 与用户确认
    ↓
5. 确认后执行操作

Core Capabilities

1. Content Generation Process

Complete Workflow

用户输入主题
    ↓
Step 1: 从 HAP "API服务配置" 表动态读取搜索 API 配置(Tavily/Serper)
    ↓
Step 2: 调用搜索 API 获取主题相关资料(Tavily API)
    ↓
Step 3: **【强制要求】从 HAP "账号人设" 表读取账号人设配置(必须在生成内容之前执行)**
    - **禁止使用本地文件**:绝对不允许使用 `AGENTS.md` 或其他本地文件作为账号人设来源
    - **必须调用 HAP MCP**:必须通过 MCP 调用 `get_record_list()` 从 HAP "账号人设" 表读取
    - **读取流程**:
      1. 确认当前连接的 HAP MCP 应用(通过 `get_app_info()`)
      2. 动态获取"账号人设"表的 ID(通过别名 `account_persona` 或名称 `账号人设` 匹配)
      3. 根据 `platform_type` 查询对应平台的账号人设(如:小红书)
      4. **读取所有必需字段**:
         - 账号定位(positioning)
         - 目标受众(target_audience)
         - 内容方向(content_direction)
         - 内容风格(content_style)**【必须严格遵循】**
         - 内容原则(content_principles)**【必须严格遵守】**
         - 图片生成提示词(image_generation_prompt)
    - **验证要求**:如果未找到账号人设配置,必须抛出异常,不允许继续生成内容
    ↓
Step 4: 根据搜索结果和账号人设撰写内容
    - **严格遵循账号人设**:必须严格按照从 HAP 读取的 `content_style` 和 `content_principles` 生成内容
    - **禁止使用本地人设**:不允许参考或使用本地 `AGENTS.md` 文件中的内容
    - **结合搜索资料**:将搜索到的资料与从 HAP 读取的账号人设结合,生成符合账号定位的内容
    - **确保符合人设**:确保内容符合目标受众、内容方向和账号定位
    ↓
Step 5: 生成封面标题(5-10个备选)
    - 根据账号人设的内容风格生成标题
    - 符合账号定位和目标受众
    ↓
Step 6: 选择话题标签(从 HAP 话题库)
    - 根据内容主题和账号人设的内容方向选择
    ↓
Step 7: 生成配图建议
    - 结合账号人设的图片生成提示词风格
    - 根据内容主题生成配图建议
    ↓
Step 8: 保存到本地文件(预览,按笔记目录结构组织)
    ↓
Step 9: 与用户确认内容、标题、图片
    ↓
Step 10: 用户确认后,从 HAP "账号人设" 表读取图片生成提示词(图片风格)
    ↓
Step 11: 从 HAP "API服务配置" 表动态读取图片生成功能配置
    ↓
Step 12: 结合图片风格提示词和配图建议,生成完整提示词
    ↓
Step 13: 提取密钥,生成图片(可选,使用配置的 API 服务)
    ↓
Step 14: 与用户确认是否直接发布至小红书
    ↓
Step 15: 与用户确认是否同步到 HAP,确认后才上传
    - **小红书笔记**:只上传图片 URL(封面图和其他配图),不上传 Markdown 文档
    - **其他平台**:根据平台需求上传图片和文档
    - **关联选题(如果适用)**:
      - 如果内容是基于选题库中的选题创作的,在创建内容记录时关联对应的选题(`related_topic` 字段)
      - 如果内容不是基于选题创作的,不关联选题
    ↓
Step 16: 发布到目标平台(使用 Playwright MCP,如用户确认)

Daily Trending Content Recommendation Workflow

用户请求热点内容推荐
    ↓
Step 1: 从 HAP "热点平台关注表" 读取用户关注的平台(is_followed = 1)
    - 按优先级(priority)排序
    - 获取平台代码(platform_code)
    ↓
Step 2: 从 HAP "API服务配置" 表读取热点新闻 API 配置
    - 功能名称:热点新闻API
    - 服务类型:热点新闻
    - Endpoint URL: https://orz.ai/api/v1/dailynews
    ↓
Step 3: 调用热点新闻 API 获取各平台热点
    - 对每个关注的平台调用:GET https://orz.ai/api/v1/dailynews/?platform={platform_code}
    - 获取热点标题、URL、评分、描述等信息
    - 合并所有平台的热点数据
    ↓
Step 4: 从 HAP "账号人设" 表读取账号人设配置
    - 账号定位(positioning)
    - 目标受众(target_audience)
    - 内容方向(content_direction)
    - 内容风格(content_style)
    - 内容原则(content_principles)
    ↓
Step 5: 基于热点和账号人设分析选题
    - 筛选与账号定位和内容方向相关的热点
    - 分析每个热点的选题价值(热度、相关性、可创作性)
    - 生成 5-10 个选题建议,每个选题包含:
      - 选题标题
      - 来源平台
      - 选题角度(如何结合账号人设)
      - 预期内容方向
      - 推荐理由
      - 相关度评分(1-10分)
    - **按相关度评分排序,标注最推荐的选题**
    ↓
Step 6: 以 Markdown 表格形式展示选题建议,供用户选择
    - **必须使用 Markdown 表格格式展示**,更加直观
    - **表格结构**:
      - 最推荐选题表格(AI 相关或评分 10/10 的选题)
      - 其他推荐选题表格(评分 6-9/10 的选题)
    - **表格列**:序号、选题标题、来源平台、选题角度、推荐理由、相关度评分
    - **明确标注最推荐的选题**(如:⭐ 最推荐选题)
    - 展示所有选题建议
    - 用户选择一个或多个选题
    ↓
Step 6.5: 询问用户是否将选题加入选题库
    - **询问用户**:是否将推荐的选题加入 HAP "选题库" 表
    - **询问方式**:在展示选题建议后,询问"是否将这些选题加入选题库?"
    - 如果用户确认,将用户选择的选题保存到 HAP "选题库" 表:
      - `topic_title`: 选题标题
      - `source_platform`: 来源平台(关联热点平台关注表,使用平台记录的 rowid)
      - `topic_angle`: 选题角度
      - `recommendation_reason`: 推荐理由
      - `relevance_score`: 相关度评分
      - `source_url`: 原文链接
      - `content_preview`: 内容预览
      - `topic_status`: 选题状态(默认:待创作)
    - 如果用户不加入,跳过此步骤
    - **批量保存**:如果用户选择了多个选题,使用 `batch_create_records` 批量保存
    ↓
Step 7: 用户选择选题后,深度搜索相关资料
    - 从 HAP "API服务配置" 表读取搜索 API 配置(Tavily)
    - 基于选题标题和角度,调用搜索 API 获取深度资料
    - 结合热点新闻中的原始信息
    ↓
Step 8: 基于热点信息和搜索资料生成内容
    - 结合热点信息(原始标题、描述、URL)
    - 结合搜索到的深度资料
    - 严格遵循账号人设中的内容风格和内容原则
    - 生成符合账号定位的内容
    ↓
Step 9: 后续流程与标准内容生成流程相同
    - 生成封面标题(5-10个备选)
    - 选择话题标签(从 HAP 话题库)
    - 生成配图建议
    - 保存到本地文件(预览)
    - 与用户确认内容、标题、图片
    - 生成图片(用户确认后)
    - 同步到 HAP(用户确认后):
      - **如果内容是基于选题库中的选题创作的**:
        - 在创建内容记录时,关联对应的选题(`related_topic` 字段)
        - 更新选题状态为"创作中"或"已创作"
        - 选题库中的 `related_content` 字段会自动关联已创作的内容(双向关联)
      - **如果内容不是基于选题创作的**:
        - 不关联选题,`related_topic` 字段留空
    - 发布到目标平台(用户确认后)

Trending News API Usage Instructions:

API Address: https://orz.ai/api/v1/dailynews

Request Method: GET

Parameters:

  • platform: Platform code (required), supported platform codes are described in the "Trending Platform Watchlist" instructions

Request Example:

GET https://orz.ai/api/v1/dailynews/?platform=baidu
GET https://orz.ai/api/v1/dailynews/?platform=weibo
GET https://orz.ai/api/v1/dailynews/?platform=zhihu

Response Format:

{
  "status": "200",
  "data": [
    {
      "title": "热点标题",
      "url": "热点链接",
      "score": "热度评分",
      "desc": "热点描述"
    }
  ],
  "msg": "success"
}

Configuration Instructions:

  • Add a record in the HAP "API Service Configuration" table:
    • Function Name: Trending News API (Title field)
    • Service Provider:orz.ai
    • Service Type: Hot news (select from dropdown)
    • Endpoint URL:https://orz.ai/api/v1/dailynews(**必需填写**)
    • Usage description: Used to retrieve hot news data from various platforms, supporting daily hot content recommendations
    • Configuration status: Enabled

Hot platform follow table configuration:

  • The user needs to add platforms to follow in the HAP "Hot Platform Follow Table"
  • Set is_followed = 1(checked) to follow this platform
  • Set priority(priority, 1-10) to control the retrieval order
  • platform_code must match the platform codes supported by the hot news API

Topic suggestion display format (important):

  • Topic suggestions must be displayed in Markdown table format, which is more intuitive
  • Table structure example:
    ## ⭐ 最推荐选题(AI 相关,强烈推荐)
    
    | 序号 | 选题标题 | 来源平台 | 选题角度 | 推荐理由 |
    |------|---------|---------|---------|---------|
    | 1 | 选题标题1 | 平台1 | AI 技术科普 | 符合账号定位... |
    
    ## 📌 其他推荐选题
    
    | 序号 | 选题标题 | 来源平台 | 选题角度 | 推荐理由 | 相关度 |
    |------|---------|---------|---------|---------|--------|
    | 1 | 选题标题2 | 平台2 | 技术趋势解读 | 符合内容方向... | 8/10 |
    
  • The most recommended topic must be clearly marked(e.g.: ⭐ Most recommended topic, relevance score 10/10)
  • Sort by relevance score, with the most recommended topic placed first
  • Each topic includes: title, source platform, topic angle, recommendation reason, relevance score
  • Do not generate files in the conversation, display directly in the conversation in Markdown table format

2. Platform support

Xiaohongshu

Content format:

  • Title: within 10 characters, question-style/number-style/pain-point-style/contrast-style
  • Body: 300-400 characters, story-based opening, clear structure
  • Topic tags: 5-8, selected from the HAP topic library
  • Images: cover image + 2-3 accompanying images

Publishing process:

  1. Navigate to https://creator.xiaohongshu.com/publish/publish?type=image_text
  2. Upload images (use setInputFiles)
  3. Fill in the title
  4. Fill in the body (including topic tags)
  5. Click publish

HAP worksheet:

  • Worksheet name:内容管理(general table, supports multiple platforms)
  • Fields:
    • platform_type: Platform type (SingleSelect: Xiaohongshu/Douyin/WeChat Official Account/Video Account/Other)
    • content_title: Content title (title field)
    • cover_title: Cover title
    • content: Body content
    • tags: Topic tags (space-separated)
    • cover_image: Cover image (attachment)
    • other_images: Other accompanying images (attachment)
    • markdown_doc: Markdown document (attachment)
    • publish_status: Publish status (draft/to be published/published/cancelled)
    • publish_time: Publish time
    • note_url: Content link (updated after publishing, may have different names on different platforms)
    • views: Views
    • likes: Likes
    • collections: Favorites
    • comments: Comments

Douyin

Content format:

  • Video duration: 15-60 seconds
  • Copy: no more than 50 characters
  • Topic tags: 3-5

Publishing process:

  1. Navigate to https://creator.douyin.com/
  2. Upload video
  3. Fill in the copy
  4. Add topics
  5. Click publish

WeChat Official Account

Content format:

  • Title: no more than 64 characters
  • Body: 2000-5000 characters (HTML format)
  • Summary: article summary
  • Cover: Cover image

Publishing process:

  1. Navigate to https://mp.weixin.qq.com/
  2. Click "Write New Article"
  3. Fill in the title, body, and summary
  4. Set the cover image
  5. Click Publish

WeChat Channels

Content format:

  • Video duration: 30 seconds - 30 minutes
  • Copy: no more than 1000 characters
  • Topics: 3-5

Publishing process:

  1. Log in to the WeChat Channels management backend
  2. Click "Publish Video"
  3. Upload the video
  4. Fill in the copy and topics
  5. Click Publish

3. Search for materials (Tavily API)

Use the Tavily API to search for related materials

API service configuration management:

Search API configurations are stored uniformly in the HAP "API Service Configuration" table, categorized by function, with one record per function containing all configuration fields.

Important: The configuration is obtained dynamically and is not hardcoded

Configuration reading process:

  1. Confirm the MCP connection: First confirm the currently connected HAP application MCP (via get_app_info())
  2. Query configuration: Query the search API configuration from the HAP "API Service Configuration" table
  3. Match configuration: Based on function_name(function name, such as "Tavily Search API") or service_type(service type: search API), match the configuration
  4. Verify status: Verify that config_status(configuration status) is "Enabled"
  5. Read configuration: Read all configuration fields for this function (API Key, Base URL, etc.)

Tavily API configuration example:

# Step 1: 确认当前连接的 MCP 应用
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']

# Step 2: 动态获取工作表列表,通过别名匹配找到"API服务配置"表
# 重要:优先使用别名(alias)匹配,不要使用硬编码的 ID
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
api_config_worksheet_id = None
for ws in worksheets:
    # 优先通过别名匹配,如果别名不存在则使用名称匹配
    if ws.get('alias') == 'api_service_config' or ws.get('name') == 'API服务配置':
        api_config_worksheet_id = ws['id']
        break

if not api_config_worksheet_id:
    raise Exception(f"在应用「{current_app_name}」中未找到「API服务配置」表(别名:api_service_config)")

# Step 3: 查询 Tavily 搜索 API 配置
configs = mcp_hap-mcp-_get_record_list(
    worksheet_id=api_config_worksheet_id,
    filter={
        "type": "group",
        "logic": "AND",
        "children": [
            {
                "type": "condition",
                "field": "function_name",
                "operator": "contains",
                "value": ["Tavily"]
            },
            {
                "type": "condition",
                "field": "config_status",
                "operator": "eq",
                "value": ["启用"]
            }
        ]
    }
)

# Step 4: 提取配置并调用 API
if configs and len(configs) > 0:
    config = configs[0]
    api_key = config.get('api_key')  # Tavily API Key(必需)
    endpoint_url = config.get('endpoint_url')  # Endpoint URL(必需)
    
    # 验证必需字段
    if not api_key:
        raise Exception("Tavily API Key 未配置,请在 HAP 'API服务配置' 表中填写 api_key 字段")
    if not endpoint_url:
        raise Exception("Endpoint URL 未配置,请在 HAP 'API服务配置' 表中填写 endpoint_url 字段")
    
    # 调用 Tavily API 搜索
    import requests
    response = requests.post(
        f"{endpoint_url}/search",
        headers={"Content-Type": "application/json"},
        json={
            "api_key": api_key,
            "query": topic,  # 用户输入的主题
            "search_depth": "basic",
            "max_results": 5,
            "topic": "general",
            "include_answer": False,
            "include_raw_content": False,
            "include_images": False
        }
    )
    
    search_results = response.json().get('results', [])
    # 使用搜索结果生成内容

Tavily API configuration field descriptions (required fields):

  • function_name: Function name (Text, title field, such as: "Tavily Search API")
  • provider: Service provider (Text, such as: "Tavily")
  • service_type: Service type (SingleSelect: Search API/Image Generation/Content Generation/Data Analysis/Other)
  • api_key: API Key (Text, required) - Tavily API Key, such as: tvly-dev-xxx...
    • When to fill in: Search APIs (Tavily, Serper, etc.) must fill in this field
  • endpoint_url: Endpoint URL (Text, required) - API base address, such as:https://api.tavily.com
    • When to fill in: All API services need to fill in this field to specify the API access address
  • config_status: Configuration status (SingleSelect: Enabled/Disabled)
  • purpose: Purpose description (Text, such as: "Used to search for materials related to the topic")

Search process:

  1. Read configuration: Read the Tavily search API configuration from the HAP "API Service Configuration" table
  2. Call API: Use the API Key in the configuration to call the Tavily API to search for materials related to the topic
  3. Process results: Extract key information from the search results (title, content, URL, etc.)
  4. Read account persona(Important: must be before generating content): Read the account positioning, content style, content principles, etc. from the HAP "Account Persona" table
  5. Generate content: Combine search results with the account persona, strictly follow the content style and content principles in the account persona, and generate high-quality content

Search parameter description:

  • query: Search topic (user input)
  • search_depth: Search depth (basic/advanced, basic recommended)
  • max_results: Maximum number of results (5 recommended)
  • topic: Topic type (general/tech/business, etc.)
  • include_answer: Whether to include answer summaries (False)
  • include_raw_content: Whether to include raw content (False)
  • include_images: Whether to include images (False)

Feature configuration example (in the HAP table):

  • Feature name: Tavily Search API (title field)
  • Service provider:Tavily
  • Service type: Search API (select from the drop-down list)
  • Purpose description: Used to search for materials related to the topic and obtain the latest information
  • API Key:tvly-dev-xxx...(Required,Tavily API Key)
  • Endpoint URL:https://api.tavily.com(**必需填写**,API base URL)
  • Configuration status: Enabled (select from the drop-down list)

Hot news API configuration example (in the HAP table):

  • Feature name: Hot News API (title field)
  • Service provider:orz.ai
  • Service type: Hot news (select from the drop-down list)
  • Purpose description: Used to obtain hot news data from various platforms and support daily hot content recommendations
  • Endpoint URL:https://orz.ai/api/v1/dailynews(**必需填写**,API base URL)
  • Configuration status: Enabled (select from the drop-down list)

Important note:

  • api_key and endpoint_url are required fields for the search API and must be filled in
  • api_key is used for API authentication
  • endpoint_url is used to specify the API access address, in a format such as:https://api.tavily.com
  • The hot news API does not require api_key, only endpoint_url

4. Content generation specifications

Account persona configuration (important: must be read first)

The account persona configuration must be read from the HAP "Account Persona" table:

Important principle: Before generating content, the account persona configuration must first be read from the HAP "Account Persona" table, and the account positioning and content rules must be strictly followed.

Mandatory requirements:

  • Use of local files is prohibited: It is absolutely not allowed to use AGENTS.md or other local files as the source of the account persona
  • Must be read from HAP: Must be called through HAP MCP get_record_list() to read from the HAP "Account Persona" table
  • Must be executed before generating content: If the account persona configuration is not read, an exception must be thrown and content generation must not continue
  • Must be strictly followed: When generating content, it must strictly follow the content_style and content_principles read from HAP

Reading process:

  1. Confirm the currently connected MCP application
  2. Dynamically obtain the ID of the "Account Persona" table (through alias matching)
  3. Based on platform_name or platform_type , query the account persona for the corresponding platform
  4. Read all required fields:
    • Account positioning (positioning): understand the core positioning of the account
    • Target audience (target_audience): Understand the audience group the content is aimed at
    • Content direction (content_direction): Understand the main direction of the content
    • Content style (content_style): Understand the style the content should adopt (must be strictly followed)
    • Content principles (content_principles): Understand the principles and considerations for content creation (must be strictly followed)
    • Image generation prompt (image_generation_prompt): Understand the image style requirements
  5. Apply to content generation: When generating content, strictly follow the content style and content principles in the account persona

Account persona table fields:

  • platform_name: Platform name (Text, title field)
  • platform_type: Platform type (SingleSelect: Xiaohongshu/Douyin/WeChat Official Account/Video Account)
  • positioning: Account positioning (Text, required) - The core positioning of the account, used to guide the content direction
  • target_audience: Target audience (Text, required) - The audience group the content is aimed at, used to adjust the content style and depth
  • content_direction: Content direction (Text, required) - The main direction of the content, used to determine the content theme and scope
  • content_style: Content style (Text, required) - The style the content should adopt, must be strictly followed
    • Example: Professional but not aloof, explain complex concepts in plain and easy-to-understand language. Simple and straightforward, avoid piling up technical terms, and use analogies and examples when necessary.
  • content_principles: Content principles (Text, required) - The principles and considerations for content creation, must be strictly followed
    • Example: ✅ Explain complex technology in simple language so that non-technical people can understand it; ❌ Avoid excessive use of technical terms
  • image_generation_prompt: Image generation prompt (Text) - Style prompt used to generate images
    • Purpose: Style prompt used to generate images, which can set the overall style, color, composition, etc. of the image
    • How to use: When generating images, combine this prompt with the specific image content description
    • Example: Chinese handwritten information poster style illustration, vertical composition, creamy light-colored background, cute and healing, relaxed and humorous popular science visual language

Usage example (must be executed strictly according to this process):

# Step 1: 确认当前连接的 HAP MCP 应用
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']
print(f"当前连接的 HAP 应用:{current_app_name}")

# Step 2: 通过别名匹配找到"账号人设"表(不要使用硬编码 ID)
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
persona_worksheet_id = None
for ws in worksheets:
    # 优先通过别名匹配,如果别名不存在则使用名称匹配
    if ws.get('alias') == 'account_persona' or ws.get('name') == '账号人设':
        persona_worksheet_id = ws['id']
        break

if not persona_worksheet_id:
    raise Exception(f"在应用「{current_app_name}」中未找到「账号人设」表(别名:account_persona)。请确保 HAP 应用中存在此表。")

# Step 3: 查询小红书账号人设(重要:必须在生成内容之前读取)
personas = mcp_hap-mcp-_get_record_list(
    worksheet_id=persona_worksheet_id,  # 使用通过别名匹配获取的 ID
    filter={
        "type": "group",
        "logic": "AND",
        "children": [
            {
                "type": "condition",
                "field": "platform_type",
                "operator": "eq",
                "value": ["小红书"]
            }
        ]
    }
)

# Step 4: 验证是否读取到账号人设(强制要求)
if not personas or len(personas) == 0:
    raise Exception(f"在应用「{current_app_name}」的「账号人设」表中未找到小红书账号人设配置。请先在 HAP 中添加账号人设记录。")

persona = personas[0]

# Step 5: 读取所有账号人设字段(必需)
positioning = persona.get('positioning')  # 账号定位
target_audience = persona.get('target_audience')  # 目标受众
content_direction = persona.get('content_direction')  # 内容方向
content_style = persona.get('content_style')  # 内容风格(必须严格遵循)
content_principles = persona.get('content_principles')  # 内容原则(必须严格遵守)
image_prompt_base = persona.get('image_generation_prompt', '')  # 图片风格基础提示词

# Step 6: 验证必需字段是否存在
if not content_style:
    raise Exception(f"账号人设配置中缺少「内容风格」(content_style)字段,无法生成内容。")
if not content_principles:
    raise Exception(f"账号人设配置中缺少「内容原则」(content_principles)字段,无法生成内容。")

# Step 7: 打印账号人设信息(用于确认)
print(f"\n✅ 已从 HAP 读取账号人设配置:")
print(f"  - 账号定位:{positioning}")
print(f"  - 目标受众:{target_audience}")
print(f"  - 内容方向:{content_direction}")
print(f"  - 内容风格:{content_style[:100]}...")
print(f"  - 内容原则:{content_principles[:100]}...")

# Step 8: 根据账号人设和搜索结果生成内容
# **必须严格遵循从 HAP 读取的 content_style 和 content_principles**
# **禁止使用本地 AGENTS.md 文件或其他本地文件**

# 生成内容示例:
# 1. 根据 content_style 确定写作风格(如:通俗易懂、专业但不高冷等)
# 2. 根据 content_principles 确定内容原则(如:用简单语言解释复杂技术、避免专业术语堆砌等)
# 3. 根据 positioning 确定内容定位(如:IT公司产品经理视角)
# 4. 根据 target_audience 调整内容深度和表达方式
# 5. 根据 content_direction 确定内容主题和范围
# 6. 结合搜索结果中的资料,生成符合账号人设的内容

# 生成标题时,也要遵循从 HAP 读取的 content_style 和 positioning
# 生成配图建议时,要结合从 HAP 读取的 image_prompt_base

# 生成图片时,将从 HAP 读取的 image_prompt_base 与具体内容结合

Content writing requirements (Important: must follow the account persona)

Content generation process:

  1. First read the account persona: Read the account positioning, content style, content principles, etc. from the HAP "Account Persona" table (must be before generating content)
  2. Combine with search materials: Combine the searched materials with the account persona
  3. Strictly follow the account persona:
    • Must write according to content_style(content style)
    • Must comply with content_principles(content principles)
    • Ensure the content matches positioning(account positioning)
    • Ensure the content suits target_audience(target audience)
    • Ensure the content matches content_direction(content direction)

Xiaohongshu post (300-400 characters) general requirements:

  1. Engaging opening: Story-driven opening with emotional color (excitement/curiosity/reflection), from a product manager's perspective
  2. Technical explanation: Explain complex concepts in simple language, avoid piling up jargon
  3. Product perspective: Analyze the impact of technology on the industry and users
  4. Summary and elevation: Actionable suggestions/reflective inspiration

Content generation process (refer to the wechat-article-writer skill):

  • Step 1: Search for materials (Tavily API)
  • Step 2: Write the article (must first read the account persona)
  • Step 3: Generate titles (5-10 candidates, refer to the style of viral Xiaohongshu titles)
  • Step 4: Layout optimization + image suggestions

WeChat official account article (2000-5000 characters) general requirements:

  1. Title: Eye-catching, no more than 64 characters
  2. Summary: The article's core viewpoint
  3. Body: HTML format, clear structure
    • Introduction
    • Main content (divided into chapters)
    • Conclusion
  4. Images: Cover image + body images

Note: The above are general requirements. When actually writing, you must strictly follow the content_style and content_principles。

Cover title generation (must follow the account persona, refer to the style of viral Xiaohongshu titles)

Generate 5-10 candidate titles, referring to the characteristics of viral Xiaohongshu titles:

Title types:

  • Question type: Spark curiosity ("What is agentic? AI can finally do work on its own")
  • Number type: Specific numbers are more persuasive ("Understand agentic AI in 3 minutes!")
  • Pain point type: Hit readers' pain points directly ("Still operating manually? agentic AI lets you get it all done with one instruction")
  • Contrast type: Create conflict ("AI no longer 'waits for instructions'! agentic lets AI work proactively")
  • Reveal type: Create suspense ("Revealing agentic: AI's evolution from 'Q&A machine' to 'intelligent assistant'")
  • Result type: Show the value first ("AI can also make decisions autonomously! What exactly is agentic?")
  • Comparison type: Clearly show the difference ("Traditional AI vs agentic AI: from passive response to proactive execution")
  • Trend type: Emphasize the sense of the times ("What is agentic? The era of AI's 'digital employees' has arrived")
  • Identity label type: Fit the account persona ("From a product manager's perspective: how agentic AI will change the way we work")

Important:

  • The title style must match the content_style(content style) in the account persona
  • The title must match the positioning(account positioning) and target_audience(target audience) in the account persona
  • Refer to the characteristics of viral Xiaohongshu titles: eye-catching, sparking curiosity, emphasizing value, lowering the learning threshold
  • Recommend the top-choice title and explain the reason

Topic hashtag selection (must match the account persona)

Select from the HAP topic library table:

Selection strategy:

  1. Prioritize high-popularity tags (increase exposure)
  2. Match topic type based on the theme
  3. Pair with precise tags to attract target users
  4. Ensure tags match the account persona's content_direction(content direction) and target_audience(target audience)

Query method:

# Step 1: 通过别名匹配找到"话题库"表(不要使用硬编码 ID)
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
topics_worksheet_id = None
for ws in worksheets:
    # 优先通过别名匹配,如果别名不存在则使用名称匹配
    if ws.get('alias') == 'topic_library' or ws.get('name') == '话题库':
        topics_worksheet_id = ws['id']
        break

if not topics_worksheet_id:
    raise Exception(f"在应用「{current_app_name}」中未找到「话题库」表(别名:topic_library)")

# Step 2: 查询高热度话题
mcp_hap-mcp-_get_record_list(
    worksheet_id=topics_worksheet_id,  # 使用通过别名匹配获取的 ID
    filter={
        "type": "group",
        "logic": "AND",
        "children": [
            {
                "type": "condition",
                "field": "heat_level",
                "operator": "eq",
                "value": ["高热度"]
            }
        ]
    }
)

# 查询特定平台的内容(通过别名匹配获取工作表ID)
# Step 1: 通过别名匹配找到"内容管理"表(不要使用硬编码 ID)
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
content_worksheet_id = None
for ws in worksheets:
    # 优先通过别名匹配,如果别名不存在则使用名称匹配
    if ws.get('alias') == 'content_management' or ws.get('name') == '内容管理':
        content_worksheet_id = ws['id']
        break

if not content_worksheet_id:
    raise Exception(f"在应用「{current_app_name}」中未找到「内容管理」表(别名:content_management)")

# Step 2: 查询小红书内容
mcp_hap-mcp-_get_record_list(
    worksheet_id=content_worksheet_id,
    filter={
        "type": "group",
        "logic": "AND",
        "children": [
            {
                "type": "condition",
                "field": "platform_type",
                "operator": "eq",
                "value": ["小红书"]
            }
        ]
    }
)

4. Image generation

Supports multiple image generation API configurations

API service configuration management:

All API service configurations are stored uniformly in the HAP "API Service Configuration" table, categorized by function, with each function having one record containing all configuration fields.

Important: Configurations are retrieved dynamically, not hardcoded

Multi-configuration selection mechanism:

  • Supports multiple image generation API configurations: You can configure multiple image generation APIs in the HAP "API Service Configuration" table (such as TUZI API, Volcano Engine Jimeng API, etc.)
  • "Is Default" field control: Controlled via the is_default(Is Default) field to determine which configuration to use
    • If a configuration marked as "default" exists, prioritize using that configuration
    • If there is no default configuration, use the first enabled configuration
  • Configuration status control: Only configurations whose config_status(configuration status) is "enabled" will be used

Configuration reading process:

  1. Confirm MCP connection: First confirm the currently connected HAP application MCP (via get_app_info())
  2. Query configurations: Query all image generation type configurations from the HAP "API Service Configuration" table (service_type = 图片生成 and config_status = 启用)
  3. Select configuration:
    • Prioritize selecting the configuration with is_default = 1(is default)
    • If there is no default configuration, use the first enabled configuration
  4. Read configuration: Read all configuration fields of that configuration (API Key, Endpoint URL, Access Key ID, etc.)

Configuration selection example:

# Step 1: 确认当前连接的 MCP 应用
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']

# Step 2: 通过别名匹配找到"API服务配置"表
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
api_config_worksheet_id = None
for ws in worksheets:
    if ws.get('alias') == 'api_service_config' or ws.get('name') == 'API服务配置' or ws.get('name') == '密钥管理':
        api_config_worksheet_id = ws['id']
        break

if not api_config_worksheet_id:
    raise Exception(f"在应用「{current_app_name}」中未找到「API服务配置」表(别名:api_service_config)")

# Step 3: 查询所有图片生成 API 配置(启用状态)
configs = mcp_hap-mcp-_get_record_list(
    worksheet_id=api_config_worksheet_id,
    filter={
        "type": "group",
        "logic": "AND",
        "children": [
            {
                "type": "condition",
                "field": "service_type",
                "operator": "eq",
                "value": ["图片生成"]
            },
            {
                "type": "condition",
                "field": "config_status",
                "operator": "eq",
                "value": ["启用"]
            }
        ]
    }
)

# Step 4: 选择配置(优先使用默认配置)
if configs and len(configs) > 0:
    # 优先选择标记为"默认"的配置
    default_config = None
    for config in configs:
        if config.get('is_default') == 1:
            default_config = config
            break
    
    # 如果没有默认配置,使用第一个启用的配置
    if not default_config:
        default_config = configs[0]
    
    config = default_config
    
    # 根据服务提供商读取对应的配置字段
    provider = config.get('provider', '').upper()
    
    if 'TUZI' in provider:
        # TUZI API (OpenAI 兼容接口)
        api_key = config.get('api_key')  # 必需
        endpoint_url = config.get('endpoint_url', 'https://api.tu-zi.com/v1')  # 必需
        # 使用 OpenAI SDK 调用
    elif '火山引擎' in provider or '即梦' in config.get('function_name', ''):
        # 火山引擎即梦 API
        access_key_id = config.get('access_key_id')  # 必需
        secret_access_key = config.get('secret_access_key')  # 必需
        region = config.get('region', 'cn-beijing')
        service = config.get('service', 'cv')
        api_version = config.get('api_version', 'jimeng_t2i_v31')
        sdk_name = config.get('sdk_name', 'volcenginesdkcv20240606')
        # 使用火山引擎 SDK 调用

Generation process:

  1. Confirm MCP: Confirm the currently connected HAP application MCP (provided or specified by the user)
  2. Read account persona: Read the account persona configuration for the corresponding platform from the HAP "Account Persona" table
  3. Get image style: Extract from the account persona the image_generation_prompt(image generation prompt)
  4. Dynamically read configuration: Query all image generation type configurations from the HAP "API Service Configuration" table
  5. Select configuration:
    • Prioritize selecting the configuration with is_default = 1(is default)
    • If there is no default configuration, use the first enabled configuration
  6. Extract key: Extract the corresponding key field based on the service provider
    • TUZI API:api_key、endpoint_url
    • Volcano Engine Jimeng:access_key_id、secret_access_key、region、service etc.
  7. Generate prompt: Combine the image style prompt in the account persona with the specific image suggestion to generate a complete image generation prompt
    • Format:{image_generation_prompt},{具体配图内容描述}
    • Example:手绘风格插画,清新活泼的卡通插画风格,{具体图片内容}
  8. Call API to generate image:
    • TUZI API: Uses OpenAI SDK, supports multiple models (gemini-3-pro-image-preview, dall-e-3, dall-e-2)
      • Must use the response_format="url" parameter: Ensures the API returns a URL format instead of base64
      • Request parameters:model、prompt、n=1、response_format="url"、size="{width}x{height}"
    • Volcano Engine Jimeng: Uses the Volcano Engine SDK
    • Parallel generation: Uses a thread pool to generate multiple images in parallel (up to 3 concurrent), greatly improving generation speed
    • Automatically skip existing: Checks whether the local file exists; if it already exists, skips generation, saving time and cost
  9. Process API response:
    • Prioritize URL: If the API returns an HTTP/HTTPS URL, use it directly
    • Handle base64 data: If the API returns base64 data (data URI or base64 string), automatically decode and save it as an image file
    • Error handling: If the API returns invalid data, log the error and continue generating other images
  10. Save images:
    • Save image URL: Save the image URL to 配图/image_urls.json(only save the URL, not base64)
    • Automatically download images: Automatically download image files from the URL to 配图/{图片名称}.png, making it convenient for local viewing and display
    • Image file naming: cover image.png, comparison image.png, flowchart.png, application scenario image.png, etc.
    • Download failure handling: If the download fails, keep the URL and log a warning, without affecting subsequent processes
  11. Upload to HAP:
    • Xiaohongshu note: Only upload image URLs (cover image and other accompanying images) to the HAP attachment field; do not upload the Markdown document
    • Other platforms: Upload images and documents according to platform requirements
    • Use URL when uploading: Use the image URL when uploading to HAP; base64 data is not needed

Image format requirements (Xiaohongshu):

  • Size: 768x1024 (Xiaohongshu 3:4 format, portrait)
  • Style: Hand-drawn style illustration (fresh and lively cartoon illustration style)
  • Content requirements: The image content must be strongly related to the body content and express the core meaning (process, introduction, comparison, etc.)

Image types (must follow the account persona):

  • Cover image: Image style prompt combined with the account persona + specific content description + cover title text
    • The cover image must include the cover title text, using a bold decorative font with stroke and gradient effects
    • The title text should be eye-catching and occupy an important position on the cover, in line with Xiaohongshu cover image design standards
  • Comparison image: Image style prompt combined with the account persona + comparison content description (strongly related to the content)
  • Flowchart: Image style prompt combined with the account persona + process content description (strongly related to the content)
  • Application scenario image: Image style prompt combined with the account persona + scene content description (strongly related to the content)

Hand-drawn style illustration characteristics (reference):

  • Overall style: Fresh and lively cartoon illustration style, full of positive energy and vitality
  • Lines: Thick black outlines, hand-drawn texture, smooth and natural
  • Colors: Bright and saturated colors - warm tones such as orange, yellow, blue, green, red, etc., harmonious color scheme
  • Rendering: Mainly flat style, paired with simple gradients and highlights to add a sense of depth
  • Font: Bold decorative font with stroke and gradient effects
  • Atmosphere: Positive and uplifting, full of vitality, tech-savvy, warm and cute
  • Design philosophy: Concise and lively, strong visual impact, suitable for digital media dissemination

Important:

  • Image suggestions must be combined with the image_generation_promptin the account persona (image generation prompt) to generate
  • The image content must be strongly related to the body content, expressing the core meaning (process, introduction, comparison, etc.)
  • The cover image must include the cover title text
  • The image format must meet platform requirements (Xiaohongshu: 768x1024, 3:4 format)

Image prompt generation rules:

  1. Read from the HAP "Account Persona" table image_generation_prompt(basic image style prompt)
  2. Combine the style prompt with the specific image content description
  3. Format:{image_generation_prompt},{具体图片内容描述,与内容强相关}
  4. Special requirements for cover image: The cover image must include the cover title text
    • Format:{image_generation_prompt},封面图内容: {具体内容描述},标题文字: "{封面标题}",使用粗体装饰性字体,带笔画和渐变效果
  5. Example (cover image):
    • Style in the account persona:创建一个手绘风格的插画作品,具有以下特点: 整体风格: 清新活泼的卡通插画风格,充满正能量和活力...
    • Specific image content:展示"agentic 是什么"的核心概念,中心是一个可爱的大脑图标,大脑周围有多个小机器人或执行箭头,表示自主规划和执行能力
    • Cover title:3分钟搞懂 agentic AI!
    • Final prompt:{image_generation_prompt},封面图内容: 展示"agentic 是什么"的核心概念,中心是一个可爱的大脑图标,大脑周围有多个小机器人或执行箭头,表示自主规划和执行能力。上方有粗体装饰性标题文字"3分钟搞懂 agentic AI!",使用粗体装饰性字体,带笔画和渐变效果,增强视觉冲击力。标题文字要醒目,占据封面重要位置,符合小红书封面图设计规范。
  6. Example (comparison image):
    • Style in the account persona:创建一个手绘风格的插画作品...
    • Specific image content:左右分屏对比,左侧展示传统AI - 一个简单的问答机形象,只能被动回答问题,用问号表示。右侧展示agentic AI - 一个智能助手形象,正在自主规划任务、执行操作,用执行箭头和任务卡片表示。中间用粗箭头连接,表示从"被动响应"到"主动执行"的转变。整体清晰易懂,色彩对比鲜明。
    • Final prompt:{image_generation_prompt},{具体图片内容描述}

5. HAP Data Management

Worksheet Structure

Content management table (general table, supports multiple platforms):

  • platform_type: Platform type (SingleSelect: Xiaohongshu/Douyin/WeChat Official Account/Video Account/Other)
  • content_title: Content title (Text, title field)
  • cover_title: Cover title (Text)
  • content: Body content (Text)
  • tags: Topic tags (Text)
  • cover_image: Cover image (Attachment)
  • other_images: Other images (Attachment)
  • markdown_doc: Markdown document (Attachment,Xiaohongshu notes do not use this field)
  • related_topic: Related topic selection (Relation, related topic library table, single select,bidirectional relation)
  • publish_status: Publish status (SingleSelect: Draft/Pending publish/Published/Cancelled)
  • publish_time: Publish time (DateTime)
  • note_url: Content link (Text, may have different names on different platforms)
  • views: Views (Number)
  • likes: Likes (Number)
  • collections: Favorites (Number)
  • comments: Comments (Number)

Important notes:

  • Xiaohongshu notes do not sync Markdown documents: When syncing Xiaohongshu notes to HAP, only upload images (cover image and other accompanying images), do not upload Markdown documents
  • markdown_doc This field is only used for other platforms (such as WeChat Official Accounts); Xiaohongshu notes do not use this field
  • Bidirectional link to topic library:
    • If the content is created based on a topic in the topic library, you need to link the corresponding topic in the content record
    • If the content is not created based on a topic, you can leave it unlinked
    • In the topic library, the related_content field will automatically link created content

Design notes:

  • Use a unified "Content Management" table to manage content across all platforms
  • Distinguish different platforms via the platform_type field
  • Different platforms share common fields; special requirements can be handled through notes or extension fields

Hashtag library table:

  • topic_name: Topic name (Text)
  • topic_type: Topic type (SingleSelect)
  • heat_level: Popularity level (SingleSelect: High popularity/Medium popularity/Low popularity)
  • description: Description (Text)
  • last_updated: Last updated (DateTime)

Topic library table:

  • topic_title: Topic title (Text, title field)
  • source_platform: Source platform (Relation, linked to hot topic platform follow table, single select)
  • topic_angle: Topic angle (Text, how to combine with the account persona)
  • recommendation_reason: Recommendation reason (Text)
  • relevance_score: Relevance score (Number, 1-10 points)
  • source_url: Original link (Text)
  • content_preview: Content preview (Text, multiline text)
  • topic_status: Topic status (SingleSelect: To be created/In creation/Created/Cancelled)
  • related_content: Related content (Relation, linked to content management table, multiple select,bidirectional link)
  • notes: Notes (Text, multiline text)

Design notes:

  • The topic library is used to store recommended topics for easy subsequent management and creation
  • Linked to the hot topic platform follow table, the source of topics can be traced
  • Bidirectional link to content management table:
    • In the topic library, the related_content field can link multiple created content items
    • In the content management table, the related_topic field can link the corresponding topic
    • If the content is created based on a topic, you need to link the topic when creating the content
    • If the content is not created based on a topic, you can leave it unlinked
  • The topic status is used to track the creation progress of the topic

Account persona table:

  • platform_name: Platform name (Text, title field)
  • platform_type: Platform type (SingleSelect: Xiaohongshu/Douyin/WeChat Official Account/Video Account)
  • positioning: Account positioning (Text)
  • target_audience: Target audience (Text)
  • content_direction: Content direction (Text)
  • content_style: Content style (Text)
  • content_principles: Content principles (Text)
  • image_generation_prompt: Image generation prompt (Text)
    • Purpose: Used for style prompts for image generation; you can set the overall style, color, composition, etc. of the image
    • How to use: When generating images, combine this prompt with the specific image content description
    • Example: Minimalist tech style, blue-purple gradient background, modern flat design, high quality, professional feel

Hot Topic Platform Watchlist:

  • platform_name: Platform Name (Text, title field, e.g.: "Baidu Hot Search", "Weibo Hot Search")
  • platform_code: Platform Code (Text, e.g.: "baidu", "weibo", corresponding to the platform code of the hot news API)
  • platform_type: Platform Type (SingleSelect: General News/Tech/Social Media/Finance/Tech Community/Other)
  • is_followed: Followed (Checkbox) - whether the user follows hot topics on this platform
  • priority: Priority (Number, 1-10, the larger the number, the higher the priority)
  • description: Platform Description (Text, describing the platform's features and content types)
  • last_fetch_time: Last Fetch Time (DateTime, records the last time hot topics were fetched from this platform)

Supported platform codes (corresponding to the hot news API):

  • baidu: Baidu Hot Search (social hot topics, entertainment, events)
  • sspai: SSPAI (technology, digital, lifestyle)
  • weibo: Weibo Hot Search (social media hot topics, entertainment, events)
  • zhihu: Zhihu Hot List (Q&A, in-depth content, social hot topics)
  • tskr: 36Kr (tech startups, business news)
  • ftpojie: 52pojie (technology, software, security)
  • bilibili: Bilibili (videos, anime, games, lifestyle)
  • douban: Douban (books, movies, music, culture, discussions)
  • hupu: Hupu (sports, games, digital)
  • tieba: Baidu Tieba (interest communities, topic discussions)
  • juejin: Juejin (programming, technical articles)
  • douyin: Douyin (short video hot topics, entertainment)
  • vtex: V2EX (technology, programming, creativity)
  • jinritoutiao: Toutiao (news, hot events)
  • stackoverflow: Stack Overflow (programming Q&A, technical discussions)
  • github: GitHub Trending (open source projects, programming languages)
  • hackernews: Hacker News (tech news, startups, programming)
  • sina_finance: Sina Finance (financial news, stock market information)
  • eastmoney: East Money (financial news, investment and wealth management)
  • xueqiu: Xueqiu (stock investing, financial community)
  • cls: Cailian Press (financial news flashes, market updates)
  • tenxunwang: Tencent (general news, entertainment, technology)

API Service Configuration Table:

  • function_name: Feature Name (Text, title field, e.g.: "Tavily Search API", "TUZI Image Generation", "Jimeng Image Generation", "Hot News API")
  • provider: Service Provider (Text, e.g.: "Tavily", "TUZI", "Volcano Engine", "orz.ai")
  • service_type: Service Type (SingleSelect: Search API/Image Generation/Content Generation/Data Analysis/Hot News/Other)
  • purpose: Purpose Description (Text, e.g.: "Used to search for materials related to the topic", "Used to generate images", "Used to fetch hot news")
  • is_default: Is Default (Checkbox) - Used to control which image generation API configuration is used
    • Purpose: When multiple image generation API configurations exist, the configuration marked as "default" is used preferentially
    • Usage: Checked means this configuration is used by default, unchecked means it is a non-default configuration
    • Selection Logic: Preferentially select is_default = 1(default) configuration; if there is no default configuration, the first enabled configuration is used
  • endpoint_url: Endpoint URL (Text, required) - API base address
    • Hot News API:https://orz.ai/api/v1/dailynews

Key fields (user-fillable):

  • api_key: API Key (Text, required) - used for API authentication
    • When to fill in:
      • Search API(Tavily, Serper, etc.):Required
      • Services that use API Key authentication, such as OpenAI, Anthropic, Midjourney, etc.:Required
  • endpoint_url: Endpoint URL (Text, required) - API base address
    • When to fill in:All API services must fill this in, used to specify the API access address
    • Format example:
      • Tavily: https://api.tavily.com
      • OpenAI: https://api.openai.com/v1
      • Custom proxy: https://proxy.example.com
  • access_key_id: Access Key ID(Text)
    • When to fill in: Services that use Access Key authentication, such as Volcano Engine, Alibaba Cloud, Tencent Cloud, etc., need to fill this in
  • secret_access_key: Secret Access Key(Text)
    • When to fill in: Used in pair with Access Key ID; Volcano Engine, Alibaba Cloud, Tencent Cloud, etc. need to fill this in
  • api_secret: API Secret(Text)
    • When to fill in: Used in pair with API Key; some services need to fill this in
  • token: Token(Text)
    • When to fill in: Services that use GitHub, GitLab, JWT Token authentication need to fill this in
  • app_id: App ID(Text)
    • When to fill in: Services that use App ID authentication, such as WeChat, WeCom, DingTalk, etc., need to fill this in
  • app_secret: App Secret(Text)
    • When to fill in: Used in pair with App ID; WeChat, WeCom, DingTalk, etc. need to fill this in

Configuration fields:

  • endpoint_url: Endpoint URL (Text, required) - API base address
    • When to fill in:All API services must fill this in
    • Format example:
      • Tavily Search API: https://api.tavily.com
      • OpenAI API: https://api.openai.com/v1
      • Volcano Engine Jimeng: https://ark.cn-beijing.volces.com/api/v3
      • Custom proxy: https://proxy.example.com
  • region: Region(Text)
    • When to fill in: Services that need a specified region, such as AWS, Alibaba Cloud, Tencent Cloud, Volcano Engine, etc., need to fill this in (e.g., cn-beijing, us-east-1)
  • service: Service(Text)
    • When to fill in: Services that need a specified service name, such as Volcano Engine, etc., need to fill this in (e.g., cv, ocr)
  • api_version: API version (Text)
    • When to fill in: Services that need a specified API version need to fill this in (e.g., jimeng_t2i_v31, v1, v2)
  • sdk_name: SDK name (Text)
    • When to fill in: When using the Python SDK, you need to fill in the SDK package name (e.g., volcenginesdkcv20240606, openai)
  • extra_config: Other configuration (Text)
    • When to fill in: Fill in when additional configuration parameters are needed, in JSON format (e.g., {"timeout": 30, "max_retries": 3})
  • config_status: Configuration status (SingleSelect: enabled/disabled)
  • notes: Remarks (Text)

Usage instructions:

  • All API services must fill in endpoint_url(API base address)
  • Depending on the API service type, fill in the corresponding key fields:
    • Tavily Search API:Required api_key and endpoint_url
    • Volcengine Jimeng: Use access_key_id、secret_access_key and endpoint_url
    • OpenAI/Anthropic:Required api_key and endpoint_url
    • WeChat/WeCom: Use app_id、app_secret and endpoint_url
  • All key fields are visible, and users can fill in and edit them directly in HAP
  • endpoint_url Format: The complete API base URL, such as https://api.tavily.com or https://api.openai.com/v1

Function configuration example:

  1. Tavily Search API: Used to search for topic-related materials

    • Service provider: Tavily
    • Service type: Search API (select from the drop-down list)
    • API Key:tvly-dev-xxx...(Required,Tavily API Key)
    • Endpoint URL:https://api.tavily.com(**必需填写**,API base URL)
    • Purpose description: Search for the latest materials before generating content to improve content quality
    • Configuration status: Enabled (select from the drop-down list)
  2. TUZI Image Generation: Used to generate images (OpenAI-compatible interface)

    • Service provider: TUZI
    • Service type: Image generation (select from the drop-down list)
    • API Key:sk-xxx...(Required,TUZI API Key)
    • Endpoint URL:https://api.tu-zi.com/v1(**必需填写**,API base URL)
    • Is default: Yes (check box; checked indicates that this configuration is used by default)
    • Configuration status: Enabled (select from the drop-down list)
    • Note: Uses an OpenAI-compatible interface and supports multiple models (gemini-3-pro-image-preview, dall-e-3, dall-e-2)
  3. Jimeng Image Generation: Used to generate images (Text-to-Image 3.1)

    • Service provider: Volcengine
    • Service type: Image generation (select from the drop-down list)
    • Endpoint URL:https://ark.cn-beijing.volces.com/api/v3(可选,API base URL)
    • Access Key ID: Used for API authentication (user fills in)
    • Secret Access Key: Used for API signing (user fills in)
    • Region: cn-beijing (user fills in)
    • Service: cv (user fills in)
    • API version: jimeng_t2i_v31 (user fills in)
    • SDK name: volcenginesdkcv20240606 (user fills in)
    • Is default: No (check box; unchecked indicates a non-default configuration)
    • Configuration status: Enabled (select from the drop-down list)

Important:

  • All configuration information is filled in by the user in the HAP "API Service Configuration" table
  • The Skill is only responsible for reading from the table and does not contain any default values or hard-coded configurations
  • Users need to fill in the corresponding configuration fields according to the API service actually used

Data synchronization process

1. 搜索资料(Tavily API)→ 获取最新信息
2. 生成内容 → 保存到本地文件(预览,按笔记目录结构:`内容/{平台}/{笔记标题}/{笔记标题}.md`)
3. 与用户确认内容、标题、图片
4. 用户确认后生成图片 → 保存到笔记目录的配图文件夹(`内容/{平台}/{笔记标题}/配图/`)
5. 与用户确认是否发布和同步
6. 用户确认后同步到 HAP:
   - **小红书笔记**:只上传图片 URL(封面图和其他配图),不上传 Markdown 文档
   - **其他平台**:根据平台需求上传图片和文档
7. 用户确认后发布 → 使用 Playwright 发布到目标平台
8. 发布成功 → 更新发布状态和笔记链接

目录结构说明:
- `内容/`:根目录
- `内容/{平台}/`:平台目录(小红书/抖音/微信公众号/视频号)
- `内容/{平台}/{笔记标题}/`:笔记目录,使用封面标题作为目录名
- `内容/{平台}/{笔记标题}/{笔记标题}.md`:Markdown 文档(仅本地保存,小红书不同步到 HAP)
- `内容/{平台}/{笔记标题}/配图/`:配图文件夹

重要说明:
- **小红书笔记的 Markdown 文档不同步到 HAP**,只同步图片 URL
- Markdown 文档仅保存在本地,用于预览和编辑
- 图片生成后:
  1. 保存图片 URL 到 `配图/image_urls.json`
  2. **下载图片到本地**:保存图片文件到 `配图/{图片名称}.png`(如:封面图.png、对比图.png),方便本地查看和展示
  3. 通过 MCP 上传 URL 到 HAP(上传时使用 URL,不需要 base64)

6. Automated publishing

Use Playwright MCP

Pre-publishing preparation:

  1. Confirm that the user is logged in to the target platform
  2. Check content completeness (title, body, images, tags)
  3. Verify that HAP data has been synchronized

Publishing process (Xiaohongshu example):

// 1. 导航到发布页面
await page.goto('https://creator.xiaohongshu.com/publish/publish?type=image_text');

// 2. 上传图片
const fileInput = await page.locator('input[type="file"]').first();
await fileInput.setInputFiles(imageFiles);

// 3. 填写标题
await page.getByRole('textbox', { name: '填写标题会有更多赞哦~' }).fill(title);

// 4. 填写正文(包含话题标签)
await page.getByRole('textbox').nth(1).fill(content + '\n\n' + tags);

// 5. 点击发布
await page.getByRole('button', { name: '发布' }).click();

// 6. 等待发布成功,获取笔记链接
// 7. 更新 HAP 记录:发布状态、发布时间、笔记链接

Post-publishing processing:

  1. Obtain the link to the successfully published content
  2. Update HAP "Content Management" table records:
    • platform_type: Target platform (Xiaohongshu/Douyin/WeChat Official Account/WeChat Channels)
    • publish_status: Published
    • publish_time: Current time
    • note_url: Content link

Usage examples

Example 1: Generate and publish a Xiaohongshu note

用户:帮我生成一篇关于 "Skills 科普介绍" 的小红书笔记并发布

执行流程:
1. **确认 MCP**:确认当前连接的 HAP 应用 MCP(通过用户提供或指定)
2. **读取搜索配置**:从 HAP "API服务配置" 表读取 Tavily 搜索 API 配置
3. **搜索资料**:调用 Tavily API 搜索主题相关资料(获取最新 5 条结果)
4. **【强制要求】读取账号人设**(必须在生成内容之前执行):从 HAP "账号人设" 表读取账号人设配置
   - **禁止使用本地文件**:绝对不允许使用 `AGENTS.md` 或其他本地文件
   - **必须调用 HAP MCP**:必须通过 MCP 调用 `get_record_list()` 从 HAP "账号人设" 表读取
   - **读取所有必需字段**:
     - **账号定位**(positioning):了解账号的核心定位
     - **目标受众**(target_audience):了解内容面向的受众群体
     - **内容方向**(content_direction):了解内容的主要方向
     - **内容风格**(content_style):了解内容应该采用的风格(必须严格遵循)
     - **内容原则**(content_principles):了解内容创作的原则和注意事项(必须严格遵守)
     - **图片生成提示词**(image_generation_prompt):了解图片风格要求
   - **验证要求**:如果未找到账号人设配置,必须抛出异常,不允许继续生成内容
5. **撰写内容**:根据搜索结果和从 HAP 读取的账号人设撰写内容
   - **严格遵循账号人设**:必须严格按照从 HAP 读取的 `content_style` 和 `content_principles` 来撰写
   - **禁止使用本地人设**:不允许参考或使用本地 `AGENTS.md` 文件中的内容
   - **结合搜索资料**:将搜索到的资料与从 HAP 读取的账号人设结合,生成符合定位的内容
   - **符合目标受众**:确保内容适合目标受众阅读
6. **生成封面标题**:根据账号人设的内容风格生成 5-10 个封面标题
   - 标题风格必须符合账号人设的内容风格
   - 标题要符合账号定位和目标受众
7. **选择话题标签**:从 HAP 话题库选择 5-8 个话题标签(动态查询)
   - 根据内容主题和账号人设的内容方向选择
8. **生成配图建议**:结合账号人设的图片生成提示词风格,生成配图建议
9. **保存预览**:保存到本地文件(按笔记目录结构:`内容/小红书/{笔记标题}/{笔记标题}.md`)
10. **与用户确认**:与用户确认内容、标题、图片
11. **生成图片**(用户确认后):从 HAP "账号人设" 表读取图片生成提示词,从 HAP "API服务配置" 表读取图片生成配置,生成图片
12. **与用户确认发布**:与用户确认是否直接发布至小红书
13. **与用户确认同步**:与用户确认是否同步到 HAP,确认后才上传
14. **同步 HAP**(用户确认后):同步到 HAP "内容管理" 表(platform_type = 小红书)
    - **只上传图片**:上传封面图和其他配图的 URL 到 HAP
    - **不上传 Markdown 文档**:小红书笔记的 Markdown 文档不同步到 HAP
15. **发布内容**(用户确认后):使用 Playwright 发布到小红书
16. **更新状态**:更新 HAP 发布状态和内容链接

Example 2: Batch generate content

用户:帮我生成一周的小红书笔记(7篇),主题如下:
1. Claude Code 新功能
2. AI 工具推荐
3. 大模型应用场景
...

执行流程:
1. **确认 MCP**:确认当前连接的 HAP 应用 MCP
2. **批量生成**:对每个主题重复上述流程
3. **动态读取配置**:每次生成图片时从 HAP "API服务配置" 表动态读取配置
4. **批量保存**:批量生成并保存到 HAP "内容管理" 表(platform_type = 小红书)

Example 3: Multi-platform publishing

用户:将这篇笔记发布到小红书和微信公众号

执行流程:
1. **确认 MCP**:确认当前连接的 HAP 应用 MCP
2. **读取内容**:从 HAP "内容管理" 表读取内容(platform_type = 小红书)
3. **动态获取工作表**:动态获取"内容管理"表的 ID 和字段结构
4. **适配格式**:适配不同平台的格式要求:
   - 小红书:300-400字,5-8个话题标签
   - 微信公众号:2000-5000字,HTML格式
5. **发布内容**:分别发布到两个平台
6. **更新 HAP**:在 HAP "内容管理" 表中创建新记录(platform_type = 微信公众号),或更新现有记录的发布状态

Technical implementation

Dependencies and Tools

  1. Tavily API(configuration stored in HAP): Search for relevant materials and obtain the latest information
  2. wechat-article-writer skill: Content generation
  3. HAP MCP(provided by the user): Data management, used to store content, configurations, topic libraries, etc.
  4. Playwright MCP: Automated publishing to each platform
  5. Third-party API(configuration stored in HAP): Image generation, content generation, and other API services

MCP configuration requirements

The user needs to provide:

  • The MCP configuration for the HAP application (including Appkey and Sign)
  • Or explicitly specify which configured MCP to use

The Skill will automatically:

  • Identify the currently connected MCP application
  • Dynamically obtain the worksheet list and structure
  • Read keys and configurations from the "API Service Configuration" table
  • Filter content records by platform type

File structure

social-media-operation/
├── AGENTS.md                    # 账号人设配置(可选,本地参考文件)
├── 笔记生成工作流.md            # 工作流说明
├── 内容/                        # 内容根目录
│   └── 小红书/                  # 平台分类(小红书/抖音/微信公众号/视频号)
│       └── {笔记标题}/          # 每个笔记一个目录,使用封面标题作为目录名
│           ├── {笔记标题}.md    # Markdown 文档(使用笔记标题命名)
│           └── 配图/            # 配图目录
│               ├── 封面图.png
│               ├── 架构图.png
│               └── 应用场景图.png
├── 话题库/                      # 话题标签库(可选,本地参考文件)
│   └── {类型}.md
└── README.md                    # 项目说明

目录结构说明:
- 内容/:根目录,包含所有平台的内容
- 小红书/:平台目录,展示该平台的所有笔记标题(目录名)
- {笔记标题}/:笔记目录,使用封面标题作为目录名,更清晰直观
- {笔记标题}.md:Markdown 文档,使用笔记标题命名
- 配图/:配图文件夹,包含该笔记的所有配图

示例:
内容/
  └── 小红书/
      └── MCP 是什么?/           # 笔记标题作为目录名
          ├── MCP科普介绍.md      # Markdown 文档
          └── 配图/
              ├── 封面图.png
              ├── 架构图.png
              └── 应用场景图.png

注意:
- 账号人设和话题库数据统一存储在 HAP 中
- 本地文件仅作为参考,实际使用时从 HAP 表读取
- 内容按笔记目录结构组织,每个笔记包含 md 文档和配图
- 目录名使用笔记标题,更清晰直观

HAP application configuration

Important: The application name and MCP configuration are provided by the user and are not hard-coded

General worksheet structure (the user needs to create it in HAP):

  1. Content Management(general table, distinguishing platforms by the platform_type field: Xiaohongshu/Douyin/WeChat Official Account/WeChat Channels, etc.)
  2. Topic hashtag library(stores topic hashtags for each platform)
  3. Account persona(stores account persona configurations for different platforms)
  4. API Service Configuration(categorized by function; each function corresponds to one record containing all configuration fields, including keys)
  5. Hotspot Platform Follow Table(stores the hotspot platforms followed by the user, used for daily hotspot content recommendations)
  6. Topic Library(stores recommended topics, linked to the Hotspot Platform Follow Table and the Content Management table)
  7. Social media data(optional, stores operational data)

Worksheet creation:

  • The user needs to create the above worksheets in the HAP application
  • When creating worksheets, it is recommended to set an alias to facilitate subsequent queries
  • Or the user provides an existing application MCP, and the Skill will automatically identify the worksheet structure
  • The Skill will, through get_app_worksheets_list() , dynamically obtain the worksheet list
  • When querying, match by alias first; if the alias does not exist, match by name
  • Never use hard-coded worksheet IDs

Notes

MCP and configuration management

  1. The MCP configuration is provided by the user:

    • The Skill does not contain any hard-coded MCP configuration
    • The user needs to provide the MCP configuration information for the HAP application
    • Or explicitly specify which configured MCP to use
  2. MCP application confirmation:

    • Before performing HAP operations, you must first call get_app_info() Confirm the currently connected MCP application
    • If the user provides an MCP configuration, it needs to be compared and confirmed whether it matches
    • If it does not match, it needs to be confirmed with the user
  3. Dynamically read configuration:

    • All API keys and configurations are stored in the HAP "API Service Configuration" table
    • When in use, they must be read dynamically from the table,absolutely do not hard-code them in the code
    • Through get_record_list() query the configuration, matching by function name or service type
  4. Dynamic worksheet identification (important):

    • Through get_app_worksheets_list() dynamically obtain the worksheet list
    • Prioritize matching worksheets by alias; if the alias does not exist, use name matching
    • Absolutely do not use hard-coded worksheet IDs
    • All query operations must first obtain the worksheet ID by alias or name matching, and then use that ID for the query

Content generation

Account persona reading checklist (must be strictly executed):

  1. ✅ Confirm MCP connection: Before executing any operation, you must first call get_app_info() confirm the currently connected HAP MCP application
  2. ✅ Dynamically obtain worksheets: Through get_app_worksheets_list() dynamically obtain the worksheet list, and match through alias account_persona or name 账号人设 match
  3. ✅ Query account persona: Use get_record_list() according to platform_type query the account persona record for the corresponding platform
  4. ✅ Verify required fields: Check whether content_style and content_principles fields are read; if missing, throw an exception
  5. ✅ Local files are prohibited: It is absolutely not allowed to use AGENTS.md or other local files as the source of the account persona
  6. ✅ Strictly follow the persona: When generating content, it must strictly follow the content_style and content_principles read from HAP

Other notes: 5. Content preview: After generating content, first save it to a local file, and after the user confirms, sync it to HAP 6. Image generation: Image generation may fail (SSL error), and retrying or manual creation is required 7. Publishing login: Before publishing, the user needs to log in to the target platform first 8. Word count control: Different platforms have different word count requirements and need to be adapted 9. Topic tags: Must be selected from the HAP topic library; do not make them up yourself 10. Account persona:Must be read from the HAP "Account Persona" table; the use of local files is prohibited, including image generation prompts 11. Image style: When generating images, combine the image_generation_prompt from the account persona read from HAP with the specific illustration suggestions

Best practices

General-purpose design

  1. MCP configuration:

    • Never hard-code MCP configuration
    • Always read the configuration from the MCP provided or specified by the user
    • Before executing operations, first confirm the currently connected MCP application
  2. Configuration management:

    • All keys and configurations are stored in the HAP "API Service Configuration" table
    • Read dynamically at runtime, do not assume any default values
    • Users need to fill in all necessary configuration information in HAP
  3. Worksheet Identification (Important):

    • Dynamically retrieve the worksheet list
    • Prefer to match worksheets by alias; if the alias does not exist, use name to match
    • Never use hard-coded worksheet IDs
    • All query operations must first obtain the worksheet ID by matching the alias or name, and then use that ID to perform the query
    • Dynamically retrieve the field structure, and match field IDs by name or alias

Content Operations

  1. Content Quality: Ensure the content is valuable and aligns with the account positioning
  2. Update Frequency: Maintain a stable update frequency (recommended 3-5 posts per week)
  3. Data Tracking: Regularly check the data in HAP and analyze viral patterns
  4. Interaction Management: Reply to comments promptly and actively interact with users
  5. Multi-platform Adaptation: Adjust content format and style according to the characteristics of different platforms