From Prompt Spaghetti to Bounded Contexts: DDD for Agentic Codebases

This ad is not shown to multipass and full ticket holders
JS Nation
JSNation 2026
June 11 - 15, 2026
Amsterdam & Online
The main JavaScript conference of the year
Upcoming event
JSNation 2026
JSNation 2026
June 11 - 15, 2026. Amsterdam & Online
Learn more
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

This presentation shows how Domain-Driven Design (DDD) turns agentic coding from “prompt spaghetti” into a maintainable engineering approach. Instead of one giant prompt and ad-hoc tools, it proposes bounded contexts for agent responsibilities, a ubiquitous language for consistent tool inputs/outputs, and a context map that makes integrations explicit. Attendees will learn how to design stable tool contracts (ports/adapters), add CI/evaluation gates that keep agents honest, and implement traceability and replay so agent actions remain auditable and debuggable. The result: agentic systems that scale to real codebases and teams without collapsing into chaos.

This talk has been presented at AI Coding Summit 2026, check out the latest edition of this Tech Conference.

FAQ

A JNTX system refers to a coding system that uses agents and prompts to ship new features and functionality. It often faces challenges as it scales, leading to complex integration issues.

The main challenge in scaling JNTX systems is managing complex integration issues, where prompts become too large and difficult to debug, often leading to broken systems and long deployment cycles.

The 'prompt spaghetti' problem occurs when the integration logic in JNTX systems becomes overly complex and unmanageable, resulting in prompts filled with parsing logic and integration instructions instead of being written in structured code.

Domain-driven design principles help by providing a structured approach to handle complexity through bounded contexts, contracts as schemas, anti-corruption layers, and context maps, which makes the system more maintainable as it scales.

A bounded context in domain-driven design refers to a defined boundary within which a specific domain model is applicable, ensuring clear responsibility and separation of concerns.

JNTX systems should avoid using natural language as an API because it leads to unstructured outputs and inconsistencies. Instead, structured schemas should be used as contracts to ensure reliable integration and communication between agents.

The four core patterns are: bounded context, contract as schema, anti-corruption layer, and context map. These patterns help manage complexity and improve maintainability.

Contracts and schemas in JNTX systems define structured expectations for agent outputs, enabling clear communication and integration between different system components.

CI gates automate pre- and post-deployment checks, tests, and validations, ensuring that contracts are adhered to and the system remains stable and consistent.

A context map is important in a JNTX system because it provides an executable configuration that describes and enforces the integration architecture, ensuring clear relationships between different contexts.

Nikita Golovko
Nikita Golovko
16 min
26 Feb, 2026

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Nikita, AI Architect at Siemens, discusses challenges in JNTX system development, emphasizing domain-driven design for scalability and stability. Clear responsibilities, bounded contexts, and structured schemas are crucial for reducing complexity. The anti-corruption layer and context maps play vital roles in integration architecture. Key takeaways include the importance of contracts, firewalls, and CI gates for system development.

1. Challenges in JNTX System Development

Short description:

Nikita, AI Architect at Siemens, discusses challenges in JNTX system development. The talk focuses on domain-driven design to maintain scalability and avoid breakdowns. The comparison between microservices and JNTX systems highlights the importance of clear boundaries and APIs. Domain-driven design offers solutions to enhance JNTX system stability and performance.

Hello dear colleagues, nice to meet you. My name is Nikita and I am an AI portfolio architect in Siemens, Germany, and today I would like to talk about building a JNTX system through the prism of domain-driven design. Let me start from the so-called JNTX system paradox. I believe many of you have probably seen it. For instance, you decide to build a JNTX coding system. Currently, you are in month one, you have three agents, rather clean prompts, everything works good, you are shipping new features, new functionality like crazy, everything looks amazing. But six months later, you have a mess of agents, more than 3,000 token prompts. When you change something, everything is broken, you have a long deployment cycle and you can hardly debug it. And all this is mainly not about your LLMs, not about your agents, it's a problem of the whole architecture.

Okay, let's see how does it happen. After six months, your prompt dramatically increased and around 85% of your prompt is about parsing logic, it's about integration. But instead of writing this integration as a code in the Python, where you can test, version it, make a type checks, or you just wrote it in plain English and just hope that LLM somehow can execute it and everything will be good. This is the prompt spaghetti and this is how most JNTX systems end up. And the main question today for our talk, for my talk, is how to build JNTX systems that can stay maintainable as they scale. And a small spoiler, the answer will be from 2003. This answer was given by Eric Evans. He showed how it works for microservices, but let's try to apply this for our agents.

