Loading...
Loading...
An automation skill for social media operations, supporting content generation, image generation, data management, and automated publishing across Xiaohongshu, Douyin, WeChat Official Accounts, WeChat Channels, and other platforms. It provides complete workflows for Tavily API search, content generation, image generation, HAP data management, and automated publishing. It also adds daily trending-content recommendations. Image generation supports parallel generation, automatic downloading, automatic skipping of existing images, and other optimizations. Account persona configurations must be read from the HAP "Account Persona" table; using local files is strictly prohibited.
npx skill4agent add garfield-bb/hap-skills-collection social-media-automation{"hap-mcp-{application_name}": {"url": "https://api.mingdao.com/mcp?HAP-Appkey=...&HAP-Sign=..."}}mcp_hap-mcp-_get_app_info()get_app_worksheets_list()get_app_worksheets_list()aliasnameget_worksheet_structure()User request
↓
1. Identify the MCP configuration provided by the user or the specified MCP
↓
2. Call get_app_info() to confirm the currently connected MCP application
↓
3. Compare: current connection vs. user-specified MCP
↓
4. If they do not match → confirm with the user
↓
5. Proceed after confirmationUser enters a topic
↓
Step 1: Dynamically read the search API configuration (Tavily/Serper) from the HAP "API Service Configuration" table
↓
Step 2: Call the search API to retrieve material related to the topic (Tavily API)
↓
Step 3: **【MANDATORY】Read the account persona configuration from the HAP "Account Persona" table (must be performed before content generation)**
- **Local files are prohibited**: using AGENTS.md or any other local file as the account persona source is strictly prohibited
- **HAP MCP must be called**: MCP must be used to call get_record_list() to read from the HAP "Account Persona" table
- **Reading flow**:
1. Confirm the currently connected HAP MCP application through get_app_info()
2. Dynamically obtain the ID of the "Account Persona" table by matching the alias account_persona or the name 账号人设
3. Query the account persona for the relevant platform according to platform_type, such as Xiaohongshu
4. **Read all required fields**:
- Account positioning (positioning)
- Target audience (target_audience)
- Content direction (content_direction)
- Content style (content_style) **【MUST BE STRICTLY FOLLOWED】**
- Content principles (content_principles) **【MUST BE STRICTLY OBSERVED】**
- Image generation prompt (image_generation_prompt)
- **Validation requirement**: if no account persona configuration is found, throw an exception and do not continue content generation
↓
Step 4: Write the content based on the search results and account persona
- **Strictly follow the account persona**: content must be generated strictly according to content_style and content_principles read from HAP
- **Local personas are prohibited**: do not reference or use content from the local AGENTS.md file
- **Combine the search material**: combine the retrieved material with the account persona read from HAP to generate content aligned with the account positioning
- **Ensure persona alignment**: ensure the content matches the target audience, content direction, and account positioning
↓
Step 5: Generate cover titles (5–10 alternatives)
- Generate titles according to the account persona's content style
- Ensure they match the account positioning and target audience
↓
Step 6: Select topic hashtags (from the HAP Hashtag Library)
- Select them according to the content topic and the account persona's content direction
↓
Step 7: Generate image suggestions
- Combine the account persona's image generation prompt style
- Generate image suggestions based on the content topic
↓
Step 8: Save to a local file for preview, organized according to the note directory structure
↓
Step 9: Confirm the content, titles, and images with the user
↓
Step 10: After user confirmation, read the image generation prompt (image style) from the HAP "Account Persona" table
↓
Step 11: Dynamically read the image generation configuration from the HAP "API Service Configuration" table
↓
Step 12: Combine the image style prompt and image suggestions to generate a complete prompt
↓
Step 13: Extract the key and generate images (optional, using the configured API service)
↓
Step 14: Confirm with the user whether to publish directly to Xiaohongshu
↓
Step 15: Confirm with the user whether to synchronize the content to HAP; upload only after confirmation
- **Xiaohongshu notes**: upload only image URLs, including the cover image and other images; do not upload the Markdown document
- **Other platforms**: upload images and documents according to platform requirements
- **Related topic, if applicable**:
- If the content was created from a topic in the Topic Idea Library, associate it with the corresponding topic through the related_topic field when creating the content record
- If the content was not created from a topic, do not create an association
↓
Step 16: Publish to the target platform using Playwright MCP, if confirmed by the userUser requests trending content recommendations
↓
Step 1: Read the platforms followed by the user from the HAP "Trending Platform Follow List" table (is_followed = 1)
- Sort by priority
- Obtain platform codes (platform_code)
↓
Step 2: Read the Trending News API configuration from the HAP "API Service Configuration" table
- Function name: Trending News API
- Service type: Trending News
- Endpoint URL: https://orz.ai/api/v1/dailynews
↓
Step 3: Call the Trending News API to retrieve trending topics for each platform
- For each followed platform, call: GET https://orz.ai/api/v1/dailynews/?platform={platform_code}
- Retrieve the headline, URL, score, description, and other information
- Merge the trending data from all platforms
↓
Step 4: Read the account persona configuration from the HAP "Account Persona" table
- Account positioning (positioning)
- Target audience (target_audience)
- Content direction (content_direction)
- Content style (content_style)
- Content principles (content_principles)
↓
Step 5: Analyze topics based on the trending data and account persona
- Select trending topics related to the account positioning and content direction
- Analyze the content potential of each topic, including popularity, relevance, and creatability
- Generate 5–10 topic suggestions, each containing:
- Topic title
- Source platform
- Topic angle (how to combine it with the account persona)
- Expected content direction
- Recommendation reason
- Relevance score (1–10)
- **Sort by relevance score and clearly mark the most highly recommended topic**
↓
Step 6: Present the topic suggestions in a Markdown table so the user can make a selection
- **A Markdown table must be used** to provide a more intuitive presentation
- **Table structure**:
- Top recommendation table (AI-related or scored 10/10)
- Other recommendation table (scored 6–9/10)
- **Table columns**: number, topic title, source platform, topic angle, recommendation reason, relevance score
- **Clearly mark the top recommendation**, such as ⭐ Top Recommendation
- Display all topic suggestions
- The user selects one or more topics
↓
Step 6.5: Ask the user whether to add the selected topics to the Topic Idea Library
- **Ask the user**: Would you like to add these topics to the HAP "Topic Idea Library" table?
- **How to ask**: after presenting the topic suggestions, ask "Would you like to add these topics to the Topic Idea Library?"
- If the user confirms, save the selected topics to the HAP "Topic Idea Library" table:
- topic_title: topic title
- source_platform: source platform, linked to the Trending Platform Follow List table using the platform record's rowid
- topic_angle: topic angle
- recommendation_reason: recommendation reason
- relevance_score: relevance score
- source_url: original article URL
- content_preview: content preview
- topic_status: topic status, with 待创作 as the default
- If the user does not want to add them, skip this step
- **Batch saving**: if the user selects multiple topics, use batch_create_records to save them in bulk
↓
Step 7: After the user selects a topic, perform an in-depth search for related material
- Read the Tavily search API configuration from the HAP "API Service Configuration" table
- Search for in-depth material based on the topic title and angle
- Combine it with the original information from the Trending News API
↓
Step 8: Generate content based on the trending information and search material
- Combine the original headline, description, and URL from the trending information
- Combine the in-depth search material
- Strictly follow the content style and content principles in the account persona
- Generate content aligned with the account positioning
↓
Step 9: Continue with the standard content generation workflow
- Generate cover titles (5–10 alternatives)
- Select topic hashtags from the HAP Hashtag Library
- Generate image suggestions
- Save to a local file for preview
- Confirm the content, titles, and images with the user
- Generate images after user confirmation
- Synchronize to HAP after user confirmation:
- **If the content was created from a topic in the Topic Idea Library**:
- Associate it with the corresponding topic through the related_topic field when creating the content record
- Update the topic status to 创作中 or 已创作
- The related_content field in the Topic Idea Library automatically links to the created content through a bidirectional relation
- **If the content was not created from a topic**:
- Do not create an association and leave related_topic empty
- Publish to the target platform after user confirmationhttps://orz.ai/api/v1/dailynewsGETplatformGET 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{
"status": "200",
"data": [
{
"title": "Trending headline",
"url": "Trending article URL",
"score": "Popularity score",
"desc": "Trending description"
}
],
"msg": "success"
}is_followed = 1priorityplatform_code## ⭐ Top Recommendation (AI-related, highly recommended)
| No. | Topic Title | Source Platform | Topic Angle | Recommendation Reason |
|------|---------|---------|---------|---------|
| 1 | Topic title 1 | Platform 1 | AI technology explainer | Matches the account positioning... |
## 📌 Other Recommendations
| No. | Topic Title | Source Platform | Topic Angle | Recommendation Reason | Relevance |
|------|---------|---------|---------|---------|--------|
| 1 | Topic title 2 | Platform 2 | Technology trend analysis | Matches the content direction... | 8/10 |https://creator.xiaohongshu.com/publish/publish?type=image_textsetInputFiles内容管理platform_typecontent_titlecover_titlecontenttagscover_imageother_imagesmarkdown_docpublish_statuspublish_timenote_urlviewslikescollectionscommentshttps://creator.douyin.com/https://mp.weixin.qq.com/get_app_info()function_nameservice_typeconfig_status# Step 1: Confirm the currently connected MCP application
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']
# Step 2: Dynamically obtain the worksheet list and find the API Service Configuration table by alias
# Important: prioritize alias matching and do not use hard-coded IDs
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
api_config_worksheet_id = None
for ws in worksheets:
# Prioritize alias matching; use name matching when no alias exists
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'Application {current_app_name} does not contain the API Service Configuration table (alias: api_service_config)')
# Step 3: Query the Tavily search API configuration
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: Extract the configuration and call the API
if configs and len(configs) > 0:
config = configs[0]
api_key = config.get('api_key') # Tavily API Key, required
endpoint_url = config.get('endpoint_url') # Endpoint URL, required
# Validate required fields
if not api_key:
raise Exception('Tavily API Key is not configured. Enter api_key in the HAP API Service Configuration table')
if not endpoint_url:
raise Exception('Endpoint URL is not configured. Enter endpoint_url in the HAP API Service Configuration table')
# Call the Tavily API to search
import requests
response = requests.post(
f"{endpoint_url}/search",
headers={"Content-Type": "application/json"},
json={
"api_key": api_key,
"query": topic, # User-provided 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', [])
# Use the search results to generate contentfunction_nameproviderservice_typeapi_keytvly-dev-xxx...endpoint_urlhttps://api.tavily.comconfig_statuspurposecontent_stylecontent_principlesquerysearch_depthmax_resultstopicinclude_answerinclude_raw_contentinclude_imagestvly-dev-xxx...https://api.tavily.comhttps://orz.ai/api/v1/dailynewsapi_keyendpoint_urlapi_keyendpoint_urlhttps://api.tavily.comapi_keyendpoint_urlAGENTS.mdget_record_list()content_stylecontent_principlesplatform_nameplatform_typepositioningtarget_audiencecontent_directioncontent_stylecontent_principlesimage_generation_promptcontent_stylecontent_principlesplatform_nameplatform_typepositioningtarget_audiencecontent_directioncontent_stylecontent_principlesimage_generation_prompt# Step 1: Confirm the currently connected HAP MCP application
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']
print(f"Currently connected HAP application: {current_app_name}")
# Step 2: Find the Account Persona table by alias; do not use a hard-coded ID
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
persona_worksheet_id = None
for ws in worksheets:
# Prioritize alias matching; use name matching when no alias exists
if ws.get('alias') == 'account_persona' or ws.get('name') == '账号人设':
persona_worksheet_id = ws['id']
break
if not persona_worksheet_id:
raise Exception(f'Application {current_app_name} does not contain the Account Persona table (alias: account_persona). Create this table in the HAP application.')
# Step 3: Query the Xiaohongshu account persona; this must happen before content generation
personas = mcp_hap-mcp-_get_record_list(
worksheet_id=persona_worksheet_id, # Use the ID obtained through alias matching
filter={
"type": "group",
"logic": "AND",
"children": [
{
"type": "condition",
"field": "platform_type",
"operator": "eq",
"value": ["小红书"]
}
]
}
)
# Step 4: Validate that the account persona was read; this is mandatory
if not personas or len(personas) == 0:
raise Exception(f'No Xiaohongshu account persona configuration was found in the Account Persona table of application {current_app_name}. Add a persona record in HAP first.')
persona = personas[0]
# Step 5: Read all required account persona fields
positioning = persona.get('positioning') # Account positioning
target_audience = persona.get('target_audience') # Target audience
content_direction = persona.get('content_direction') # Content direction
content_style = persona.get('content_style') # Content style; must be strictly followed
content_principles = persona.get('content_principles') # Content principles; must be strictly observed
image_prompt_base = persona.get('image_generation_prompt', '') # Base image style prompt
# Step 6: Validate that all required fields exist
if not content_style:
raise Exception('The account persona configuration is missing content_style. Content generation cannot continue.')
if not content_principles:
raise Exception('The account persona configuration is missing content_principles. Content generation cannot continue.')
# Step 7: Print the account persona information for confirmation
print(f"\n✅ Account persona configuration read from HAP:")
print(f" - Account positioning: {positioning}")
print(f" - Target audience: {target_audience}")
print(f" - Content direction: {content_direction}")
print(f" - Content style: {content_style[:100]}...")
print(f" - Content principles: {content_principles[:100]}...")
# Step 8: Generate content based on the account persona and search results
# **Strictly follow content_style and content_principles read from HAP**
# **Do not use the local AGENTS.md file or any other local file**
# Content generation example:
# 1. Determine the writing style from content_style, such as accessible language or a professional but approachable style
# 2. Determine the content principles from content_principles, such as explaining complex technology in simple terms and avoiding excessive jargon
# 3. Determine the account positioning from positioning, such as an IT company product manager perspective
# 4. Adjust content depth and expression for the target_audience
# 5. Determine the content subject and scope from content_direction
# 6. Combine the search material with the account persona to generate content aligned with the positioning
# When generating titles, also follow content_style and positioning read from HAP
# When generating image suggestions, combine them with image_prompt_base read from HAP
# When generating images, combine image_prompt_base read from HAP with the specific contentcontent_stylecontent_principlespositioningtarget_audiencecontent_directioncontent_stylecontent_principlescontent_stylepositioningtarget_audiencecontent_directiontarget_audience# Step 1: Find the Hashtag Library table by alias; do not use a hard-coded ID
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
topics_worksheet_id = None
for ws in worksheets:
# Prioritize alias matching; use name matching when no alias exists
if ws.get('alias') == 'topic_library' or ws.get('name') == '话题库':
topics_worksheet_id = ws['id']
break
if not topics_worksheet_id:
raise Exception(f'Application {current_app_name} does not contain the Hashtag Library table (alias: topic_library)')
# Step 2: Query high-heat hashtags
mcp_hap-mcp-_get_record_list(
worksheet_id=topics_worksheet_id, # Use the ID obtained through alias matching
filter={
"type": "group",
"logic": "AND",
"children": [
{
"type": "condition",
"field": "heat_level",
"operator": "eq",
"value": ["高热度"]
}
]
}
)
# Query content for a specific platform by obtaining the worksheet ID through alias matching
# Step 1: Find the Content Management table by alias; do not use a hard-coded ID
worksheets = mcp_hap-mcp-_get_app_worksheets_list()
content_worksheet_id = None
for ws in worksheets:
# Prioritize alias matching; use name matching when no alias exists
if ws.get('alias') == 'content_management' or ws.get('name') == '内容管理':
content_worksheet_id = ws['id']
break
if not content_worksheet_id:
raise Exception(f'Application {current_app_name} does not contain the Content Management table (alias: content_management)')
# Step 2: Query Xiaohongshu content
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": ["小红书"]
}
]
}
)is_defaultis_defaultconfig_statusget_app_info()service_type = 图片生成config_status = 启用is_default = 1# Step 1: Confirm the currently connected HAP MCP application
current_app = mcp_hap-mcp-_get_app_info()
current_app_name = current_app['data']['name']
# Step 2: Find the API Service Configuration table by alias
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'Application {current_app_name} does not contain the API Service Configuration table (alias: api_service_config)')
# Step 3: Query all enabled image generation API configurations
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: Select the configuration, prioritizing the default configuration
if configs and len(configs) > 0:
# Prioritize configurations marked as the default
default_config = None
for config in configs:
if config.get('is_default') == 1:
default_config = config
break
# If no default configuration exists, use the first enabled configuration
if not default_config:
default_config = configs[0]
config = default_config
# Read the appropriate configuration fields based on the service provider
provider = config.get('provider', '').upper()
if 'TUZI' in provider:
# TUZI API, an OpenAI-compatible interface
api_key = config.get('api_key') # Required
endpoint_url = config.get('endpoint_url', 'https://api.tu-zi.com/v1') # Required
# Use the OpenAI SDK to call the API
elif '火山引擎' in provider or '即梦' in config.get('function_name', ''):
# Volcengine Jimeng API
access_key_id = config.get('access_key_id') # Required
secret_access_key = config.get('secret_access_key') # Required
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')
# Use the Volcengine SDK to call the APIimage_generation_promptis_default = 1api_keyendpoint_urlaccess_key_idsecret_access_keyregionservice{image_generation_prompt}, {specific image content description}hand-drawn illustration style, fresh and lively cartoon illustration style, {specific image content}response_format="url"modelpromptn=1response_format="url"size="{width}x{height}"配图/image_urls.json配图/{image_name}.png封面图.png对比图.png流程图.png应用场景图.pngimage_generation_promptimage_generation_prompt{image_generation_prompt}, {specific image content description that is strongly related to the content}{image_generation_prompt}, cover image content: {specific content description}, title text: "{cover title}", using a bold decorative font with strokes and gradient effectsCreate a hand-drawn illustration with the following characteristics: overall style: a fresh and lively cartoon illustration style full of positive energy and vitality...Show the core concept of what agentic is, with a cute brain icon in the center and multiple small robots or execution arrows around it to represent autonomous planning and execution capabilitiesUnderstand agentic AI in 3 minutes!{image_generation_prompt}, cover image content: Show the core concept of what agentic is, with a cute brain icon in the center and multiple small robots or execution arrows around it to represent autonomous planning and execution capabilities. A prominent decorative title reading "Understand agentic AI in 3 minutes!" appears at the top, using a bold decorative font with strokes and gradient effects to enhance visual impact. The title must be prominent, occupy an important position on the cover, and comply with Xiaohongshu cover design standards.Create a hand-drawn illustration with the following characteristics...Use a left-right split-screen comparison. The left side shows traditional AI as a simple question-answering machine that can only respond passively, with question marks. The right side shows agentic AI as an intelligent assistant autonomously planning tasks and executing actions, with execution arrows and task cards. Connect the two sides with a thick arrow to represent the transition from passive response to proactive execution. The overall image should be clear and easy to understand, with a distinct color contrast.{image_generation_prompt}, {specific image content description}platform_typecontent_titlecover_titlecontenttagscover_imageother_imagesmarkdown_docrelated_topicpublish_statuspublish_timenote_urlviewslikescollectionscommentsmarkdown_docrelated_contentplatform_typetopic_nametopic_typeheat_leveldescriptionlast_updatedtopic_titlesource_platformtopic_anglerecommendation_reasonrelevance_scoresource_urlcontent_previewtopic_statusrelated_contentnotesrelated_contentrelated_topicplatform_nameplatform_typepositioningtarget_audiencecontent_directioncontent_stylecontent_principlesimage_generation_promptplatform_nameplatform_codebaiduweiboplatform_typeis_followedprioritydescriptionlast_fetch_timebaidusspaiweibozhihutskrftpojiebilibilidoubanhuputiebajuejindouyinvtexjinritoutiaostackoverflowgithubhackernewssina_financeeastmoneyxueqiuclstenxunwangfunction_nameproviderservice_typepurposeis_defaultis_default = 1endpoint_urlhttps://orz.ai/api/v1/dailynewsapi_keyendpoint_urlhttps://api.tavily.comhttps://api.openai.com/v1https://proxy.example.comaccess_key_idsecret_access_keyapi_secrettokenapp_idapp_secretendpoint_urlhttps://api.tavily.comhttps://api.openai.com/v1https://ark.cn-beijing.volces.com/api/v3https://proxy.example.comregionserviceapi_versionsdk_nameextra_config{"timeout": 30, "max_retries": 3}config_statusnotesendpoint_urlapi_keyendpoint_urlaccess_key_idsecret_access_keyendpoint_urlapi_keyendpoint_urlapp_idapp_secretendpoint_urlendpoint_urlhttps://api.tavily.comhttps://api.openai.com/v1tvly-dev-xxx...https://api.tavily.comsk-xxx...https://api.tu-zi.com/v1https://ark.cn-beijing.volces.com/api/v31. Search for material through the Tavily API → obtain the latest information
2. Generate content → save it to a local file for preview, using the note directory structure: 内容/{platform}/{note_title}/{note_title}.md
3. Confirm the content, titles, and images with the user
4. After user confirmation, generate images → save them in the note's image directory: 内容/{platform}/{note_title}/配图/
5. Confirm whether to publish and synchronize
6. After user confirmation, synchronize to HAP:
- **Xiaohongshu notes**: upload only the image URLs, including the cover image and other images; do not upload the Markdown document
- **Other platforms**: upload images and documents according to platform requirements
7. After user confirmation, publish → use Playwright to publish to the target platform
8. After successful publication → update the publishing status and note URL
Directory structure notes:
- 内容/: root directory
- 内容/{platform}/: platform directory, including 小红书/抖音/微信公众号/视频号
- 内容/{platform}/{note_title}/: note directory, using the cover title as the directory name
- 内容/{platform}/{note_title}/{note_title}.md: Markdown document, stored locally only and not synchronized to HAP for Xiaohongshu
- 内容/{platform}/{note_title}/配图/: image directory
Important notes:
- **Markdown documents for Xiaohongshu notes are not synchronized to HAP**; only image URLs are synchronized
- Markdown documents are stored locally only for previewing and editing
- After image generation:
1. Save the image URLs to 配图/image_urls.json
2. **Download the images locally**: save the image files to 配图/{image_name}.png, such as 封面图.png or 对比图.png, for convenient local viewing and display
3. Upload the URLs to HAP through MCP; use the URLs rather than base64 data when uploading// 1. Navigate to the publishing page
await page.goto('https://creator.xiaohongshu.com/publish/publish?type=image_text');
// 2. Upload the images
const fileInput = await page.locator('input[type="file"]').first();
await fileInput.setInputFiles(imageFiles);
// 3. Enter the title
await page.getByRole('textbox', { name: '填写标题会有更多赞哦~' }).fill(title);
// 4. Enter the body, including hashtags
await page.getByRole('textbox').nth(1).fill(content + '\n\n' + tags);
// 5. Click Publish
await page.getByRole('button', { name: '发布' }).click();
// 6. Wait for successful publication and obtain the note URL
// 7. Update the HAP record: publishing status, publishing time, and note URLplatform_typepublish_statuspublish_timenote_urlUser: Generate a Xiaohongshu note about "An introduction to Skills" and publish it
Execution flow:
1. **Confirm the MCP**: confirm the currently connected HAP application MCP through the user-provided or user-specified configuration
2. **Read the search configuration**: read the Tavily search API configuration from the HAP "API Service Configuration" table
3. **Search for material**: call the Tavily API to retrieve the 5 latest results related to the topic
4. **【MANDATORY】Read the account persona** before generating content: read the account persona configuration from the HAP "Account Persona" table
- **Local files are prohibited**: never use AGENTS.md or any other local file
- **HAP MCP must be called**: use MCP to call get_record_list() to read from the HAP "Account Persona" table
- **Read all required fields**:
- **Account positioning** (positioning): understand the account's core positioning
- **Target audience** (target_audience): understand the audience for whom the content is intended
- **Content direction** (content_direction): understand the account's main content areas
- **Content style** (content_style): understand the style to use; it must be strictly followed
- **Content principles** (content_principles): understand the principles and considerations for content creation; they must be strictly observed
- **Image generation prompt** (image_generation_prompt): understand the image style requirements
- **Validation requirement**: if no account persona configuration is found, throw an exception and do not continue content generation
5. **Write the content**: write the content based on the search results and the account persona read from HAP
- **Strictly follow the account persona**: write strictly according to content_style and content_principles read from HAP
- **Local personas are prohibited**: do not reference or use content from the local AGENTS.md file
- **Combine the search material**: combine the retrieved material with the account persona read from HAP to generate content aligned with the positioning
- **Suit the target audience**: ensure the content is suitable for the target audience
6. **Generate cover titles**: generate 5–10 cover titles according to the account persona's content style
- The title style must comply with the account persona's content style
- Titles must match the account positioning and target audience
7. **Select hashtags**: select 5–8 hashtags from the HAP Hashtag Library through dynamic queries
- Select them according to the content topic and the account persona's content direction
8. **Generate image suggestions**: combine the account persona's image generation prompt style with the content topic to generate image suggestions
9. **Save the preview**: save it to a local file using the note directory structure: 内容/小红书/{note_title}/{note_title}.md
10. **Confirm with the user**: confirm the content, titles, and images
11. **Generate images after user confirmation**: read the image generation prompt from the HAP "Account Persona" table, read the image generation configuration from the HAP "API Service Configuration" table, and generate the images
12. **Confirm publication**: ask whether to publish directly to Xiaohongshu
13. **Confirm synchronization**: ask whether to synchronize the content to HAP, and upload only after confirmation
14. **Synchronize to HAP after user confirmation**: synchronize it to the HAP "Content Management" table with platform_type = 小红书
- **Upload only images**: upload the cover image and other image URLs to HAP
- **Do not upload the Markdown document**: do not synchronize the Xiaohongshu note's Markdown document to HAP
15. **Publish the content after user confirmation**: use Playwright to publish to Xiaohongshu
16. **Update the status**: update the HAP publishing status and content URLUser: Generate a week of Xiaohongshu notes, 7 posts in total, with these topics:
1. New Claude Code features
2. Recommended AI tools
3. Large-model application scenarios
...
Execution flow:
1. **Confirm the MCP**: confirm the currently connected HAP application MCP
2. **Batch generation**: repeat the preceding workflow for each topic
3. **Dynamically read the configuration**: read the image generation configuration from the HAP "API Service Configuration" table whenever images are generated
4. **Save in bulk**: generate the content in bulk and save it to the HAP "Content Management" table with platform_type = 小红书User: Publish this note to both Xiaohongshu and WeChat Official Account
Execution flow:
1. **Confirm the MCP**: confirm the currently connected HAP application MCP
2. **Read the content**: read the content from the HAP "Content Management" table with platform_type = 小红书
3. **Dynamically obtain the worksheet**: dynamically obtain the ID and field structure of the "Content Management" table
4. **Adapt the format**: adapt the content to the format requirements of each platform:
- Xiaohongshu: 300–400 Chinese characters and 5–8 hashtags
- WeChat Official Account: 2,000–5,000 Chinese characters in HTML format
5. **Publish the content**: publish it separately to both platforms
6. **Update HAP**: create a new record in the HAP "Content Management" table with platform_type = 微信公众号, or update the existing record's publishing statussocial-media-operation/
├── AGENTS.md # Account persona configuration (optional local reference file)
├── 笔记生成工作流.md # Workflow documentation
├── 内容/ # Content root directory
│ └── 小红书/ # Platform categories: 小红书/抖音/微信公众号/视频号
│ └── {note_title}/ # One directory per note, using the cover title as the directory name
│ ├── {note_title}.md # Markdown document, named after the note title
│ └── 配图/ # Image directory
│ ├── 封面图.png
│ ├── 架构图.png
│ └── 应用场景图.png
├── 话题库/ # Hashtag library (optional local reference file)
│ └── {type}.md
└── README.md # Project documentation
Directory structure notes:
- 内容/: root directory containing content for all platforms
- 小红书/: platform directory containing all note titles for that platform
- {note_title}/: note directory using the note title as the directory name for greater clarity
- {note_title}.md: Markdown document named after the note title
- 配图/: image directory containing all images for the note
Example:
内容/
└── 小红书/
└── 什么是 MCP?/ # Note title used as the directory name
├── MCP科普介绍.md # Markdown document
└── 配图/
├── 封面图.png
├── 架构图.png
└── 应用场景图.png
Notes:
- Account persona and Hashtag Library data are stored uniformly in HAP
- Local files are provided only as references; actual usage reads from HAP tables
- Content is organized by note directory, with each note containing an md document and images
- Directory names use note titles for greater clarityplatform_typeget_app_worksheets_list()get_app_info()get_record_list()get_app_worksheets_list()get_app_info()get_app_worksheets_list()account_persona账号人设get_record_list()platform_typecontent_stylecontent_principlesAGENTS.mdcontent_stylecontent_principlesimage_generation_prompt