Files
holocron/plugins/core/skills/provider-adapter-author
Defame1297 59f27dbd94 fix(core): close five ways validate-adapter.sh graded an adapter it had not read
The adapter check shipped green on files it should have failed, and failed files it
should have passed. Each defect is a residual of the fix that closes #115.

A fenced, indented or HTML-commented `@AGENTS.md` counted as an import, though
Claude Code resolves none of them — the adapter deferred to nothing and the gate
said so approvingly. Import matching now runs against a character mask that marks
fenced blocks and HTML comments inert, and applies CommonMark's four-space rule.
The mask is deliberately not applied to prose pointers, where four-space
indentation is ordinary list continuation.

The encoding fix reached only BOM-carrying UTF-16/32. BOM-less UTF-16LE/BE and
UTF-32LE are valid UTF-8, so they still produced the exact false diagnosis the fix
was written to remove: "no reference to AGENTS.md" on a file whose first line is
`@AGENTS.md`. A NUL-byte check is the complete signal. BOM stripping is no longer
positional, which also drops the mirror-image false FAILs on a doubled or mid-file
BOM.

`@NOTAGENTS.md`, `@zzzAGENTS.md` and `@docs/does/not/exist/AGENTS.md` all passed:
the pattern had no path-segment boundary and the target was never resolved on disk.
Both now hold, and a zero-byte or blank target is reported rather than credited.
Unresolved candidates print as `Near miss:` lines so the author sees why a line was
not counted.

`--no-import-syntax` still used substring matching, so `Do NOT read AGENTS.md; it
is obsolete.` passed as a pointer. That is #115's own defect surviving in the flag's
other mode. A mention must now carry a deference cue and must not be negated.

An unreadable file passed `isfile()`, raised, and exited 1 with a traceback and no
FAIL line — the one exit code no document covered, while Step 3 says to re-run
until it exits 0. It now exits 3 with a diagnostic, and the README states all four
codes and what to do about each instead of "exits non-zero on any failure".

Tests 18 to 42. Two of the new cases initially survived their own mutation and were
strengthened: `@NOTAGENTS.md` was being rejected by the disk check before the token
boundary ran, and stripping that boundary leaves the fragment `NOT`, which the
negation cue then rejects for an unrelated reason.

Refs: #115
2026-09-01 12:38:04 +00:00
..

provider-adapter-author

Convert a target repo's provider-specific instruction file (CLAUDE.md, .cursor/rules, copilot-instructions.md, etc.) into a thin adapter over AGENTS.md.

What it does

Detects a provider-specific AI instruction file in a target repo, diffs it against the repo's AGENTS.md, and rewrites it down to a minimal reference — an @AGENTS.md-style import for providers that support one, or a text pointer for those that don't — plus only genuinely provider-specific additions. Self-validates its own output with a bundled deterministic script (no LLM judgment, no separate audit skill) before finishing.

Before you start

The target repo must already have an AGENTS.md. If it doesn't, run agentsmd-author first — this skill never creates or edits AGENTS.md itself.

Usage

/provider-adapter-author

Provide the path to the provider-specific file to convert (and the target repo root, if not inferable). Can be invoked directly, or composed into by agentsmd-author when it detects an existing provider file with content overlapping AGENTS.md.

Files

File Purpose
SKILL.md Skill instructions for agents
references/provider-matrix.md Loaded at Step 1 before searching, unless the target is already a known root CLAUDE.md: known files per provider, which ones resolve a cross-file import, the validator flag each needs, and the rule that a standalone run and a run composed into by agentsmd-author behave identically
references/sources.md Provenance record — the in-repo ADR precedent this skill's design is modeled on
scripts/validate-adapter.sh Self-check gate: reference to AGENTS.md present, no excessive duplication, adapter stays thin
scripts/README.md Directory documentation for scripts/
tests/README.md (source-only) Bats test dependency and run instructions
tests/validate-adapter.bats (source-only) Bats test suite for scripts/validate-adapter.sh

Rows marked (source-only) exist in the authoring source (.apm/skills/provider-adapter-author/) but are not present in an installed plugin: the repo's scripts/sync-plugin-content.sh strips <category>/<name>/tests when it generates the flat mirror, because these are dev-time fixtures no plugin host needs to discover (ADR-0017). Run them from a repo checkout, not from an install.