Check Bounded Contexts logo

Check Bounded Contexts

Community
dykyi-roman
check-bounded-contexts

Analyzes bounded context boundaries in DDD projects. Detects cross-context coupling, shared kernel violations, context mapping issues, and ubiquitous language inconsistencies. Generates context map diagrams and boundary recommendations.

Overview

Publisherdykyi-roman
Repositoryawesome-claude-code
Skill namecheck-bounded-contexts
Stars
98
Forks
25
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dykyi-roman on GitHub. Read the source before you install it.

Installation

Install the Check Bounded Contexts AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dykyi-roman/awesome-claude-code.git /tmp/awesome-claude-code
mkdir -p .claude/skills
cp -r /tmp/awesome-claude-code/skills/check-bounded-contexts .claude/skills/check-bounded-contexts
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Check Bounded Contexts in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Check Bounded Contexts on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Check Bounded Contexts is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Bounded Contexts Analyzer

Overview

This skill analyzes PHP DDD projects for bounded context boundary issues, cross-context coupling, and context mapping violations.

Bounded Context Concepts

ConceptDefinitionViolation Indicator
Bounded ContextExplicit boundary with its own domain modelMissing namespace separation
Ubiquitous LanguageConsistent terminology within contextSame term, different meanings
Context MapRelationships between contextsUnclear dependencies
Anti-Corruption LayerTranslation between contextsDirect foreign model usage
Shared KernelDeliberately shared codeUnintentional sharing
Published LanguagePublic API contractsBreaking changes

Detection Patterns

Phase 1: Context Discovery

bash
# Identify bounded contexts from directory structure
Glob: **/src/**/Domain/*
Glob: **/src/**/Context/*
Glob: **/src/**/Bounded/*
Glob: **/src/**/Module/*

# Namespace-based contexts
Grep: "namespace.*\\\\Domain\\\\|namespace.*\\\\Context\\\\" --glob "**/*.php"

# Composer autoload namespaces
Read: composer.json (check autoload paths for context namespaces)

Context Indicators:

  • Top-level namespace under src/ (e.g., Order, User, Payment)
  • Explicit Domain/ subfolder per context
  • BoundedContext/ or Context/ folder structure

Phase 2: Cross-Context Coupling Detection

Direct Cross-Context Imports
bash
# Find cross-context imports (most critical)
# Pattern: Context A importing from Context B's Domain layer

# Order context importing User domain
Grep: "use Order\\\\.*\\\\Domain" --glob "**/User/**/*.php"
Grep: "use User\\\\.*\\\\Domain" --glob "**/Order/**/*.php"

# General pattern: Domain layer importing another Domain
Grep: "use [A-Z][a-z]+\\\\Domain\\\\" --glob "**/Domain/**/*.php"

# Direct entity references across contexts
Grep: "use.*\\\\Entity\\\\(?!.*\\\\self)" --glob "**/Domain/**/*.php"
Foreign Aggregate References
bash
# Aggregates referencing foreign entities directly
Grep: "private.*[A-Z][a-z]+Entity\|private readonly [A-Z][a-z]+" --glob "**/Aggregate/**/*.php"

# Should use ID references only
# Good: private UserId $userId
# Bad: private User $user (from another context)

# Detect direct object references vs ID references
Grep: "\\$user[^I]|\\$order[^I]|\\$customer[^I]" --glob "**/Domain/**/*.php"
Shared Repository Usage
bash
# Repository from one context used in another
Grep: "UserRepositoryInterface" --glob "**/Order/**/*.php"
Grep: "OrderRepositoryInterface" --glob "**/User/**/*.php"

# Generic repository pattern violations
Grep: "RepositoryInterface" --glob "**/*.php"
# Check if implementations span contexts

Phase 3: Shared Kernel Analysis

bash
# Identify potential shared kernel (common code between contexts)
Glob: **/Shared/**/*.php
Glob: **/Common/**/*.php
Glob: **/Core/**/*.php
Glob: **/SharedKernel/**/*.php

