It is better to prevent writing some wrong values to Wikidata than fixing its after write. Data validation might be based on existing constraints system. For example Format constraints are very useful for this.
The following changes are need to be done:
- One more possible value should be added for https://www.wikidata.org/wiki/Property:P2316. Something like "checked before write".
- wbcreateclaim, wbsetclaim and other edit APIs should validate incoming value using all constraints with "checked before write" status. The APIs should fail if some constraint is violated. Error message should have details about violated constraint.
- The APIs user should have ability to avoid some constraints check specifying some parameter. For example ignored_constraints=Q21510855. This is needed to work with circular links and similar cases.
- Wikidata UI also should validate values before write. Same as edits via API.
- Error message on UI should have button "ignore the error and write the value anyway".