AyCode.Core/.github/skills/protocol-audit/SKILL.md

5.2 KiB

name description compatibility metadata
protocol-audit Audit the 5 AyCode/Mango repos (AyCode.Core, AyCode.Blazor, Libraries, FruitBank, FruitBankHybridApp) for .github/copilot-instructions.md protocol consistency. Checks Rule numbering, required substrings (NO-RE-READ definition, auto-detection triggers, CROSS-REPO HARD-GATE, PER-QUESTION DOC-FIRST, Rule 5 scope), @repo block format, and own-dep-repos relative paths. Use when the user asks to "audit protocol", "check instruction consistency", "verify repo rules", "check cross-repo drift", or after modifying the AI AGENT CORE PROTOCOL in any of the 5 repos. Produces a repo x invariant table and concrete patch suggestions; does NOT modify any file without explicit consent. Designed for Claude Code and GitHub Copilot (VS). Requires read access to the 5 listed repo paths.
author version
Fullepi 1.0

Protocol Audit

Verify that the 5 AyCode/Mango repos share a consistent AI AGENT CORE PROTOCOL in .github/copilot-instructions.md.

Before you start

This skill READS files and REPORTS findings. It MUST NOT modify any file. Patch suggestions are surfaced as diffs for the user to review and approve. Follow Rule #5 from the active repo's copilot-instructions.md.

Step 1 — Load the repo list

Read references/REPOS.md (relative to this SKILL.md). Extract the 5 absolute repo paths and the expected own-dep-repos table.

Step 2 — Read each instruction file

For each repo in REPOS.md, read <abs-path>\.github\copilot-instructions.md once. Record the full text keyed by repo name.

Do NOT re-read a file that is already in your LOADED_DOCS list (per Rule #3 of the active repo's protocol).

Step 3 — Run invariant checks

For each file, evaluate these invariants. Each yields PASS / FAIL and (on FAIL) an evidence snippet.

Structural invariants

  1. Rule numbering is contiguous 1..N Extract all ^\d+\. \*\* lines. The numbers must form 1, 2, 3, ..., N with no gaps and no duplicates.

  2. Rule count is >= 5 The AI AGENT CORE PROTOCOL has five core rules. Sections after rule 5 (Conventions etc.) may add more; the first 5 are mandatory.

Rule-content invariants

  1. Rule #2 contains CROSS-REPO HARD-GATE Substring present.

  2. Rule #2 contains PER-QUESTION DOC-FIRST Substring present.

  3. Rule #3 is the NO-RE-READ rule Header matches STRICT NO-RE-READ POLICY (ANTI-LOOP).

  4. Rule #3 contains the "in context" definition Substring lossy compressions present.

  5. Rule #4 contains auto-detection triggers Substring Auto-detection triggers present AND substring LOADED_DOCS: NONE present.

  6. Rule #5 scope is broad Substring any file (code, documentation, configuration, memory, or otherwise) present. Negative check: substring delete code/files without must be ABSENT (old wording).

Cross-reference invariants

  1. "strictly maintain rule 3" reference exists in Rule #2 Substring strictly maintain rule 3 present. Old references (rule 15, rule 18, rule 19, rule 20, rule 21) must be absent.

@repo block invariants

  1. @repo block has all 4 required fields Inside the @repo { ... } block, the keys name, type, layer, own-dep-repos must all be present.

  2. own-dep-repos paths resolve to existing directories For each "<dep-name>: <relative-path>" entry, resolve <repo-root>/<relative-path> and check the directory exists.

  3. own-dep-repos matches REPOS.md expectations For each repo, the deps listed must equal the expected set in REPOS.md's "Expected own-dep-repos" table.

Step 4 — Produce the report

Emit a markdown table with one row per repo and one column per invariant. Cell values: PASS / FAIL. Use concise column headers (e.g., 1.Num, 2.Cnt, 3.XR-HG, ...).

Below the table, list every FAIL with:

  • Repo name
  • Invariant ID
  • Evidence (the offending line or missing substring)
  • Suggested patch (concrete old-string / new-string pair the user can review)

Step 5 — DO NOT apply patches

End the report with:

All checks complete. N failures detected. To apply any of the suggested patches, reply with "apply patches 1,2,5" (or similar). No files have been modified.

Wait for explicit user consent before using any edit/write tool.

Tool usage

This skill is tool-neutral. Use whichever file-reading and file-editing tool your host agent provides:

  • Reading files: Read (Claude Code), get_file (Copilot), or equivalent
  • Directory existence checks: Glob / file_search / ls / Test-Path
  • Applying patches (only after consent): Edit / replace_string_in_file

Map these to your tools per the active repo's CLAUDE.md (if present) before proceeding.

Edge cases

  • Repo path missing from disk: Skip that repo, record as MISSING in every invariant cell, and continue with the others.
  • File read fails: Same handling — record UNREADABLE.
  • Multiple @repo blocks in one file: Audit the first one; flag the duplicate as its own finding.
  • Rule order differs (e.g., Rule #3 and #4 swapped): Invariants 5 and 7 fail independently — do not try to auto-reorder.
  • User is running this mid-edit: If a file has obviously unfinished edits (e.g., truncated mid-sentence), report as CORRUPT and stop that repo's audit.