lektorat-apply¶
Reviews existing Markdown prose against six editorial dimensions (readability, comprehensibility, grammar, style, audience-fit, idiomatic naturalness).
Reviews existing Markdown prose against six editorial dimensions (readability, comprehensibility, grammar, style, audience-fit, idiomatic naturalness) defined in spec/project/lektorat/. Three operations — audit (read-only report), patch (one finding, one diff, one approval), revise (full-artefact rewrite with diff review); dispatches lektorat-scanner for the detection phase. Invoke when the user asks to "lektoriere README.md", "audit docs for audience-fit", "revise this page with Lektorat", "prüfe auf Lesbarkeit", or equivalent EN/DE requests. Writes outputs to .audits/lektorat/<YYYY-MM-DD-HHMM>/. Don't use to author new prose (use audience-doc-author), curate Vale rules (use prose-vale-curator), lektor spec/ files (out of scope), or edit code, configs, or LLM-instruction artefacts (SKILL.md, agents/*.md). Supports resume on re-invocation per spec/claude/resumable-work/.
- Plugin:
nolte-shared - Phase: 6 Quality (
quality) - Tags:
prose,audit - Source: skills/lektorat-apply/SKILL.md
Use when¶
- you want to audit existing docs for editorial quality
- you want to apply a single editorial fix as a one-finding, one-diff change
- you want a full-artefact rewrite with diff review (lektorat revise)
Don't use when¶
- You want to author new prose from scratch →
audience-doc-author - You want to curate Vale rules rather than fix prose →
prose-vale-curator
See also¶
Referenced by¶
Lektorat Apply¶
Operationalises spec/project/lektorat/ for the nolte-shared plugin: the editorial layer that audits, patches, or revises already-existing human-readable Markdown prose against six named quality dimensions, with a per-language rule set and explicit operator dialogue at every mutating step.
This skill binds the spec's contract to an on-disk procedure. It does not redefine the rules; when this skill and the spec disagree, the spec wins and this skill needs the update.
German trigger phrases¶
This skill also triggers on equivalent German-language requests, including:
- "lektoriere die README"
- "prüfe diese Doku auf Lesbarkeit"
- "audit die Seite auf Audience-Fit"
- "revise diesen Eintrag mit Lektorat"
- "Rechtschreibung in den deutschen Docs prüfen"
User-language policy¶
Detect the user's language from their message and respond in it. The machine-readable JSON output uses English keys (per spec/project/lektorat/ §Outputs); the human-readable Markdown summary uses English section headings so downstream tooling can parse it reliably; prose around the report is localised.
The artefact being reviewed is not translated by this skill. Each file is reviewed against the rules of its own language (DE-rules on DE-text, EN-rules on EN-text); cross-language translation belongs to the spec skill or docs-multilingual-authoring.
Why this is a skill, not an agent¶
- Mid-flow user approval is load-bearing:
patchrequires explicit per-finding approval before any write (one finding, one diff, one OK), andreviserequires diff review on the full-artefact rewrite. Agents have no stable way to surface that dialogue back to the parent. - Externally visible writes: outputs land under
.audits/lektorat/<YYYY-MM-DD-HHMM>/and, inpatch/revise, modify in-scope Markdown artefacts. The skill owns the persistent on-disk state. - Orchestration role: this skill dispatches the
lektorat-scanneragent for the read-only D1–D6 detection (context-window protection, tool restriction) and stays in the main thread to render results, run operator dialogues, and write outputs. - Counter-dimension considered and accepted: the
auditoperation alone fits the agent shape cleanly (self-contained input, structured output, no interactivity). It still lives in this skill becausepatchandrevisereuse the same detection inventory and consolidating the three operations behind one entry point keeps the operator's mental model coherent. The scan half is delegated to the agent; the orchestration half stays in the skill per the hybrid pattern fromspec/claude/skill-vs-agent/.
Inputs¶
- Target set: one of (a) a single artefact path the user named, (b) a directory the user named (every in-scope file under it is reviewed), © the whole repository (default when the user gave no scope but invoked the skill). The set is filtered through §Scope and applicability in
spec/project/lektorat/before any scan runs. - Operation:
audit(default),patch, orrevise. The operation name must match the spec's closed vocabulary exactly; synonyms likecheckorrewriteare rejected. - Severity floor (optional, applies to all operations): defaults to
suggestion(report everything). The caller may narrow towarningorcriticalto de-noise gate-style runs. - Audience-artefact path (optional, defaults to
AUDIENCES.mdat the bounded-context root peraudience-identification): the skill resolves the artefact through the priority chain inspec/project/lektorat/§Audience binding; missing artefact stops the run with the message documented under §Hard rules.
Operations¶
1. audit (read-only)¶
Runs the spec's audit operation per §Operations §Operation A — audit. The operation completes without operator interaction and is suitable for CI / pre-commit / sprint-review / release-publish gates.
- Resolve scope — filter the user-supplied target set against
spec/project/lektorat/§Scope and applicability. Reject any path underspec/,skills/,agents/, source code, generated configs, or binary artefacts with the single-sentence rejection message the spec mandates. Code fences, inline code, HTML comments, and YAML frontmatter are read-only context. - Resolve languages — apply the file-to-language priority chain in §Language handling (path segment under
docs/<lang>/, suffix convention*.<lang>.md, repository default fromspec/.spec-config.yml, interactive operator choice as last resort). Never auto-detect from text content. Record the resolved language per file; this drives whether EN-mechanics or DE-mechanics fire. - Resolve audiences — read the audience artefact via the priority chain in §Audience binding. If missing at every declared location, stop with the single-sentence error message pointing at the
audience-identifyskill; never invent audiences. Resolve each artefact's applicable audiences via frontmatteraudience:→ artefact-type defaults → whole audience set (priority order from the spec). - Dispatch the read-only scanner — dispatch
lektorat-scanner(Agent) with the resolved (file, language, audiences, content_mode, audience-artefact) tuples and the severity floor. Wait for its structured findings inventory before proceeding. The spec leaves the dispatch shape open (one agent run per artefact vs. one batched run for the whole set); pick batched as the default and split per-file only when an artefact set spans more files than a single agent context can hold comfortably. - Render the JSON report following the verbatim shape in
spec/project/lektorat/§Outputs §Findings report (machine-readable). The top-level keys, in order, areoperation,operation_version,repository,ran_at,language_summary,pipeline_metadata,inventory_findings, andfindings.pipeline_metadata.<language>carries the resolved tool/version/configured_path per language;inventory_findingscarries infrastructure-level scan conditions (closedkindenumeration) that the scanner could not silently work around. Keepidstable across runs (hash of file + dimension + line) so dismissals recorded in earlier runs can be honoured. - Surface inventory conditions first — when the scanner returns a non-empty
inventory_findingsarray, render those as the first section of the Markdown summary under the heading Infrastructure conditions, before any severity-grouped editorial findings. They indicate parts of the scan that could not complete (Vale missing, DE pipeline missing, audience artefact missing, language ambiguous, content-mode missing). They carry no severity and are never auto-patchable. - Render the human-readable Markdown summary — severity-sorted (
criticalfirst, thenwarning, thensuggestion), within severity grouped by file then dimension, with each finding showing the offending sample (≤240 chars), the named rule or metric, the resolution hint, and the audience IDs the finding cites. - Write both outputs under
.audits/lektorat/<YYYY-MM-DD-HHMM>/(timestamp in UTC). The JSON file isfindings.json; the Markdown summary issummary.md; the caller-side configuration record (severity floor, resolved target set, user-supplied options) isrun.json. Pipeline metadata (tool name + version + configured path) lives infindings.json'spipeline_metadatablock per the spec, not inrun.json. - Confirm in the user's language with: the audit-trail folder path, the per-severity counts, the
inventory_findingscount when non-zero, and a one-line next-step hint (patchfor interactive fixes,revisefor full-artefact rewrites, or no action when the run was a gate check).
The audit operation never writes outside .audits/lektorat/, never edits any in-scope artefact, and never dispatches any mutating tool. Deterministic re-run produces a byte-identical findings array (modulo ran_at) on an unchanged repository.
2. patch (one finding, one diff, one approval)¶
Runs the spec's patch operation per §Operations §Operation B — patch. Each approval cycle resolves at most one finding.
- Run
auditfirst (see operation 1) — the patch list is the audit'sfindingsarray (editorial findings only);inventory_findingsare not patchable. If the caller invokedpatchstandalone, runauditimplicitly and cache the inventory. - Block on infrastructure conditions — when
inventory_findingsis non-empty, surface the list to the operator before any patch loop starts. The operator decides: resolve the underlying condition and re-run, or proceed with the partialfindingsset acknowledging the skipped dimensions. Never silently iterate over a partial inventory. - Sort findings in severity order (
critical→warning→suggestion) and present them to the operator one at a time. Within a severity, ties broken by file path then dimension. - For each finding, render the proposed edit as a unified diff against the on-disk artefact with at least three context lines, labelled with the operation name (
patch), the finding ID, and the file's repo-relative path. Show the finding's evidence and resolution hint alongside the diff. - Wait for explicit operator decision:
approvewrites the diff to disk;skipdefers the finding to the next run;skip-and-recordrecords a permanent dismissal (by findingid) under.audits/lektorat/<run>/dismissals.jsonso futureauditruns do not re-surface it. - Pre-write safety checks (refactor-safety per §Refactor safety): heading-text changes that move the MkDocs-derived slug must announce the slug churn to the operator before the write is approved; block-quoted citations and HTML comments must stay byte-identical; link
[text](target)pairs are preserved unless the finding explicitly targets the link; frontmatter key set and key order are preserved; embedded include directives are byte-identical; list items, table rows, and checklist entries are neither reordered, merged, nor split. - After every approved write, re-render the JSON and Markdown reports under the same
.audits/lektorat/<run>/folder so the audit-trail reflects the post-patch state. Do not start a fresh run folder per patch; the patch belongs to the audit run that surfaced the finding.
The patch operation never silently combines multiple findings into a single edit; a multi-finding fix is a sequence of patch operations, not a single one.
3. revise (full-artefact rewrite with diff review)¶
Runs the spec's revise operation per §Operations §Operation C — revise. The rewrite addresses every critical and warning finding from the prior audit in a single pass.
- Run
auditfirst on the target artefact (single file, not a set —reviseis per-artefact). Cache the pre-revisefindings list and the pre-revisetotal count. - Compose the rewrite addressing every
criticalandwarningfinding;suggestionfindings are optional and only adopted when adopting them does not extend the rewrite scope. - Enforce semantic preservation per §Operation C: every fact, claim, command, identifier, link target, frontmatter key, and code block from the original must still be present in the rewrite, with at most lexical changes (active voice, shorter sentences, lifted prerequisites). Never delete a section, drop a list item or checklist entry, drop a table row, or change a code block — those are structural decisions outside the spec's
revisescope and belong to the operator. - Forbid new factual content: if the prose required an addition (new command, new file path, new product name, new URL) that was not present in the original, the operation must surface a
suggestionto the operator and stop. Never invent facts to round out the rewrite. - Render the unified diff of the proposed full-artefact rewrite (operation
revise, finding IDs addressed, repo-relative path), with at least three context lines. - Wait for explicit operator decision on the full diff:
approvewrites the rewrite;rejectdiscards it;reviseinvites operator edit instructions and re-composes the rewrite before showing the diff again. Until approval lands, the on-disk artefact is untouched. - Re-run
auditon the rewrite before declaring success. Surface any new findings the rewrite introduced; if the post-revisetotal finding count exceeds the pre-revisecount, label the run a regression in the operator-facing confirmation and let the operator decide whether to keep, reject, orrevise-again. - Update the audit-trail folder: write
pre-revise.json,post-revise.json,rewrite.diff, and updatesummary.mdto record the regression status. Do not overwrite the originalauditreports; thereviseartefacts are siblings.
The revise operation never starts without a fresh audit pass and never writes the rewrite to disk until the operator explicitly approves the diff.
Output handling¶
All persistent outputs live under .audits/lektorat/<YYYY-MM-DD-HHMM>/ in the active repository (timestamp in UTC, minute-precision). The folder layout:
.audits/lektorat/<YYYY-MM-DD-HHMM>/
├── findings.json # Machine-readable; top-level keys per spec §Outputs:
│ # operation, operation_version, repository, ran_at,
│ # language_summary, pipeline_metadata,
│ # inventory_findings, findings
├── summary.md # Human-readable; Infrastructure conditions first,
│ # then editorial findings severity-sorted
├── run.json # Caller-side config: severity floor, resolved target set,
│ # user-supplied options (NOT pipeline metadata —
│ # that lives in findings.json's pipeline_metadata)
├── dismissals.json # Recorded skip-and-record entries (patch only)
├── pre-revise.json # revise only: pre-rewrite audit
├── post-revise.json # revise only: post-rewrite audit
└── rewrite.diff # revise only: unified diff of the rewrite
Mirrors the audit-trail convention used by .audits/portfolio/, .audits/skill-review/, and similar layered audits. The folder is per-run; never reuse an existing timestamped folder for a fresh run.
Examples¶
- Read
examples/01-audit-bilingual-repo.mdwhen running anauditacross a repository with both DE and EN documentation trees. - Read
examples/02-patch-readme-critical.mdwhen runningpatchon a published top-level artefact (README) with a mix ofcriticalandwarningfindings. - Read
examples/03-revise-tutorial-page.mdwhen runningreviseon a tutorial page whose readability metric crosses the corridor and whose voice flips active/passive.
Resumability¶
Per spec/claude/resumable-work/, this skill is resumable: true. State is persisted to .resume/lektorat-apply/<run-id>.yml after every successful user-approval gate and after each named phase boundary. On re-invocation, scan that directory for files with status: in_progress whose inputs: snapshot matches the current invocation; if one matches, prompt the operator with Resume run <run_id> from phase <phase> (last checkpoint <last_checkpoint_at>)? [resume / start-new / discard]. The state-file envelope (schema_version, run_id, inputs, phase, decisions[], status, ...) and the fail-closed semantics on schema or YAML errors are load-bearing in the spec; don't duplicate those rules here.
Hard rules¶
- The six quality dimensions (D1–D6), the three operations (
audit/patch/revise), the three severities (critical/warning/suggestion), the JSON output shape, the per-language readability corridors, the refactor-safety invariants, the audience-binding priority chain, and the language-resolution chain are defined inspec/project/lektorat/. This skill must not redefine, relax, or extend them; when this skill and the spec disagree, the spec wins. - Never lektor a file under
spec/,skills/**/SKILL.md,skills/**/templates/**,skills/**/examples/**, oragents/*.md. Reject with a single-sentence message naming the responsible authoring flow (thespecskill forspec/,skill-managementfor skill artefacts,agent-managementfor agent artefacts). - Never lektor source code, code comments, docstrings, generated configuration (
.github/*.yml,mkdocs.yml,Taskfile.yml, lockfiles), or binary artefacts. The scope is Markdown prose. - Never write to any in-scope artefact during
audit. The operation is read-only and must run unattended. - Never combine multiple findings into a single
patchedit; one finding, one diff, one approval. - Never write the
reviserewrite to disk until the operator explicitly approves the diff. Never introduce new factual content not present in the original artefact duringrevise. - Never invent audiences. When the audience artefact is missing at every location declared in
spec/project/lektorat/§Audience binding, stop with the single-sentence error message pointing at theaudience-identifyskill. - Never rewrite a non-English passage inside an English-resolved file (or vice versa). Such a passage is a
D3(spelling) orD5(register) finding and the resolution is flagged for the operator, not silently fixed. - Never auto-detect a file's language from its text content for scope decisions. Use the path-segment / suffix / repository-default / interactive-choice chain in priority order.
- Never modify a Vale rule, a vocabulary entry, or any rule mechanic. Vale and
nolte/vale-styleare owned byprose-styleandvocab-drift-audit; this skill consumes their output and surfaces it asD3/D4findings. - Always preserve refactor-safety invariants in every mutating operation: code blocks, inline code, HTML comments, YAML frontmatter (key set and key order), block-quoted citations, link
[text](target)pairs, heading IDs, embedded include directives, and the order and count of list items, table rows, and checklist entries. - Always record the DE pipeline (tool name, version, configured path) in
findings.json'spipeline_metadata.deblock perspec/project/lektorat/§Outputs — not inrun.json, which carries only caller-side configuration (severity floor, resolved target set, user-supplied options). The portfolio default is the LanguageTool HTTP API; a repository may override it but the chosen tool must be recorded inpipeline_metadata.defor the run to be reproducible. - Always cite the spec section that motivates a finding in the finding's
rulefield (for examplelektorat §D1 Readabilityorlektorat §D5 Audience-fit); a finding without a spec citation is not a finding.
Gotchas¶
auditdeterministic re-run depends on stable finding IDs. Theidis the hash of file + dimension + line; if the implementation re-keys findings on every run, dismissals recorded under one ID won't match the next run's IDs and the spec's "dismissal does not re-surface" acceptance criterion fails. Use a stable hash, document its inputs inrun.json, and never includeran_ator absolute paths in the hash.- DE pipeline tool choice is resolved at spec level: the portfolio default is the LanguageTool HTTP API (
spec/project/lektorat/§Open Questions §OQ-2, resolved). Use the Public endpoint (https://api.languagetool.org/v2) for open-source repositories or a self-hosted deployment of the same engine for repositories with sensitivity, throughput, or air-gap constraints — the HTTP-API contract is identical. A repository may override the default by pinning an alternative tool in itsLektorat-local configuration, but record whatever tool was actually used infindings.json'spipeline_metadata.deso the audit-trail is reproducible. mkdocs-include-markdown-plugindirectives look like prose but are not. Treat{% include … %}(or whatever syntax the plugin uses in the repository) as byte-identical context per §Refactor safety; the included source is reviewed when its own file is in scope, not through the consumer page. A naïve re-flow that paraphrases inside the include directive will silently break the include resolution at MkDocs build time.content_mode: metaexempts D1 entirely. Navigational pages (Home, per-section index) have no readability corridor; producing a D1 finding for ametapage is a spec violation, not a smell-test catch. Read the page's frontmattercontent_modebefore running D1 evaluation; when absent, fall back to the spec'scontent_modedefault perspec/project/mkdocs-structure/.auditagainst the whole repository on a first run can produce hundreds of findings. The severity floor exists for a reason — gate-style runs (release-publish, sprint-review) should narrow tocriticalto keep the report actionable; the first end-to-end audit on a repo that never ran Lektorat before will surface a largesuggestionbacklog. Surface the per-severity counts up front in the operator-facing confirmation so the operator can decide whether to triage now or defer.- GitHub Release-note bodies and Issue / PR bodies live outside the repository tree. The spec includes them as in-scope artefact types (per §Scope and applicability), but they are fetched via
gh api, not read from.. The audit-trail still writes to.audits/lektorat/<...>/in the active repository; the source artefact's identifier infindings.jsonuses theghURL shape (gh:nolte/<repo>/release/<tag>orgh:nolte/<repo>/issues/<n>) rather than a relative path so the link is unambiguous. - The skill never bumps version, never opens a PR, and never commits. Mutating operations land on disk in the working tree; staging, committing, and PR-creation are the operator's call (via
git add/git commitandnolte-shared:pull-request-create). Surfacing those follow-ups in the operator-facing confirmation is helpful; performing them silently is forbidden.
Multi-model testing¶
Examples and operations in this skill are expected to work on Claude Sonnet (default), Haiku (cost-sensitive runs, smaller audit scopes), and Opus (high-stakes runs, large revise rewrites). The skill body has no model-specific assumptions beyond standard tool-call semantics; the dispatched lektorat-scanner agent pins its own model per its frontmatter.