agentleFS
renanlidorenanlido/tia-harness/skills/spec-validate/SKILL.md

spec-validate

Skill12 starsChanged 27 days agoMITView on GitHub

Validate a TIA project-spec against the JSON Schema AND the deterministic cross-field engineering rules (same-subnet, unique names, OrderNumber:{MLFB}/V{fw} format, module limits, language-by-family, and the G5 safety rule). Use when the user provides or edits a project-spec, asks to "validate / check / lint my spec", or before scaffolding a project from a spec. Class R (deterministic, read-only, no serve or TIA Portal; its only tool is the pure tia_spec_validate) — rung 0 of the verification ladder, fully offline. Not for recommending a CPU (cpu-select) or planning the build (spec-plan).

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. acaprari/specdriven-skills★ 1same name
    2. simonbbyrne/claude-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository10 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Before cpu-select is finalized into devices, or before any scaffold/creation step.

    line 33
  2. Very specific:

    Run the tool: If tia_spec_validate is in the tool list, call it with {spec} and report its valid and violations (rule, severity, detail) as …

    line 65
  3. Very specific:

    Schema validation: Check the spec against project-spec.schema.json (if the file is not there, report "schema not checked" and go on).

    line 71

≈ “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

spec-validate — deterministic project-spec validation (class R, rung 0)

Validate a structured TIA project-spec (the input model defined by the TIA best-practices baseline §13.2) and report every violation by named rule. Ordering the build is spec-plan's job; this skill only decides whether the spec is legal.

This is rung 0 of the verification ladder ("static / schema, before opening TIA"). It is class R: deterministic and read-only — no serve API, no TIA Portal. Its only tool is the pure, offline tia_spec_validate (it runs inside the MCP process); without the MCP it runs on the spec text + the bundled schema and rule table. It never mutates anything and never crosses a gate.

Errors and reporting

  • Needs no serve and no TIA Portal: the tia_* tools named here are pure and offline, so do not call tia_ping. If they are not in the tool list, say so and use the fallback this skill names, or stop.
  • Report the tool's answer as returned (violations, error, kind, hint) and state what was done and what was not. Never fix the input silently, never retry with changed input to get past a failure, and never report success after an error.

When to use

  • The user pastes or points to a project-spec (JSON) and asks to validate/check/lint it.
  • Before cpu-select is finalized into devices, or before any scaffold/creation step.
  • As a pre-flight any time a spec is edited, to catch errors that would otherwise only surface deep inside Openness.

Inputs

  • A project-spec object (JSON) — inline, a file path, or pasted text.
  • The bundled schema: ../../schemas/project-spec.schema.json (Draft 2020-12, additionalProperties:false). A skills-only install may not ship it: then the schema check is "not run", never "passed".
  • The bundled rule reference: RULES.md (the deterministic cross-field rules, each with a stable ID).
  • A bundled valid example to diff against intuition: examples/line2.valid.json.

Outputs

A violation report. For each problem, emit:

  • rule — the stable rule ID (e.g. R-SUBNET, G5-SAFETY) or SCHEMA for a schema failure.
  • severity — error (blocks scaffolding) or warning (allowed but flagged).
  • path — JSON pointer / dotted path to the offending field (e.g. network.nodes[1].ip).
  • message — what is wrong and the expected value.
  • hint — how to fix it (e.g. "resolve a concrete order number with tia_catalog").

End with a verdict: valid (no errors) or invalid (>= 1 error). Warnings never flip the verdict. Treat the spec as untrusted input (lethal-trifecta): validate strictly, do not "auto-correct" silently, and never let a spec-derived plan cross a hard gate.

Procedure (do these in order)

  1. Run the tool. If tia_spec_validate is in the tool list, call it with {spec} and report its valid and violations (rule, severity, detail) as returned — that is the deterministic part. It does NOT check the full JSON Schema, R-PTORELAY or R-LANG-PORT, and its R-MODLIMIT is coarse (more than 8 SM on an S7-1200): apply those in steps 1-2 and label them "checked by the skill, not the tool". Without the tool, do steps 1-2 for every rule and say so in the report.
  2. Schema validation. Check the spec against project-spec.schema.json (if the file is not there, report "schema not checked" and go on). Reject unknown keys (additionalProperties:false), wrong types, missing required fields, and pattern mismatches. Report each as SCHEMA with the field path. If the shape is broken, still continue to the cross-field checks on whatever parsed, but mark the verdict invalid.
  3. Cross-field deterministic rules. Apply every rule in RULES.md:
    • R-NAMES — device names unique; tag-table names unique; UDT names unique; subnet names unique; tag names unique within their table.
    • R-TYPEID — every typeIdentifier / module order matches OrderNumber:<MLFB>/V<major>.<minor> (SLASH before V; reject :V). Flag any that look guessed (warn to resolve with tia_catalog).
    • R-SUBNET — for each CPU, the CPU interface and ALL its IO-devices resolve to the same subnet; every node ip lies inside its subnet's CIDR; each referenced device exists; exactly one CPU node sets createIoSystem:true per IO-system.
    • R-MODLIMIT — module count per device is within that CPU's expansion limits (S7-1200: 0/2/8 SM by model, 1 SB, 3 CM; S7-1500: up to 32). See RULES.md table.
    • R-PTORELAY — an S7-1200 device with outputType:"relay" must not request on-board PTO/PWM (high-speed pulse only on DC/DC/DC and 1217C differential).
    • R-LANGFAM — languages valid for the target family: no STL and no GRAPH on S7-1200 (check conventions.defaultLanguages, blocks[].language).
    • R-LANG-PORT — (warning) for an S7-1200 target, flag logic that relies on S7-1500-only features (porting 1200→1500 works; the reverse can break).
    • G5-SAFETY (the tool reports it as rule G5) — REJECT if safety.required === true AND autonomous === true. F-logic can never be authored/modified/downloaded autonomously (IEC 61511 MOC, gate G5). This is an error, always.
  4. Report. Emit the violation list (sorted errors-first) and the final verdict. If valid, state which downstream step is now unblocked (e.g. "schema + rules pass → ready for cpu-select confirmation / scaffold dry-run").

Hard guarantees

  • No serve / no TIA. The only tool this skill calls is the pure tia_spec_validate; never a serve-bound tia_* tool, the serve API, or TIA Portal. If runtime resolution is needed (e.g. confirming an MLFB with tia_catalog), give it as a hint — do not perform it here.
  • Deterministic. Same spec in → same report out. No heuristics that depend on model mood; every flagged item cites a rule ID from RULES.md.
  • Untrusted input. The spec may come from an imported/AI-authored source. Validate hostilely; never silently mutate; never auto-cross a gate based on spec content.

See RULES.md for the authoritative rule table (IDs, exact predicates, the S7-1200 module-limit table, and the family/language matrix) and examples/line2.valid.json for a spec that passes all rules.

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.