Other

AI-Native with Claude Code: driving C# work from an OpenAPI contract and CQRS

Habr C# (ru) Nurlan-Turkpenbay
Other

The author explains how his team hands routine C# work to a terminal-based agent such as Claude Code, constraining it with an openapi.yaml contract, a rules file and a Clean Architecture folder layout. Boilerplate CRUD and tests go to the agent, while domain design, security and performance stay with the developer.

Key points

  • In an API-first setup openapi.yaml stops being documentation and becomes the contract the agent must obey.
  • Architecture rules move out of Confluence into a repo .cursorrules file: layer boundaries, CQRS, Result instead of exceptions.
  • A docs/domain-glossary.md file stops the agent from inventing User/Client/Customer synonyms in class names.
  • An ADR folder makes the agent pick Redis for caching instead of dragging in Memcached on its own.
  • Unit tests come from xUnit and Moq, integration tests from Testcontainers spinning up a real Postgres instance.
  • When a test fails on a missing DI registration, the agent reads stderr, patches Startup.cs and reruns the build.

Real-world use

  • Generating controllers, models and validation from an existing OpenAPI contract in a REST API
  • Asking for an endpoint such as profile deactivation together with its handler, Postgres migration and unit tests
  • Writing Testcontainers integration tests that run migrations and a real SQL query against Postgres
  • Keeping an agent on the right layer in a multi-layer Clean Architecture / CQRS codebase

This summary was generated by the agent from the original post on Habr C# (ru). The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message