agentleFS
indranilbanerjeeindranilbanerjee/contentforge/skills/cf-switch-backend/SKILL.md

cf-switch-backend

Skill30 starsChanged 6 months agoMITView on GitHub

Switch ContentForge's tracking and delivery backend between Google Sheets + Drive, Airtable, and local filesystem — guiding credential setup, verifying access, optionally migrating existing tracking records and output files (migration is additive and never deletes source data), and updating tracking.backend in the brand profile so the next run uses it immediately. Triggers on \"/contentforge:cf-switch-backend\", \"switch tracking to Airtable\", \"move tracking to Google Sheets\", \"which backend am I using\", \"migrate my tracking data\". Runs backend-migrator.py, sheets-tracker.py, airtable-tracker.py, or local-tracker.py; --status reports current backend health. Pairs with /contentforge:cf-cowork-setup for the Cowork Drive route and /contentforge:cf-style-guide, whose Step G sets the initial backend.

  • Reads credentials

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 10 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the active brand profile's tracking.backend field.

    line 35
  2. Very specific:

    Check AIRTABLE_TOKEN environment variable exists

    line 47
  3. Distinctive:

    If missing, guide through setup:

    line 48
  4. Very specific:

    Create a Personal Access Token with data.records:read and data.records:write scopes

    line 50
  5. Very specific:

    Ask for the Airtable Base ID (from the base URL: airtable.com/appXXXXXXXXX/...)

    line 53
  6. Distinctive:

    Verify access by running:

    line 54
  7. Very specific:

    Check Google credentials at ~/.claude-marketing/google-credentials.json

    line 60
  8. Distinctive:

    Create a project (or use existing)

    line 63
  9. Distinctive:

    Create a Service Account and download the JSON key

    line 65
  10. Distinctive:

    Create a Google Sheet and share it with the service account email (Editor)

    line 67
  11. Distinctive:

    Create a Google Drive folder and share it with the service account email (Editor)

    line 68
  12. Distinctive:

    Ask for the Google Sheet ID and Drive folder ID

    line 69
  13. Distinctive:

    No setup needed — works immediately

    line 76
  14. Distinctive:

    Run init to ensure directory exists:

    line 77
  15. Distinctive:

    If the current backend has existing records:

    line 84
  16. Very specific:

    Run with --status flag to check current backend health:

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Switch Tracking Backend

Switch ContentForge's tracking and delivery backend between Google Sheets + Drive, Airtable, or Local filesystem. Optionally migrate existing tracking data and output files to the new backend.

When to Use

  • Switching from local (default) to a cloud backend for collaboration
  • Migrating from Google to Airtable (or vice versa) for simpler auth
  • Downgrading to local when cloud access isn't needed
  • Checking current backend status before switching

Running in Cowork? The "local" backend writes to the ephemeral sandbox filesystem — files vanish at session end. For Cowork team setups, use the Google (Drive) route and run /contentforge:cf-cowork-setup first to wire the Drive folder layout.

How to Use

/contentforge:cf-switch-backend airtable
/contentforge:cf-switch-backend google_sheets
/contentforge:cf-switch-backend local
/contentforge:cf-switch-backend --status

What This Command Does

Step 1: Identify Current Backend

Read the active brand profile's tracking.backend field.

Report current state:

Current backend: local
Records: 47 tracking records (~/.claude-marketing/{brand}/tracking/tracking.json)
Output files: 42 files in ~/.claude-marketing/{brand}/outputs/{YYYY}/{MM}/

Step 2: Validate Target Backend

If switching to Airtable:

  1. Check AIRTABLE_TOKEN environment variable exists
  2. If missing, guide through setup:
    • Go to airtable.com/create/tokens
    • Create a Personal Access Token with data.records:read and data.records:write scopes
    • Select the base that will hold tracking data
    • Set the environment variable: export AIRTABLE_TOKEN=patXXXXXXXX
  3. Ask for the Airtable Base ID (from the base URL: airtable.com/appXXXXXXXXX/...)
  4. Verify access by running:
    python {scripts_dir}/airtable-tracker.py --action init --base-id {base_id}