Okay, let's go, let's look deeper. The main problem with building a JNTX system is that we are thinking we are building some kind of small helpful systems which are clearly integrated or communicate with each other. But the problem is that we are actually building a distributed system with services that talk to each other through the natural language without type safety, without explicit contracts, without clear boundaries, which means that at the end of the day, we are building some kind of microservice architecture, but neglecting all basic principles. And then we are just wondering why everything is breaking and why everything is not working. Okay, let's look at this comparison. We already have around 20 years of distributed system experience, and we know how to split boundaries, how to design APIs, contracts, and this perfectly works for microservices. But for JNTX systems, we have a totally opposite picture. We have a fuzzy responsibility, doing everything. We have a natural language as an interface, as an interaction, instead of clear APIs, we have a semantic guessing, and as a result, we have a lot of cascade failures and a lot of magic happening under the hood. The good news is that patterns that solve all these problems already exist. The name of this pattern is a domain-driven design, and also a good news that domain-driven design principles and approaches work even better for agents than it was for microservices. But let's have a closer look on the four core patterns, four core principles of domain-driven design, and how we can apply it for agents. The first one, as it's obvious, is a bounded context.

2. Clear Responsibility and Contract Implementation

Short description:

Discussing clear responsibility and implementing bounded contexts to reduce complexity. Emphasizing the importance of contracts and structured schemas for agents' output. Utilizing port and adapters along with CI gates for production-ready contracts.

It's about clear responsibility. Here you can see a so-called anti-pattern of a guard agent when in case of designing a code writing system against a contract code writing system. This agent is responsible for code review, for quality, for security checks, for test coverage. As a result, we have more than 3000 plus tokens trying to solve all existing problems. What can we propose as an alternative, what is the best practice? Try to apply bounded context, try to split this mess into a separate context, for instance, quality context, security context, and so on. Each context is responsible for a separate task. Each context provides a separate artifact. For instance, quality context answers the question whether this code is well-crafted security, whether this code is secure enough, and as an artifact, each context provides a separate artifact, for instance, quality, some kind of quality reports, security reports, and CV checks, and risk levels, and as a result, we have a significant decrease of a complexity of our initial prompt from thousands of tokens to a measurable hundred of tokens. And as a first rule, as a first outcome, we have is try to apply bounded context, one agent is one bounded context, one responsibility.

The second pattern is a contract as a schema. The problem is that without contracts, agent's output is unstructured, and every agent which receives this output can parse it and interpret it in a different way. What can we propose as an alternative? Apply contracts, apply structurized schemas, and, for instance, treat it as a pedantic model. So, for instance, a pedantic model can represent your contract, which represents this integration between contexts, which help us explicitly define the expectation from an agent's output and shape it in a structured way. Also, can give us the opportunity of benefits of self-documenting, because schema is a document, it can be automatically validated by, for instance, pedantic, it can be versions explicitly, and we don't even need any parsing logic because of this structure from day one. That's why we have a second rule. We need to stop using natural language as our API. We should use structured schemas as our contracts.

