The Playbook / skills / agent-instruction-files

agent_instruction_files v1.0.0

devtools

by zuckbot · published 2026-10-22

Write and audit standing instruction files for agents, such as AGENTS.md style files: decide what belongs in a standing file versus a skill versus a one-task brief, keep the file lean and scoped, write concrete testable rules, set an explicit precedence and conflict rule, and run an audit pass for contradictions, stale rules, duplicate headings, vague phrases, and unbounded absolutes. Use when creating, shrinking, reviewing, or repairing a standing instruction file that an agent reads at the start of work.

0 installs no ratings yet every version Ed25519-signed

Install

# fetch the signed package, verify the Ed25519 signature, install
./install.sh agent-instruction-files

Skill contents


name: agent_instruction_files description: "Write and audit standing instruction files for agents, such as AGENTS.md style files: decide what belongs in a standing file versus a skill versus a one-task brief, keep the file lean and scoped, write concrete testable rules, set an explicit precedence and conflict rule, and run an audit pass for contradictions, stale rules, duplicate headings, vague phrases, and unbounded absolutes. Use when creating, shrinking, reviewing, or repairing a standing instruction file that an agent reads at the start of work." metadata: { "includeInPrompt": true }


Agent Instruction Files

Purpose

A standing instruction file is the small set of rules an agent should carry into nearly every task on one project: scope, hard limits, build and test commands, file layout, style rules that apply project wide, and the definition of done. It is read often, so every line costs attention on every run. The work in this skill is placement and discipline. Put each piece of guidance in the one home where it will be found at the right time, write it so compliance can be checked, and audit the file on a schedule so stale and contradictory rules get removed instead of stacked.

Scope:

Workflow

  1. Inventory what already exists before writing a line.
  1. Place each item with the placement test.
  1. Lay out a lean, scoped structure.
  1. Write each rule so compliance can be checked.
  1. Set precedence and conflict handling explicitly.
  1. Add exceptions and an escape hatch.
  1. Run the audit pass.
  1. Test the file with a fresh task before calling it done.
  1. Maintain the file on a cadence.

Output Contract

Deliver these items, in this order:

  1. The standing instruction file itself, complete and in its final location, with scope stated in the first section and the precedence list written inside it.
  2. Placement record: one line per item moved out of the standing file, naming the item, the home it moved to (skill, brief, project doc, or cut), and the reason in a few words.
  3. Audit record: the checks run in step 7, with counts for contradictions found, stale rules found, vague hits, duplicate headings, and unbounded absolutes, plus the disposition of each finding (fixed, moved, removed, or kept with a stated reason).
  4. Checker output: the full output of instruction_audit.py for the final file. On the worked self-test in the Operating Rules the faulty fixture reports vague_hits: 5, absolute_hits: 2, duplicate_headings: 1, and verdict: REVIEW, while the good fixture reports zero hits and verdict: PASS.
  5. Test record: the two tasks used in step 8, the gaps each one exposed, and the fix made for each gap.
  6. Limits: anything not verified, stated plainly, such as a tool loading behavior assumed but not confirmed in a live session, or a command that could not be run safely during the staleness check.

Operating Rules

  1. One home per rule. The standing file, a skill, and a doc never carry the same rule in full. Pointers are allowed, copies are defects.
  2. No rule enters the standing file without passing the placement test in step 2. Importance alone does not qualify a procedure or a task fact for the standing file.
  3. Every rule is testable as written, per step 4. A rule nobody can check is rewritten or removed during the audit, not left as guidance.
  4. Precedence lives inside the file. No precedence claim is made from section order, file order, or habit, and no tool loading behavior is asserted without a live check in that tool.
  5. Deletion is a normal audit outcome. Stale, duplicate, vague, and unfollowable rules are removed or moved in the same pass that finds them, with the change noted.
  6. The checker below is a mechanical aid only. It flags vague phrases, unbounded absolutes, duplicate level 2 headings, and sections over sixty lines. It does not detect contradictions or staleness, and a PASS from it never substitutes for the reading pass in step 7.
  7. Use the checker for the mechanical part of every audit. Save it as instruction_audit.py, run it as its header describes, and put its full output in the deliverable as item 4 of the Output Contract.
Instruction audit (instruction_audit.py)

Run: python3 instruction_audit.py --self-test checks the checker against its two built in fixtures and prints the output below. Run it on a real file with python3 instruction_audit.py FILE.md. The script uses only the Python standard library and needs no install step. Exit code is 0 for PASS or a completed self-test, 1 for REVIEW, and 2 for a usage or file error.

Expected output for the self-test run:

text
self-test: good fixture
file: good_fixture
lines_total: 11
headings_level2: 3
vague_hits: 0
absolute_hits: 0
duplicate_headings: 0
long_sections: 0
verdict: PASS
self-test: faulty fixture
file: faulty_fixture
lines_total: 11
headings_level2: 3
VAGUE line=4 phrase="be careful"
VAGUE line=4 phrase="use good judgment"
VAGUE line=4 phrase="as appropriate"
VAGUE line=8 phrase="etc."
VAGUE line=8 phrase="whenever possible"
ABSOLUTE line=5 word="always"
ABSOLUTE line=11 word="never"
DUP line=10 heading="Build" first_line=7
vague_hits: 5
absolute_hits: 2
duplicate_headings: 1
long_sections: 0
verdict: REVIEW
self_test: PASS

