Rewrite skill scripts to use API instead of direct SQLite access #124

Open
opened 2026-03-23 03:33:23 +00:00 by cal · 1 comment
Owner

Summary

Two scripts in ~/.claude/skills/paper-dynasty/scripts/ directly import sqlite3 and query a local SQLite database. These need to be rewritten to use the Paper Dynasty API (via the CLI or api_client.py) now that the database is PostgreSQL-only.

Affected files

  • ~/.claude/skills/paper-dynasty/scripts/generate_summary.py — uses sqlite3.connect() for card counts, new players, and comparison reports
  • ~/.claude/skills/paper-dynasty/scripts/validate_database.py — uses sqlite3.connect() for card validation checks

Fix

Rewrite both scripts to use the paperdomo CLI or api_client.py instead of direct database access. This aligns with the skill's own rule: "NEVER access local SQLite directly."

Note

The skill's SKILL.md line "NEVER access local SQLite directly" (line 64) is still correct as a rule — it's the scripts themselves that violate it.

## Summary Two scripts in `~/.claude/skills/paper-dynasty/scripts/` directly import `sqlite3` and query a local SQLite database. These need to be rewritten to use the Paper Dynasty API (via the CLI or `api_client.py`) now that the database is PostgreSQL-only. ## Affected files - `~/.claude/skills/paper-dynasty/scripts/generate_summary.py` — uses `sqlite3.connect()` for card counts, new players, and comparison reports - `~/.claude/skills/paper-dynasty/scripts/validate_database.py` — uses `sqlite3.connect()` for card validation checks ## Fix Rewrite both scripts to use the `paperdomo` CLI or `api_client.py` instead of direct database access. This aligns with the skill's own rule: "NEVER access local SQLite directly." ## Note The skill's SKILL.md line "NEVER access local SQLite directly" (line 64) is still correct as a rule — it's the scripts themselves that violate it.
Claude added the
ai-working
label 2026-03-23 04:01:10 +00:00
Claude removed the
ai-working
label 2026-03-23 04:08:53 +00:00
Collaborator

Opened PR #125: #125

Both scripts have been rewritten to use api_client.PaperDynastyAPI instead of sqlite3:

  • generate_summary.py: now takes --cardset-id / --env flags; fetches card counts from GET /battingcards and GET /pitchingcards, player count from GET /players. The two-DB rarity-change comparison was dropped (not possible via API).
  • validate_database.py: now takes --cardset-id / --env flags; validates that cards exist and every player in the cardset has at least one card. Raw field-level validation (groundout_b, percentages) was dropped — those fields are auth-protected in the API; enforcement happens via Pydantic validators at upload time.

Note: the actual script files live in cal/claude-configs (~/.claude/skills/paper-dynasty/scripts/). The database repo commit adds a CLAUDE.md note documenting this constraint.

Opened PR #125: https://git.manticorum.com/cal/paper-dynasty-database/pulls/125 Both scripts have been rewritten to use `api_client.PaperDynastyAPI` instead of `sqlite3`: - **`generate_summary.py`**: now takes `--cardset-id` / `--env` flags; fetches card counts from `GET /battingcards` and `GET /pitchingcards`, player count from `GET /players`. The two-DB rarity-change comparison was dropped (not possible via API). - **`validate_database.py`**: now takes `--cardset-id` / `--env` flags; validates that cards exist and every player in the cardset has at least one card. Raw field-level validation (groundout_b, percentages) was dropped — those fields are auth-protected in the API; enforcement happens via Pydantic validators at upload time. Note: the actual script files live in `cal/claude-configs` (`~/.claude/skills/paper-dynasty/scripts/`). The database repo commit adds a CLAUDE.md note documenting this constraint.
Claude added the
ai-pr-opened
label 2026-03-23 04:09:03 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-database#124
No description provided.