<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq" -->

---
title: Give coding agents checks they can learn from | daily.dev
description: Enforceable checks, not remembered instructions, make it easier to catch a coding agent's mistakes. A database uniqueness constraint on a supplier/product code...
canonical: https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Give coding agents checks they can learn from | daily.dev
og:description: Enforceable checks, not remembered instructions, make it easier to catch a coding agent's mistakes. A database uniqueness constraint on a supplier/product code...
og:url: https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq
og:image: https://api.daily.dev/og/posts/Boo06aGOq.png
og:image:alt: Give coding agents checks they can learn from
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Give coding agents checks they can learn from

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 13 min read · 0 upvotes · 0 comments

## Summary

Enforceable checks, not remembered instructions, make it easier to catch a coding agent's mistakes. A database uniqueness constraint on a supplier/product code pair, paired with SQLite's ON CONFLICT DO NOTHING, prevents a repeated pair from being inserted twice while the constraint is present. Written rules, static types, runtime validation, database constraints and integration tests each cover a different gap, none alone sufficient. Agents can also edit the checks themselves, so passing tests must be reviewed alongside the diff that changed them.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/agent-trust-checks>

## Questions this post answers

### How do I prevent duplicate records when an AI coding agent writes the import logic?

Enforce uniqueness at the database level rather than relying on application logic or agent instructions. A SQLite table can declare 'UNIQUE (supplier_id, product_code)' with both columns 'NOT NULL', so any insert attempt that repeats the pair fails with a constraint error, regardless of how the import code is written.

_Anyone hardening agent-written import code can compare constraint patterns and reviews on daily.dev._

### Does a unique database constraint make an import operation safe to retry (idempotent)?

No, a unique constraint only guarantees the stored record itself isn't duplicated; it says nothing about side effects like notifications or billing calls triggered by the import. A worker could commit the product, send a notification, then fail before recording completion, so retrying could still duplicate the notification even though the product stays unique.

_Teams designing retry-safe workflows can track idempotency pitfalls like this on daily.dev._

### How should I handle a duplicate insert in SQLite without overwriting existing data?

Use a targeted ON CONFLICT clause, such as 'INSERT ... ON CONFLICT (supplier_id, product_code) DO NOTHING', which leaves the original row unchanged when the same supplier/product code pair is inserted again. The application should then separately check the database driver's result to report whether a row was actually inserted or already existed, rather than assuming every completed statement created a new record.

_Developers writing SQLite upsert logic can find concrete conflict-handling patterns like this on daily.dev._

## Similar posts on daily.dev

- [How Relational Database Constraints Work and Why They're Important](https://daily.dev/posts/how-relational-database-constraints-work-and-why-they-re-important-b2qqhc1ch) · freeCodeCamp · 1 upvotes · 0 comments
- [Agentic Code Quality](https://daily.dev/posts/agentic-code-quality-7iuckhife) · Addy Osmani · 56 upvotes · 6 comments
- [Coding Agents Keep Shipping Silent Failures — Here Is How to Catch Them](https://daily.dev/posts/coding-agents-keep-shipping-silent-failures-here-is-how-to-catch-them-cf5nsoexd) · Towards Data Science · 0 upvotes · 0 comments
- [Using coding agents on a migration: Three practices that mattered](https://daily.dev/posts/using-coding-agents-on-a-migration-three-practices-that-mattered-yrlwovp9d) · Temporal · 1 upvotes · 1 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#testing](https://daily.dev/tags/testing), [#sqlite](https://daily.dev/tags/sqlite)

[View this post on daily.dev](https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Give coding agents checks they can learn from","url":"https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq"},"datePublished":"2026-10-28T16:24:12.937Z","dateModified":"2026-10-28T16:35:39.169Z","description":"Enforceable checks, not remembered instructions, make it easier to catch a coding agent's mistakes. A database uniqueness constraint on a supplier/product code...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cc7a9958880390a6bb1631581c595fd7?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cc7a9958880390a6bb1631581c595fd7?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,testing,sqlite","timeRequired":"PT13M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"Give coding agents checks they can learn from"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/give-coding-agents-checks-they-can-learn-from-boo06agoq#faq","mainEntity":[{"@type":"Question","name":"How do I prevent duplicate records when an AI coding agent writes the import logic?","acceptedAnswer":{"@type":"Answer","text":"Enforce uniqueness at the database level rather than relying on application logic or agent instructions. A SQLite table can declare 'UNIQUE (supplier_id, product_code)' with both columns 'NOT NULL', so any insert attempt that repeats the pair fails with a constraint error, regardless of how the import code is written. Anyone hardening agent-written import code can compare constraint patterns and reviews on daily.dev."}},{"@type":"Question","name":"Does a unique database constraint make an import operation safe to retry (idempotent)?","acceptedAnswer":{"@type":"Answer","text":"No, a unique constraint only guarantees the stored record itself isn't duplicated; it says nothing about side effects like notifications or billing calls triggered by the import. A worker could commit the product, send a notification, then fail before recording completion, so retrying could still duplicate the notification even though the product stays unique. Teams designing retry-safe workflows can track idempotency pitfalls like this on daily.dev."}},{"@type":"Question","name":"How should I handle a duplicate insert in SQLite without overwriting existing data?","acceptedAnswer":{"@type":"Answer","text":"Use a targeted ON CONFLICT clause, such as 'INSERT ... ON CONFLICT (supplier_id, product_code) DO NOTHING', which leaves the original row unchanged when the same supplier/product code pair is inserted again. The application should then separately check the database driver's result to report whether a row was actually inserted or already existed, rather than assuming every completed statement created a new record. Developers writing SQLite upsert logic can find concrete conflict-handling patterns like this on daily.dev."}}]}
```

