agentleFS
ukorvlukorvl/web-of-flaws/scripts/AGENTS.md

web-of-flaws / scripts

AGENTS.md8 starsChanged 3 months agoMITView on GitHub

This directory contains Python tooling for repository validation, catalog generation, guide parsing, standards validation, label synchronization, and related maintenance tasks. These scripts are part of the repository's integrity layer. Changes here may affect guides, generated catalog data, CI validation, and downstream machine-readable consumers. - Prefer the Python standard library unless an external dependency provides substantial value. - Add type annotations to function parameters and return values. - Prefer precise types over Any. - Use pathlib.Path for filesystem paths. - Read…

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

38 rules. About 0 are common, 29 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈29

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer the Python standard library unless an external dependency provides substantial value.

    line 13
  2. Distinctive:

    Add type annotations to function parameters and return values.

    line 14
  3. Very specific:

    Prefer precise types over Any.

    line 15
  4. Very specific:

    Use pathlib.Path for filesystem paths.

    line 16
  5. Distinctive:

    Read and write text files using explicit UTF-8 encoding.

    line 17
  6. Distinctive:

    Prefer immutable data structures for configuration and value objects when practical.

    line 18
  7. Distinctive:

    Keep module-level mutable state to a minimum.

    line 19
  8. Distinctive:

    Keep parsing, validation, transformation, filesystem I/O, subprocess execution, and CLI handling separated when practical.

    line 20
  9. Distinctive:

    Prefer pure functions for repository-domain logic so behavior can be tested without filesystem or process side effects.

    line 22
  10. Distinctive:

    Keep functions focused on one responsibility.

    line 24
  11. Distinctive:

    Prefer explicit control flow over clever or overly compact implementations.

    line 25
  12. Distinctive:

    Do not silently swallow parsing, validation, filesystem, or subprocess errors.

    line 27
  13. Distinctive:

    Do not rely on the caller's current working directory unless that is an explicit interface requirement.

    line 32
  14. Distinctive:

    Do not rely on filesystem traversal order.

    line 34
  15. Distinctive:

    Prefer generating complete output in memory before replacing an existing generated file.

    line 36
  16. Distinctive:

    Use temporary files or directories for intermediate state when needed.

    line 37
  17. Distinctive:

    Avoid modifying unrelated repository files as a side effect of validation.

    line 38
  18. Distinctive:

    Use proper parsers for structured formats.

    line 42
  19. Distinctive:

    Do not parse JSON, YAML, or similar structured data with regular expressions or shell pipelines.

    line 43
  20. Distinctive:

    Do not silently normalize malformed security metadata when rejection is safer.

    line 47
  21. Distinctive:

    Treat guide schema and catalog structure as compatibility-sensitive contracts.

    line 49
  22. Very specific:

    Use subprocess.run() with an argument list.

    line 53
  23. Very specific:

    Never use shell=True with dynamic or repository-controlled input.

    line 54
  24. Distinctive:

    Do not construct shell commands by concatenating strings.

    line 55
  25. Very specific:

    Use check=True when failure should abort immediately.

    line 57
  26. Very specific:

    Use check=False only when the return code is intentionally handled.

    line 58
  27. Distinctive:

    When selective or incremental validation cannot reliably determine what must run, fall back to the broader validation.

    line 64
  28. Distinctive:

    Never interpret missing Git metadata, malformed input, or detection uncertainty as permission to skip a check.

    line 66
  29. Distinctive:

    Prefer running extra validation over silently missing an affected repository invariant.

    line 67
  30. Distinctive:

    Keep runtime dependencies minimal.

    line 73
  31. Very specific:

    Update pyproject.toml and uv.lock together when dependency state changes.

    line 75
  32. Distinctive:

    Use locked dependency execution where the repository already provides it.

    line 76
  33. Distinctive:

    Do not update dependency locks implicitly during validation.

    line 77
  34. Distinctive:

    Test observable behavior and repository invariants, not internal implementation details.

    line 83
  35. Very specific:

    Prefer real temporary filesystem fixtures over mocking Path.

    line 84
  36. Very specific:

    Keep shared fixture-building helpers in scripts/tests/support.py when they are genuinely reusable.

    line 88
  37. Distinctive:

    Do not weaken assertions merely to accommodate changed implementation behavior.

    line 89
  38. Distinctive:

    If mutation-tested logic changes, also run the relevant mutation test command defined by the repository.

    line 102

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Python Repository Tooling Instructions

