AI Astrology Assistant
Build an astrology assistant that computes birth charts with the same logic as professional tools (e.g. Astro-Seek). Use Swiss Ephemeris (or pyswisseph, swephR, swisseph-js) as the calculation engine.
When to Apply This Skill
- User asks for birth chart calculation, natal chart, or horoscope by birth data
- Building an astrology API, chatbot, or web calculator
- Interpreting planetary positions, houses, or aspects
- Implementing ephemeris-based astrology features
Core Workflow
1. Parse birth data (date, time, location) → validate inputs
2. Convert local time → UTC → Julian Day
3. Compute planetary positions (swe_calc_ut)
4. Compute houses, Ascendant, MC (swe_houses)
5. Assign planets to houses (swe_house_pos)
6. Calculate aspects between all pairs
7. Optionally apply sidereal ayanamsha
8. Format and interpret results
Required Inputs
| Input |
Required |
Notes |
| Date of birth |
Yes |
Day, month, year |
| Time |
No* |
Local time (h, m, s). *Required for houses/Ascendant |
| Birth place |
Yes |
City name or lat/long |
| Timezone |
Yes |
Auto from location or manual (e.g. UTC+1) |
| DST |
Yes |
Observed / Not-Observed |
| House system |
No |
Default: Placidus |
| Zodiac |
No |
Default: Tropical |
Implementation Checklist
1. Time Conversion
# Local → UTC (apply timezone + DST)
# UTC → Julian Day
jd_ut = swe_utc_to_jd(year, month, day, hour, min, sec, SE_GREG_CAL)
# Returns: dret[0]=JD_TT, dret[1]=JD_UT
2. Planetary Positions
# For each body: Sun(0), Moon(1), Mercury(2)... Pluto(9), Node(10/11), Chiron(12), Lilith(15)
ret, xx = swe_calc_ut(jd_ut, planet_id, SEFLG_SWIEPH)
# xx[0]=longitude, xx[1]=latitude, xx[2]=distance, xx[3]=speed (retrograde if < 0)
3. Houses
# Requires: jd_ut, latitude, longitude, house_system
cusps, ascmc = swe_houses(jd_ut, lat, lon, hsys)
# cusps[1..12] = house cusps, ascmc[0]=Ascendant, ascmc[1]=MC
4. House Assignment
house = swe_house_pos(armc, lat, obliquity, hsys, [lon, lat])
5. Aspects
Compute angular distance between each planet pair. Aspect is valid if |distance - aspect_angle| <= orb.
| Aspect |
Angle |
Default orb |
| Conjunction |
0° |
8° |
| Opposition |
180° |
7° |
| Trine |
120° |
6° |
| Square |
90° |
6° |
| Sextile |
60° |
4° |
6. Sidereal (Optional)
swe_set_sid_mode(ayanamsha_type) # e.g. SE_SIDM_LAHIRI
# Then swe_calc_ut returns sidereal positions
# Or: sidereal_lon = tropical_lon - swe_get_ayanamsa_ut(jd_ut)
Output Format
Present results as:
- Planet table: Planet | Sign | Degree | House | Retrograde
- House cusps: ASC, MC, and houses 1–12
- Aspects list: Planet A – Aspect – Planet B (orb)
- Special points: Part of Fortune, Vertex, Nodes, Lilith (if enabled)
Key Constants
- Planet IDs: Sun=0, Moon=1, Mercury=2, Venus=3, Mars=4, Jupiter=5, Saturn=6, Uranus=7, Neptune=8, Pluto=9, MeanNode=10, TrueNode=11, Chiron=12, MeanLilith=15
- House systems: P=Placidus, K=Koch, R=Regiomontanus, C=Campanus, E=Equal, W=Whole Sign
- Zodiac signs: 0°=Aries, 30°=Taurus, 60°=Gemini... 330°=Pisces
Part of Fortune
Diurnal (Sun above horizon): Fortune = ASC + Moon - Sun
Nocturnal (Sun below horizon): Fortune = ASC + Sun - Moon
Error Handling
- Unknown birth time: Compute chart without houses; use noon or offer "chart for date only"
- Invalid coordinates: Reject or use fallback (e.g. capital city)
- Polar latitudes: Placidus fails; suggest Equal or Whole Sign
- Date out of range: Swiss Ephemeris covers ~13,000 years; validate 1800–2100 for typical use
Dependencies
- Python:
pyswisseph + ephemeris files (download from astro.com)
- Node.js:
swisseph or astronomia
- R:
swephR
Set ephemeris path: swe_set_ephe_path("/path/to/ephe")
Reference & Examples
- Full API specs, formulas, ayanamshas: reference.md
- User flows, response formats, edge cases: examples.md
1---2name: astro-skill-md3description: AI Astrology Assistant4---5# AI Astrology Assistant67Build an astrology assistant that computes birth charts with the same logic as professional tools (e.g. Astro-Seek). Use **Swiss Ephemeris** (or pyswisseph, swephR, swisseph-js) as the calculation engine.89## When to Apply This Skill1011- User asks for birth chart calculation, natal chart, or horoscope by birth data12- Building an astrology API, chatbot, or web calculator13- Interpreting planetary positions, houses, or aspects14- Implementing ephemeris-based astrology features1516---1718## Core Workflow1920```211. Parse birth data (date, time, location) → validate inputs222. Convert local time → UTC → Julian Day233. Compute planetary positions (swe_calc_ut)244. Compute houses, Ascendant, MC (swe_houses)255. Assign planets to houses (swe_house_pos)266. Calculate aspects between all pairs277. Optionally apply sidereal ayanamsha288. Format and interpret results29```3031---3233## Required Inputs3435| Input | Required | Notes |36|-------|----------|-------|37| Date of birth | Yes | Day, month, year |38| Time | No* | Local time (h, m, s). *Required for houses/Ascendant |39| Birth place | Yes | City name or lat/long |40| Timezone | Yes | Auto from location or manual (e.g. UTC+1) |41| DST | Yes | Observed / Not-Observed |42| House system | No | Default: Placidus |43| Zodiac | No | Default: Tropical |4445---4647## Implementation Checklist4849### 1. Time Conversion5051```python52# Local → UTC (apply timezone + DST)53# UTC → Julian Day54jd_ut = swe_utc_to_jd(year, month, day, hour, min, sec, SE_GREG_CAL)55# Returns: dret[0]=JD_TT, dret[1]=JD_UT56```5758### 2. Planetary Positions5960```python61# For each body: Sun(0), Moon(1), Mercury(2)... Pluto(9), Node(10/11), Chiron(12), Lilith(15)62ret, xx = swe_calc_ut(jd_ut, planet_id, SEFLG_SWIEPH)63# xx[0]=longitude, xx[1]=latitude, xx[2]=distance, xx[3]=speed (retrograde if < 0)64```6566### 3. Houses6768```python69# Requires: jd_ut, latitude, longitude, house_system70cusps, ascmc = swe_houses(jd_ut, lat, lon, hsys)71# cusps[1..12] = house cusps, ascmc[0]=Ascendant, ascmc[1]=MC72```7374### 4. House Assignment7576```python77house = swe_house_pos(armc, lat, obliquity, hsys, [lon, lat])78```7980### 5. Aspects8182Compute angular distance between each planet pair. Aspect is valid if `|distance - aspect_angle| <= orb`.8384| Aspect | Angle | Default orb |85|--------|-------|-------------|86| Conjunction | 0° | 8° |87| Opposition | 180° | 7° |88| Trine | 120° | 6° |89| Square | 90° | 6° |90| Sextile | 60° | 4° |9192### 6. Sidereal (Optional)9394```python95swe_set_sid_mode(ayanamsha_type) # e.g. SE_SIDM_LAHIRI96# Then swe_calc_ut returns sidereal positions97# Or: sidereal_lon = tropical_lon - swe_get_ayanamsa_ut(jd_ut)98```99100---101102## Output Format103104Present results as:1051061. **Planet table**: Planet | Sign | Degree | House | Retrograde1072. **House cusps**: ASC, MC, and houses 1–121083. **Aspects list**: Planet A – Aspect – Planet B (orb)1094. **Special points**: Part of Fortune, Vertex, Nodes, Lilith (if enabled)110111---112113## Key Constants114115- **Planet IDs**: Sun=0, Moon=1, Mercury=2, Venus=3, Mars=4, Jupiter=5, Saturn=6, Uranus=7, Neptune=8, Pluto=9, MeanNode=10, TrueNode=11, Chiron=12, MeanLilith=15116- **House systems**: P=Placidus, K=Koch, R=Regiomontanus, C=Campanus, E=Equal, W=Whole Sign117- **Zodiac signs**: 0°=Aries, 30°=Taurus, 60°=Gemini... 330°=Pisces118119---120121## Part of Fortune122123```124Diurnal (Sun above horizon): Fortune = ASC + Moon - Sun125Nocturnal (Sun below horizon): Fortune = ASC + Sun - Moon126```127128---129130## Error Handling131132- **Unknown birth time**: Compute chart without houses; use noon or offer "chart for date only"133- **Invalid coordinates**: Reject or use fallback (e.g. capital city)134- **Polar latitudes**: Placidus fails; suggest Equal or Whole Sign135- **Date out of range**: Swiss Ephemeris covers ~13,000 years; validate 1800–2100 for typical use136137---138139## Dependencies140141- **Python**: `pyswisseph` + ephemeris files (download from astro.com)142- **Node.js**: `swisseph` or `astronomia`143- **R**: `swephR`144145Set ephemeris path: `swe_set_ephe_path("/path/to/ephe")`146147---148149## Reference & Examples150151- **Full API specs, formulas, ayanamshas:** [reference.md](reference.md)152- **User flows, response formats, edge cases:** [examples.md](examples.md)