Decision-Linked Development (DLD) — a workflow for recording, linking, and maintaining development decisions alongside code. Skills for planning, recording, implementing, auditing, and documenting decisions via @decision annotations.
68
Quality
68%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
You are running an autonomous audit of the decision-code relationship. Unlike the interactive /dld-audit, you detect issues and fix them without asking for human input. Your output is a branch with fixes and a PR for review.
This skill is designed for unattended execution — scheduled runs, CI pipelines, or autonomous agent sessions. Do not ask questions or wait for user input.
Shared scripts:
../dld-common/scripts/common.sh
../dld-common/scripts/regenerate-index.sh
../dld-common/scripts/update-status.shSkill-specific scripts:
../dld-audit/scripts/find-annotations.sh
../dld-audit/scripts/update-audit-state.shdld.config.yaml exists at the repo root. If not, exit with a clear error message.git status --porcelain should be empty). If not, exit — do not mix audit fixes with uncommitted work.git checkout -b dld/audit-$(date +%Y%m%d-%H%M%S)Perform all the same checks as /dld-audit:
bash ../dld-audit/scripts/find-annotations.shRead all DL-*.md files in the records subdirectory (decisions/records/). Note each decision's ID, status, and code references.
Check for all drift categories:
For check (4), if decisions/.dld-state.yaml exists with an audit.commit_hash, first verify reachability:
git cat-file -t <commit_hash> 2>/dev/nullIf unreachable (e.g., after rebase or shallow clone), skip check (4) and note it in the PR description. If reachable, use git diff --name-only <commit_hash>..HEAD to find changed files and cross-reference with annotated files.
Apply fixes for each issue category. Use judgment on what can be safely fixed automatically vs. what should only be flagged in the PR description.
Orphaned annotations — If the annotation has an obvious typo (e.g., DL-01 where DL-001 exists), fix it. If the referenced ID is completely unknown, remove the annotation and note the removal in the commit message.
Stale references in decisions — Remove file paths from the decision's references field that no longer exist. If the file was renamed/moved (detectable via git log --follow --diff-filter=R), update the path instead of removing.
Annotations referencing superseded decisions — Update the annotation to reference the superseding decision (read the supersedes field of the newer decision to find the chain). For deprecated decisions, remove the annotation.
Decisions without annotations — If an accepted decision has code references but no annotations, and the referenced files exist, add the missing @decision(DL-NNN) annotations to the referenced code locations.
Unreferenced code changes — Annotated files that were modified since the last audit without a corresponding decision update. These represent changes made outside the DLD process. Try to resolve them:
git log --oneline <last_audit_hash>..HEAD -- <file>). Look for context about what changed and why.gh CLI, etc.) to gather additional context about the change.@decision annotations to the new/changed code. Mark any new decisions as accepted since the code already exists.Important: These best-effort fixes are inferred, not authoritative. In the PR description, clearly mark each one under a "Inferred Decisions — Review Required" section. Explain what changed, what context was found (commit messages, tickets), and what decision was created or updated. Reviewers should prioritize checking these for accuracy.
If any decision records were modified:
bash ../dld-common/scripts/regenerate-index.shbash ../dld-audit/scripts/update-audit-state.shIf there are changes (fixes were applied or audit state was updated):
git add -ACommit with a descriptive message summarizing the fixes:
git commit -m "fix: resolve DLD audit drift
- [list each fix applied]
- Audit state updated"Push and open a PR:
git push -u origin HEADCreate a PR with the following structure:
## DLD Audit — Automated Drift Fixes
**Audit date:** YYYY-MM-DD
**Issues found:** N
**Auto-fixed:** M
**Needs review:** K
### Fixes Applied
- [Description of each fix, grouped by category]
### Inferred Decisions — Review Required
These decisions were created or updated based on code changes made outside the DLD process. The rationale was inferred from commit messages and available ticket context. **Please verify accuracy.**
- **DL-NNN: [Title]** (new/updated) — [What changed in the code, what context was found, what was inferred]
### Audit Summary
| Check | Result |
|-------|--------|
| Orphaned annotations | N found, M fixed |
| Stale references | N found, M fixed |
| Superseded/deprecated refs | N found, M fixed |
| Missing annotations | N found, M added |
| Modified annotated files | N flagged for review |If no issues were found (only audit state updated), still commit and push the state update but do not open a PR. Instead, exit with a message:
Audit complete. No drift detected. Audit state updated.