Skip to content

📝 docs: add agent skills, AGENTS.md, and a doc-sync rule - #758

Merged
nstarman merged 3 commits into
GalacticDynamics:mainfrom
nstarman:claude/coordinax-skills-agents-7eb099
Aug 19, 2026
Merged

📝 docs: add agent skills, AGENTS.md, and a doc-sync rule#758
nstarman merged 3 commits into
GalacticDynamics:mainfrom
nstarman:claude/coordinax-skills-agents-7eb099

Conversation

@nstarman

Copy link
Copy Markdown
Contributor

Adds the three agent-facing documents, modelled on the quax / quaxed /
quax-blocks set, and wires the skill's examples into CI so they cannot rot.

The layering

Each fact gets one home, and the files cite each other rather than restating:

docs/spec.md               → what is TRUE (normative math + API contract)
skills/coordinax/SKILL.md  → how to USE it from outside, and what bites you
AGENTS.md                  → how to WORK in this repo
.github/skills/code-review → what to CHECK on a diff

skills/coordinax/SKILL.md

The chart / representation / vector / manifold layering, framed around the
one idea that unlocks the library: a chart is not a representation, so
pt_map (dicts, chart-only) and cconvert (vectors, representation-aware)
are not interchangeable. Then the things that cost real time:

  • tangents need an anchor, and coord_basis vs phys_basis differ by the
    chart's scale factors — with a worked example showing 1 rad/s become
    2 m/s at r = 2 m
  • == is strict on chart and frame; equivalent is the geometric relation
  • Distance/Angle degradation to plain Quantity is deliberate
  • charts are register_static; close over them, and keep pytrees off the
    jit boundary
  • geodesic_distance vs chord_distance, and the lorentzian gate
  • a 12-row troubleshooting table, each row keyed to an error string I
    reproduced
  • a version-notes rename table (separationgeodesic_distance,
    prolongact_jet, ParametricTimeDep,
    materialize_transformevaluate_at, the groups/builders
    namespaces, quantity_matrix removed)

AGENTS.md

Distilled from .github/copilot-instructions.md rather than copied. Keeps
spec authority, the workspace table, commands, abstract-final, no
from __future__ import annotations, never parametrising a generic in a
dispatched signature, operators via quax.register, scalar-first, and the
new-package versioning template. Adds a Pitfalls section the old file
lacked — batch safety, routes composing instead of failing, eqx.error_if
under jit, plum cache regressions — each citing the PRs it came from.

.github/skills/code-review/SKILL.md

