test-repo/skills/daily-digest/SKILL.md

224 lines
5.2 KiB
Markdown

---
name: daily-digest
description: Daily digest creation workflow - research, format, and publish to blog. Runs at 7am daily. Uses Tavily for research, formats with proper title, publishes to blog API. NO Vercel mentions ever.
---
# daily-digest
**Orchestrator Skill** - Creates and publishes the daily digest to blog.twisteddevices.com.
## Purpose
Run every morning at 7am CST to:
1. Research top stories in target categories via Tavily
2. Extract content from top articles
3. Format digest with proper title format
4. Publish to blog API (NOT Vercel - no Vercel notes ever!)
5. Handle duplicates gracefully
## Authentication
```bash
export BLOG_API_URL="https://blog.twisteddevices.com/api"
export BLOG_MACHINE_TOKEN="21719c689a355e40b427a35c548b28699bd7c014aac4d23f5c1bbb122bbb9878"
```
## Title Format (MANDATORY)
**ALWAYS use this exact format:**
```
## Daily Digest - <FULL_DATE>
Example: ## Daily Digest - Monday, March 2, 2026
```
- Day of week: Full name (Monday, Tuesday, etc.)
- Month: Full name (January, February, March, etc.)
- Day: Number (1, 2, 3, etc.)
- Year: 4-digit year (2026)
**CRITICAL:** This format is required - never use any other title format!
## Workflow
### Step 1: Check for Existing Digest
```bash
source ~/.agents/skills/blog-backup/lib/blog.sh
TODAY=$(date +%Y-%m-%d)
if blog_post_status "$TODAY"; then
echo "Digest already exists for today - delete it first"
# Get existing ID and delete
EXISTING=$(curl -s "$BLOG_API_URL/messages?date=eq.$TODAY" -H "Authorization: Bearer $BLOG_MACHINE_TOKEN" | jq -r '.[0].id')
if [ -n "$EXISTING" ]; then
blog_post_delete "$EXISTING"
fi
fi
```
### Step 2: Research Categories
Research these 4 categories using Tavily:
1. **iOS/Apple AI** - iOS development, Apple AI, Swift
2. **AI Coding Assistants** - Claude Code, Cursor, AI coding tools
3. **OpenClaw/AI Agents** - OpenClaw updates, AI agent news
4. **Entrepreneurship** - Indie hacking, startups, side projects
**Tavily search commands:**
```bash
cd ~/.openclaw/workspace
./tavily-search.sh "iOS 26 Apple AI development" -n 5
./tavily-search.sh "Claude Code Cursor AI coding assistant" -n 5
./tavily-search.sh "OpenClaw AI agents updates" -n 5
./tavily-search.sh "indie hacking entrepreneurship startup" -n 5
```
### Step 3: Extract Top Articles
For each category, extract 2-3 articles using Tavily or direct content extraction.
**Target:** 7-10 articles total across 4 categories
### Step 4: Format Digest Content
**Use this template:**
```markdown
## Daily Digest - <FULL_DATE>
### iOS & Apple AI News
**[Article Title]**
[2-3 sentence summary]
[Read more](URL)
---
### AI Coding Assistants
**[Article Title]**
[2-3 sentence summary]
[Read more](URL)
---
### OpenClaw & AI Agents
**[Article Title]**
[2-3 sentence summary]
[Read more](URL)
---
### Entrepreneurship & Indie Hacking
**[Article Title]**
[2-3 sentence summary]
[Read more](URL)
---
*Generated by OpenClaw*
```
### Step 5: Publish to API
```bash
source ~/.agents/skills/blog-backup/lib/blog.sh
TODAY=$(date +%Y-%m-%d)
FULL_DATE=$(date +"%A, %B %-d, %Y") # e.g., "Monday, March 2, 2026"
# Prepend title to content
CONTENT="## Daily Digest - $FULL_DATE
$ARTICLE_CONTENT"
# Create digest
DIGEST_ID=$(blog_post_create \
--date "$TODAY" \
--content "$CONTENT" \
--tags '["daily-digest", "iOS", "AI", "Apple", "OpenClaw"]')
echo "Digest created: $DIGEST_ID"
```
### Step 6: Handle Duplicates
**BEFORE publishing, check and remove existing digest for today:**
```bash
# Check for existing
EXISTING=$(curl -s "$BLOG_API_URL/messages?date=eq.$TODAY" \
-H "Authorization: Bearer $BLOG_MACHINE_TOKEN" | jq -r '.[0].id // empty')
if [ -n "$EXISTING" ]; then
echo "Deleting existing digest: $EXISTING"
curl -s -X DELETE "$BLOG_API_URL/messages" \
-H "x-api-key: $BLOG_MACHINE_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"id\": \"$EXISTING\"}"
fi
```
## Cron Configuration
**Schedule:** Every day at 7:00 AM CST (America/Chicago)
**Environment variables required:**
```bash
export BLOG_API_URL="https://blog.twisteddevices.com/api"
export BLOG_MACHINE_TOKEN="21719c689a355e40b427a35c548b28699bd7c014aac4d23f5c1bbb122bbb9878"
export TAVILY_API_KEY="your-tavily-key" # if not auto-loaded
```
## Common Issues
### "No digest found" after posting
- The API endpoint for status check uses `/messages`, not `/digest`
- Check directly: `curl -s "$BLOG_API_URL/messages?date=eq.$TODAY"`
### Duplicate digests
- ALWAYS delete existing digest before creating new one
- Use the duplicate check Step 6 above
### Vercel deployment issues
- **NEVER mention Vercel in the digest content**
- The blog is hosted on Vercel but we don't talk about that
- If there's an infrastructure issue, handle it silently
## Files
```
~/.agents/skills/daily-digest/
├── SKILL.md # This file
└── lib/
└── daily-digest.sh # Helper functions (optional)
```
## Usage
```bash
# Run the full workflow
source ~/.agents/skills/daily-digest/lib/daily-digest.sh
run_daily_digest
```
Or manually run each step following the workflow above.
---
**REMEMBER:**
- Title format: `## Daily Digest - <FULL_DATE>`
- NO Vercel mentions
- Delete duplicates before posting
- Use blog API (not Vercel CLI)