# Find duplicated Value Objects across contexts
# Same class name in multiple contexts
Glob: **/Domain/**/Email.php
Glob: **/Domain/**/Money.php
Glob: **/Domain/**/Address.php

# Shared events
Grep: "class.*Event.*implements|extends.*Event" --glob "**/Shared/**/*.php"

Shared Kernel Rules:

  • Must be explicitly designated
  • Minimal and stable
  • Changes require agreement from all context owners
  • Should contain only Value Objects, not Entities

Phase 4: Context Map Relationships

Upstream/Downstream Detection
bash
# Event publishers (upstream)
Grep: "EventDispatcher|MessageBus|publish\(" --glob "**/Domain/**/*.php"
Grep: "class.*Event\s*\{|final readonly class.*Event" --glob "**/Domain/**/*.php"

# Event subscribers (downstream)
Grep: "EventSubscriber|MessageHandler|Listener" --glob "**/*.php"
Grep: "function __invoke\(.*Event" --glob "**/*.php"

# Check which context publishes and which subscribes
Customer/Supplier Relationships
bash
# API clients (customer role)
Grep: "ApiClient|HttpClient|RestClient" --glob "**/Infrastructure/**/*.php"

# API providers (supplier role)
Grep: "Controller|Action|Endpoint" --glob "**/Presentation/**/*.php"
Anti-Corruption Layer Detection
bash
# ACL presence
Glob: **/AntiCorruption/**/*.php
Glob: **/ACL/**/*.php
Glob: **/Adapter/**/*.php
Glob: **/Translator/**/*.php

# Missing ACL (direct external model usage)
Grep: "use External\\\\|use ThirdParty\\\\|use Legacy\\\\" --glob "**/Domain/**/*.php"

Phase 5: Ubiquitous Language Analysis

bash
# Find same term with different meanings
# Example: "Account" in User context vs Payment context

# Find class with same name in different contexts
Glob: **/User/**/Account.php
Glob: **/Payment/**/Account.php
Glob: **/Billing/**/Account.php

# Find similar entity names
Glob: **/Domain/**/User.php
Glob: **/Domain/**/Customer.php
Glob: **/Domain/**/Client.php

# Inconsistent naming
Grep: "class Order|class Purchase|class Sale" --glob "**/Domain/**/*.php"

Report Format

markdown
# Bounded Context Analysis Report

## Context Map