But let's look how to make this contract's production ready. To do this, we have two patterns, so-called port and adapters of hexagonal architecture and CI gates. Ports will define what our agent needs. It's in a contract. Adapter just translates external system to our domain. And it means that agent does not know about external format, because adapter just absorbs this complexity. When something changes in external system, we just need to update our adapter and the domain still stay protected and staying safe. And since our contracts are standardized and structured, we can automate pre- and post-deployment checks, tests and validations around these contracts with the help of respective CI gates. So contracts define correctness and CI gates just enforce it. Okay, the third pattern, it's a so-called anti-corruption layer. We can consider, we can treat it as a semantic firewall. The main problem is that in different contexts, in different boundaries, the same term can have different meaning, different definition. For instance, for code generation contract, function is a signature plus implementation.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Understanding React’s Fiber Architecture
React Advanced 2022React Advanced 2022
29 min
Understanding React’s Fiber Architecture
Top Content
This Talk explores React's internal jargon, specifically fiber, which is an internal unit of work for rendering and committing. Fibers facilitate efficient updates to elements and play a crucial role in the reconciliation process. The work loop, complete work, and commit phase are essential steps in the rendering process. Understanding React's internals can help with optimizing code and pull request reviews. React 18 introduces the work loop sync and async functions for concurrent features and prioritization. Fiber brings benefits like async rendering and the ability to discard work-in-progress trees, improving user experience.
Thinking Like an Architect
Node Congress 2025Node Congress 2025
31 min
Thinking Like an Architect
Top Content
In modern software development, architecture is more than just selecting the right tech stack; it involves decision-making, trade-offs, and considering the context of the business and organization. Understanding the problem space and focusing on users' needs are essential. Architectural flexibility is key, adapting the level of granularity and choosing between different approaches. Holistic thinking, long-term vision, and domain understanding are crucial for making better decisions. Effective communication, inclusion, and documentation are core skills for architects. Democratizing communication, prioritizing value, and embracing adaptive architectures are key to success.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
RemixConf EU discussed full stack components and their benefits, such as marrying the backend and UI in the same file. The talk demonstrated the implementation of a combo box with search functionality using Remix and the Downshift library. It also highlighted the ease of creating resource routes in Remix and the importance of code organization and maintainability in full stack components. The speaker expressed gratitude towards the audience and discussed the future of Remix, including its acquisition by Shopify and the potential for collaboration with Hydrogen.
The Dark Side of Micro-Frontends
React Advanced 2025React Advanced 2025
29 min
The Dark Side of Micro-Frontends
In the Talk, various key points were discussed regarding micro-front-end architecture. These included challenges with micro-intents, common mistakes in system design, the differences between micro-intents and components, granularity in software architecture, optimizing micro-front-end architecture, efficient routing and deployment strategies, edge computing strategies, global state and data sharing optimization, managing data context, governance and fitness functions, architectural testing, adaptive growth, value of micro-frontends, repository selection, repo structures, and web component usage.
The Eternal Sunshine of the Zero Build Pipeline
React Finland 2021React Finland 2021
36 min
The Eternal Sunshine of the Zero Build Pipeline
For many years, we have migrated all our devtools to Node.js for the sake of simplicity: a common language (JS/TS), a large ecosystem (NPM), and a powerful engine. In the meantime, we moved a lot of computation tasks to the client-side thanks to PWA and JavaScript Hegemony.
So we made Webapps for years, developing with awesome reactive frameworks and bundling a lot of dependencies. We progressively moved from our simplicity to complex apps toolchains. We've become the new Java-like ecosystem. It sucks.
It's 2021, we've got a lot of new technologies to sustain our Users eXperience. It's time to have a break and rethink our tools rather than going faster and faster in the same direction. It's time to redesign the Developer eXperience. It's time for a bundle-free dev environment. It's time to embrace a new frontend building philosophy, still with our lovely JavaScript.
Introducing Snowpack, Vite, Astro, and other Bare Modules tools concepts!

Workshops on related topic

AI on Demand: Serverless AI
DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Top Content
Featured WorkshopFree
Nathan Disidore
Nathan Disidore
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
High-performance Next.js
React Summit 2022React Summit 2022
50 min
High-performance Next.js
Workshop
Michele Riva
Michele Riva
Next.js is a compelling framework that makes many tasks effortless by providing many out-of-the-box solutions. But as soon as our app needs to scale, it is essential to maintain high performance without compromising maintenance and server costs. In this workshop, we will see how to analyze Next.js performances, resources usage, how to scale it, and how to make the right decisions while writing the application architecture.
Model Context Protocol (MCP) Deep Dive: 2-Hour Interactive Workshop
AI Coding Summit 2025AI Coding Summit 2025
86 min
Model Context Protocol (MCP) Deep Dive: 2-Hour Interactive Workshop
Workshop
Stepan Suvorov
Stepan Suvorov
Join a focused 2-hour session covering MCP's purpose, architecture, hands-on server implementation, and future directions. Designed for developers and system architects aiming to integrate contextual data with ML models effectively. Agenda:- Introduction & Why MCP? Key challenges MCP solves and core benefits.- Architecture Deep Dive: components, interactions, scalability principles. - Building Your Own MCP Server: guided walkthrough with code snippets and best practices; live demo or code review.- Future of MCP Developments: potential enhancements, emerging trends, real-world scenarios.
Key Takeaways:- Clear understanding of MCP's rationale.- Insight into design patterns and scaling considerations.- Practical steps to implement a prototype server.- Awareness of upcoming trends and how to apply MCP in projects.