Skip to content

REF-004 Zone dependencies

Validates that Markdown links crossing zone boundaries (subdirectories under zonesDir) are explicitly declared in the dependency section of the source zone’s overview.md. Cross-zone references that are not declared are reported as error.

When documentation is organized into zones (responsibility-scoped directories) such as auth/, payment/, and notification/, dependencies between zones grow over time as implicit links. Even when the design says “auth does not depend on payment”, links can be authored freely and will accumulate undetected. This rule enforces “every cross-zone dependency must be declared in overview.md’s dependency section”, keeping the documentation structure aligned with the design intent.

FieldTypeRequiredDescription
zonesDirstringYesPath to the directory containing zones
dependencySectionstringHeading of the section that declares dependencies (default: Dependencies)

Each subdirectory directly under zonesDir is treated as one zone. Each zone is expected to contain an overview.md with the heading specified by dependencySection, and a table under that heading listing the names of the dependent zones.

docs/zones/auth/overview.md:
# Auth zone
## Dependencies
| Zone |
| ---- |
docs/zones/auth/login.md:
See [billing logic](../payment/charge.md) for details.

auth/login.md links to the payment zone, but payment is not declared in the Dependencies section of auth/overview.md, which triggers a violation.

docs/zones/auth/login.md
line 1 error Cross-zone reference to "payment" zone, but "payment" is not listed in the "Dependencies" section of auth/overview.md REF-004

Declare the dependency explicitly in overview.md.

docs/zones/auth/overview.md:
# Auth zone
## Dependencies
| Zone |
| ------- |
| payment |

If the dependency was unintended, remove the link or rethink the source zone.

{
"rule": "ref004",
"options": {
"zonesDir": "docs/zones",
"dependencySection": "Dependencies"
}
}