# 🚀 SEO Multi-Channel Skills - Installation & Testing Guide

**Last Updated:** 2026-03-08  
**Status:** ✅ Ready for Testing

---

## 📦 INSTALLATION

### **Step 1: Install Python Dependencies**

```bash
# Navigate to skills directory
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills

# Option A: Install all at once (recommended)
pip install "pythainlp[default]" pyyaml python-dotenv pandas aiohttp tqdm rich markdown python-frontmatter GitPython Pillow

# Option B: Install per skill
pip install -r seo-multi-channel/scripts/requirements.txt
pip install -r seo-analyzers/scripts/requirements.txt
```

### **Step 2: Verify Installation**

```bash
# Test PyThaiNLP
python3 -c "from pythainlp import word_tokenize; print(word_tokenize('บริการ podcast hosting'))"

# Expected output: ['บริการ', ' ', 'podcast', ' ', 'hosting']
```

### **Step 3: Install with Conda (Alternative)**

```bash
# If using conda instead of pip
conda install pythainlp
pip install pyyaml python-dotenv pandas tqdm rich
```

---

## 🧪 TESTING COMMANDS

### **Test 1: Keyword Analyzer (seo-analyzers)**

```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-analyzers/scripts

python3 thai_keyword_analyzer.py \
  --text "บริการ podcast hosting ที่ดีที่สุดช่วยให้คุณเผยแพร่ podcast ไปยัง Apple Podcasts, Spotify ได้ง่าย" \
  --keyword "บริการ podcast" \
  --language th
```

**Expected Output:**
```
📊 Keyword Analysis Results

Keyword: บริการ podcast
Word Count: 15
Occurrences: 2
Density: 13.33% (target: 1.0-1.5%)
Status: too_high

💡 Recommendations:
  • ลดการใช้คำหลักลง อาจถูกมองว่า keyword stuffing
```

---

### **Test 2: Readability Analyzer (seo-analyzers)**

```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-analyzers/scripts

python3 thai_readability.py \
  --text "มาเริ่ม podcast กันเลย! ไม่ต้องรอให้พร้อม 100% แค่มีไอเดียดีๆ กับไมค์หนึ่งอัน คุณก็เริ่มต้นได้แล้ว" \
  --output text
```

**Expected Output:**
```
📖 Thai Readability Analysis

Sentence Count: 3
Word Count: 28
Avg Sentence Length: 9.3 words

Grade Level: ง่าย (ม.6-ม.9)
Formality: กันเอง (Casual)

Readability Score: 75/100
```

---

### **Test 3: Content Quality Scorer (seo-analyzers)**

```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-analyzers/scripts

python3 content_quality_scorer.py \
  --text "# คู่มือ Podcast Hosting

บริการ podcast hosting เป็นสิ่งสำคัญสำหรับ podcaster ทุกคน..." \
  --keyword "podcast hosting" \
  --output text
```

**Expected Output:**
```
⭐ Content Quality Score

Overall Score: 65.0/100
Status: fair
Action: Address priority fixes

Category Scores:
  • Keyword Optimization: 15/25
  • Readability: 18/25
  • Structure: 17/25
  • Brand Voice: 15/25
```

---

### **Test 4: Multi-Channel Generation (seo-multi-channel)**

```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-multi-channel/scripts

python3 generate_content.py \
  --topic "บริการ podcast hosting" \
  --channels facebook google_ads blog \
  --language th \
  --output test-output
```

**Expected Output:**
```
🎯 Generating content for: บริการ podcast hosting
📱 Channels: facebook, google_ads, blog
🌐 Language: th

  Generating facebook...
  [Image Generation] Would generate image for facebook
    Topic: บริการ podcast hosting, Type: social
    
  Generating google_ads...
  Generating blog...

✅ Results saved to: output/บริการ-podcast-hosting/results.json

📊 Summary:
  Topic: บริการ podcast hosting
  Channels generated: 3
    - facebook: 5 variations
    - google_ads: 3 variations
    - blog: 1 variations

✨ Done!
```

---

### **Test 5: Create Context Files (seo-context)**

```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-context/scripts

python3 context_manager.py \
  --create \
  --project "/Users/kunthawatgreethong/Gitea/opencode-skill/test-website" \
  --industry "podcast" \
  --formality "normal"
```

**OR using --action:**

```bash
python3 context_manager.py \
  --action create \
  --project "/Users/kunthawatgreethong/Gitea/opencode-skill/test-website" \
  --industry "podcast"
```

**Expected Output:**
```
📝 Context Manager
Project: /Users/kunthawatgreethong/Gitea/opencode-skill/test-website

Creating context files...
Industry: podcast
Audience: Thai audience
Formality: normal

✅ Context created successfully!

📁 Created files:
  ✓ brand-voice.md
  ✓ target-keywords.md
  ✓ seo-guidelines.md
  ✓ internal-links-map.md
  ✓ data-services.json
  ✓ style-guide.md

📍 Location: /Users/kunthawatgreethong/Gitea/opencode-skill/test-website/context
```

---

## 🐛 TROUBLESHOOTING

### **Error: No module named 'pythainlp'**

```bash
# Solution: Install PyThaiNLP
pip install pythainlp

# Or with conda
conda install pythainlp
```

### **Error: yaml.parser.ParserError**

```bash
# Solution: Template files have been fixed
# Pull latest version or manually fix YAML syntax
# Check that template values don't have unquoted text with special chars
```

### **Error: unrecognized arguments: --create**

```bash
# Solution: Use either --create flag OR --action create
python3 context_manager.py --create --project ./my-website

# OR
python3 context_manager.py --action create --project ./my-website
```

### **Error: PyThaiNLP download failed**

```bash
# Solution: Skip download - basic tokenizers work without it
# PyThaiNLP includes built-in tokenizers that work immediately
pip install pythainlp
# That's enough for basic functionality
```

### **Thai text displays as garbage characters**

```bash
# Solution: Ensure UTF-8 encoding
export PYTHONIOENCODING=utf-8
python3 your_script.py
```

---

## 📊 EXPECTED BEHAVIOR

### **What Works Now:**

✅ Thai keyword density analysis  
✅ Thai readability scoring  
✅ Content quality scoring (0-100)  
✅ Multi-channel content generation (structure)  
✅ Context file creation  
✅ YAML template loading  
✅ CLI argument parsing  

### **What's Placeholder:**

⏳ Actual content generation (returns template structure)  
⏳ Image generation/edit integration (design ready)  
⏳ Website auto-publish (design ready)  
⏳ API connectors for analytics (manager pattern ready)  

---

## 🎯 NEXT STEPS AFTER TESTING

1. **Run all 5 tests above**
2. **Report any bugs** (unexpected errors)
3. **Test with your real content**
4. **Customize templates** for your brand voice
5. **Integrate with actual LLM** for content generation (future)

---

## 📞 SUPPORT

If you encounter issues:

1. Check error message carefully
2. Verify all dependencies installed
3. Try with simple Thai text first
4. Check file encoding is UTF-8
5. Report bug with full error traceback

---

**All core features are implemented and ready for testing!** 🎉