```mermaid
graph TB
    subgraph "Order Context"
        O_Domain[Domain]
        O_App[Application]
    end

    subgraph "User Context"
        U_Domain[Domain]
        U_App[Application]
    end

    subgraph "Payment Context"
        P_Domain[Domain]
        P_App[Application]
    end

    subgraph "Shared Kernel"
        SK[Money, Currency]
    end

    O_Domain -->|"uses ID only"| U_Domain
    O_Domain -->|"publishes events"| P_Domain
    O_Domain --> SK
    U_Domain --> SK
    P_Domain --> SK

Detected Contexts

ContextLocationEntitiesEventsDependencies
Ordersrc/Order/58User (ID), Payment (event)
Usersrc/User/34None
Paymentsrc/Payment/46Order (event)
Sharedsrc/Shared/00All contexts

Critical Issues

BC-001: Cross-Context Entity Reference

  • File: src/Order/Domain/Entity/Order.php:15
  • Issue: Direct reference to User entity instead of UserId
  • Code: private User $user (from User context)
  • Expected: private UserId $userId
  • Impact: Tight coupling, breaks context isolation
  • Refactoring: Replace with ID reference, use ACL if needed
  • Skills: create-value-object (for UserId), create-anti-corruption-layer

BC-002: Missing Anti-Corruption Layer

  • File: src/Payment/Infrastructure/Gateway/StripeGateway.php
  • Issue: Stripe models used directly in domain
  • Code: use Stripe\PaymentIntent;
  • Impact: External API changes affect domain
  • Refactoring: Create PaymentIntent adapter/translator
  • Skills: create-anti-corruption-layer

BC-003: Unintended Shared Kernel

  • Files:
    • src/Order/Domain/ValueObject/Address.php
    • src/User/Domain/ValueObject/Address.php
  • Issue: Duplicated Address VO without explicit sharing
  • Impact: Inconsistent behavior, maintenance burden
  • Refactoring: Either consolidate to Shared Kernel or differentiate
  • Skills: create-value-object

Warning Issues

BC-004: Ambiguous Ubiquitous Language

  • Context 1: src/User/ uses Account for user profile
  • Context 2: src/Payment/ uses Account for financial account
  • Issue: Same term, different meanings
  • Refactoring: Rename to UserProfile and PaymentAccount

BC-005: Missing Published Language

  • Context: Order
  • Issue: No explicit contract for inter-context communication
  • Events published: 8
  • Documented: 0
  • Refactoring: Create event schema documentation

BC-006: Upstream Without Events

  • Context: User (upstream)
  • Downstream: Order, Payment (via direct queries)
  • Issue: Downstream contexts query User directly
  • Refactoring: User should publish events, downstreams react

Context Relationship Matrix

From \ ToOrderUserPaymentShared
Order-ID refEventsUses
User---Uses
PaymentQueriesQueries-Uses
Shared----

Legend:

  • ID ref: References only by ID (good)
  • Events: Async event communication (good)
  • Queries: Direct query (warning)
  • Uses: Shared kernel usage (acceptable)

Recommendations

Immediate Actions

  1. Replace direct entity references with ID Value Objects
  2. Add ACL for external service integrations

Short-term

  1. Document published language (event contracts)
  2. Consolidate or differentiate duplicated VOs

Long-term

  1. Consider event-driven communication between contexts
  2. Review shared kernel scope

## Context Integration Patterns

### Recommended Patterns

| Pattern | When to Use | Skills |
|---------|-------------|--------|
| ID Reference | Entity association across contexts | `create-value-object` |
| Domain Events | Async communication | `create-domain-event` |
| ACL | External systems, legacy | `create-anti-corruption-layer` |
| Shared Kernel | Common VOs (Money, etc.) | `create-value-object` |
| Published Language | Public contracts | Documentation |

### Anti-patterns

| Anti-pattern | Issue | Remediation |
|--------------|-------|-------------|
| Direct Entity Reference | Tight coupling | Use ID + resolve via query |
| Shared Entities | Ownership unclear | Split or explicit ownership |
| Cross-Context Repository | Boundary violation | Use events or ACL |
| Synchronous Cross-Context Calls | Temporal coupling | Use async events |

## Quick Analysis Commands

```bash
# Detect bounded contexts
echo "=== Bounded Contexts ===" && \
find src -maxdepth 2 -type d -name "Domain" && \
echo "=== Cross-Context Imports ===" && \
for ctx in $(find src -maxdepth 1 -type d | tail -n +2); do \
  name=$(basename $ctx); \
  grep -rn "use .*\\\\Domain\\\\" --include="*.php" "$ctx" | grep -v "use $name"; \
done && \
echo "=== Shared Kernel ===" && \
find src -type d -name "Shared" -o -name "Common" -o -name "Core"

Integration

Works with:

  • ddd-auditor — Domain model quality
  • structural-auditor — Layer violations
  • ddd-generator — Generate missing components

References

  • "Domain-Driven Design" (Eric Evans) — Chapter 14: Context Mapping
  • "Implementing Domain-Driven Design" (Vaughn Vernon) — Chapter 3: Context Maps
  • Strategic DDD patterns documentation

Frequently asked questions

What does the Check Bounded Contexts AI skill do?

Analyzes bounded context boundaries in DDD projects. Detects cross-context coupling, shared kernel violations, context mapping issues, and ubiquitous language inconsistencies. Generates context map diagrams and boundary recommendations.

Why use Check Bounded Contexts on TypingMind?

Because you install it once and use it with any model. Check Bounded Contexts is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Check Bounded Contexts in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/check-bounded-contexts. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Check Bounded Contexts?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Check Bounded Contexts?

As many as you like. As long as a model supports skills, you can use Check Bounded Contexts with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Check Bounded Contexts AI skill free?

Yes. It is published on GitHub by dykyi-roman under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