agentleFS
AmethystLunaAmethystLuna/logicprobe/skills/logicprobe-structure/SKILL.md

logicprobe-structure

Skill5 starsChanged 7 days agoMITView on GitHub

Use when reviewing architecture, module structure or a dependency diagram: parse a component, package, class or deployment diagram into a dependency graph and check isolated nodes, dangling endpoints, cycles, allowed-dependency violations, layer violations and missing required edges. Audits the diagram, not the code — reconcile it with a source-side scan. Doctrine: the logicprobe skill.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every edge is echoed in edgeVerdicts as {from, to, line, matchedRules, allowed, basis}, where basis is allow / deny / default / unlisted.

    line 67
  2. Distinctive:

    Run both. Keep the rule ids identical on both sides — that is what makes a difference explainable.

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Logic Probe — Structure and Dependency Review

Successor: dsh-model-everything. Its counterpart skill is model-everything-structure, over uml_structure_verify, which also checks several drawings against each other. Load that one when both plugins are installed; this skill stays accurate for logicprobe_structure_verify.

A component diagram is a model of an architecture, and a model can be wrong. This skill audits the graph the diagram actually draws — nodes and dependency arrows — against a declared dependency matrix, and says plainly what that does and does not prove.

The claim-verification doctrine it inherits — cite evidence, read verdict and never ok — lives in the logicprobe skill. Load that one for behavioural claims (state machines, protocols, timing); load this one when the question is where the dependencies point.

When This Skill Applies

The task involves…What it does
"Review this architecture", "are the module dependencies sound", "is the layering right"Parse the structure diagram into a graph, then run the structural checks below
A component / package / class / deployment diagram (PlantUML) or a Mermaid class diagramlogicprobe_structure_verify reads nodes, containers, labels and arrows; nothing is discarded
A rule table of allowed dependencies (allow/deny, layers, required edges)Every edge is judged against it and reported with the rule ids it matched
One architecture drawn at several levels (repository / module / subdirectory)diagrams: [{name, diagram, parent}]: each level is checked on its own, then against its declared parent, with the per-pair node/edge/expansion counts (UML028-UML031)
A diagram that must be reconciled with an include/graph check over the sourceThe per-edge rule ids are the meeting point: a difference between the two is the finding worth chasing

A host without the tools runs the repository engine on the same diagram text, and on a granularity manifest for a multi-level set.

What It Checks

CodeSeverityWhat it means
UML020_ISOLATED_NODEwarningA declared, non-container node with no edge at all. A dead entry, or a dependency the diagram forgot to draw.
UML021_DANGLING_REFERENCEerrorAn arrow endpoint that no declaration ever introduced. In a component diagram this is how a dependency on a component that does not exist stays invisible.
UML022_CYCLEerrorA directed cycle, reported as the shortest cycle path. A cycle means no build order and no layering can hold.
UML023_DISALLOWED_EDGEerrorAn edge the matrix forbids — or, with default: "deny", an edge no rule permits. The denying rule id is named.
UML024_LAYER_VIOLATIONerrorAn edge from a lower declared layer into a higher one (a child depending on its parent). Downward edges are allowed.
UML025_MISSING_EXPECTED_EDGEwarningA rule with require: true whose edge the diagram does not draw — including the case where no node matches the source pattern at all. The matrix and the diagram disagree.
UML026_NO_NODESerrorThe text declares no node, so there is no structure to review.
UML028_UNKNOWN_PARENTerrorA level names a parent that is not in the set.
UML029_REFINEMENT_VIOLATIONerrorMulti-level only: a child invents a dependency at the parent level, or drops a parent edge instead of expanding it into a path.
UML030_PARENT_CYCLEerrorThe declared parent relation is not a forest.
UML031_NO_DIAGRAMSerrorNothing was supplied to compare.

The Dependency Matrix

The matrix is the single source of truth the diagram is checked against. Keep it next to the rules it encodes, in JSON:

