# CLAUDE.md

## Overview

Content strategy tool for SEO-driven content planning. Performs content inventory via sitemap crawl and our-seo-agent CLI, scores content performance, detects content decay, analyzes topic gaps vs competitors, maps topic clusters, and generates content briefs. Supports Korean content patterns (Naver Blog format, review/후기 content).

## Quick Start

```bash
pip install -r scripts/requirements.txt

# Content audit
python scripts/content_auditor.py --url https://example.com --json

# Content gap analysis
python scripts/content_gap_analyzer.py --target https://example.com --competitor https://competitor.com --json

# Generate content brief
python scripts/content_brief_generator.py --keyword "치과 임플란트 비용" --url https://example.com --json
```

## Scripts

| Script | Purpose | Key Output |
|--------|---------|------------|
| `content_auditor.py` | Content inventory, performance scoring, decay detection | Content inventory with scores and decay flags |
| `content_gap_analyzer.py` | Topic gap analysis and cluster mapping vs competitors | Missing topics, cluster map, editorial calendar |
| `content_brief_generator.py` | Generate SEO content briefs with outlines | Brief with outline, keywords, word count targets |
| `base_client.py` | Shared utilities | RateLimiter, ConfigManager, BaseAsyncClient |

## Content Auditor

```bash
# Full content audit
python scripts/content_auditor.py --url https://example.com --json

# Detect decaying content
python scripts/content_auditor.py --url https://example.com --decay --json

# Filter by content type
python scripts/content_auditor.py --url https://example.com --type blog --json
```

**Capabilities**:
- Content inventory via sitemap crawl + our-seo-agent CLI or pre-fetched data
- Performance scoring (traffic, rankings, backlinks)
- Content decay detection (pages losing traffic over time)
- Content type classification (blog, product, service, landing, resource)
- Word count and freshness assessment
- Korean content format analysis (Naver Blog style, 후기/review content)

## Content Gap Analyzer

```bash
# Gap analysis vs competitor
python scripts/content_gap_analyzer.py --target https://example.com --competitor https://comp1.com --json

# With topic cluster mapping
python scripts/content_gap_analyzer.py --target https://example.com --competitor https://comp1.com --clusters --json
```

**Capabilities**:
- Topic gap identification vs competitors
- Topic cluster mapping (pillar + cluster pages)
- Content freshness comparison
- Content volume comparison
- Editorial calendar generation with priority scoring
- Korean content opportunity detection

## Content Brief Generator

```bash
# Generate brief for keyword
python scripts/content_brief_generator.py --keyword "치과 임플란트 비용" --url https://example.com --json

# With competitor analysis
python scripts/content_brief_generator.py --keyword "dental implant cost" --url https://example.com --competitors 5 --json
```

**Capabilities**:
- Content outline generation with H2/H3 structure
- Target keyword list (primary + secondary + LSI)
- Word count recommendation based on top-ranking pages
- Competitor content analysis (structure, word count, topics covered)
- Internal linking suggestions
- Korean content format recommendations

## Data Sources

| Source | Purpose |
|--------|---------|
| `our-seo-agent` CLI | Primary data source (future); use `--input` for pre-fetched JSON |
| WebSearch / WebFetch | Supplementary live data |
| Notion MCP | Save audit report to database |

## Output Format

```json
{
  "url": "https://example.com",
  "content_inventory": {
    "total_pages": 150,
    "by_type": {"blog": 80, "product": 40, "service": 20, "other": 10},
    "avg_performance_score": 45
  },
  "decaying_content": [...],
  "top_performers": [...],
  "gaps": [...],
  "clusters": [...],
  "timestamp": "2025-01-01T00:00:00"
}
```

## Notion Output (Required)

**IMPORTANT**: All audit reports MUST be saved to the OurDigital SEO Audit Log database.

### Database Configuration

| Field | Value |
|-------|-------|
| Database ID | `2c8581e5-8a1e-8035-880b-e38cefc2f3ef` |
| URL | https://www.notion.so/dintelligence/2c8581e58a1e8035880be38cefc2f3ef |

### Required Properties

| Property | Type | Description |
|----------|------|-------------|
| Issue | Title | Report title (Korean + date) |
| Site | URL | Audited website URL |
| Category | Select | Content Strategy |
| Priority | Select | Based on gap severity |
| Found Date | Date | Audit date (YYYY-MM-DD) |
| Audit ID | Rich Text | Format: CONTENT-YYYYMMDD-NNN |

### Language Guidelines

- Report content in Korean (한국어)
- Keep technical English terms as-is
- URLs and code remain unchanged
