@opendirectory.dev/skills 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/registry.json +1 -1
- package/skills/meta-ads-skill/README.md +24 -55
- package/skills/meta-ads-skill/meta-ads-skill/SKILL.md +35 -18
- package/skills/meta-ads-skill/meta-ads-skill/references/report_templates.md +4 -3
- package/skills/meta-ads-skill/meta-ads-skill/references/workflows.md +11 -15
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"name": "meta-ads-skill",
|
|
206
|
-
"description": "Use when interacting with the Meta Ads
|
|
206
|
+
"description": "Use when interacting with the Meta Ads CLI to manage accounts, campaigns, ads, and insights. Act as an Expert Media Buyer.",
|
|
207
207
|
"tags": [],
|
|
208
208
|
"author": "opendirectory",
|
|
209
209
|
"version": "0.0.1",
|
|
@@ -28,9 +28,9 @@ https://github.com/user-attachments/assets/ee98a1b5-ebc4-452f-bbfb-c434f2935067
|
|
|
28
28
|
|
|
29
29
|
## Overview
|
|
30
30
|
|
|
31
|
-
The **Meta Ads Skill** is a comprehensive, production-ready
|
|
31
|
+
The **Meta Ads Skill** is a comprehensive, production-ready skill designed to give LLMs and AI agents expert-level capabilities to orchestrate the official **Meta Ads Python CLI**.
|
|
32
32
|
|
|
33
|
-
By using this skill, an agent transforms into an **Expert Media Buyer**. It will know exactly how to
|
|
33
|
+
By using this skill, an agent transforms into an **Expert Media Buyer**. It will know exactly how to explore ad structures, troubleshoot campaign performance (like CPA spikes), discover new audiences, and format massive Meta APIs JSON payloads into beautiful, readable markdown reports.
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
@@ -39,63 +39,36 @@ By using this skill, an agent transforms into an **Expert Media Buyer**. It will
|
|
|
39
39
|
This skill is designed using a **Progressive Disclosure (Hub-and-Spoke)** architecture to maximize context window efficiency:
|
|
40
40
|
|
|
41
41
|
1. **The Hub (`SKILL.md`)**: The primary entry point. It provides strict guardrails, safety protocols, and the authentication troubleshooting workflow.
|
|
42
|
-
2. **The Spokes (`references/`
|
|
42
|
+
2. **The Spokes (`references/`)**:
|
|
43
43
|
- When you need to perform a specific task (e.g., investigating a CPA spike), read `references/workflows.md` for the exact step-by-step orchestration strategy.
|
|
44
44
|
- When presenting data to the user, read `references/report_templates.md` to strictly follow the required Markdown layout.
|
|
45
|
-
- **Data Parsing**: Meta Ads JSON responses are massive. *Always* use the provided `scripts/formatters.py` to condense raw JSON from `get_campaigns`, `get_adsets`, or `get_insights` into clean markdown tables before reasoning over them.
|
|
46
45
|
|
|
47
46
|
### Strict Agent Guardrails
|
|
48
47
|
* **Context Protection**: ALWAYS default to `time_range="last_7d"` for insights. ALWAYS use `limit=10` for listing campaigns/adsets initially.
|
|
49
|
-
* **Safety First**: NEVER execute state-changing tools (`create_campaign`, `update_campaign
|
|
48
|
+
* **Safety First**: NEVER execute state-changing tools (`create_campaign`, `update_campaign`) without explicitly showing the parameters to the user and waiting for their affirmative confirmation.
|
|
50
49
|
|
|
51
50
|
---
|
|
52
51
|
|
|
53
|
-
## Installation & Setup
|
|
52
|
+
## Installation & Setup
|
|
54
53
|
|
|
55
|
-
To use this skill,
|
|
54
|
+
To use this skill, you must install the official Meta Ads CLI and configure your credentials.
|
|
56
55
|
|
|
57
|
-
### 1.
|
|
58
|
-
-
|
|
59
|
-
- A **Meta Developer Account** with a configured App.
|
|
60
|
-
|
|
61
|
-
### 2. Configure the Meta App
|
|
62
|
-
1. Go to the [Facebook Developers Portal](https://developers.facebook.com/).
|
|
63
|
-
2. Create an App and add the **Marketing API** product.
|
|
64
|
-
3. Under the Facebook Login settings, add `http://localhost:8000/auth/facebook/callback` to the **Valid OAuth Redirect URIs**.
|
|
65
|
-
4. Retrieve your **App ID** and **App Secret**.
|
|
66
|
-
|
|
67
|
-
### 3. Server Setup
|
|
68
|
-
Clone the MCP repository:
|
|
56
|
+
### 1. Install the CLI
|
|
57
|
+
The skill relies on the `meta-ads` Python package:
|
|
69
58
|
```bash
|
|
70
|
-
|
|
71
|
-
cd Meta-Ads-MCP
|
|
72
|
-
pip install -r requirements.txt
|
|
59
|
+
pip install meta-ads
|
|
73
60
|
```
|
|
74
61
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
FB_REDIRECT_URI="http://localhost:8000/auth/facebook/callback"
|
|
81
|
-
DATABASE_URL="sqlite:///.meta-ads-mcp/oauth.db"
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Authentication Workflow
|
|
87
|
-
|
|
88
|
-
The server uses OAuth backed by a local SQLite database to seamlessly pass tokens to the MCP context.
|
|
89
|
-
|
|
90
|
-
1. **Start the local Auth Server**:
|
|
91
|
-
```bash
|
|
92
|
-
python src/auth/run_web_server.py
|
|
93
|
-
```
|
|
94
|
-
2. **Authenticate**: Open `http://localhost:8000/auth/facebook` in your web browser.
|
|
95
|
-
3. **Grant Permissions**: Click "Connect Facebook" and approve the `ads_management`, `ads_read`, and `read_insights` permissions.
|
|
96
|
-
4. **Completion**: The OAuth token is saved securely to the SQLite DB. The agent can now use the MCP tools automatically without needing the token pasted into the prompt.
|
|
62
|
+
### 2. Authentication (System User Token)
|
|
63
|
+
The CLI uses a **System User Access Token** for authentication.
|
|
64
|
+
1. Generate a System User Token in your [Meta Business Suite](https://business.facebook.com/settings/system-users).
|
|
65
|
+
2. Ensure the token has `ads_management`, `ads_read`, and `read_insights` permissions.
|
|
66
|
+
3. Set the following environment variables on your machine:
|
|
97
67
|
|
|
98
|
-
|
|
68
|
+
```bash
|
|
69
|
+
export ACCESS_TOKEN="your_system_user_access_token"
|
|
70
|
+
export AD_ACCOUNT_ID="act_your_ad_account_id"
|
|
71
|
+
```
|
|
99
72
|
|
|
100
73
|
---
|
|
101
74
|
|
|
@@ -109,16 +82,12 @@ meta-ads-skill/
|
|
|
109
82
|
references/
|
|
110
83
|
report_templates.md # Standardized markdown report structures
|
|
111
84
|
workflows.md # Orchestration strategies (e.g., CPA troubleshooting)
|
|
112
|
-
scripts/
|
|
113
|
-
auth_check.py # Diagnostic script for token status
|
|
114
|
-
formatters.py # JSON -> Markdown table utilities
|
|
115
85
|
```
|
|
116
86
|
|
|
117
|
-
## Supported
|
|
87
|
+
## Supported Commands
|
|
118
88
|
|
|
119
|
-
|
|
120
|
-
* **
|
|
121
|
-
* **
|
|
122
|
-
* **
|
|
123
|
-
* **
|
|
124
|
-
* **Database**: `token_status()`, `clear_database()`, `reset_database()`
|
|
89
|
+
This skill orchestrates the `meta-ads` CLI using a noun-verb structure:
|
|
90
|
+
* **Campaigns**: `meta ads campaign list`, `meta ads campaign create`
|
|
91
|
+
* **Ad Sets**: `meta ads adset list`
|
|
92
|
+
* **Ads**: `meta ads ad list`
|
|
93
|
+
* **Insights**: `meta ads insights get`
|
|
@@ -1,41 +1,58 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: meta-ads-expert
|
|
3
|
-
description: Use when interacting with the Meta Ads
|
|
3
|
+
description: Use when interacting with the Meta Ads CLI to manage accounts, campaigns, ads, and insights. Act as an Expert Media Buyer.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Meta Ads Expert Skill
|
|
7
7
|
|
|
8
|
-
**Persona:** You are an Expert Media Buyer. This skill acts as a router, providing high-level instructions and linking to detailed references
|
|
8
|
+
**Persona:** You are an Expert Media Buyer. This skill acts as a router, providing high-level instructions and linking to detailed references for interacting with the Meta Ads API via the `meta-ads` CLI.
|
|
9
9
|
|
|
10
10
|
## Authentication & Setup
|
|
11
11
|
|
|
12
|
-
The Meta Ads
|
|
12
|
+
The Meta Ads CLI uses a **System User Access Token** for authentication.
|
|
13
13
|
|
|
14
|
-
###
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
3. **Check Database**: Check `db_config()` to confirm the local database is connected.
|
|
19
|
-
4. **Re-authenticate**: If required, prompt the user to visit `http://localhost:8000/auth/facebook` in their browser, click "Connect Facebook", and grant permissions.
|
|
14
|
+
### Environment Variables
|
|
15
|
+
Ensure the following environment variables are set in the environment where the CLI is executed:
|
|
16
|
+
- `ACCESS_TOKEN`: Your Meta System User Access Token.
|
|
17
|
+
- `AD_ACCOUNT_ID`: Your target Ad Account ID (e.g., `act_123456789`).
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
**CRITICAL:** NEVER use inline tokens in commands (e.g., `meta ads --token <TOKEN>`). Always rely on environment variables or pre-configured config files.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
## CLI Routing
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Map your intent to the following `meta-ads` CLI commands:
|
|
24
|
+
|
|
25
|
+
| Intent | CLI Command |
|
|
26
|
+
|---|---|
|
|
27
|
+
| List Ad Accounts | `meta ads account list` |
|
|
28
|
+
| List Campaigns | `meta ads campaign list` |
|
|
29
|
+
| List Ad Sets | `meta ads adset list` |
|
|
30
|
+
| List Ads | `meta ads ad list` |
|
|
31
|
+
| Get Insights | `meta ads insights get` |
|
|
32
|
+
| Create Campaign | `meta ads campaign create` |
|
|
26
33
|
|
|
27
34
|
## Strict Guardrails
|
|
28
35
|
|
|
29
|
-
###
|
|
36
|
+
### Command Execution
|
|
37
|
+
- **JSON Output**: ALWAYS use `--output json` for all read operations to ensure structured data for analysis.
|
|
38
|
+
- **No Input**: ALWAYS use `--no-input` (or equivalent) to prevent the Bash tool from hanging on interactive prompts.
|
|
39
|
+
- **Creation Safety**: ALWAYS use `--status PAUSED` for all creation commands unless the user explicitly requests an active status.
|
|
30
40
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- **
|
|
41
|
+
### Date Ranges & Pagination
|
|
42
|
+
To prevent context window overflow and API rate limits:
|
|
43
|
+
- **Pagination Limits**: When listing items, cap the limit parameter (e.g., `--limit 10`) initially. Only expand if explicitly required.
|
|
44
|
+
- **Date Ranges**: For insights, ALWAYS default to `--time-range last_7d`. Do NOT request larger ranges unless instructed by the user.
|
|
34
45
|
|
|
35
46
|
## Safety Guardrails (State-Changing Actions)
|
|
36
47
|
|
|
37
|
-
You MUST require explicit user confirmation before executing any state-changing
|
|
48
|
+
You MUST require explicit user confirmation before executing any state-changing commands (e.g., `campaign create`, `campaign update`).
|
|
38
49
|
|
|
39
|
-
1. Present the exact parameters to the user.
|
|
50
|
+
1. Present the exact CLI command and parameters to the user.
|
|
40
51
|
2. Ask for explicit approval.
|
|
41
52
|
3. Only proceed if approved.
|
|
53
|
+
|
|
54
|
+
## Orchestration Workflows
|
|
55
|
+
|
|
56
|
+
For complex orchestrations (e.g., CPA spike analysis), see [references/workflows.md](references/workflows.md).
|
|
57
|
+
|
|
58
|
+
For reporting standards and output templates, see [references/report_templates.md](references/report_templates.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Meta Ads Report Templates
|
|
2
2
|
|
|
3
|
-
Use these markdown templates when generating reports and summaries for users.
|
|
3
|
+
Use these markdown templates when generating reports and summaries for users. These templates are designed to be populated using the structured data from the `meta-ads` CLI's JSON output (`--output json`).
|
|
4
4
|
|
|
5
5
|
## 1. Executive Summary Template
|
|
6
6
|
|
|
@@ -10,11 +10,12 @@ Use these markdown templates when generating reports and summaries for users.
|
|
|
10
10
|
## Executive Summary
|
|
11
11
|
[2-3 sentences summarizing the overall performance. E.g., "Account performance remained stable this week with a 5% increase in ROAS, primarily driven by the new Retargeting campaign. However, top-of-funnel CPA has started to rise."]
|
|
12
12
|
|
|
13
|
-
## Key Metrics
|
|
13
|
+
## Key Metrics (Source: `meta ads insights get`)
|
|
14
14
|
- **Spend:** $[Amount] ([+/-]% vs previous period)
|
|
15
15
|
- **Revenue/Conversions:** [Amount] ([+/-]% vs previous period)
|
|
16
16
|
- **CPA:** $[Amount] ([+/-]% vs previous period)
|
|
17
17
|
- **ROAS:** [Amount]x ([+/-]% vs previous period)
|
|
18
|
+
- **CTR:** [Amount]% ([+/-]% vs previous period)
|
|
18
19
|
|
|
19
20
|
## Key Findings
|
|
20
21
|
- **Highlight 1:** [E.g., Campaign X is driving 60% of total conversions at a very efficient CPA.]
|
|
@@ -35,7 +36,7 @@ Use these markdown templates when generating reports and summaries for users.
|
|
|
35
36
|
## The Issue
|
|
36
37
|
[Briefly state the problem. E.g., "CPA increased from $20 to $35 starting on [Date]."]
|
|
37
38
|
|
|
38
|
-
## Root Cause Analysis
|
|
39
|
+
## Root Cause Analysis (Source: `meta ads insights get --level [level]`)
|
|
39
40
|
- **Campaign Level:** [Identify which campaign(s) caused the spike.]
|
|
40
41
|
- **Ad Set Level:** [Identify specific ad sets. Did a lookalike audience degrade? Did a specific placement get expensive?]
|
|
41
42
|
- **Ad Level:** [Identify ad fatigue, drop in CTR, increase in CPM, or decrease in conversion rate.]
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
# Meta Ads Workflows
|
|
2
2
|
|
|
3
|
-
This document outlines complex orchestrations and workflows for common Meta Ads tasks.
|
|
3
|
+
This document outlines complex orchestrations and workflows for common Meta Ads tasks using the `meta-ads` CLI.
|
|
4
4
|
|
|
5
5
|
## 1. CPA Spike Troubleshooting
|
|
6
6
|
|
|
7
7
|
When a client or user asks to investigate a spike in Cost Per Action (CPA), follow this systematic approach:
|
|
8
8
|
|
|
9
9
|
1. **Account Level Overview**
|
|
10
|
-
- **
|
|
11
|
-
- **Tool:** `get_insights` (Level: account)
|
|
10
|
+
- **Command:** `meta ads insights get --level account --time-range last_30d --output json`
|
|
12
11
|
- **Action:** Look at overall account performance over the last 7, 14, and 30 days to identify when the spike started.
|
|
13
12
|
|
|
14
13
|
2. **Campaign Breakdown**
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
14
|
+
- **Command:** `meta ads campaign list --output json`
|
|
15
|
+
- **Command:** `meta ads insights get --level campaign --time-range last_7d --output json`
|
|
17
16
|
- **Action:** Identify which specific campaigns are driving the CPA increase. Compare spend and CPA across active campaigns.
|
|
18
17
|
|
|
19
18
|
3. **Ad Set Deep Dive**
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
19
|
+
- **Command:** `meta ads adset list --campaign-id <ID> --output json`
|
|
20
|
+
- **Command:** `meta ads insights get --level adset --time-range last_7d --output json`
|
|
22
21
|
- **Action:** For the offending campaigns, break down by Ad Set to see if specific audiences or placements are underperforming.
|
|
23
22
|
|
|
24
23
|
4. **Ad & Creative Analysis**
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
24
|
+
- **Command:** `meta ads ad list --adset-id <ID> --output json`
|
|
25
|
+
- **Command:** `meta ads insights get --level ad --time-range last_7d --output json`
|
|
27
26
|
- **Action:** Check if specific ads are experiencing ad fatigue (high frequency, dropping CTR) or if recent changes disrupted the learning phase.
|
|
28
27
|
|
|
29
|
-
5. **
|
|
30
|
-
- **Tool:** `analyze_campaigns`
|
|
31
|
-
- **Action:** Run automated analysis on the specific campaigns to generate actionable recommendations.
|
|
32
|
-
|
|
33
|
-
6. **Synthesis and Reporting**
|
|
28
|
+
5. **Synthesis and Reporting**
|
|
34
29
|
- Use the `CPA Spike Investigation Report` template (found in `report_templates.md`) to structure the findings and recommendations.
|
|
35
30
|
|
|
36
31
|
## 2. New Audience Discovery
|
|
@@ -38,7 +33,7 @@ When a client or user asks to investigate a spike in Cost Per Action (CPA), foll
|
|
|
38
33
|
When a user wants to find new audiences or test new targeting:
|
|
39
34
|
|
|
40
35
|
1. **Review Current Top Performers**
|
|
41
|
-
- **
|
|
36
|
+
- **Command:** `meta ads insights get --level adset --time-range last_30d --output json`
|
|
42
37
|
- **Action:** Identify the ad sets currently delivering the best ROAS/CPA.
|
|
43
38
|
|
|
44
39
|
2. **Generate Audience Ideas**
|
|
@@ -46,6 +41,7 @@ When a user wants to find new audiences or test new targeting:
|
|
|
46
41
|
|
|
47
42
|
3. **Structure the Test**
|
|
48
43
|
- Recommend a campaign structure for testing (e.g., A/B testing with Campaign Budget Optimization (CBO) or Ad Set Budget Optimization (ABO)).
|
|
44
|
+
- **Command Example:** `meta ads campaign create --name "Test_Audience_X" --status PAUSED --no-input`
|
|
49
45
|
|
|
50
46
|
4. **Monitoring**
|
|
51
47
|
- Provide the exact metrics to watch (e.g., CTR, CPC, early conversions) over the next 3-7 days.
|