feat: add @electric-sql/playbook package with AI coding assistant skills#3775
feat: add @electric-sql/playbook package with AI coding assistant skills#3775KyleAMathews wants to merge 26 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New package with CLI commands: install, list-skills, read-skill - Skills for Electric ecosystem: quickstart, TanStack integration, security, deployment, production - Skills added to @electric-sql/client: shapes, auth, http-api - CI workflow for detecting stale skills when source files change - Thin pointer system: only router skill installed, loads others as needed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Comment |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3775 +/- ##
==========================================
- Coverage 87.36% 87.36% -0.01%
==========================================
Files 23 23
Lines 2011 2050 +39
Branches 528 541 +13
==========================================
+ Hits 1757 1791 +34
- Misses 252 257 +5
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add @types/node to @electric-sql/agent devDependencies - Format check-skill-staleness.mjs with prettier Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CI expects all packages to have a coverage script. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Router skill now shows the full ecosystem and how to load skills from: - @tanstack/db-skills (npx db-skills show) - @durable-streams/client (cat from node_modules) - @electric-sql/agent (npx read-skill) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
pnpm only symlinks direct dependencies to node_modules, so users who only have @durable-streams/state won't have the client symlinked. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use list/show pattern instead of hardcoding skill names. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Per updated RFC, rename package and CLI commands: - Package: @electric-sql/agent → @electric-sql/playbook - Binary: electric-agent → electric-playbook - Commands: list-skills → list, read-skill → show - Env var: ELECTRIC_AGENT_SKILLS_DIR → ELECTRIC_PLAYBOOK_SKILLS_DIR Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- @tanstack/db-playbook - @durable-streams/playbook - @electric-sql/playbook Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy-paste-ready TanStack Start + Electric setup including: - Prerequisites checklist (nitro, server.ts, etc.) - Complete proxy helper functions - SSR/SPA mode configuration with link to official docs - Troubleshooting section for common errors - File structure reference Based on user testing feedback that skills need to be "the working example, explained" not conceptual fragments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Complete proxy implementation guide including: - Helper function pattern (prepareElectricUrl, proxyElectricRequest) - ELECTRIC_PROTOCOL_QUERY_PARAMS usage and why it matters - Headers to delete (content-encoding, content-length) - Headers to add (Vary for cache isolation) - Framework examples: TanStack Start, Next.js, Express, Hono - Electric Cloud auth (source_id, secret) - Anti-patterns section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace deprecated @tanstack/react-start/server pattern with current createFileRoute + server.handlers pattern. Also adds Vary header for cache isolation and updates skill cross-references. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the three pieces needed for TanStack Start SPA mode: 1. defaultSsr: false in createStart 2. shellComponent pattern in root route 3. nitro plugin for server routes Links to official TanStack Start SPA mode guide. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Router skill (electric) now has quick reference table of all skills - electric-security-check links to proxy and auth skills - electric-auth links to proxy and setup skills Helps agents discover related skills when only one is loaded. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
electric-tanstack-integration: - SSR-safe URL construction (typeof window check) - Timestamp parser for Date conversion - txid generation with ::xid cast (critical!) - drizzle-zod schema integration - localOnlyCollectionOptions for auth state tanstack-start-quickstart: - Docker compose with wal_level=logical - Caddy/HTTP2 setup for optimal performance - better-auth integration with TanStack Start - Protected routes pattern (_authenticated) - Environment variables reference Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep the critical txid generation pattern but remove drizzle-specific schema setup - that belongs in a separate drizzle skill. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive guide covering: - Database connection setup with node-postgres - Schema definition patterns (identity columns, arrays, timestamps) - drizzle-zod integration for generating Zod schemas - Critical txid generation with ::xid cast for Electric sync - Migration workflow with drizzle-kit - Query patterns with user scoping - Type inference and null handling - Common patterns (soft deletes, optimistic locking) Includes security note about not leaking server schemas to client and updated syntax for Drizzle v1.0.0-beta.2+ array changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Zod v4 support is being added but not fully stable yet. Recommend staying on Zod v3.25.x for now. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Based on user testing feedback: 1. SSR-safe URLs: Use `new URL(..., window.location.origin)` pattern - Relative URLs like '/api/todos' fail during SSR - Must construct full absolute URL 2. Collection preloading: Add `collection.preload()` in route loaders - Prevents flash of empty state - Ensures data ready before component renders 3. One route per table (security): Emphasize that each table needs its own API route with hardcoded table name - Server controls table, not client - Generic /api/shapes?table=X is a security hole Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Treat shape URLs like regular API calls - pass business logic arguments via query params or route params, and let the server map them to actual Electric shape queries. This maintains the security boundary where clients never control the shape directly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Standardize on ELECTRIC_SOURCE_ID/ELECTRIC_SECRET (not SOURCE_*) - electric-shapes: Add security warning, partitioned tables, log modes, subset snapshots, offset=now - electric-http-api: Add security note, SSE keep-alive details, auto-fallback behavior, Caddy/Apache proxy configs - AGENTS.md: Change Docker image from :canary to :latest Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🤖 Agent Skills Staleness Check Skills potentially affected by this PRThe following skills reference source files that were modified: deploying-electric (@electric-sql/playbook)
electric (@electric-sql/playbook)
electric-go-live (@electric-sql/playbook)
electric-quickstart (@electric-sql/playbook)
electric-security-check (@electric-sql/playbook)
electric-tanstack-integration (@electric-sql/playbook)
tanstack-start-quickstart (@electric-sql/playbook)
Action needed: Review these skills and update if necessary. |
Without this, Electric won't accept unauthenticated requests in local development. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- README: Add grep tip for finding skills by keyword - README: Add missing tanstack-start-quickstart to skills table - electric-tanstack-integration: Add Common Errors table with solutions - electric-tanstack-integration: Add explicit SSR routing hint Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| @@ -0,0 +1,118 @@ | |||
| --- | |||
| name: electric | |||
| description: Electric sync engine for Postgres - routes to appropriate skills for building local-first apps | |||
There was a problem hiding this comment.
for all electric stuff — not "local-first"
Summary
Adds
@electric-sql/playbook- a new package providing AI coding assistant skills for building local-first apps with Electric and TanStack DB. Also adds skills to@electric-sql/client.User impact: AI coding assistants (Claude Code, Cursor, Copilot, etc.) can now get contextual guidance when building Electric apps via
npx @electric-sql/playbook install.Approach
Architecture
The skills system has three components:
electric) - Lightweight overview that agents load first, explains what Electric is and what help is available.claude/skills/,.cursor/skills/, etc.) that reference the full skills in the npm packageCLI Commands
Skills Included
@electric-sql/playbook:
electric- Router/overview skillelectric-quickstart- New project setupelectric-tanstack-integration- Collections, live queries, mutationselectric-security-check- Security audit checklistelectric-go-live- Production readinessdeploying-electric- Cloud/Docker/self-hosted deployment@electric-sql/client:
electric-shapes- Shapes API referenceelectric-auth- Auth patternselectric-http-api- HTTP API referenceRelated Playbooks
The Electric ecosystem has three playbook packages (each with
listandshowcommands):@electric-sql/playbook- Electric sync patterns (this PR)@tanstack/db-playbook- TanStack DB patterns@durable-streams/playbook- Durable Streams patternsCI Automation
Added GitHub workflow that detects when source files change and comments on PRs if skills may need updating (staleness detection).
Key Invariants
Non-goals
Verification
Files Changed
packages/playbook/- New package with CLI and skillspackages/typescript-client/skills/- Skills for the client packagepackages/typescript-client/package.json- Added "skills" to files array.github/workflows/skill-staleness.yml- CI for detecting stale skillsscripts/check-skill-staleness.mjs- Script to check which skills reference changed files.changeset/add-agent-skills.md- Changeset for versioning🤖 Generated with Claude Code