module-boundary-design

Design module boundaries with explicit contracts and enforced dependency direction.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill module-boundary-design-machenjie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: module-boundary-design
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/module-boundary-design
Command: npx skills add https://github.com/machenjie/rd-skills --skill module-boundary-design-machenjie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of uncontrolled cross-module coupling by helping you define module boundaries that protect business capability ownership, enforce dependency direction, prevent circular dependencies, and require explicit public contracts.

Core Features & Use Cases

  • Business-capability boundaries: Organize modules by ownership of bounded contexts, not by technical folders.
  • Contract-only cross-boundary imports: Require that any dependency between modules goes through the target module’s public API (e.g., api/, explicit barrel exports, __all__), not internal types or persistence details.
  • Circular dependency prevention: Treat cycles as structural violations that must be caught by automated tooling during CI.
  • Shared-code discipline: Keep shared/ or common/ as pure technical utilities; escalate when business logic starts leaking into shared modules.
  • Ownership and enforcement: Ensure each boundary has a named owner (e.g., CODEOWNERS) and that dependency rules are enforced by tools rather than convention.

Quick Start

Ask the agent to design your module boundary rules and import contracts for a proposed change that risks circular dependencies or cross-capability coupling, then produce an allowed/forbidden dependency map plus CI enforcement snippets.

Frequently Asked Questions about module-boundary-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent circular dependencies and uncontrolled coupling when splitting modules?

To prevent circular dependencies and coupling creep, you must design module boundaries based on business-capability ownership. This approach requires explicit cross-boundary contracts and tooling-backed dependency enforcement so that structural violations fail your CI pipeline automatically.

What is the best way to enforce module boundaries and dependency direction in CI?

The best way to enforce module boundaries is to implement CI dependency rules that reject forbidden imports. You define an allowed dependency map, restrict cross-boundary access to public APIs, and configure automated tooling to fail the pipeline when modules bypass these explicit contracts.

How do you stop business logic from leaking into shared utility modules?

To stop business logic from leaking into shared modules, you must enforce a shared-code discipline that restricts these directories to pure technical utilities. Any attempt to import business-specific bounded contexts into shared code should be treated as a structural violation.

Why should cross-module imports go through a public API instead of internal types?

Cross-module imports should go through a public API to maintain strict encapsulation and minimal public API surface. Relying on internal types or persistence details bypasses module boundaries, destroys test isolation, and causes uncontrolled coupling that automated CI rules cannot catch.

Can I use automated tooling to enforce bounded contexts and ownership rules?

Yes, you can and should use automated tooling to enforce bounded contexts. By assigning named ownership via CODEOWNERS and configuring CI dependency rules, structural violations like circular dependencies or illegal internal imports will fail the build rather than relying on convention.

When do I need to redesign module boundaries for architecture enforcement?

You need to redesign module boundaries when proposed changes add, move, split, or merge modules, or when new cross-module imports threaten encapsulation. This ensures dependency direction remains explicit and bounded context ownership stays protected against coupling creep.