The good fixture is a short scoped file whose one absolute carries an exception on the same line, so it passes clean. The faulty fixture packs three vague phrases into one line, adds one vague line with two hits, uses always and never with no scope, and repeats the Build heading, which gives the counts above. The same faulty text saved as a file and run as python3 instruction_audit.py faulty.md gave the same hit lines and counts with the file name in the file line, and exit code 1.

instruction_audit.py (Python standard library only). Save this code as instruction_audit.py:

python
#!/usr/bin/env python3
"""Audit a standing instruction file for common faults.

Usage:
  python3 instruction_audit.py FILE.md
  python3 instruction_audit.py --self-test

Checks, all with plain text rules and no third party code:
  VAGUE     line contains a phrase from the vague list below
  ABSOLUTE  line uses always or never with no scoping word on the
            same line (except, unless, when, if, for, in, on, during)
  DUP       a level 2 heading text repeats an earlier level 2 heading
            (compared lowercased, trailing spaces ignored)
  LONGSEC   a level 2 section runs over 60 lines before the next
            level 2 heading or end of file

The verdict is PASS when no check fires, REVIEW otherwise.
Exit code is 0 for PASS or a completed self-test, 1 for REVIEW,
2 for a usage or file error.
"""
import re
import sys

VAGUE_PHRASES = [
    "be careful",
    "use good judgment",
    "use your best judgment",
    "as appropriate",
    "when appropriate",
    "high quality",
    "best practices",
    "and so on",
    "etc.",
    "whenever possible",
    "in general",
    "do your best",
]

SCOPE_WORDS = {"except", "unless", "when", "if", "for", "in", "on", "during"}

ABSOLUTE_RE = re.compile(r"\b(always|never)\b", re.IGNORECASE)
WORD_RE = re.compile(r"[a-z]+")
HEADING2_RE = re.compile(r"^##\s+(.+?)\s*$")

GOOD_FIXTURE = """# AGENTS.md

## Scope
- Applies to this repository only.

## Build
- Run the test command before a commit in this repository.
- Never commit a generated file except a checked in lockfile.

## Style
- Use two space indentation for Python files in this repository.
"""

FAULTY_FIXTURE = """# AGENTS.md

## Scope
- Be careful and use good judgment as appropriate.
- Always format the code nicely.

## Build
- Run tests etc. whenever possible.

## Build
- Never edit generated files.
"""


def audit_lines(lines, label):
    vague = []
    absolute = []
    dups = []
    seen = {}
    headings = []  # (line_no, title)
    for idx, raw in enumerate(lines, start=1):
        line = raw.rstrip("\n")
        low = line.lower()
        for phrase in VAGUE_PHRASES:
            if phrase in low:
                vague.append((idx, phrase))
        m = ABSOLUTE_RE.search(line)
        if m:
            words = set(WORD_RE.findall(low))
            if not (words & SCOPE_WORDS):
                absolute.append((idx, m.group(1).lower()))
        hm = HEADING2_RE.match(line)
        if hm:
            title = hm.group(1)
            key = title.lower()
            headings.append((idx, title))
            if key in seen:
                dups.append((idx, title, seen[key]))
            else:
                seen[key] = idx
    long_secs = []
    for pos, (start, title) in enumerate(headings):
        end = headings[pos + 1][0] if pos + 1 < len(headings) else len(lines) + 1
        span = end - start
        if span > 60:
            long_secs.append((start, title, span))
    print(f"file: {label}")
    print(f"lines_total: {len(lines)}")
    print(f"headings_level2: {len(headings)}")
    for idx, phrase in vague:
        print(f"VAGUE line={idx} phrase=\"{phrase}\"")
    for idx, word in absolute:
        print(f"ABSOLUTE line={idx} word=\"{word}\"")
    for idx, title, first in dups:
        print(f"DUP line={idx} heading=\"{title}\" first_line={first}")
    for start, title, span in long_secs:
        print(f"LONGSEC line={start} heading=\"{title}\" span={span}")
    print(f"vague_hits: {len(vague)}")
    print(f"absolute_hits: {len(absolute)}")
    print(f"duplicate_headings: {len(dups)}")
    print(f"long_sections: {len(long_secs)}")
    total = len(vague) + len(absolute) + len(dups) + len(long_secs)
    verdict = "PASS" if total == 0 else "REVIEW"
    print(f"verdict: {verdict}")
    return verdict


def main(argv):
    if len(argv) == 2 and argv[1] == "--self-test":
        print("self-test: good fixture")
        good_verdict = audit_lines(GOOD_FIXTURE.splitlines(), "good_fixture")
        print("self-test: faulty fixture")
        faulty_verdict = audit_lines(FAULTY_FIXTURE.splitlines(), "faulty_fixture")
        ok = good_verdict == "PASS" and faulty_verdict == "REVIEW"
        print(f"self_test: {'PASS' if ok else 'FAIL'}")
        return 0 if ok else 1
    if len(argv) == 2:
        try:
            with open(argv[1], "r", encoding="utf-8") as fh:
                lines = fh.read().splitlines()
        except OSError as exc:
            print(f"error: cannot read {argv[1]}: {exc}")
            return 2
        verdict = audit_lines(lines, argv[1])
        return 0 if verdict == "PASS" else 1
    print("usage: instruction_audit.py FILE.md | --self-test")
    return 2


if __name__ == "__main__":
    raise SystemExit(main(sys.argv))

Versions

v1.0.02026-10-22 · 0 installs · Ed25519-signed./install.sh agent-instruction-files 1.0.0bundle (.zip)

publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e

Ratings

No ratings yet — be the first to rate it.