Organised around the two properties that generate most defects here:

  1. A missing route composes instead of failing — a wrong route is a wrong
    number, not an exception (🐛 fix(charts): route Cart3D → ProlateSpheroidal3D via Cylindrical3D (stop recursion) #593, 🐛 fix(charts): convert between non-canonical two-sphere charts via canonical #594).
  2. Scalar-first code meets batched callers — the largest landed-bug class
    in the log (🐛 fix(charts): read CartND components on the last axis, not the batch axis #590, 🐛 fix(manifolds): make analytic curvilinear metric_matrix batch-safe #591, 🐛 fix(manifolds): make DiagonalMetric.to_dense and the product metric batch-safe #613, 🐛 fix(manifolds): make the hyperspherical round metric batch-safe #618, 🐛 fix(manifolds): batch-safe two-sphere pullback metric; pin the pole behaviour #621, 🐛 fix(vectors): batch indexing crashes on broadcastable-but-unequal shapes #653, 🐛 fix(manifolds): round-metric scale_factors on S¹ and on a batch #751), and one every scalar
    test passes through.

Plus a scope section (leave ruff/ty/prettier to nox -s lint; no generic
security checklist) and a what changed → what to check path table.

Keeping them current

Both AGENTS.md and the review skill carry a doc-sync rule: a change that
alters public semantics, adds a hazard, or invalidates an example is not done
until these files match it, with a table mapping change → file. The review
skill flags the omission from the other side.

#733 is the precedent that motivates it — 17 examples in docs/spec.md had
gone stale purely because nothing forced the update.

The examples are tests

skills/ joins [tool.pytest.ini_options] testpaths and the coordinax
PackageEnum paths in noxfile.py, so Sybil executes all 49 ```pycon blocks
under nox -s test and in CI. Confirmed collected: 10,981 tests total, 49 of
them from the skill.

This earns its keep immediately — three outputs I wrote from memory were
wrong and the first run caught all three.

Two decisions worth a look

  • .github/copilot-instructions.md becomes an 8-line pointer (-674).
    Copilot reads AGENTS.md too, and two ~700-line files would diverge within
    a month. Everything load-bearing moved across; I checked specifically for
    the workspace-package versioning template, the scratch-file rule, and the
    agent checklist, which are all now in AGENTS.md.
  • /AGENTS.md is dropped from .gitignore, where it sat under
    # Local agents reserving a slot for an untracked local file. The tracked
    file is now canonical, matching quax / quaxed / quax-blocks. Anyone with a
    local untracked AGENTS.md will want to move it aside.

Verification

🤖 Generated with Claude Code

Three agent-facing documents, layered so each fact has one home:

- `skills/coordinax/SKILL.md` — using and extending coordinax from outside
  the repo: the chart/representation/vector/manifold layering, the tangent
  anchor and `coord_basis` vs `phys_basis` rules, `==` vs `equivalent`,
  deliberate `Distance`/`Angle` degradation, the static-chart performance
  rule, a troubleshooting table, and a version-notes rename table.
- `AGENTS.md` — working inside the repo: spec authority, workspace layout,
  commands, the conventions that bite, the pitfalls drawn from the landed
  bug history, and the testing contract.
- `.github/skills/code-review/SKILL.md` — reviewing a change, organised
  around the two properties that generate most defects here: a missing
  route composes rather than failing, and scalar-first code meets batched
  callers.

Each cites the others rather than restating them; `docs/spec.md` stays
authoritative and is cross-linked, not duplicated.

Both `AGENTS.md` and the review skill carry a doc-sync rule: a change that
alters public semantics, adds a hazard, or invalidates an example is not
done until these files match it. GalacticDynamics#733 is the motivating precedent — 17
examples in `docs/spec.md` had gone stale because nothing forced the update.

The skill's examples are tests. `skills/` joins `testpaths` and the
`coordinax` nox package paths, so Sybil executes all 49 `pycon` blocks
under `nox -s test` and in CI. Three outputs written from memory were wrong
and this caught them.

`.github/copilot-instructions.md` becomes a pointer to `AGENTS.md`; Copilot
reads both, and two long files would diverge. Everything load-bearing moved
across, including the workspace-package versioning template and the
pre-submit checklist.

`/AGENTS.md` is dropped from `.gitignore`, where it had reserved a slot for
an untracked local file. The tracked file is now the canonical one, matching
quax, quaxed, and quax-blocks.
Copilot AI lite review requested due to automatic review settings August 19, 2026 20:18
@nstarman
nstarman requested a review from a team as a code owner August 19, 2026 20:18
@github-actions github-actions Bot added 🔧 Add / update configuration Add or update configuration files. 🙈 Add / update .gitignore Add or update a .gitignore file. 📝 Add / update documentation Add or update documentation. labels Aug 19, 2026
@nstarman nstarman added this to the v0.24.0 milestone Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a layered set of agent-facing documentation for the Coordinax workspace (usage skill, in-repo agent instructions, and a code-review skill), and wires the new skills/ docs into the test/lint surface so examples are continuously validated in CI.

Changes:

  • Add skills/coordinax/SKILL.md, AGENTS.md, and .github/skills/code-review/SKILL.md, with cross-references to avoid duplicated “source of truth” content.
  • Include skills/ in pytest collection and in the coordinax package path set used by nox sessions.
  • Replace the large .github/copilot-instructions.md with a short pointer to AGENTS.md, and stop ignoring /AGENTS.md.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
skills/coordinax/SKILL.md New user-facing “how to use Coordinax” skill with tested pycon examples and troubleshooting/version notes.
AGENTS.md New canonical in-repo agent instructions (spec authority, commands, conventions, pitfalls, doc-sync rule).
.github/skills/code-review/SKILL.md New code-review checklist skill focused on coordinax-specific defect patterns and review scope.
pyproject.toml Add skills/ to testpaths so skill examples are collected under pytest/Sybil.
noxfile.py Include skills/ in PackageEnum.coordinax paths so package-scoped pytest runs cover the skill docs.
.github/copilot-instructions.md Reduce to a pointer to AGENTS.md + the review skill to prevent divergence.
.gitignore Stop ignoring /AGENTS.md so the tracked canonical file is used.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.63%. Comparing base (c29dad6) to head (b75009b).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #758      +/-   ##
==========================================
+ Coverage   96.62%   96.63%   +0.01%     
==========================================
  Files         267      267              
  Lines        9034     9064      +30     
==========================================
+ Hits         8729     8759      +30     
  Misses        305      305              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A self-review found the same facts stated in two files, PR citations and
all — two copies that would diverge on the first update.

- `AGENTS.md` "Pitfalls" duplicated five sections of the review skill,
  including the identical PR lists. Now a pointer naming that file as the
  single source of truth for the defect classes.
- The 35-line workspace-package TOML template is one line: copy
  `packages/coordinaxs.hypothesis/pyproject.toml` and substitute the name.
- "Before you submit" restated six items already on the same page. The one
  item that was not — roles obey affine vs tangent semantics — moves into
  Conventions, along with the one-sentence scratch-file rule that had its
  own section.
- The review skill's "Repo conventions" and its doctest/Hypothesis bullets
  restated `AGENTS.md`; both now defer to it.

Also corrects a claim in `AGENTS.md`: the fence convention describes files
pytest collects, and `AGENTS.md` is not one of them.

AGENTS.md 157 -> 108, the review skill 143 -> 138. No content lost, only
second copies.
@github-actions github-actions Bot added the 🎨 Improve code structure / format Improve structure / format of the code. label Aug 19, 2026
`.github/skills/<name>/SKILL.md` is GitHub's agent-skill location, and
Copilot code review has consumed agent skills since they went GA. But a
SKILL.md needs YAML frontmatter with `name` and `description`, and the
description is what Copilot matches on to decide whether to load the skill
at all. Without it the file is inert — it sits in the right directory and
is never read.

The sibling `gitmoji-commit` skill already has frontmatter; this one was
modelled on the quax and quaxed code-review skills, which omit it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nstarman
nstarman merged commit 9c503e1 into GalacticDynamics:main Aug 19, 2026
4 of 5 checks passed
@nstarman
nstarman deleted the claude/coordinax-skills-agents-7eb099 branch August 19, 2026 21:38
@github-actions github-actions Bot added the 🐛 Fix a bug Fix a bug. label Aug 19, 2026
nstarman added a commit that referenced this pull request Aug 20, 2026
…iners (#775)

`main` is red, and every open PR with it. #752 made `pt_map` return `Angle` for
angular components rather than `Quantity` -- the point of that change -- but the
`SKILL.md` doctest was written against the old behaviour and not updated:

    Expected  {'r': Q(...), 'theta': Q(...),     'phi': Q(...)}
    Got       {'r': Q(...), 'theta': Angle(...), 'phi': Angle(...)}

`skills/` is in `testpaths`, so this fails the whole matrix on every branch that
has #752 in its ancestry, which is now all of them. It is unrelated to whatever
those branches touch.

Mine to have caught. #752's doctest sweep ran over `src/`, `packages/`,
`README.md` and `docs/`, and `skills/` was not in that list -- it arrived in
#758, which merged after that branch's last full run and before #752 did, so no
run on the branch ever saw the file. A sweep enumerated by hand missed a
testpath the config already knew about; it should have read `testpaths`.

Checked the rest of `skills/` for the same pattern rather than fixing only the
reported line; that was the only occurrence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 Add / update configuration Add or update configuration files. 📝 Add / update documentation Add or update documentation. 🙈 Add / update .gitignore Add or update a .gitignore file. 🐛 Fix a bug Fix a bug. 🎨 Improve code structure / format Improve structure / format of the code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants