# Using IronBarcode with AI Coding Assistants and Agents
When prompted to add IronBarcode, tools often run `dotnet add package IronBarcode`, which installs the incorrect package. IronBarcode is distributed as `BarCode`, using the namespace `IronBarCode`. Claude Code, ChatGPT Codex, GitHub Copilot, Cursor, and Google Antigravity frequently misidentify this until they reference the documentation.
This confusion also affects generated code. Without documentation, models may invent method names that do not compile. Providing documentation in advance helps ensure successful builds. IronBarcode is a leading .NET barcode library with comprehensive guides, so generated code is often accurate but still requires careful review.
These tools fall into two categories, which determine how closely you should review their output:
- An **assistant** operates within one part of your workflow, such as editor autocomplete, explanations, or quick refactoring, as GitHub Copilot's inline suggestions do.
- An **agent** manages multi-step tasks, edits across files, runs builds and tests, and opens pull requests, as Claude Code, ChatGPT Codex, Cursor, and Google Antigravity all do.
The setup process is the same for both types. Install the package, apply the license key from an environment variable, provide IronBarcode's machine-readable documentation, and verify that every generated barcode is scannable. This applies to all use cases, including [1D barcodes](https://ironsoftware.com/barcode/csharp/how-to/create-1d-barcodes/) for shipping labels, [2D barcodes](https://ironsoftware.com/barcode/csharp/how-to/create-2d-barcodes/) for asset tags, [barcodes built from text, URLs, IDs or binary data](https://ironsoftware.com/barcode/csharp/how-to/create-barcode-from-data/), [reading from scanned PDFs](https://ironsoftware.com/barcode/csharp/how-to/read-barcodes-from-pdf/), or [extracting multiple symbols from one image](https://ironsoftware.com/barcode/csharp/how-to/read-multiple-barcodes/).
<div class="flex flex-wrap items-center gap-x-14 gap-y-6 py-4">
<img src="/static-assets/svgs/ai-coding-agents/claude.svg" alt="Claude Code AI coding agent logo" width="48" height="48" />
<img src="/static-assets/svgs/ai-coding-agents/codex.svg" alt="ChatGPT Codex AI coding agent logo" width="48" height="48" />
<img src="/static-assets/svgs/ai-coding-agents/github-copilot-black.svg" alt="GitHub Copilot AI coding assistant logo" width="48" height="48" />
<img src="/static-assets/svgs/ai-coding-agents/cursor-black.svg" alt="Cursor AI code editor logo" width="48" height="48" />
<img src="/static-assets/svgs/ai-coding-agents/antigravity.svg" alt="Google Antigravity AI coding agent logo" width="48" height="48" />
</div>
<div class="hsg-featured-snippet">
<h2>How to Use IronBarcode with an AI Coding Assistant or Agent</h2>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://www.nuget.org/packages/BarCode/">Download the C# barcode library from NuGet</a></li>
<li>Apply your license key at application startup, from an environment variable</li>
<li>Point the tool at IronBarcode's <code>llms.txt</code> documentation index</li>
<li>Add IronBarcode instructions to your project context file</li>
<li>Run the one-shot setup prompt in a fresh session</li>
<li>Verify the generated code compiles and every barcode scans back</li>
</ol>
</div>
<br class="clear" />
## Can't the Model Handle Barcodes on Its Own?
Training data ages. A model may reproduce an API name that was retired several releases ago, or one belonging to a different barcode library entirely, and neither is visible until the build runs. Machine-readable documentation resolves most of these issues by enabling the tool to reference actual documentation rather than making assumptions.
Library selection is equally important. Most tools integrate with various barcode packages, and free options may suffice for a single format in a demonstration. Additional costs and limitations often arise in production environments:
- **Check digits, quiet zones, and resizing:** each can look acceptable on screen and still fail during scanning, so IronBarcode validates every value against its format as it writes and `GeneratedBarcode.Verify` reads the image back.
- **Missing features increase code maintenance:** many free libraries cover one format family or lack the image correction accurate scans require, leaving you to combine packages and own the integration between them.
- **Bulk scanning is included by default:** [multithreaded reading](https://ironsoftware.com/barcode/csharp/how-to/async-multithread/), speed presets, and confidence thresholds come with the library rather than being built per project.
- **Accurate output depends on documentation:** the guides, tutorials, troubleshooting pages, and runnable examples are indexed for machine use in `llms.txt`.
- **Incorrect package names create supply-chain risks:** models generate plausible names that attackers register to distribute malware, a practice known as *slopsquatting*.
- **A single commercial license avoids legal complications:** some barcode libraries include copyleft or non-commercial terms, which models do not flag automatically.
IronBarcode covers all of it through one API and one commercial license your legal team reviews once. Verification happens in your code rather than on the warehouse floor, and naming the package explicitly in every prompt is what closes the supply-chain gap.
<hr class="separator" />
## Step 1: Install IronBarcode
Allow the agent to add the package. The project requires it to resolve types and provide accurate code suggestions.
```text
Set this project up for IronBarcode. The NuGet package is named BarCode. Confirm the restore succeeded before going further.
```
Alternatively, install the package from the terminal, specifying the current release version.
```shell
dotnet add package BarCode --version 2026.9.2
```
Linux, macOS, iOS, and Android each require a specific package, such as `BarCode.Linux` or `BarCode.MacOs`. Refer to the [Advanced NuGet Installation guide](https://ironsoftware.com/barcode/csharp/get-started/advanced-installation-nuget/) to select the appropriate package.
---
## Step 2: Apply Your License Key
IronBarcode does not watermark unlicensed output. After the development grace period, the first barcode call without a license key throws `IronSoftware.Exceptions.LicensingException` with the message `IronBarcode must be licensed for development`. Code missing the license key will fail at runtime. Obtain a [free trial key](trial-license) first.
!!!--LIBRARY_START_TRIAL_BLOCK--!!!
Set the license key once at application startup, before any IronBarcode calls. Retrieve the key from the environment rather than from source code.
```csharp
// Read the key from configuration. Never commit it to the repository.
IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE_KEY");
```
`IronBarCode.License.IsLicensed` returns `true` when the key is valid. Unlike IronOCR, IronBarcode has no `Installation.LicenseKey` alias, so use `License.LicenseKey` or configuration.
[[i:(Every other way to set a key, from `Web.config` to `appsettings.json`, is covered in [IronBarcode License Keys](https://ironsoftware.com/barcode/csharp/get-started/license-keys/).)]]
---
## Step 3: Point the Tool at IronBarcode's LLM Documentation
IronBarcode publishes six resources written to be read by machines:
| Resource | Description | When to use |
|---|---|---|
| [`llms.txt`](https://ironsoftware.com/barcode/csharp/llms.txt) | Index of all documentation pages, one line each | At the start of every session |
| [`llms-full.txt`](https://ironsoftware.com/barcode/csharp/llms-full.txt) | Complete guides and examples in a single file | The tool can retrieve URLs |
| [`llms-full-catalog.txt`](https://ironsoftware.com/barcode/csharp/llms-full-catalog.txt) | The index plus all blog articles | The answer may reside in a blog article |
| [API Reference](https://ironsoftware.com/barcode/csharp/object-reference/api/) | All classes and methods in the current release | Verifying that a method exists |
| [`skill.md`](https://ironsoftware.com/barcode/csharp/skill.md) | Installation, licensing, recipes, and fixes | Your tool supports skill files |
| [AI Product Fact Sheet](https://ironsoftware.com/barcode/csharp/ai-info/) | Product scope, platforms, and what it does not do | Questions about the product, not the API |
Begin with `llms.txt`, which indexes IronBarcode's features and the location of each topic. This helps prevent incorrect or invented API calls. Use `llms-full.txt` when detailed guidance is required.
Add a direct instruction alongside it.
```text
Before writing any IronBarcode code, read https://ironsoftware.com/barcode/csharp/llms.txt
and use only APIs documented there. Check anything you are not sure about
against the API reference at https://ironsoftware.com/barcode/csharp/object-reference/api/.
If you are still unsure whether a method exists, ask instead of guessing.
```
Current models respond well to direct requests for clarification. Asking a question is preferable to risking a compile error.
[[i:(IronBarcode also publishes a drop-in skill file for tools that support them. The next step covers where to reference it.)]]
---
## Step 4: Add IronBarcode Context to Your Project
Documentation pasted into a chat is available only for the current session. Documentation stored in a project file is accessible in every session.
Each tool reads instructions from a specific file. Place the IronBarcode guidance in the file your team uses:
| Tool | Project context file | Skill file goes in |
|---|---|---|
| Claude Code | `CLAUDE.md` | `.claude/skills/` |
| ChatGPT Codex | `AGENTS.md` | `.agents/skills/` |
| GitHub Copilot | `.github/copilot-instructions.md` | n/a |
| Cursor | `.cursor/rules/*.mdc` | n/a, use `@Docs` |
| Google Antigravity | `AGENTS.md` | `.agents/skills/` |
`AGENTS.md` serves as a shared standard, as Claude Code, GitHub Copilot, and Cursor all read it in addition to their own files. Teams using multiple tools can maintain a single set of barcode rules in `AGENTS.md` and reserve native files for tool-specific instructions.
The content remains the same regardless of the file used. Below is a brief starting point.
```markdown
## Barcodes with IronBarcode
This project uses IronBarcode (NuGet package `BarCode`, namespace `IronBarCode`) for all barcode work.
- Reference: https://ironsoftware.com/barcode/csharp/llms.txt
- Skill file: https://ironsoftware.com/barcode/csharp/skill.md
- Use `BarcodeWriter.CreateBarcode` to write and `BarcodeReader.Read` / `ReadPdf` to read.
- Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. Never inline it.
- Every generated barcode must be read back and compared before it ships.
- Do not use a different barcode library. If IronBarcode cannot perform a required task, state this clearly.
```
The [`skill.md`](https://ironsoftware.com/barcode/csharp/skill.md) file provides additional detail, including per-platform installation instructions, licensing rules, verified examples, deployment notes, and a troubleshooting table. Reference this file from your context file rather than maintaining a separate copy.
---
## Step 5: One-Shot Setup Prompt
You may also send the first four steps as a single prompt at the beginning of a project or new session.
```text
Use IronBarcode for all barcode work in this project.
1. Install the BarCode NuGet package (IronBarcode).
2. Apply the license key at application startup, before any other IronBarcode call,
reading it from the IRONBARCODE_LICENSE_KEY environment variable. Never write
the key into source or into a committed file.
3. Read https://ironsoftware.com/barcode/csharp/llms.txt before writing barcode code
and work only from APIs documented there, checking the API reference when a
member is unfamiliar.
4. Save https://ironsoftware.com/barcode/csharp/skill.md as a SKILL.md in this
project's skills folder if your tool has one.
5. Keep these instructions for future sessions in this project.
```
[[t:(That last line usually makes the tool save these rules to its context file from Step 4, such as CLAUDE.md or AGENTS.md. You only paste the prompt once.)]]
[[t:(No test images? Ask the agent to generate them with IronBarcode first, then read them back. A barcode library is one of the few things an agent can test end to end in text alone. It writes a value, decodes the image, and compares the strings.)]]
---
## Step 6: Prompt Patterns That Produce Working Code
Ambiguous prompts often result in weak output. The following three patterns help ensure clarity.
**Name the class and the symbology:** IronBarcode handles dozens of formats. A reader that knows which ones to expect works faster and misreads less.
> **Vague** *Scan the barcodes in this image with IronBarcode.*
>
> **Better** *Using `BarcodeReader.Read` with `BarcodeReaderOptions`, read the Code 128 and QR codes in this image and return each value with its format.*
**Specify the version and framework:** APIs change between releases, and omitting the version can cause inconsistencies. Release 2026.9.2 introduced [`EciMode`](https://ironsoftware.com/barcode/csharp/how-to/eci-encoding/), which controls whether a 2D barcode carries a UTF-8 ECI header and is not available in 2026.8.6 or earlier.
> **Better** *Target .NET 9 and BarCode 2026.9.2. Include the license key line, read from the environment.*
**Request the complete runnable file:** Code fragments may omit necessary `using` statements or setup steps.
> **Better** *Give me the complete Program.cs, including all using statements and license key setup, so I can run it as-is.*
---
## Step 7: Verify What You Get Back
Review generated code as you would a first draft from a colleague who has not executed it. Four checks address most issues:
1. **It compiles:** an invented method fails right away.
2. **The license key is applied:** it must be set before the first IronBarcode call, or that call throws `LicensingException`.
3. **Each API method exists:** consult the [API reference](https://ironsoftware.com/barcode/csharp/object-reference/api/) for any unfamiliar method before seeking alternatives.
4. **Every barcode can be read:** decode each generated image with `BarcodeReader` or `GeneratedBarcode.Verify` and compare the result to the input.
The fourth check exists because the compiler cannot detect an unreadable barcode.
Be aware of the following common issues in generated IronBarcode code:
- **The wrong package name:** the opening paragraph covers this, and it remains the most repeated mistake.
- **Enum casing inconsistencies:** `BarcodeEncoding.Databar` and `BarcodeWriterEncoding.DataBar` belong to different enums and differ by one capital letter.
- **Methods borrowed from other barcode libraries:** a model may combine APIs from several sources into methods that do not exist.
- **Invented reader options:** check any unfamiliar option against the [reading speed options](https://ironsoftware.com/barcode/csharp/how-to/reading-speed-options/) and [crop region](https://ironsoftware.com/barcode/csharp/how-to/set-crop-region/) guides.
### Let the Agent Verify Its Own Work
An agent can perform all four checks independently. Request evidence for each check rather than a summary.
```text
Build and run the project in Release mode. Confirm that every IronBarcode member used
appears in the documentation, that IronBarCode.License.IsLicensed returns true, and
that every barcode you generated reads back to the value you wrote. Report the build
result and a table of written value, read value, and format from the run itself.
```
---
## A Result You Can Reproduce
This section evaluates an agent using a realistic task and a single prompt, with no code provided by you. Run it in a new session on an empty project and judge the outcome against the criteria below.
[[i:(Before you start, you need the .NET 9 SDK, an AI coding agent that can run commands, an internet connection, and an IronBarcode trial or production key in the IRONBARCODE_LICENSE_KEY environment variable. IronBarcode throws an error instead of watermarking when there is no key, so this test cannot pass without one.)]]
### The prompt
```text
Build a .NET 9 minimal API for shipping labels with two endpoints: GET /label/{trackingNumber} returns a Code 128 PNG with the value printed below the bars, and POST /scan accepts an uploaded image and returns every barcode it contains as JSON (value and format). Work start to finish alone: write, build, run, and fix, making sensible assumptions where anything is unspecified. Save every deliverable to the project root.
1. Install the BarCode NuGet package pinned to version 2026.9.2.
2. Read from https://ironsoftware.com/barcode/csharp/llms.txt and the pages it links to, using only APIs documented there.
3. Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. If IronBarCode.License.IsLicensed is false, stop and report that instead of continuing.
4. Generate a test set of 12 barcodes into a testset folder: 4 Code 128 tracking numbers, 3 QR codes carrying order URLs, 3 DataMatrix codes carrying GS1 element strings, and 2 EAN-13 codes with correct check digits. Name each PNG after its format and index.
5. Implement /scan with BarcodeReaderOptions narrowed to those four formats and ExpectMultipleBarcodes enabled.
6. Build in Release, run the API, call /label for one tracking number, then POST every testset image and the /label output to /scan.
7. Write roundtrip.md: a table of file, written value, read value, format, and match. All 13 must match; if any do not, fix the cause and run again.
8. Finish with a short report: build result, match count, and assumptions made.
```
### Output
<img src="/static-assets/barcode/ai-agents/ai/label.png" alt="Code 128 shipping label for tracking number 1Z999AA10123456784, returned by GET /label in the acceptance test run" width="300" loading="lazy" />
This is the original PNG returned by `GET /label/1Z999AA10123456784` during the recorded run. The [round-trip table](/static-assets/barcode/ai-agents/ai/roundtrip.md) from the same run lists all 13 images with their written and decoded values.
### What passes
- The Release build completes without manual intervention.
- `roundtrip.md` shows 13 of 13 matching rows, each read value matching what was written and each format correct.
- Both EAN-13 values carry valid check digits, and the GS1 strings come back unchanged.
- The license key comes from the environment and appears nowhere in source or in `roundtrip.md`.
[[i:(Pin the version to match your own project by swapping the release in step 1 for the one you target. The [IronBarcode changelog](https://ironsoftware.com/barcode/csharp/product-updates/changelog/) lists what changed in each release.)]]
### The run record
| Item | Value |
|---|---|
| Package | `BarCode` 2026.9.2 |
| Target framework | .NET 9 |
| Agent and model | Claude Code, Opus 5 |
| Machine | Windows 11 x64, Intel Core i9-14900KF, 64 GB RAM |
| Result | Release build passed, 13 of 13 round trips matched |
| Reference output | [label.png](/static-assets/barcode/ai-agents/ai/label.png), [roundtrip.md](/static-assets/barcode/ai-agents/ai/roundtrip.md) |
| **Last tested** | **September 16, 2026** |
One compilation fix was required during the run, and no code was manually edited.
---
## Agent-Specific Guides
The setup above works with any of them. Each guide below adapts it to one tool:
- [Use IronBarcode with Claude Code](https://ironsoftware.com/barcode/csharp/ai-agents/claude-code/).
- [Use IronBarcode with ChatGPT Codex](https://ironsoftware.com/barcode/csharp/ai-agents/chatgpt-codex/).
- [Use IronBarcode with GitHub Copilot](https://ironsoftware.com/barcode/csharp/ai-agents/github-copilot/).
- [Use IronBarcode with Cursor](https://ironsoftware.com/barcode/csharp/ai-agents/cursor/).
- [Use IronBarcode with Google Antigravity](https://ironsoftware.com/barcode/csharp/ai-agents/antigravity/).
---
## Troubleshooting
- [Apply a License Key in IronBarcode](https://ironsoftware.com/barcode/csharp/troubleshooting/apply-a-license-key-in-ironbarcode/) covers every way to set the key when the first barcode call throws.
- [Barcode Not Recognized](https://ironsoftware.com/barcode/csharp/troubleshooting/barcode-not-recognized/) works through a symbol that writes but will not decode.
- [IronBarcode NuGet Packages](https://ironsoftware.com/barcode/csharp/troubleshooting/nuget-packages/) lists which package belongs on which platform.
---
## Questions?
If you have any questions, reach out to [support@ironsoftware.com](mailto:support@ironsoftware.com)
When prompted to add IronBarcode, tools often run dotnet add package IronBarcode, which installs the incorrect package. IronBarcode is distributed as BarCode, using the namespace IronBarCode. Claude Code, ChatGPT Codex, GitHub Copilot, Cursor, and Google Antigravity frequently misidentify this until they reference the documentation.
This confusion also affects generated code. Without documentation, models may invent method names that do not compile. Providing documentation in advance helps ensure successful builds. IronBarcode is a leading .NET barcode library with comprehensive guides, so generated code is often accurate but still requires careful review.
These tools fall into two categories, which determine how closely you should review their output:
An assistant operates within one part of your workflow, such as editor autocomplete, explanations, or quick refactoring, as GitHub Copilot's inline suggestions do.
An agent manages multi-step tasks, edits across files, runs builds and tests, and opens pull requests, as Claude Code, ChatGPT Codex, Cursor, and Google Antigravity all do.
Apply your license key at application startup, from an environment variable
Point the tool at IronBarcode's llms.txt documentation index
Add IronBarcode instructions to your project context file
Run the one-shot setup prompt in a fresh session
Verify the generated code compiles and every barcode scans back
Can't the Model Handle Barcodes on Its Own?
Training data ages. A model may reproduce an API name that was retired several releases ago, or one belonging to a different barcode library entirely, and neither is visible until the build runs. Machine-readable documentation resolves most of these issues by enabling the tool to reference actual documentation rather than making assumptions.
Library selection is equally important. Most tools integrate with various barcode packages, and free options may suffice for a single format in a demonstration. Additional costs and limitations often arise in production environments:
Check digits, quiet zones, and resizing: each can look acceptable on screen and still fail during scanning, so IronBarcode validates every value against its format as it writes and GeneratedBarcode.Verify reads the image back.
Missing features increase code maintenance: many free libraries cover one format family or lack the image correction accurate scans require, leaving you to combine packages and own the integration between them.
Bulk scanning is included by default:multithreaded reading, speed presets, and confidence thresholds come with the library rather than being built per project.
Accurate output depends on documentation: the guides, tutorials, troubleshooting pages, and runnable examples are indexed for machine use in llms.txt.
Incorrect package names create supply-chain risks: models generate plausible names that attackers register to distribute malware, a practice known as slopsquatting.
A single commercial license avoids legal complications: some barcode libraries include copyleft or non-commercial terms, which models do not flag automatically.
IronBarcode covers all of it through one API and one commercial license your legal team reviews once. Verification happens in your code rather than on the warehouse floor, and naming the package explicitly in every prompt is what closes the supply-chain gap.
Step 1: Install IronBarcode
Allow the agent to add the package. The project requires it to resolve types and provide accurate code suggestions.
Set this project up for IronBarcode. The NuGet package is named BarCode. Confirm the restore succeeded before going further.
Set this project up for IronBarcode. The NuGet package is named BarCode. Confirm the restore succeeded before going further.
Text
Alternatively, install the package from the terminal, specifying the current release version.
dotnet add package BarCode --version 2026.9.2
dotnet add package BarCode --version 2026.9.2
SHELL
Linux, macOS, iOS, and Android each require a specific package, such as BarCode.Linux or BarCode.MacOs. Refer to the Advanced NuGet Installation guide to select the appropriate package.
Step 2: Apply Your License Key
IronBarcode does not watermark unlicensed output. After the development grace period, the first barcode call without a license key throws IronSoftware.Exceptions.LicensingException with the message IronBarcode must be licensed for development. Code missing the license key will fail at runtime. Obtain a free trial key first.
Start using IronBarcode in your project today with a free trial.
First Step:
Set the license key once at application startup, before any IronBarcode calls. Retrieve the key from the environment rather than from source code.
// Read the key from configuration. Never commit it to the repository.IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE_KEY");
// Read the key from configuration. Never commit it to the repository.
IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE_KEY");
C#
IronBarCode.License.IsLicensed returns true when the key is valid. Unlike IronOCR, IronBarcode has no Installation.LicenseKey alias, so use License.LicenseKey or configuration.
Please note: Every other way to set a key, from Web.config to appsettings.json, is covered in IronBarcode License Keys.
Step 3: Point the Tool at IronBarcode's LLM Documentation
IronBarcode publishes six resources written to be read by machines:
Begin with llms.txt, which indexes IronBarcode's features and the location of each topic. This helps prevent incorrect or invented API calls. Use llms-full.txt when detailed guidance is required.
Add a direct instruction alongside it.
Before writing any IronBarcode code, read https://ironsoftware.com/barcode/csharp/llms.txtand use only APIs documented there. Check anything you are not sure aboutagainst the API reference at https://ironsoftware.com/barcode/csharp/object-reference/api/.If you are still unsure whether a method exists, ask instead of guessing.
Before writing any IronBarcode code, read https://ironsoftware.com/barcode/csharp/llms.txt
and use only APIs documented there. Check anything you are not sure about
against the API reference at https://ironsoftware.com/barcode/csharp/object-reference/api/.
If you are still unsure whether a method exists, ask instead of guessing.
Text
Current models respond well to direct requests for clarification. Asking a question is preferable to risking a compile error.
Please note: IronBarcode also publishes a drop-in skill file for tools that support them. The next step covers where to reference it.
Step 4: Add IronBarcode Context to Your Project
Documentation pasted into a chat is available only for the current session. Documentation stored in a project file is accessible in every session.
Each tool reads instructions from a specific file. Place the IronBarcode guidance in the file your team uses:
Tool
Project context file
Skill file goes in
Claude Code
CLAUDE.md
.claude/skills/
ChatGPT Codex
AGENTS.md
.agents/skills/
GitHub Copilot
.github/copilot-instructions.md
n/a
Cursor
.cursor/rules/*.mdc
n/a, use @Docs
Google Antigravity
AGENTS.md
.agents/skills/
AGENTS.md serves as a shared standard, as Claude Code, GitHub Copilot, and Cursor all read it in addition to their own files. Teams using multiple tools can maintain a single set of barcode rules in AGENTS.md and reserve native files for tool-specific instructions.
The content remains the same regardless of the file used. Below is a brief starting point.
## Barcodes with IronBarcodeThis project uses IronBarcode (NuGet package `BarCode`, namespace `IronBarCode`) for all barcode work.- Reference: https://ironsoftware.com/barcode/csharp/llms.txt- Skill file: https://ironsoftware.com/barcode/csharp/skill.md- Use `BarcodeWriter.CreateBarcode` to write and `BarcodeReader.Read` / `ReadPdf` to read.- Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. Never inline it.- Every generated barcode must be read back and compared before it ships.- Do not use a different barcode library. If IronBarcode cannot perform a required task, state this clearly.
## Barcodes with IronBarcode
This project uses IronBarcode (NuGet package `BarCode`, namespace `IronBarCode`) for all barcode work.
- Reference: https://ironsoftware.com/barcode/csharp/llms.txt
- Skill file: https://ironsoftware.com/barcode/csharp/skill.md
- Use `BarcodeWriter.CreateBarcode` to write and `BarcodeReader.Read` / `ReadPdf` to read.
- Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. Never inline it.
- Every generated barcode must be read back and compared before it ships.
- Do not use a different barcode library. If IronBarcode cannot perform a required task, state this clearly.
Text
The skill.md file provides additional detail, including per-platform installation instructions, licensing rules, verified examples, deployment notes, and a troubleshooting table. Reference this file from your context file rather than maintaining a separate copy.
Step 5: One-Shot Setup Prompt
You may also send the first four steps as a single prompt at the beginning of a project or new session.
Use IronBarcode for all barcode work in this project.1. Install the BarCode NuGet package (IronBarcode).2. Apply the license key at application startup, before any other IronBarcode call, reading it from the IRONBARCODE_LICENSE_KEY environment variable. Never write the key into source or into a committed file.3. Read https://ironsoftware.com/barcode/csharp/llms.txt before writing barcode code and work only from APIs documented there, checking the API reference when a member is unfamiliar.4. Save https://ironsoftware.com/barcode/csharp/skill.md as a SKILL.md in this project's skills folder if your tool has one.5. Keep these instructions for future sessions in this project.
Use IronBarcode for all barcode work in this project.
1. Install the BarCode NuGet package (IronBarcode).
2. Apply the license key at application startup, before any other IronBarcode call,
reading it from the IRONBARCODE_LICENSE_KEY environment variable. Never write
the key into source or into a committed file.
3. Read https://ironsoftware.com/barcode/csharp/llms.txt before writing barcode code
and work only from APIs documented there, checking the API reference when a
member is unfamiliar.
4. Save https://ironsoftware.com/barcode/csharp/skill.md as a SKILL.md in this
project's skills folder if your tool has one.
5. Keep these instructions for future sessions in this project.
Text
Tips: That last line usually makes the tool save these rules to its context file from Step 4, such as CLAUDE.md or AGENTS.md. You only paste the prompt once.
Tips: No test images? Ask the agent to generate them with IronBarcode first, then read them back. A barcode library is one of the few things an agent can test end to end in text alone. It writes a value, decodes the image, and compares the strings.
Step 6: Prompt Patterns That Produce Working Code
Ambiguous prompts often result in weak output. The following three patterns help ensure clarity.
Name the class and the symbology: IronBarcode handles dozens of formats. A reader that knows which ones to expect works faster and misreads less.
VagueScan the barcodes in this image with IronBarcode.
BetterUsing BarcodeReader.Read with BarcodeReaderOptions, read the Code 128 and QR codes in this image and return each value with its format.
Specify the version and framework: APIs change between releases, and omitting the version can cause inconsistencies. Release 2026.9.2 introduced EciMode, which controls whether a 2D barcode carries a UTF-8 ECI header and is not available in 2026.8.6 or earlier.
BetterTarget .NET 9 and BarCode 2026.9.2. Include the license key line, read from the environment.
Request the complete runnable file: Code fragments may omit necessary using statements or setup steps.
BetterGive me the complete Program.cs, including all using statements and license key setup, so I can run it as-is.
Step 7: Verify What You Get Back
Review generated code as you would a first draft from a colleague who has not executed it. Four checks address most issues:
It compiles: an invented method fails right away.
The license key is applied: it must be set before the first IronBarcode call, or that call throws LicensingException.
Each API method exists: consult the API reference for any unfamiliar method before seeking alternatives.
Every barcode can be read: decode each generated image with BarcodeReader or GeneratedBarcode.Verify and compare the result to the input.
The fourth check exists because the compiler cannot detect an unreadable barcode.
Be aware of the following common issues in generated IronBarcode code:
The wrong package name: the opening paragraph covers this, and it remains the most repeated mistake.
Enum casing inconsistencies:BarcodeEncoding.Databar and BarcodeWriterEncoding.DataBar belong to different enums and differ by one capital letter.
Methods borrowed from other barcode libraries: a model may combine APIs from several sources into methods that do not exist.
An agent can perform all four checks independently. Request evidence for each check rather than a summary.
Build and run the project in Release mode. Confirm that every IronBarcode member usedappears in the documentation, that IronBarCode.License.IsLicensed returns true, andthat every barcode you generated reads back to the value you wrote. Report the buildresult and a table of written value, read value, and format from the run itself.
Build and run the project in Release mode. Confirm that every IronBarcode member used
appears in the documentation, that IronBarCode.License.IsLicensed returns true, and
that every barcode you generated reads back to the value you wrote. Report the build
result and a table of written value, read value, and format from the run itself.
Text
A Result You Can Reproduce
This section evaluates an agent using a realistic task and a single prompt, with no code provided by you. Run it in a new session on an empty project and judge the outcome against the criteria below.
Please note: Before you start, you need the .NET 9 SDK, an AI coding agent that can run commands, an internet connection, and an IronBarcode trial or production key in the IRONBARCODE_LICENSE_KEY environment variable. IronBarcode throws an error instead of watermarking when there is no key, so this test cannot pass without one.
The prompt
Build a .NET 9 minimal API for shipping labels with two endpoints: GET /label/{trackingNumber} returns a Code 128 PNG with the value printed below the bars, and POST /scan accepts an uploaded image and returns every barcode it contains as JSON (value and format). Work start to finish alone: write, build, run, and fix, making sensible assumptions where anything is unspecified. Save every deliverable to the project root.1. Install the BarCode NuGet package pinned to version 2026.9.2.2. Read from https://ironsoftware.com/barcode/csharp/llms.txt and the pages it links to, using only APIs documented there.3. Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. If IronBarCode.License.IsLicensed is false, stop and report that instead of continuing.4. Generate a test set of 12 barcodes into a testset folder: 4 Code 128 tracking numbers, 3 QR codes carrying order URLs, 3 DataMatrix codes carrying GS1 element strings, and 2 EAN-13 codes with correct check digits. Name each PNG after its format and index.5. Implement /scan with BarcodeReaderOptions narrowed to those four formats and ExpectMultipleBarcodes enabled.6. Build in Release, run the API, call /label for one tracking number, then POST every testset image and the /label output to /scan.7. Write roundtrip.md: a table of file, written value, read value, format, and match. All 13 must match; if any do not, fix the cause and run again.8. Finish with a short report: build result, match count, and assumptions made.
Build a .NET 9 minimal API for shipping labels with two endpoints: GET /label/{trackingNumber} returns a Code 128 PNG with the value printed below the bars, and POST /scan accepts an uploaded image and returns every barcode it contains as JSON (value and format). Work start to finish alone: write, build, run, and fix, making sensible assumptions where anything is unspecified. Save every deliverable to the project root.
1. Install the BarCode NuGet package pinned to version 2026.9.2.
2. Read from https://ironsoftware.com/barcode/csharp/llms.txt and the pages it links to, using only APIs documented there.
3. Read the license key from the IRONBARCODE_LICENSE_KEY environment variable at startup. If IronBarCode.License.IsLicensed is false, stop and report that instead of continuing.
4. Generate a test set of 12 barcodes into a testset folder: 4 Code 128 tracking numbers, 3 QR codes carrying order URLs, 3 DataMatrix codes carrying GS1 element strings, and 2 EAN-13 codes with correct check digits. Name each PNG after its format and index.
5. Implement /scan with BarcodeReaderOptions narrowed to those four formats and ExpectMultipleBarcodes enabled.
6. Build in Release, run the API, call /label for one tracking number, then POST every testset image and the /label output to /scan.
7. Write roundtrip.md: a table of file, written value, read value, format, and match. All 13 must match; if any do not, fix the cause and run again.
8. Finish with a short report: build result, match count, and assumptions made.
Text
Output
This is the original PNG returned by GET /label/1Z999AA10123456784 during the recorded run. The round-trip table from the same run lists all 13 images with their written and decoded values.
What passes
The Release build completes without manual intervention.
roundtrip.md shows 13 of 13 matching rows, each read value matching what was written and each format correct.
Both EAN-13 values carry valid check digits, and the GS1 strings come back unchanged.
The license key comes from the environment and appears nowhere in source or in roundtrip.md.
Please note: Pin the version to match your own project by swapping the release in step 1 for the one you target. The IronBarcode changelog lists what changed in each release.
The run record
Item
Value
Package
BarCode 2026.9.2
Target framework
.NET 9
Agent and model
Claude Code, Opus 5
Machine
Windows 11 x64, Intel Core i9-14900KF, 64 GB RAM
Result
Release build passed, 13 of 13 round trips matched
Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.