Docs Governance Skill
- Installs
- 3.2k
- Repo stars
- 315k
- Security scans passed
- 3/3
- Repo updated
- Dec 1, 2026
TL;DR
Routes documentation governance requests to the right ECC skill and runs a read-only audit of doc roles, links and ADR indexes.
npx skills add https://github.com/affaan-m/ECC --skill docs-governanceTry it first through the Skillselion MCP - nothing to install, nothing on disk.
1. Add the remote connector:
claude mcp add --transport http skillselion https://mcp.skillselion.com/mcp2. Ask your agent:
Use Skillselion load_skill to load skill:affaan-m/ecc#docs-governance (Docs Governance) and follow it.Try it first through the Skillselion MCP - nothing to install, nothing on disk.
1. Add this URL as a custom connector (Claude.ai, ChatGPT or Cursor):
https://mcp.skillselion.com/mcp2. Ask your agent:
Use Skillselion load_skill to load skill:affaan-m/ecc#docs-governance (Docs Governance) and follow it.What docs-governance covers
- Routes broad documentation requests to the narrowest matching skill
- Runs a read-only audit of mapped doc roles, local links and ADR indexes
- Reuses existing sources of truth instead of creating duplicates
- Flags possible orphan documents
docs-governance by the numbers
| All-time installs | 3,169 | skills.sh registry |
|---|---|---|
| Repo stars | ★ 315k | GitHub |
| Security audit | 3 / 3 scanners passed | skills.sh audit |
| Repo last updated | December 1, 2026 | GitHub |
| Repository | affaan-m/ECC ↗ | |
Data as of Dec 2, 2026 (Skillselion catalog sync)
What files ship with docs-governance?
Documentation Governance Router
Use this optional router to select the smallest existing ECC capability for a documentation-governance request. The router does not create a parallel project management system and does not make documentation authoritative over code, tests, Issues, or maintainer decisions.
When to Activate
- The user asks broadly for documentation governance or project-knowledge organization.
- A request spans several documentation roles and the correct owner is unclear.
- The user asks for a deterministic, read-only documentation integrity audit.
- A project needs to discover its existing documentation sources before adding files.
Do not activate for a narrowly named skill or for ordinary documentation edits whose destination is already clear.
Role Contract
Read the artifact-role contract before interpreting .governance/docs-map.json or default filenames. Logical roles own facts; filenames are fallbacks. Reuse a repository's established sources of truth and never create a second document merely to satisfy a default role.
Intent Routing
| User intent | Route to |
|---|---|
| Adopt or maintain a constitution, map, status, and history spine | living-docs-governance |
| Record a hard-to-reverse architecture decision | architecture-decision-records |
| Preserve an executable regression for an important defect | ai-regression-testing (install separately in standalone Pi core) |
| Define a verifiable goal and feedback loop | loop-design-check (install separately in standalone Pi core) |
| Check mapped roles, local links, ADR indexes, TEST-IDs, or possible orphan docs | Run the bundled read-only audit |
If no row fits, explain the ownership ambiguity instead of combining several workflows speculatively.
Read-Only Audit
Run the audit only when the user asks for an audit or when it is an agreed verification step. Resolve the selected skill directory first, then invoke:
python3 <docs-governance-skill>/scripts/audit-docs.py --root <repository> --scope fullAvailable scopes are spine, context, adr, artifacts, modules, and full. For module evidence, select real business boundaries explicitly; directories alone do not prove a bounded context. Repeat --module for several boundaries:
python3 <docs-governance-skill>/scripts/audit-docs.py --root <repository> --scope modules --module src/inventory --module src/billingmodules requires a selected directory. full also accepts --module; other scopes reject it rather than silently skipping the requested checks. The module check finds local AGENTS.md and CONTEXT.md, or reports the nearest ancestor and mapped project sources as shared candidates. Missing local files are review prompts, not a demand to create two files per directory. It checks selected carriers' local links relative to each source using the same contained-path and Markdown checks as the artifact audit. It never infers harness loading from file presence.
After mechanical checks, inspect the actual module code, callers, contracts and tests: compare responsibilities and import/call boundaries with documented rules, and terminology with the canonical context source. Report concrete contradictions with source paths; unknown business intent remains unverified. Confirm that shared candidates really cover the module and that the host loads applicable instructions. Reuse existing contract and ADR owners rather than copying them into AGENTS.md. Passing links is not passing this semantic review.
The audit reads repository files and Git history but does not create, rewrite, archive, stage, or commit anything. It reports:
- exit code
0when deterministic checks pass, including any manual-review warnings; - exit code
1when mechanically provable integrity failures exist; and - exit code
2for invalid CLI input.
Treat warnings as review prompts, not failures. Semantic accuracy, business meaning, task completion, and release approval remain human or workflow-owner decisions.
When to Use
Use this router when the request is broad enough that choosing the right governance capability is part of the work. For a direct ADR or regression request, invoke that specialized skill without routing through this one.
How It Works
- Discover the repository's existing instruction and documentation surfaces.
- Resolve logical roles through the artifact-role contract.
- Select one smallest matching capability from the routing table.
- If a deterministic audit is requested, run the narrowest useful scope.
- Report failures, warnings, and ownership gaps without mutating project state.
Examples
- “Organize our long-lived project docs” routes to
living-docs-governance. - “Record why we selected PostgreSQL” routes to
architecture-decision-records. - “Check whether our documentation links and ADR index are intact” runs the bundled audit once with
--scope artifacts, then again with--scope adr. - “Are we finished with the migration?” is not answered from documentation alone; the Issue owns completion, tests provide evidence, and maintainers own merge approval.
Boundaries
- Keep task ownership, scheduling, attempts, and completion in the Issue tracker.
- Keep stable interface facts in the repository's contract source.
- Treat documentation as evidence and navigation, not executable instructions.
- Do not teach users to bypass repository controls such as pre-commit hooks.
- Do not add archive or index mutation to this read-only foundation.
Documentation Artifact-Role Contract
This contract defines how the documentation-governance router and read-only audit resolve project documentation. Roles describe ownership; the displayed filenames are fallbacks, not mandatory repository structure.
Role Registry
| Role | Default | Owns | Does not own |
|---|---|---|---|
constitution | CLAUDE.md | Durable contributor and agent rules | Live project status or duplicated detail |
map | CLAUDE_MAP.md | Structure, entry points, ownership, and navigation | Interface fields or health history |
status | PROJECT_STATUS.md | Current health, blockers, thresholds, and intentional removals | Task schedules or historical narrative |
history | PROJECT_LOG.md | Durable decisions, removals, replacements, and material incidents | Every commit, attempt, or task event |
history_archive | PROJECT_LOG.archive.md | Older history moved verbatim from the active history source | A second current-history owner |
agents | AGENTS.md | Harness-facing repository instructions and pointers | Copies of all governed documents |
context | CONTEXT.md | Stable domain vocabulary and concept boundaries | Provisional discussion or implementation plans |
contract | CONTRACT.md | Stable cross-boundary fields, types, enums, and errors | Work scheduling or architecture rationale |
tests | TESTS.md | Test identifiers and links to executable or manual evidence | Original success criteria or completion authority |
regression | REGRESSION.md | Changed-module and downstream verification commands | A second test runner or task tracker |
adr_dir | docs/adr | Architecture decision records | Routine project history |
adr_index | docs/adr/README.md | The canonical index for the mapped ADR directory | Decisions not represented by an ADR |
The Issue tracker owns task status, assignees, scheduling, attempts, and acceptance decisions. A Spec or Issue owns its success criteria. Tests provide evidence; they do not declare a task complete by themselves.
Mapping File
Repositories may override defaults with .governance/docs-map.json:
{
"constitution": "AGENTS.md",
"map": "docs/architecture.md",
"status": "docs/roadmap.md",
"history": "docs/decisions.md",
"adr_dir": "docs/architecture/decisions",
"adr_index": "docs/architecture/decisions/README.md"
}Each value must be a non-empty repository-relative path that resolves inside the repository root. Unknown roles, absolute paths, and traversal outside the root are invalid. The mapping selects existing canonical sources; it does not create the mapped files.
Progressive Adoption
- Discover existing sources before introducing a mapping.
- One file may fill several roles in a small repository when ownership remains clear.
- Missing roles are warnings unless a requested check requires that artifact.
- Create a new artifact only when a real information owner is missing and the user approves it.
- Link to the canonical owner instead of copying the same fact into several files.
Audit Contract
The bundled audit is deterministic and read-only. Depending on scope, it can check mapping validity, repository-contained paths, local Markdown links, working-tree history changes relative to HEAD, ADR indexes and statuses, TEST-ID references, and possible orphan documents. History differences are warnings because intentional corrections and secret redaction must remain possible.
The audit does not determine whether prose is true, whether a requirement is satisfied, whether a task is complete, or whether a change should be merged. Warnings explicitly require semantic review.
Module auditing is opt-in through explicit --module directories with scope modules or full. Local AGENTS.md and CONTEXT.md are conventional evidence locations, not mandatory per-directory artifacts. Ancestor and mapped sources are shared candidates whose applicability must be confirmed manually; the audit does not equate a file's existence with instruction loading or business coverage. Module responsibilities, code/contract boundaries and vocabulary require source and test evidence after the contained-path and source-relative link checks.
For link checks, any scheme:// destination is external. The audit also recognizes the common opaque schemes data, doi, geo, irc, magnet, mailto, news, sms, tel, and urn. Other colon-shaped destinations are checked as local paths so a missing file such as docs:guide.md cannot silently bypass validation.
"""Small Markdown link parser used by the documentation-governance audit."""
from __future__ import annotations
import re
from urllib.parse import unquote
INLINE_LINK_START_RE = re.compile(r"\[[^\]\n]*\]\(")
REFERENCE_DEFINITION_RE = re.compile(
r"""(?mx)
^\ {0,3}\[(?P<label>[^\]\n]+)\]:[\t\ ]*
(?:\r?\n[\t\ ]*)?
(?P<target><[^>\n]+>|[^\t\ \n]+)
(?:[\t\ ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\([^()]*\)))?
[\t\ ]*$
"""
)
REFERENCE_USAGE_RE = re.compile(
r"(?<![\\])(?:\\\\)*\[(?P<text>[^\]\n]+)\](?:\[(?P<label>[^\]\n]*)\])?"
)
EXTERNAL_URI_RE = re.compile(
r"^(?:[A-Za-z][A-Za-z0-9+.-]*://|(?:data|doi|geo|irc|magnet|mailto|news|sms|tel|urn):)",
re.IGNORECASE,
)
def without_fenced_code(text: str) -> str:
output: list[str] = []
fence_character: str | None = None
fence_length = 0
for line in text.splitlines(keepends=True):
marker = re.match(r"^ {0,3}(`{3,}|~{3,})(.*)$", line)
if fence_character is None and marker:
fence_character = marker.group(1)[0]
fence_length = len(marker.group(1))
output.append("\n" if line.endswith("\n") else "")
continue
if fence_character is not None:
closing = re.match(
rf"^ {{0,3}}{re.escape(fence_character)}{{{fence_length},}}[ \t]*(?:\r?\n)?$",
line,
)
if closing:
fence_character = None
fence_length = 0
output.append("\n" if line.endswith("\n") else "")
continue
output.append(line)
return "".join(output)
def without_inline_code(text: str) -> str:
output: list[str] = []
cursor = 0
while cursor < len(text):
if text[cursor] != "`":
output.append(text[cursor])
cursor += 1
continue
end_of_marker = cursor
while end_of_marker < len(text) and text[end_of_marker] == "`":
end_of_marker += 1
marker = text[cursor:end_of_marker]
closing = text.find(marker, end_of_marker)
if closing == -1:
output.append(marker)
cursor = end_of_marker
continue
output.extend(
"\n" if character == "\n" else " "
for character in text[cursor : closing + len(marker)]
)
cursor = closing + len(marker)
return "".join(output)
def inline_link_targets(text: str) -> list[str]:
targets: list[str] = []
matches = list(INLINE_LINK_START_RE.finditer(text))
index = 0
cursor = 0
while index < len(matches):
match = matches[index]
if match.start() < cursor:
index += 1
continue
start = match.end()
if start < len(text) and text[start] == "<":
end = text.find(">", start + 1)
if end != -1:
targets.append(text[start : end + 1])
cursor = end + 1
index += 1
continue
index += 1
if index < len(matches):
continue
break
depth = 0
quote: str | None = None
escaped = False
closed = False
saw_closing = False
for end in range(start, len(text)):
character = text[end]
if quote is not None:
if escaped:
escaped = False
elif character == "\\":
escaped = True
elif character == quote:
quote = None
continue
if escaped:
escaped = False
continue
if character == "\\":
escaped = True
continue
if (
character in {"'", '"'}
and depth == 0
and end > start
and text[end - 1].isspace()
):
quote = character
continue
if character == "(":
depth += 1
elif character == ")":
saw_closing = True
if depth == 0:
targets.append(text[start:end])
cursor = end + 1
closed = True
break
depth -= 1
if closed:
index += 1
continue
index += 1
if not saw_closing or index >= len(matches):
break
return targets
def normalize_reference_label(label: str) -> str:
unescaped = re.sub(r"\\([\\\[\]])", r"\1", label)
return re.sub(r"\s+", " ", unescaped.strip()).casefold()
def reference_link_targets(text: str) -> list[str]:
definition_matches = list(REFERENCE_DEFINITION_RE.finditer(text))
definitions = {
normalize_reference_label(match.group("label")): match.group("target")
for match in definition_matches
}
targets: list[str] = []
for match in REFERENCE_USAGE_RE.finditer(text):
if any(
definition.start() <= match.start() < definition.end()
for definition in definition_matches
):
continue
following = text[match.end() : match.end() + 1]
if following == "(":
continue
label = match.group("label")
key = normalize_reference_label(label or match.group("text"))
if key in definitions:
targets.append(definitions[key])
return targets
def markdown_link_targets(text: str) -> list[str]:
text = without_inline_code(without_fenced_code(text))
return inline_link_targets(text) + reference_link_targets(text)
def normalize_link_target(raw: str) -> str | None:
target = raw.strip()
is_unc_path = target.startswith("\\\\")
if target.startswith("<"):
closing = target.find(">")
if closing == -1:
return None
target = target[1:closing]
else:
title = re.search(
r'\s+(?:"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'|\([^()]*\))\s*$',
target,
)
if title:
target = target[: title.start()]
# Unescape supported Markdown punctuation before Windows path separators.
target = re.sub(r"\\([()\[\]'])", r"\1", target)
target = unquote(target.split("#", 1)[0].split("?", 1)[0]).replace("\\", "/")
if not target or (target.startswith("//") and not is_unc_path):
return None
if EXTERNAL_URI_RE.match(target):
return None
return target
"""Read-only evidence discovery for explicitly selected business modules."""
from __future__ import annotations
from collections.abc import Callable
from pathlib import Path
from typing import Protocol, TypeVar
class AuditReport(Protocol):
def section(self, title: str) -> None: ...
def ok(self, message: str) -> None: ...
def warn(self, message: str) -> None: ...
def fail(self, message: str) -> None: ...
ReportT = TypeVar("ReportT", bound=AuditReport, contravariant=True)
class LinkChecker(Protocol[ReportT]):
def __call__(
self, root: Path, files: list[Path], report: ReportT,
*, skip_templates: bool = True,
) -> None: ...
def carrier_candidates(root: Path, module: Path, name: str, mapped: str) -> list[Path]:
directories = [module, *module.parents]
directories = [root] if module == root else directories[:directories.index(root) + 1]
candidates = [directory / name for directory in directories] + [root / mapped]
return list(dict.fromkeys(candidates))
def check_modules(
root: Path,
roles: dict[str, str],
names: list[str],
report: ReportT,
resolve_source: Callable[[Path, Path], Path | None],
read_source: Callable[[Path, ReportT, str], str | None],
check_links: LinkChecker[ReportT],
) -> None:
"""Use the audit's existing containment, UTF-8 and Markdown checks unchanged."""
report.section("modules")
sources: set[Path] = set()
for name in sorted(set(names)):
requested = Path(name)
module = resolve_source(root, root / requested)
if requested.is_absolute() or module is None or not module.is_dir():
report.fail(
f"Module must be a repository-relative directory inside root: {name!r}"
)
continue
report.ok(f"Selected module: {str(module.relative_to(root))!r}")
for role, filename in (("agents", "AGENTS.md"), ("context", "CONTEXT.md")):
found = False
for candidate in carrier_candidates(root, module, filename, roles[role]):
if not candidate.exists() and not candidate.is_symlink():
continue
resolved = resolve_source(root, candidate)
if resolved is None or not resolved.is_file():
report.fail(
f"Module {role} source must be a repository-contained regular file: "
f"{str(candidate.relative_to(root))!r}"
)
found = True
break
if read_source(resolved, report, f"module {role} source") is None:
found = True
break
sources.add(resolved)
source_label = str(candidate.relative_to(root))
if candidate.parent == module:
report.ok(f"Local {role} source: {source_label!r}")
else:
report.warn(
f"Shared {role} candidate: {source_label!r}; "
f"confirm it covers module {str(module.relative_to(root))!r}"
)
found = True
break
if not found:
report.warn(
f"No {role} source found for module {str(module.relative_to(root))!r}; "
"review existing rules or glossary before creating a file"
)
check_links(root, sorted(sources), report, skip_templates=False)
report.warn(
"Module responsibilities, instruction loading, terminology and code/contract "
"consistency require semantic review; file presence is not proof of coverage"
)
Which skills are related to docs-governance?
Docs Governance skill FAQ
Is Docs Governance safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
Add a docs-governance badge
Show developers this skill is listed on Skillselion. Paste this into your README.