Use this skill when a user wants to build a night's observing schedule from telescope time requests: fit prioritised requests (priority 1-3, minutes wanted) into the dark period (nightMinutes) and produce observing-plan.csv plus a list of requests that did not fit (not-scheduled.json). Not for general calendar or meeting scheduling.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Telescope Slots?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-telescope-slots-60ba7809)
---
name: telescope-slots
description: "Use this skill when a user wants to build a night's observing schedule from telescope time requests: fit prioritised requests (priority 1-3, minutes wanted) into the dark period (nightMinutes) and produce observing-plan.csv plus a list of requests that did not fit (not-scheduled.json). Not for general calendar or meeting scheduling."
---
# Telescope slots
Turn `input.json` (night length + prioritised requests) into a back-to-back observing plan and a list of dropped targets. Work by reading and writing files only; no commands are needed.
## Inputs
`input.json` in the working folder:
- `nightMinutes`: integer, length of the dark period.
- `requests`: array of `{target, priority, minutes}` in submission order. Priority is 1 (highest), 2 or 3. Target names are unique.
If `input.json` is missing or unparseable, say so and stop; do not invent data.
## Algorithm
1. Number requests `i = 0..n-1` in the order listed in the file (submission order).
2. Sort by priority ascending (1, then 2, then 3); ties keep submission order (stable). Do NOT sort by minutes or name.
3. Set `cursor = 0`. Go through the sorted list once, in order:
- If `cursor + minutes <= nightMinutes`: schedule it with `start = cursor`, `end = cursor + minutes`, then `cursor = end`.
- Otherwise: skip it (not scheduled) and keep going. A later, shorter request may still fit. A request ending exactly at `nightMinutes` fits.
4. Scheduled rows are in sorted (priority, then submission) order, with no gaps: each start equals the previous end.
5. The not-scheduled list contains skipped targets in **submission order** (original file order), not priority order.
Edge cases:
- `minutes` of 0 fits whenever `cursor <= nightMinutes`; it yields `start == end`.
- `nightMinutes <= 0` or negative: nothing fits except zero-minute requests when `nightMinutes == 0`; negative means all are skipped.
- A request with `minutes` greater than `nightMinutes` is simply skipped.
- Empty `requests`: CSV is header only, JSON is `[]`.
- Unexpected priority values: treat by numeric value (lower first) and mention it in your reply.
## Outputs (beside input.json)
`observing-plan.csv`: header line exactly `target,start,end`, then one row per scheduled target, integers without decimals, `\n` line endings, trailing newline. If a target name contains a comma or double quote, wrap it in double quotes and double any inner quotes.
`not-scheduled.json`: a JSON array of target-name strings, 2-space indent, e.g. `[]` when empty.
## Worked example
nightMinutes 200; requests in order: Capella p1 80, Arcturus p2 60, Mizar p3 70, Sirius p1 90, Spica p2 40, Polaris p3 30.
Sorted: Capella, Sirius, Arcturus, Spica, Mizar, Polaris.
- Capella 0-80, Sirius 80-170; Arcturus 170+60=230 > 200 skip; Spica 210 > 200 skip; Mizar 240 skip; Polaris 170-200 fits.
```csv
target,start,end
Capella,0,80
Sirius,80,170
Polaris,170,200
```
not-scheduled.json (submission order): `["Arcturus","Mizar","Spica"]` written one name per line.
## Check before finishing
- Every target appears exactly once, in the CSV or in the JSON.
- Last `end` is <= `nightMinutes`; starts/ends are contiguous.
- Re-read both written files.