sincronizar-d1

Reseeds Cloudflare D1 state domains from repository source code via a parameterized update.

Updated Jun 10, 2026
One-click install
npx skills add https://github.com/saulo-fl/armado-en-mexico --skill sincronizar-d1-saulo-fl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sincronizar-d1
Source: https://github.com/saulo-fl/armado-en-mexico/tree/main/.claude/skills/sincronizar-d1
Command: npx skills add https://github.com/saulo-fl/armado-en-mexico --skill sincronizar-d1-saulo-fl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? In the "Armado en México" site, the client store hydrates from the D1 database, which overrides the seed data shipped in the code. Publishing changes to data.js or DEFAULT_PAGES alone leaves returning visitors seeing the stale catalog stored in D1, so fixes in the repo never reach production until D1 is reseeded. ## Core Features & Use Cases - Dry-run diff: Compares the code-derived catalog against what D1 currently serves, showing sizes, counts, and marker strings without writing anything. - Safe reseed: Writes the code-derived domain (armas or pages) to production D1 with a single atomic parameterized UPDATE through the Cloudflare D1 query API. - Admin-edit protection: Warns about ids that exist only in D1 (possible admin-created entries) that would be lost by reseeding. - Use Case: After publishing thirteen new firearm entries to data.js, run the script to discover production still serves the old count, then apply the reseed and verify D1 matches the code. ## Quick Start Ask the AI to run the sincronizar-d1 reseed script for the armas domain in dry-run mode first, review the diff, and then apply it to D1 after your confirmation.

Frequently Asked Questions about sincronizar-d1

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync Cloudflare D1 database content from local source code?▼

Run the resembrar script with a domain argument (armas or pages) to diff code-derived data against production, then rerun with --aplicar to write. It sends one parameterized UPDATE to the Cloudflare D1 query API using the wrangler auth token.

Why do published code changes not appear on my Cloudflare Pages site?▼

The client store hydrates state from the D1-backed /api/state endpoint, which overrides the seed data bundled in the code. Returning visitors keep seeing the old D1 catalog until the database is reseeded from the updated source.

How to avoid SQLITE_TOOBIG when writing large JSON to Cloudflare D1?▼

Pass the JSON as a query parameter instead of embedding it in the SQL statement. The D1 query API accepts parameters of at least 220 KB, making the UPDATE atomic without chunking or temporary rows.

When should I not reseed D1 from the code repository?▼

Do not reseed when the diff warns of ids present only in D1, since those may be entries created through the admin panel that reseeding would delete. Changes made in the admin panel should be uploaded with the admin sync button instead.

Does the reseed script require wrangler authentication?▼

Yes, it requires an authenticated wrangler session, verified with npx wrangler whoami. The script obtains an OAuth token via wrangler auth token and uses it to call the Cloudflare D1 query API.