Auto create connector

From vana-com/data-connectors · View interactive version

Auto create connector is an AI agent skill from the GitHub repository vana-com/data-connectors. Autonomously create, test, and validate a data connector for any web platform — end to end. Use when asked to "auto-create a connector", "automatically build a connector", or when a connector needs to be created from scratch and tested without manual guidance. Triggers on: "auto-create", "auto conne

How to use this skill

Skill file

Autonomous Data Connector Creator

Create data connectors end-to-end with minimal human intervention. The agent writes a

Playwright connector script, tests it against the live site, validates the output, and

iterates until quality. For platforms with complex auth (Google, Uber, Cloudflare-protected

sites), the agent asks the user to log in once via a headed browser, then works autonomously.

Input

commonly useful personal data (profile, content, settings).

Authentication Strategy

Three-tier login (cascading)

| Tier | Method | Best for |

|------|--------|----------|

| 1 | Session from browser profile | All platforms — reuses previous login |

| 2 | Automated credentials (.env) | Simple login forms (LinkedIn, Spotify) |

| 3 | Manual login via capture-session | Complex auth (Google, Uber, Cloudflare, 2FA) |

Credentials in `.env`

USER_LOGIN_TWITTER=user@example.com
USER_PASSWORD_TWITTER=secretpassword

Pattern: USER_LOGIN_<PLATFORM_UPPER> and USER_PASSWORD_<PLATFORM_UPPER>.

Session Capture (for complex auth)

For platforms where automated login will likely fail (Google, Uber, Amazon, etc.):

node capture-session.cjs <platform> <login-url>

This opens a headed browser. The user logs in manually (handles CAPTCHAs, 2FA, OAuth).

The session persists in ~/.pdp-connect/desktop/browser-profiles/<platform>-playwright/ and is

automatically reused by the connector during testing.

Workflow

Execute steps IN ORDER. Do not skip validation. Do not skip testing.


Step 1 — Research the Platform

Goal: Understand the platform's data landscape, login flow, and extraction strategy.

Actions (do all of these):

  1. Web search for the platform's APIs:
  1. Identify these specifics:

Use stable selectors: input[name="username"], input[type="password"], button[type="submit"].

Note if login is multi-step (email first, then password on next page).

  1. Choose extraction strategy (in order of preference):
  1. Define scopes — what data categories to export. Each becomes a platform.scope key.

Optional — Browser-based API discovery:

If web search doesn't reveal clear APIs, use Chrome browser automation tools to:

  1. Navigate to the platform
  2. Use read_network_requests to discover API endpoints fired during normal browsing
  3. Inspect page structure with get_page_text or read_page for selector identification

Save your research findings — you'll reference them when writing the connector.


Step 1.5 — Ensure Session (if needed)

Goal: Make sure a valid browser session exists for platforms with complex auth.

Determine if session capture is needed:

protection, multi-step login, phone verification, or device-based auth

If session capture IS needed:

  1. Check for existing session:

```bash

ls sessions/<platform>.json 2>/dev/null && echo "Session exists" || echo "No session"

```

  1. Check if the browser profile exists:

```bash

ls ~/.pdp-connect/desktop/browser-profiles/<platform>-playwright/ 2>/dev/null && echo "Profile exists" || echo "No profile"

```

  1. If no session/profile, tell the user and run capture:

```bash

node capture-session.cjs <platform> <login-url> --timeout 300

```

This opens a headed browser. Wait for the user to log in (up to 5 minutes).

Use --timeout 600 for slower platforms. Use --check-url <url> if auto-detection

struggles (e.g., --check-url myaccount.google.com).

  1. Verify the session was captured:

```bash

cat sessions/<platform>.json | head -5

```

If session capture is NOT needed: skip to Step 2.


Step 2 — Create Connector Files

Read these reference files for patterns, API reference, and templates:

IMPORTANT: File locations. The scripts directory is at scripts/. Connector files go in the

connectors/ directory at the repo root:

data-connectors/              ← repo root
├── connectors/
│   └── <company>/            ← connector files go HERE
│       ├── <name>-playwright.js
│       └── <name>-playwright.json
├── schemas/                  ← schemas go HERE
│   └── <platform>.<scope>.json
├── registry.json             ← update this in Step 7
└── scripts/                  ← you are here (working directory)

Create these files:

  1. ../connectors/<company>/<name>-playwright.json — Metadata file
  1. ../connectors/<company>/<name>-playwright.js — Connector script
  1. ../schemas/<platform>.<scope>.json (schemas remain at repo root level) — One per scope
Three-Tier Login Pattern

The connector MUST implement cascading login:

const PLATFORM_LOGIN = process.env.USER_LOGIN_PLATFORMNAME || '';
const PLATFORM_PASSWORD = process.env.USER_PASSWORD_PLATFORMNAME || '';

// ... checkLoginStatus() and performLogin() defined above ...

// In the main flow:
let isLoggedIn = await checkLoginStatus();

// Tier 1: Session from browser profile (automatic)
if (isLoggedIn) {
  await page.setData('status', 'Session restored from browser profile');
}

