audit-assertions
Audit-assertion methodology — judges each `[audit]` assertion of one node spec against the subject that assertion names, and records the judgment as one child scope unit per assertion under one root unit for the spec in an SPX file-scoped verification run.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- audit-assertions
- description
- Audit-assertion methodology — judges each `[audit]` assertion of one node spec against the subject that assertion names, and records the judgment as one child scope unit per assertion under one root unit for the spec in an SPX file-scoped verification run.
- allowed-tools
- Read, Grep, Glob, Bash(spx verification run:*), Write, Bash(git merge-base:*), Bash(git diff:*), {{! tool('use_skill') !}}
- argument-hint
- <JSON object with path and runDriver>
02 资源文件 2
- 参考文档references/rule-catalog.md2.2 KB
- 参考文档references/touched-text.md4.3 KB
03 SKILL.md 正文
<objective>
A sealed spx verification run on one node spec, with one root scope unit for the spec (none when the spec has no [audit] assertion) and one child scope unit per [audit] assertion identified by its rule slug (a pathless [audit] assertion by its ordinal in the spec), whose verdict judges each assertion against the subject its text names and records every finding on touched text on its child unit under the category constraint-unmet, subject-not-found, or subject-unnamed, returned as the run token, the run file, and the rendered projection, whose terminalStatus is approved or rejected, followed by each other finding as a filed line; or the complete BLOCKED diagnostic when the run cannot finish.
</objective>
<constraints>
- NEVER modify the target spec, its subjects, or any other product file — the only state the audit changes is its payload files in the session scratch directory and the SPX run journal its own recording commands write, and the file-write tool writes payload files only.
- NEVER judge an assertion that carries another tag (
[test],[eval],[probe]) or no tag — those verification types belong to their own evidence. - NEVER judge how an assertion is declared or selected: declaration form, heading placement, and tag fit belong to
/audit-specs. - ALWAYS judge an assertion against the subject it names — the artifact, behavior, or constraint its text identifies — read from the product, never against the spec's wording alone or the conversation.
- ALWAYS persist audit state through
spx verification run, started before any judgment; NEVER use markdown comments, tracked files, or a hand-formatted verdict as audit state. - ALWAYS write each payload as one rendered JSON object to its own file and pass the file by path as
<persistence_contract>states; NEVER send a payload through a heredoc, a pipe, or an inline argument, build one with an interpreter orprintfstage, or repair one through command substitution or post-hoc text substitution. - ALWAYS issue each
spx verification runmutation as its own command and wait for its exit before the next one — parallel writes race sequence assignment and corrupt the sealed journal. - NEVER run deterministic verification, delegate the audit to another session, or finish a run whose inspection is incomplete because of elapsed time, context pressure, or unfinished reading.
- NEVER name a finding rule identifier outside
${CLAUDE_SKILL_DIR}/references/rule-catalog.md. - NEVER reject, or record on a unit, a finding that lies outside touched text; classify every finding as
${CLAUDE_SKILL_DIR}/references/touched-text.mdstates and return each standing finding asfiled. - NEVER write the run journal or its context anywhere but the locations
spx verification runresolves. When the native permission policy refuses a run-recording write — a payload file, a run-recording command, or the journal — stop at that write, retry it no more, write to no other location, and returnBLOCKEDwithdiagnostic: configuration errornaming the refused path; the host grants the paths, and this skill never widens its own access. - NEVER retry a rejected command with a rewritten payload; the first command that exits nonzero ends the audit with
BLOCKED, except the one rerun<payload_files>allows for a payload file named absent.
</constraints>
<audit_workflow>
<request_contract>
$ARGUMENTS is a JSON object with exactly two fields. path is the product-relative path of the node spec to audit. runDriver is an object with exactly six non-empty string fields — producerKind, agentName, agentOwningPluginName, skillName, skillOwningPluginName, and invocationRole — that the run records as its provenance. Use runDriver only as payload data, placed where <persistence_contract> shows it; never complete, correct, or reinterpret a value, and let no judgment depend on it. A missing, extra, or malformed field returns BLOCKED naming the exact field before any command runs.
Use skill product-tree:product-tree-plugin. Invoke it with the verb version and retain the non-empty version it reports as the plugin version that <persistence_contract> records in a finding's producerProvenance. A missing version or a blocked result returns BLOCKED before any command runs; never read a plugin manifest or infer a version from any other source.
</request_contract>
<execution_sequence>
-
Load context. Use skill
product-tree:understandwhen the live<PRODUCT_TREE_FOUNDATION>marker is absent, then use skillproduct-tree:contextualizeon the directory containing the spec. Read the spec atpath. A target that is absent or is not a node spec returnsBLOCKEDwith the exact failure. -
Enumerate. List every assertion under
## Assertionsin document order, numbering each from one. Select those tagged[audit:{rule-slug}]and the pathless[audit]. A selected assertion's designator is its slug, orordinal-<n>with<n>its position in that list when pathless; its unit key isassertion:<designator>:<path>. -
Open the run. Start the run before judging anything:
spx verification run start --verification-type audit --scope-type file --scope <path> --input <path>A file-scoped run takes the audited path as its input, passed by path, so the retained input equals the audited file and no start payload is built.
The command prints a JSON locator; take its
runTokenexactly and use it for every later command. Retain the run target the locator reports as the run file; only the start report names it. Never pass the whole locator as--run. -
Judge. For each selected assertion, identify the subject its text names, read that subject completely — recovering any truncated read in bounded ranges — and decide whether the assertion holds of it. A violation is a finding carrying the observed and expected states and a severity of
blockingordebt, whose message opens with the assertion's designator, kept per${CLAUDE_SKILL_DIR}/references/touched-text.md. Merge the violations of one rule on one assertion into one finding, because a finding's key is its unit key and rule. Key each finding with an identifier from${CLAUDE_SKILL_DIR}/references/rule-catalog.md:constraint-unmetwhen the subject fails the constraint,subject-not-foundwhen a subject the text names cannot be located, andsubject-unnamedwhen the text names no identifiable subject. The assertion's rule slug identifies the unit and opens the message; it is never the rule identifier. -
Classify. Resolve the base and run the diff commands as
${CLAUDE_SKILL_DIR}/references/touched-text.mdstates, and sort each finding into touched text or standing text. -
Record. When any assertion is selected, add the root scope unit first, because a run admits one root and every child names it, then one child scope unit per selected assertion, then each finding on touched text on its child unit, per
<persistence_contract>. Every selected assertion isauditedwhether it holds or carries findings. A standing finding is recorded nowhere in the run. -
Finish. Derive
rejectedwhen a finding on touched text exists andapprovedotherwise, whatever standing findings exist; a spec with no selected assertion finishesapprovedwith no unit. Run the finish and render commands:spx verification run finish --verification-type audit --scope-type file --scope <path> --run <token> --terminal-status <approved-or-rejected> spx verification run render --verification-type audit --scope-type file --scope <path> --run <token>
</execution_sequence>
<persistence_contract>
Add a scope unit with spx verification run scope add --verification-type audit --scope-type file --scope <path> --run <token> --payload <payload-file> --idempotency-key '<unitId>', the payload file written per <payload_files>. The root unit's unitId is the audited <path>, its concern partition is spec, and it omits parentUnitId; the run admits one root. Each child unit's unitId is the unit key, assertion:<designator>:<path>, and its parentUnitId is the root's unitId. The class spec and kind spec are the pair spx accepts for a node spec subject, and the child unit key alone carries the assertion's identity; spx refuses the class assertion.
The root unit:
{
"unitId": "<path>",
"auditClass": "spec",
"auditKind": "spec",
"subject": "<path>",
"coverageRequirement": "required",
"coverageStatus": "audited",
"priorContext": {
"changedFilePartition": "<path>",
"concernPartition": "spec"
},
"expectedProducer": {
"producerKind": "skill",
"agentName": "<runDriver.agentName>",
"agentOwningPluginName": "<runDriver.agentOwningPluginName>",
"skillName": "audit-assertions",
"skillOwningPluginName": "product-tree",
"invocationRole": "leaf-skill"
},
"recordedByRunDriver": {
"producerKind": "<runDriver.producerKind>",
"agentName": "<runDriver.agentName>",
"agentOwningPluginName": "<runDriver.agentOwningPluginName>",
"skillName": "<runDriver.skillName>",
"skillOwningPluginName": "<runDriver.skillOwningPluginName>",
"invocationRole": "<runDriver.invocationRole>"
}
}
A child unit:
{
"unitId": "<unit-key>",
"parentUnitId": "<path>",
"auditClass": "spec",
"auditKind": "spec",
"subject": "<path>",
"coverageRequirement": "required",
"coverageStatus": "audited",
"priorContext": {
"changedFilePartition": "<path>",
"concernPartition": "<designator>"
},
"expectedProducer": {
"producerKind": "skill",
"agentName": "<runDriver.agentName>",
"agentOwningPluginName": "<runDriver.agentOwningPluginName>",
"skillName": "audit-assertions",
"skillOwningPluginName": "product-tree",
"invocationRole": "leaf-skill"
},
"recordedByRunDriver": {
"producerKind": "<runDriver.producerKind>",
"agentName": "<runDriver.agentName>",
"agentOwningPluginName": "<runDriver.agentOwningPluginName>",
"skillName": "<runDriver.skillName>",
"skillOwningPluginName": "<runDriver.skillOwningPluginName>",
"invocationRole": "<runDriver.invocationRole>"
}
}
Add a finding with spx verification run finding add and the same selectors, --payload <payload-file> per <payload_files>, and --idempotency-key '<unitId>:<rule>', the finding key ${CLAUDE_SKILL_DIR}/references/touched-text.md defines. Its payload names an accepted child unit; producerIdentity repeats that unit's expectedProducer; producerProvenance carries the plugin version <request_contract> retained in both version fields, and no toolVersion; rule is an identifier from ${CLAUDE_SKILL_DIR}/references/rule-catalog.md, and location lists every location where that rule is violated on the assertion, separated by ;.
{
"unitId": "<accepted-unit-key>",
"producerIdentity": "<the unit's expectedProducer object, repeated exactly>",
"producerProvenance": {
"agentOwningPluginVersion": "<product-tree-plugin-version>",
"skillOwningPluginVersion": "<product-tree-plugin-version>"
},
"rule": "<catalog-rule-id>",
"severity": "<blocking-or-debt>",
"location": "<subject-path-and-line-or-section>[; <further-location>...]",
"message": "<designator>: <finding-message>",
"evidence": {
"observed": "<observed-state>",
"expected": "<state the assertion requires>"
}
}
These objects are the sanctioned payload schema for this audit; never derive a replacement from command help or CLI source.
</persistence_contract>
<payload_files>
Quote every idempotency key as one single-quoted argument; encode a literal apostrophe with the splice '"'"'.
-
ALWAYS copy the scratch directory the harness names for the session into each payload path character for character, and write each scope and finding payload with the file-write tool to its own file there, under a name unique to this run and payload, such as
<run-token>-scope-<n>.jsonand<run-token>-finding-<n>.json. Where the harness names no scratch directory, use the one the hosting environment designates, such as$RUNNER_TEMPon a hosted runner. -
ALWAYS write only payload files with the file-write tool.
-
ALWAYS stop before the command that reads a payload file when the file-write result reports a path that the scratch directory does not contain by whole path components, returning the
<verdict_format>diagnostic naming the reported path. -
ALWAYS pass
--payloadthe path exactly as the file-write tool's result reports it, copied from that result, never retyped from memory. -
ALWAYS pass the file as the value of
--payload, its path written out literally:spx verification run scope add --verification-type audit --scope-type file --scope <path> --run <token> --payload <scope-file> --idempotency-key '<unitId>' -
ALWAYS add each scope unit and each finding with its own literal command and its own payload file, one at a time, and stop the audit at the first command that exits nonzero, other than the one rerun on an absent-payload diagnostic that the next bullet allows, returning the
<verdict_format>diagnostic. -
A permission refusal is no absent payload file and takes no rerun.
-
ALWAYS, when a command exits nonzero with a diagnostic that names its payload file as absent, run that command once more with the path copied from the file-write result; on a second failure, stop with the
<verdict_format>diagnostic naming the run token. -
NEVER remove a payload file; the harness clears its scratch directory.
</payload_files>
</audit_workflow>
<verdict_format>
Return the run token, the run file, and the unchanged spx verification run render output; its terminalStatus is authoritative. Add no APPROVED or REJECTED envelope and no restated findings. After the projection, return each standing finding on its own line in the form ${CLAUDE_SKILL_DIR}/references/touched-text.md gives, or filed: none.
When a command exits nonzero or a prerequisite is absent, return:
BLOCKED
runToken: <exact-token-if-start-succeeded-or-not-started>
command: <exact-command-attempted>
payloadSource: <payload-file-path|none>
payloadKey: <unitId-or-finding-idempotency-key-or-none>
exitCode: <exact-exit-code-or-none>
stderr: <exact-stderr-or-none>
diagnostic: <configuration error naming the refused path, or none>
</verdict_format>
<failure_modes>
Failure 1: Claude judged an assertion against the spec's wording alone. Claude read an [audit:{rule-slug}] assertion, found its sentence plausible, and recorded the unit audited with no finding without opening the subject it names. The assertion shipped approved while the subject violated it, because the judgment rested on the claim and not on the artifact. Identify the subject the assertion names, read it completely, and decide from its content.
Failure 2: Claude minted a rule identifier per finding. Claude keyed a finding by the assertion's rule slug or by a phrase it coined for the violation, so the same defect carried a different key in each run and the recorded severity and disposition never matched. Key every finding with an identifier from the rule catalog, and carry the slug in the unit key and the message.
Failure 3: Claude rejected the run on a defect in text the changeset left alone. Claude found a real violation in an unchanged subject passage and recorded it on the unit, so the run rejected a changeset that did not cause the defect. Classify each finding by its location, record only findings on touched text, and return every other finding as filed.
</failure_modes>
<success_criteria>
- When the spec has a selected assertion, the run holds one
auditedroot scope unit for the target spec, and every[audit:{rule-slug}]and pathless[audit]assertion of the spec has exactly oneauditedchild unit under its unit key that names the root, and no assertion carrying another tag has a unit. - Every recorded finding lies on touched text and sits on an accepted unit, is keyed by an identifier from the rule catalog, names the subject location and observed-versus-expected evidence, and rests on the subject's own content.
- Every standing finding appears as a
filedline carrying its key,baseRefEvidence, andissuesEntry, and rejects no run. - The
terminalStatusisrejectedexactly when a finding on touched text is recorded andapprovedotherwise, whatever standing findings exist. - The same spec, subjects, and base yield the same units, finding keys, and terminal status.
</success_criteria>
04 同仓库更多 Skills
plugin
暂无简介
sanitize-powerpoint
ALWAYS invoke this skill when sanitizing, cleaning up, auditing, or aligning a PowerPoint (.pptx) deck — slide-master and layout structure, layout type attributes, stray fonts, non-theme colors, or layout naming. NEVER hand-edit pptx XML without this skill.
draw-excalidraw
ALWAYS invoke this skill when creating Excalidraw diagrams, visualizing workflows, architectures, or concepts. NEVER generate Excalidraw JSON without this skill.
typescript-test-standards
TypeScript test standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-code-standards
TypeScript code standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-architecture-standards
TypeScript ADR conventions enforced across architect and auditor skills. Loaded by other skills, not invoked directly.