OpenParable
Skip to content
← Back to skills

Whfmt Guard

Testing & Quality
whfmt-guard

Whfmt Guard is an Agent Skill for testing & quality published in the abbaye/WpfHexEditorIDE repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

INTERNAL DEV WORKFLOW for WpfHexEditor — Claude self-invokes after editing any *.whfmt under Core/WpfHexEditor.Core.Definitions/FormatDefinitions/ or the whfmt.schema.json. Domain checks NOT covered by build gate EmbeddedWhfmt_Tests (parse-only) or nuget-guard (public API): JSONC parse with /* */ header tolerated (per feedback_whfmt_guard), version monotone vs git HEAD (per feedback_whfmt_version), required schema fields (formatName, formatId, extensions, category, description), formatId uniqueness across catalog, magic-signature collisions, detection.strength enum (catches typos before SignatureStrength converter crash — bug_signaturestrength_converter), and placeholder/variables drift. Skip on: files outside FormatDefinitions/, Tests/, Samples/, doc-only or comment-only edits.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/abbaye/WpfHexEditorIDE/blob/HEAD/Sources/.claude/skills/whfmt-guard/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/whfmt-guard, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

whfmt-guard (internal)

Guards .whfmt file content. Complements nuget-guard (C# API) and EmbeddedWhfmt_Tests build gate (parse-only).

When I invoke

SituationRun?
Edit **/FormatDefinitions/**/*.whfmt or **/whfmt.schema.jsonyes
Edit .whfmt under Tests//Samples/, doc/comment only, .cs (nuget-guard)no

Pipeline

  1. Filter to .whfmt under Core/WpfHexEditor.Core.Definitions/FormatDefinitions/. Empty → exit 0.
  2. Load catalog index once for cross-file checks (R4, R5).
  3. Run R1→R9 per changed file. Exit code = ERR count. WARN-only ⇒ exit 0.
  4. Suppress: // whfmt-ignore: <reason> as JSONC line comment (R1 still parses).

Rules

RuleSevDetects
whfmt-jsonc-parseerrorJSONC parse failure; /* */ header tolerated
whfmt-version-monotoneerrorversion < git HEAD version; new files exempt
whfmt-schema-requirederrorMissing: formatName/formatId/extensions(≥1)/category/description
whfmt-id-uniquenesserrorformatId collision across catalog (case-insensitive)
whfmt-magic-collisionwarnSame sig+offset+ext overlap; silence by adding detection.validation.note
whfmt-strength-enumwarndetection.strength ∉ {None, Weak, Medium, Strong, VeryStrong}
whfmt-placeholder-driftwarn{{var}} in description/blocks but var not in variables{}
whfmt-expression-refswarnIdentifier in assertions/blocks/forensic expressions not in variables{}/functions{}/built-ins
whfmt-enum-valueswarnUnrecognized value in closed-set fields: blocks[].type (15 types), blocks[].valueType, assertions[].severity, detection.matchMode, fuzz.strategies[].mutation, repair[].action, forensic.riskLevel, etc.

Known deliberate gaps (dual-shape fields, no false-positive–free rule possible):

  • references — 24% flat array / 76% named-bucket object; typos in bucket keys silently hide entries in IDE.
  • formatRelationships — same dual shape (28%/72%).
  • syntaxDefinition.rules[].colorKey — parsed by DTO but ignored at runtime.

Does not validate block offsets (whfmt.Validate), run fuzz (whfmt.Fuzz), or check schema JSON itself.

Maintenance

  • New required schema field → add to whfmt-schema-required list.
  • New SignatureStrength enum value → update whfmt-strength-enum allow-list + C# enum in lockstep.