# Starhorse Access

> Access StarHorse data products including SHboost-2024 and the SH21 EDR3 catalog via gaia.aip.de

- **Type:** Skill
- **Install:** `agentstack add skill-skill-commons-skill-commons-starhorse-access`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [skill-commons](https://agentstack.voostack.com/s/skill-commons)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [skill-commons](https://github.com/skill-commons)
- **Source:** https://github.com/skill-commons/skill-commons/tree/main/skills/starhorse-access

## Install

```sh
agentstack add skill-skill-commons-skill-commons-starhorse-access
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# StarHorse Access — SHboost-2024 & SH21 EDR3

## When to Use
Use this skill for ANY StarHorse-related data work. Two products:

1. **SHboost-2024** — XGBoost-approximated posteriors, public Parquet on S3
2. **SH21 EDR3** — Full Bayesian StarHorse posteriors for Gaia EDR3, via gaia.aip.de TAP

## Data Papers & Acknowledgment
Cite the source papers in any work using these products:
- **SH21 EDR3** — Anders, Khalatyan, Queiroz et al. 2022, *A&A* **658**, A91.
- **SHboost-2024** — Khalatyan, Anders, Chiappini et al. 2024, *A&A* **691**, A98.

These are access instructions only; the catalogs remain the authors' work under their
own terms. Follow the gaia.aip.de data-acknowledgment policy when publishing.

## Quick Decision
- **Nearby stars (= 0.95` for flag-cleaned sample

## Plotting: CMD Hexbin (reproduces paper Figure 5)
```python
fig, ax = plt.subplots(figsize=(7, 7))
hb = ax.hexbin(df['bprp0'], df['mg0'], gridsize=80, cmap='jet',
               norm=mpl.colors.LogNorm(), mincnt=1, edgecolors='none')
ax.invert_yaxis()
ax.set_xlabel(r'$G_{BP} - G_{RP}$')
ax.set_ylabel(r'$M_G$')
```

## Pitfalls
- **Pandas float32 boolean chaining**: `(df['col'] > 0) & (df['col2'] < 1)` — wrap EVERY comparison in parentheses for float32 columns.
- **ADQL vs PostgreSQL**: `get_one_query()` uses `language='postgresql'`. ADQL via `run_sync()` is simpler for routine queries.
- **`run_sync()` returns pyvo TAPResults, NOT DataFrame**. Use `.to_qtable().to_pandas()` or `pd.DataFrame({c: data[c] for c in data.colnames})`. Column names are in `.colnames`, NOT `.fieldnames`.
- **Run in foreground**. PostgreSQL TAP jobs on gaia.aip.de typically complete in ~17 s for 200 k rows (verified 2026-06-30), but use `timeout=300` to be safe. If you launch via `terminal(background=true)`, the job keeps running after the session ends and creates stray completion nudges. Run the query script in foreground.
- **Data quality: ~98.6 % valid rows**. A `LIMIT 200000` query returns ~197 k rows with non-null bprp0/mg0. The ~1.4 % nulls are stars lacking BPRP or MG photometry. Always check `.notna()` before plotting.
- **`submit_job` returns immediately; `job.run()` starts execution**. You must call both.
- **Timeout on `job.wait()` is per-wait**. If the first 10 s wait times out (job still processing), call `job.wait()` again in a loop or set a longer timeout.
- **No `LIMIT` syntax issue**. PostgreSQL dialect supports `LIMIT` natively. ADQL requires `TOP N` or `WHERE random_index < N`.
- **ADQL async endpoint may return 404**. If you see `/async/phase` 404 errors, switch to ADQL via `tap_service.search()` instead.
- **sh_photoflag and sh_outflag are VARCHAR**. Always compare with string literals.
- **All float columns are float32**. Convert to float64 before chained boolean masks.
- **`fidelity` is 0–1 continuous**. Use for quality cuts.

## Verification
- Data source and access path explicitly recorded.
- Key columns and caveats documented.
- SH21 schema verified 2026-06-30 against live gaia.aip.de TAP query.
- Full schemas re-validated 2026-07-20 against TAP_SCHEMA + the SHboost Parquet
  footer → `references/schema.md` (SHboost column list corrected: `xgb_*` naming,
  no `*50` columns).
- Data-paper citations + accountable curator/ORCID added 2026-07-21 (Skill Commons
  first-package publication prep).

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [skill-commons](https://github.com/skill-commons)
- **Source:** [skill-commons/skill-commons](https://github.com/skill-commons/skill-commons)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-skill-commons-skill-commons-starhorse-access
- Seller: https://agentstack.voostack.com/s/skill-commons
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
