Domain-Driven Structure

Feature-first folders, localized 000-architecture.md primers, and domain maps agents can ingest in one pass.

  • architecture
  • folders
  • context

Suggested Cursor path: .cursor/rules/agent-domain-structure.mdc

Domain-Driven Structure

Group by feature/domain, not by file type alone. One feature = one ingestible context chunk.

Feature-first layout

If you are building tenant routing for a CRM, keep in one folder:

  • Route handlers / API logic
  • UI components for that feature
  • Schema or types used only by that feature
  • Tests for that feature
  • 000-architecture.md primer at the folder root

The agent reads one directory and understands the whole feature.

Localized primers

Name architecture docs 000-feature-architecture.md so they sort first when an agent scans a folder. Each primer should include:

  • What the feature does
  • Key files and environment variables
  • Routes or entry points affected
  • How to verify the change

Root vs. feature rules

  • Root: .cursor/rules/ or AGENTS.md — stack-wide boundaries
  • Feature folder: 000-architecture.md — feature-specific context

Separate content from logic

Content (copy, assets, datasets)Logic (templates, components, scripts)
Markdown / MDX collectionsPage and layout files
Static assetsComponent implementations
CMS or data JSONBuild and deploy config

Do not embed massive copy blocks or datasets inside template logic files.

Anti-patterns

  • Splitting one feature across 10 unrelated directories
  • Duplicating config strings outside a central data module
  • Inline thousand-line samples in page templates