If switching to Google Sheets + Drive:

  1. Check Google credentials at ~/.claude-marketing/google-credentials.json
  2. If missing, guide through setup:
    • Go to Google Cloud Console > IAM & Admin > Service Accounts
    • Create a project (or use existing)
    • Enable Google Sheets API and Google Drive API
    • Create a Service Account and download the JSON key
    • Save to ~/.claude-marketing/google-credentials.json
    • Create a Google Sheet and share it with the service account email (Editor)
    • Create a Google Drive folder and share it with the service account email (Editor)
  3. Ask for the Google Sheet ID and Drive folder ID
  4. Verify access by running:
    python {scripts_dir}/sheets-tracker.py --action init --sheet-id {sheet_id}

If switching to Local:

  • No setup needed — works immediately
  • Run init to ensure directory exists:
    python {scripts_dir}/local-tracker.py --action init --brand "{brand}"

Step 3: Offer Migration

If the current backend has existing records:

You have 47 tracking records and 42 output files on 'local'.
Would you like to migrate this data to Airtable?
  1. Yes — Copy all records and files to the new backend
  2. No — Start fresh (existing data preserved but not synced)
  3. Skip — Just switch, decide on migration later

If yes, run:

python {scripts_dir}/backend-migrator.py --action migrate --brand "{brand}" --from {current} --to {target} [backend-specific args]

{current} and {target} must be one of local, airtable, google_sheets — the migrator rejects any other value.

Report migration results:

Migration complete:
  Records migrated: 47
  Files migrated: 42
  Files failed: 0
  Source data preserved at: ~/.claude-marketing/{brand}/tracking/tracking.json
                        and ~/.claude-marketing/{brand}/outputs/{YYYY}/{MM}/

Step 4: Get explicit approval, then update the brand profile

Do not write the brand profile until the user explicitly approves this exact change — even when Step 3 had nothing to migrate and asked nothing. Show the change first:

About to switch {brand}'s tracking backend:
  tracking.backend: {current} → {target}
  New config: {backend-specific keys and values, secrets masked}
  Existing data: preserved in place (never deleted)
Type "yes" to apply, anything else to cancel.

Anything other than an explicit yes cancels the switch with no files changed. This gate is the safety boundary on every platform: Claude Code honours this skill's disable-model-invocation: true, but other hosts (Codex documents the field as unsupported) can invoke the skill without the user typing its command.

On approval, update the brand profile JSON:

  • Set tracking.backend to the new backend value
  • Fill in backend-specific config (base_id, sheet_id, folder_id, etc.)

Step 5: Report

Backend switched to Airtable.
  New tracking records → Airtable base appXXXXXX
  Output files → Airtable attachment fields
  Previous data preserved at: ~/.claude-marketing/{brand}/tracking/tracking.json
                          and ~/.claude-marketing/{brand}/outputs/{YYYY}/{MM}/

Run /contentforge:cf-switch-backend --status to verify anytime.

Backend Comparison

FactorGoogle Sheets + DriveAirtableLocal
Auth setupService account (~5 min)Personal token (~2 min)None
TrackingGoogle SheetsAirtable recordsJSON file
File deliveryGoogle DriveAttachment fieldLocal filesystem
CollaborationShare via GoogleShare via AirtableSingle user
Free tier15GB Drive1,000 records + 10GBUnlimited
OfflineNoNoYes

Check Status

Run with --status flag to check current backend health:

/contentforge:cf-switch-backend --status

This runs:

python {scripts_dir}/backend-migrator.py --action status --brand "{brand}" --from {current_backend}

Important Notes

  • Migration is additive — source data is never deleted
  • Migration is idempotent for records that carry a requirement_id — dedup is keyed on that field, so records without one are re-written on every run
  • Migration is resumable on the same basis — re-running after an interruption skips whatever already landed with a matching requirement_id
  • Migrating from google_sheets moves records only — downloading the linked Drive files is not implemented yet, so rows arrive without their attachments (the source Drive copies are untouched)
  • You can switch back anytime — data is preserved on all backends you've used
  • The pipeline uses whichever backend is set in tracking.backend — switching takes effect immediately for the next content run

Related Skills

  • /contentforge:cf-style-guide — Brand setup (Step G sets initial backend)
  • /contentforge:cf-cowork-setup — Wire Cowork + Drive before choosing the Google backend in Cowork
  • /contentforge:cf-integrations — Check all connector status
  • /contentforge:cf-connect — Set up individual connectors

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.