prolog-code-reviewlisted
Install: claude install-skill dougransom/prolog-agent-toolkit
# Prolog Code Review Guidelines & Checklist
Use this skill when reviewing Prolog pull requests, auditing code diffs, or evaluating code quality before merging into main development branches.
## 1. Code Review Checklist
| Dimension | Check Items |
| :--- | :--- |
| **Logical Purity** | - Are cuts (`!`) and negation-as-failure (`\+/1`) avoided in favor of `if_/3` from `library(reif)` or `dif/2` (preferring `dif(X, Y)` over `\+ (X = Y)`)?<br>- Are conditions and test-values isolated (e.g. `if_(G, A="A", A="B"), write(A)`)?<br>- Are Definite Clause Grammars (`-->`) used for sequence parsing/formatting instead of imperative loops? |
| **Clean Data Representation** | - Can every data element kind be distinguished solely by its **principal functor** (e.g., `leaf(L)` vs `node(L, R)`)?<br>- Are defaulty representations avoided so argument indexing works automatically?<br>- Are external defaulty/unstructured inputs converted into clean trees early? |
| **Determinism & Performance** | - Do deterministic predicates leave open choice points?<br>- Is the primary input placed in the first argument position for first-argument indexing?<br>- Is `zcompare/3` used for reified integer comparisons?<br>- Are recursive calls in tail position (TCO) with accumulators? |
| **Human Editing Syntax** | - Are neck operators `:-` free of dropped characters (`:` instead of `:-`)?<br>- Are line comments formatted with `%` rather than `#` or `//`?<br>- Are DCG rules declared with `-->` rather than `->`?<br