Scope

This directory contains Python tooling for repository validation, catalog generation, guide parsing, standards validation, label synchronization, and related maintenance tasks.

These scripts are part of the repository's integrity layer. Changes here may affect guides, generated catalog data, CI validation, and downstream machine-readable consumers.

Python Rules

  • Prefer the Python standard library unless an external dependency provides substantial value.
  • Add type annotations to function parameters and return values.
  • Prefer precise types over Any.
  • Use pathlib.Path for filesystem paths.
  • Read and write text files using explicit UTF-8 encoding.
  • Prefer immutable data structures for configuration and value objects when practical.
  • Keep module-level mutable state to a minimum.
  • Keep parsing, validation, transformation, filesystem I/O, subprocess execution, and CLI handling separated when practical.
  • Prefer pure functions for repository-domain logic so behavior can be tested without filesystem or process side effects.
  • Keep functions focused on one responsibility.
  • Prefer explicit control flow over clever or overly compact implementations.
  • Catch only exceptions that can be handled meaningfully.
  • Do not silently swallow parsing, validation, filesystem, or subprocess errors.

Filesystem and Generated Data

  • Resolve the repository root from the script location when behavior depends on repository-relative paths.
  • Do not rely on the caller's current working directory unless that is an explicit interface requirement.
  • Sort filesystem-derived collections when order affects generated output or diagnostics.
  • Do not rely on filesystem traversal order.
  • Generated output must be deterministic.
  • Prefer generating complete output in memory before replacing an existing generated file.
  • Use temporary files or directories for intermediate state when needed.
  • Avoid modifying unrelated repository files as a side effect of validation.

Structured Data and Validation

  • Use proper parsers for structured formats.
  • Do not parse JSON, YAML, or similar structured data with regular expressions or shell pipelines.
  • Validate required fields and expected value shapes explicitly.
  • Reject unsupported or unexpected fields when the repository format is intentionally strict.
  • Detect duplicate identifiers and conflicting entries.
  • Do not silently normalize malformed security metadata when rejection is safer.
  • Centralize shared guide/catalog validation rules instead of duplicating them across scripts.
  • Treat guide schema and catalog structure as compatibility-sensitive contracts.

Subprocess Rules

  • Use subprocess.run() with an argument list.
  • Never use shell=True with dynamic or repository-controlled input.
  • Do not construct shell commands by concatenating strings.
  • Set cwd explicitly when command behavior depends on repository location.
  • Use check=True when failure should abort immediately.
  • Use check=False only when the return code is intentionally handled.
  • Capture subprocess output only when it is consumed.
  • Preserve useful failure context in diagnostics.

Fail-safe Validation

  • When selective or incremental validation cannot reliably determine what must run, fall back to the broader validation.
  • Never interpret missing Git metadata, malformed input, or detection uncertainty as permission to skip a check.
  • Prefer running extra validation over silently missing an affected repository invariant.
  • Validation scripts should detect invalid state, not automatically repair it unless repair is the explicit purpose of the script.

Dependencies

  • Keep runtime dependencies minimal.
  • Pin every added Python dependency to an exact version.
  • Update pyproject.toml and uv.lock together when dependency state changes.
  • Use locked dependency execution where the repository already provides it.
  • Do not update dependency locks implicitly during validation.

Tests

  • Behavioral changes in scripts/ must be covered by tests in scripts/tests/.
  • Bug fixes should include a regression test when practical.
  • Test observable behavior and repository invariants, not internal implementation details.
  • Prefer real temporary filesystem fixtures over mocking Path.
  • Tests must not modify the real repository.
  • Tests must not depend on network access, developer credentials, or execution order.
  • Cover meaningful success, failure, malformed-input, and boundary cases.
  • Keep shared fixture-building helpers in scripts/tests/support.py when they are genuinely reusable.
  • Do not weaken assertions merely to accommodate changed implementation behavior.

Required Checks

For changes under scripts/, run:

ruff check scripts
ruff format --check scripts
python3 -m unittest discover -s scripts/tests -v
python3 scripts/check.py

If mutation-tested logic changes, also run the relevant mutation test command defined by the repository.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.