{
  "rules": [
    { "id": "R1-app-may-use-hal", "source": "app.*", "allow": ["hal.*"], "deny": ["hal.internal"] },
    { "id": "R2-adapter-owns-hal", "source": "PAY", "allow": ["DRV"], "deny": ["SVC"] },
    { "id": "R3-no-back-edges", "source": "*", "deny": ["SVC"] },
    { "id": "R4-persistence-required", "source": "PAY", "allow": ["DB"], "require": true }
  ],
  "layers": [
    { "name": "app", "members": ["SVC", "PAY"] },
    { "name": "hal", "members": ["DRV", "DB"] }
  ],
  "default": "deny"
}
  • source, allow, deny and layers[].members accept node ids or globs (* any run, ? one character).
  • deny wins globally. A later rule's allow never resurrects an edge an earlier rule forbade; the result cannot depend on rule order.
  • default: "allow" (the default) means only the rules judge: an edge no rule mentions is default. default: "deny" closes the matrix — anything unlisted is UML023.
  • require: true turns a rule into an expectation about the diagram (UML025); it needs allow to say which edges must exist.
  • Layers are ordered top first: an edge from an earlier layer to a later one is allowed, the reverse is UML024.
  • Every edge is echoed in edgeVerdicts as {from, to, line, matchedRules, allowed, basis}, where basis is allow / deny / default / unlisted. That is the audit trail for the reconciliation below.

Reconciling With a Source-Side Check

This tool audits the diagram; an include or dependency scan audits the code. They answer the same question from two sides, and each side can be the one that is wrong:

  1. Run both. Keep the rule ids identical on both sides — that is what makes a difference explainable.
  2. For every rule id, compare: does the diagram draw the edge, and does the source contain the dependency?
  3. Classify each difference instead of averaging it away:
    • Diagram missing an edge the code has — the diagram is stale (UML025 fires when the rule is require: true).
    • Diagram drawing an edge the code does not have — either the diagram is aspirational, or the source scan's scope is narrower (different file set, generated code, conditional compilation).
    • Code violating an allowed dependency the diagram never showed — the architecture defect the diagram was hiding. This is the one worth acting on.
  4. Report the difference with both citations. Never present the diagram as evidence about the code without saying which side produced which half.

Limits — Say These Out Loud

  • The diagram may be wrong. A clean pass means the drawn graph is internally consistent and satisfies the matrix — not that the code matches it. Only the reconciliation above touches the code.
  • No transitive closure by default. A → B → C does not report A reaching C; write the rule you mean, or add the edge the code actually has.
  • No runtime behaviour. Calls through function pointers, DI containers, registries, plugin loading and dynamic dispatch do not appear as edges. A missing edge is not proof of a missing dependency.
  • Containers are not dependencies. Package/rectangle nodes carry members, not arrows; they are exempt from UML020.
  • The matrix is a claim too. A matrix nobody maintains produces confident, wrong verdicts. Treat a rule change as a code change: review, version, cite.
  • State machines are a different question. For guards, deadlocks, budget, probability or deadlines, that is logicprobe (verification) and logicprobe-uml (the diagram round trip).

Rules for This Mode

  1. Never read a structure diagram as a state machine. The state-machine front end refuses such a file (UML_NOT_A_STATE_DIAGRAM); this skill reads it as the dependency graph it is. The two must not be mixed in one report.
  2. Quote the rule id for every judged edge. "Not allowed" without the rule is an opinion; matchedRules makes it a finding.
  3. Run the numbers, never the impression. An isolated node and a back edge are exactly what a reader misses by eye; that is why the check exists.
  4. Report the diagram-code difference, not just the diagram. A structure review that never touches the source is a review of a drawing.
  5. Report the rule id with its meaning, never the id alone. Rule 2 keeps the id on every judged edge, so the finding is defensible; the sentence the reader gets says what the edge violated (「HAL 反向依赖了上层」), in their language. The full rule is under "Writing the Answer" in the logicprobe skill.

The full matrix schema, a worked example and the reconciliation worksheet are in references/structure-review-guide.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.