// Tier 2: Automated login with .env credentials
if (!isLoggedIn && PLATFORM_LOGIN && PLATFORM_PASSWORD) {
  await performLogin();
  isLoggedIn = await checkLoginStatus();
}

// Tier 3: Manual login via headed browser (always works)
if (!isLoggedIn) {
  await page.showBrowser('https://platform.com/login');
  await page.promptUser(
    'Please log in to Platform. Login will be detected automatically.',
    async () => await checkLoginStatus(),
    2000
  );
  isLoggedIn = true;
}

await page.goHeadless();
// ... data collection ...

Automated login tips (for Tier 2):

```javascript

const nativeInputValueSetter = Object.getOwnPropertyDescriptor(

window.HTMLInputElement.prototype, 'value'

).set;

nativeInputValueSetter.call(emailInput, ${loginStr});

emailInput.dispatchEvent(new Event('input', { bubbles: true }));

```


Step 3 — Validate Structure

Run the structural validator:

node validate-connector.cjs ../connectors/<company>/<name>-playwright.js

This checks:

Fix ALL errors before proceeding. Warnings are advisory.

Re-run the validator after each fix until the report shows "valid": true.


Step 4 — Test

Check if session or credentials are available:

# Check for captured session (from Step 1.5)
ls ~/.pdp-connect/desktop/browser-profiles/<platform>-playwright/ 2>/dev/null && echo "Session profile exists" || echo "No session profile"

# Check for .env credentials
grep -q "USER_LOGIN_<PLATFORM_UPPER>" .env 2>/dev/null && echo "Credentials found" || echo "No credentials"

Run the connector:

# If session profile exists, headless mode works (session auto-restored):
node test-connector.cjs ../connectors/<company>/<name>-playwright.js --headless

# If no session and no credentials, run headed (Tier 3 manual login will trigger):
node test-connector.cjs ../connectors/<company>/<name>-playwright.js

What happens:

  1. The playwright-runner spawns a browser (headless or headed)
  2. The connector tries three-tier login:
  1. Data collection: fetches all scoped data
  2. Result is saved to ./connector-result.json

If the playwright-runner is not found: The test-connector.cjs will show an error.

Set PLAYWRIGHT_RUNNER_DIR env var pointing to the playwright-runner directory.

Monitor the test output for:


Step 5 — Validate Output

After the test produces connector-result.json, validate it:

node validate-connector.cjs ../connectors/<company>/<name>-playwright.js --check-result ./connector-result.json

This checks:

All errors must pass. If output validation fails, proceed to Step 6.


Step 6 — Iterate

If testing or output validation fails:

  1. Read the validation report — identify what failed
  2. Read the test output — look for error messages, unexpected behavior
  3. Diagnose the root cause:
  1. Fix the connector script (and/or schemas)
  2. Re-run the test: node test-connector.cjs ../connectors/<company>/<name>-playwright.js --headless
  3. Re-validate output
  4. Repeat until all checks pass

Maximum 3 iterations. If still failing after 3 attempts, report what's wrong and

ask for guidance rather than continuing to loop.

Debugging tips:


Step 7 — Finalize & Register

Once all validations pass:

  1. Generate checksums:

```bash

shasum -a 256 ../connectors/<company>/<name>-playwright.js | awk '{print "sha256:" $1}'

shasum -a 256 ../connectors/<company>/<name>-playwright.json | awk '{print "sha256:" $1}'

```

  1. Add entry to ../registry.json (paths in the registry use connectors/ prefix):

Read the existing registry, then add a new entry to the connectors array:

```json

{

"id": "<name>-playwright",

"company": "<company>",

"version": "1.0.0",

"name": "<PlatformDisplayName>",

"description": "Exports your <Platform> <data description> using Playwright browser automation.",

"files": {

"script": "connectors/<company>/<name>-playwright.js",

"metadata": "connectors/<company>/<name>-playwright.json"

},

"checksums": {

"script": "sha256:<script_checksum>",

"metadata": "sha256:<metadata_checksum>"

}

}

```

Also update the lastUpdated field to today's date.

  1. Report success with:
  1. PR instructions — tell the user:

```

To create a pull request:

cd .. && git add connectors/<company>/ schemas/ registry.json

git commit -m "feat: add <platform> connector"

git push origin <branch>

gh pr create --title "feat: add <platform> connector"

```


Success Criteria

A connector is COMPLETE when ALL of these are true:

Critical Rules

  1. page.evaluate() takes a STRING — page.evaluate('...') not page.evaluate(() => ...)
  2. Variable interpolation — JSON.stringify() to pass variables into evaluate strings
  3. Never use obfuscated CSS classes — no .x1lliihq, .css-1dbjc4n. Use ARIA roles, data attributes, semantic HTML
  4. Always rate-limit — page.sleep(300-1000) between API calls
  5. Always handle errors — check for _error or non-ok responses in API calls
  6. IIFE wrapper required — script body must be (async () => { ... })()
  7. Credentials stay on-device — never send tokens/passwords to external servers
  8. Credentials from .env — read via process.env.USER_LOGIN_<PLATFORM> / process.env.USER_PASSWORD_<PLATFORM> (for Tier 2)
  9. Always include Tier 3 fallback — page.promptUser for manual login ensures connectors work even without credentials or sessions
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.