wrdslisted
Install: claude install-skill kennethkhoocy/applied-micro-skills
# WRDS (Wharton Research Data Services)
Reusable patterns for connecting to WRDS and querying its databases from Python.
## Prerequisites
1. Install the client library:
```bash
pip install wrds
```
2. Credentials live in a libpq `.pgpass` file with the line format:
```
wrds-pgdata.wharton.upenn.edu:9737:wrds:your_wrds_username:PASSWORD
```
Point the environment variable `PGPASSFILE` at that file, or place it at the OS-default libpq location (`%APPDATA%\postgresql\pgpass.conf` on Windows, `~/.pgpass` elsewhere). Set `$WRDS_USERNAME` (or `$PGUSER`) to your account.
3. **Never hardcode passwords** in scripts, CLAUDE.md, or any version-controlled file. The `.pgpass` mechanism handles authentication automatically.
## Authentication: fail fast, never retry
WRDS locks an account after a few consecutive failed logins, and unlocking it requires a request to WRDS support. The `wrds` package makes this easy to trigger by accident. `wrds.Connection()` authenticates through the `.pgpass` file, and when that file is missing or its password has expired, the package silently falls back to an interactive `input()`/`getpass()` prompt and then retries. In an unattended agent session the prompt has no human to answer it, so the run either hangs on stdin or the attempt fails and gets repeated, where each repeat is another failed login against the account.
To prevent that, **always connect through the bundled guard `scripts/wrds_connect.py`, and never call `wrds.Connec