4.1 KiB
name, description
| name | description |
|---|---|
| save-post | Save posts to the links application via REST API. Use when user says /save-post, "save post", "save this as post", or wants to save content to the links application for future reference. Creates posts with title, content, summary, and tags via HTTP POST to the links API endpoint. |
Save Post Skill
Save posts to your links application with a simple command or script.
Quick Start
# Basic usage
python3 scripts/save_post.py --title "My Post Title" --content "Post content here"
# With summary and tags
python3 scripts/save_post.py --title "Django Notes" --content "Today I learned..." --summary "Learning Django REST Framework" --tags "django,api,notes"
# From JSON input
echo '{"title": "Test", "content": "Content", "tags": ["test"]}' | python3 scripts/save_post.py --json
API Integration
This skill connects to your links application's REST API to save posts.
API Endpoint
POST http://links.apps.svc.cluster.local/api/posts- Requires: title, content
- Optional: summary, tags (list of strings)
Example API Request
curl -X POST http://links.apps.svc.cluster.local/api/posts \
-H "Content-Type: application/json" \
-d '{
"title": "My Post",
"content": "Post content here",
"summary": "Brief summary",
"tags": ["tag1", "tag2"]
}'
Usage Patterns
1. Direct Command
When the user explicitly says "save this as a post" or provides content:
python3 scripts/save_post.py \
--title "会议记录" \
--content "# 项目讨论\n\n## 决定\n1. 采用新的架构\n2. 下周开始开发" \
--summary "项目讨论会议记录" \
--tags "meeting,project,notes"
2. From Conversation Context
When extracting content from conversation:
python3 scripts/save_post.py --json << 'EOF'
{
"title": "关于AI助手的安全考虑",
"content": "用户今天询问了关于AI助手的安全配置问题...",
"summary": "AI助手安全配置讨论",
"tags": ["ai", "security", "conversation"]
}
EOF
3. Integration with Other Commands
Combine with other tools to save output:
# Save command output as a post
ls -la | python3 scripts/save_post.py --title "Directory Listing" --content "$(cat)" --summary "Current directory listing"
Tag Management
Tags are automatically created if they don't exist. Use simple, lowercase tag slugs:
django,python,api(good)Django REST Framework,Python Code(avoid - will be slugified)
Error Handling
The script provides clear error messages:
- 400: Missing required fields (title, content)
- 404: API endpoint not found
- 500: Server error
Check response for details when errors occur.
Customization
Change API Endpoint
python3 scripts/save_post.py --api-url "http://localhost:8000/api/posts" --title "Test" --content "Content"
Environment Variables (optional)
You can set default API URL:
export LINKS_API_URL="http://your-instance/api/posts"
Search Posts (Bonus)
After saving posts, you can search them:
curl "http://links.apps.svc.cluster.local/api/posts/search/?q=django&page=1&page_size=10"
Common Workflows
Save Meeting Notes
python3 scripts/save_post.py \
--title "$(date +'%Y-%m-%d 会议记录')" \
--content "$(cat meeting_notes.md)" \
--tags "meeting,notes,work"
Save Code Snippets
python3 scripts/save_post.py \
--title "Django API View Example" \
--content "$(cat api_view.py)" \
--summary "Example Django REST Framework view" \
--tags "django,api,code-example"
Save Research Notes
python3 scripts/save_post.py \
--title "AI Agent Architecture Patterns" \
--content "$(cat research.md)" \
--summary "Research on modern AI agent architectures" \
--tags "ai,architecture,research"
Script Reference
scripts/save_post.py
Main script for saving posts. Supports:
- Command-line arguments
- JSON stdin input
- Tag management
- Error handling
- Configurable API endpoint
Run python3 scripts/save_post.py --help for full usage.
Remember: Posts are saved to your links application and can be accessed at http://links.apps.svc.cluster.local/ui/posts/ or via the API.