Skip to content

rileyvibecodes/meta-pixel-capi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meta Pixel + CAPI Skill

Fail-closed Meta Pixel + Conversions API orchestration for Claude Code.

Covers 8 platforms. Enforces SHA-256 hashing, event deduplication, source validation, and security checks. Blocks output if any integrity check fails.

Supported Platforms

Platform Type
Next.js Route handler CAPI
React Backend proxy CAPI
Shopify Native Meta channel + custom CAPI
WordPress Server hook / endpoint CAPI
GoHighLevel Workflow CAPI action
ClickFunnels Native settings + CAPI
Webflow Custom code embed + backend CAPI
Static HTML Manual Pixel + server endpoint

Unsupported platforms get a structured fallback contract with explicit limitations.

What It Does

When you ask Claude to implement Meta Pixel + CAPI tracking, this skill:

  1. Detects the platform from your query
  2. Validates all source URLs are live and current (14-day max age for Meta docs)
  3. Loads platform-specific implementation recipe
  4. Enforces 19 rules covering dedup, hashing, security, and platform requirements
  5. Outputs a deterministic 7-section implementation plan
  6. Blocks output if any source is stale, rule is unmapped, or security pattern is violated

Fail-Closed Architecture

The skill will refuse to generate output and return a BLOCKED status with reason codes if:

  • Any Meta source document is older than 14 days
  • A rule references a source that doesn't exist in the registry
  • The configured Graph API version is invalid
  • A platform reference file is missing required sections
  • Secret patterns or wildcard CORS are detected in fixtures

Installation

Option 1: Claude Code Plugin (recommended)

/plugin add rileyvibecodes/meta-pixel-capi

The skill becomes available as /meta-pixel-capi:meta-pixel-capi.

Option 2: Manual Installation

Copy directly into your project:

cp -r skills/meta-pixel-capi .claude/skills/meta-pixel-capi

Or install globally (available in all projects):

cp -r skills/meta-pixel-capi ~/.claude/skills/meta-pixel-capi

Option 3: Cross-Tool (Cursor, Codex, Gemini CLI)

This skill follows the Agent Skills open standard. Copy skills/meta-pixel-capi/ into your tool's skill directory:

Tool Path
Cursor .cursor/skills/meta-pixel-capi/
Codex .codex/skills/meta-pixel-capi/
Gemini CLI .gemini/skills/meta-pixel-capi/

Usage

Ask Claude to implement Meta tracking on any supported platform:

Set up Meta Pixel and CAPI on my Next.js app
Audit my Shopify Meta tracking because EMQ score is low
My GoHighLevel funnel shows duplicate Lead events in Events Manager

The skill auto-triggers on queries mentioning Meta Pixel, CAPI, Conversions API, EMQ, dedup, or event match quality combined with a supported platform name.

What's Enforced

Hashing Protocol

  • SHA-256 on all user_data fields: em, ph, fn, ln, db, ct, st, zp, country, ge, external_id
  • Never hash: client_ip_address, client_user_agent, fbp, fbc, event_id
  • Output: 64-character lowercase hex

Normalization

Field Rule
Email Lowercase + trim
Phone E.164 (strip non-numeric, add country code)
Names Lowercase + trim
ZIP 5-digit US
Country ISO 3166-1 alpha-2 lowercase

Security

  • Server tokens in environment variables only (never client-side)
  • No wildcard CORS (Access-Control-Allow-Origin: *)
  • Secret pattern detection across all skill files
  • Zero secret echo policy (mask with ****)

Purchase Events

Every Purchase event must include value (float), currency (ISO 4217), content_ids (array), and content_type for ROAS optimization.

Event Deduplication

Shared event_id between browser Pixel (eventID parameter) and server CAPI (event_id field). Both events must fire for the same user action.

Validation

Run the built-in validator:

python3 skills/meta-pixel-capi/validator/validate.py --strict --platform all

Run the full eval suite (56 tests across 4 groups):

python3 skills/meta-pixel-capi/evals/run-evals.py

Skip URL liveness checks (for CI):

python3 skills/meta-pixel-capi/evals/run-evals.py --skip-liveness

Test Coverage

Group Tests What It Checks
Trigger Classification 20 Correct activation on Meta+CAPI queries, no false positives
Scenario Assertions 20 Platform references, fixtures, checks, sources, security
Fail-Closed Mutations 4 Stale sources, missing rules, unsupported platforms, invalid API
Source URL Liveness 12 All reference URLs return HTTP 200

File Structure

skills/meta-pixel-capi/
├── SKILL.md                          # Execution contract
├── manifests/
│   ├── platform-matrix.json          # 8 Tier-1 platform definitions
│   ├── rule-registry.json            # 19 enforcement rules
│   └── source-registry.json          # 12 allowlisted source URLs
├── references/
│   ├── core/
│   │   ├── capi-baseline.md          # Hashing, normalization, timing
│   │   ├── contract.md               # 7-section output contract
│   │   ├── ios-aem-context.md        # iOS 14.5+ and AEM context
│   │   └── unsupported-fallback.md   # Fallback for non-Tier-1 stacks
│   ├── platforms/                    # 8 platform-specific recipes
│   ├── security/                     # Secret handling + networking policy
│   └── troubleshooting/              # Common failure modes
├── validator/
│   ├── validate.py                   # 6-check integrity validator
│   ├── patterns.py                   # Secret + CORS regex patterns
│   └── fixtures/                     # Test data for validator
├── evals/
│   ├── run-evals.py                  # 56-test eval runner
│   ├── evals.json                    # Scenario assertions
│   ├── trigger-eval.json             # Trigger classification tests
│   └── stress-tests.json             # Fail-closed mutation tests
└── reports/
    ├── verification-report.md        # Launch verification (READY)
    ├── eval-report.json              # Structured eval results
    └── latest.json                   # Latest validation run

CI/CD

GitHub Actions workflow included. Add to your repo:

name: meta-pixel-capi-validate

on:
  pull_request:
    paths:
      - '.claude/skills/meta-pixel-capi/**'
  push:
    paths:
      - '.claude/skills/meta-pixel-capi/**'

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - run: python3 .claude/skills/meta-pixel-capi/validator/validate.py --strict --platform all
      - run: python3 .claude/skills/meta-pixel-capi/evals/run-evals.py --skip-liveness

Requirements

  • Python 3.11+ (for validator and evals)
  • No external dependencies (stdlib only)

License

MIT

About

Fail-closed Meta Pixel + Conversions API skill for Claude Code. 8 platforms, 19 rules, 56 tests. Agent Skills open standard compatible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors