SuperAPI AI Directory

musubix-domain-inference

Coding & development

View repository

Updated 11-13 04:20

About this skill

MUSUBIX Domain Inference Skill

This skill guides you through automatic domain detection and component recommendations.

Overview

MUSUBIX supports 62 domains with 224 predefined components. The domain inference system automatically:

  1. Detects project domain from requirements/descriptions
  2. Recommends optimal components for that domain
  3. Suggests architecture patterns

Supported Domains (62)

Business (8)

Domain Description Key Components
ecommerce E-commerce / Online shopping CartService, ProductCatalog, OrderProcessor
finance Finance AccountService, TransactionManager, LedgerService
crm Customer management CustomerService, LeadManager, OpportunityTracker
hr HR EmployeeService, PayrollCalculator, AttendanceTracker
marketing Marketing CampaignManager, AudienceSegmenter, AnalyticsService
inventory Inventory management StockManager, ReorderService, WarehouseController
payment Payments PaymentGateway, RefundProcessor, InvoiceGenerator
subscription Subscription PlanManager, BillingService, RenewalProcessor

Healthcare (3)

Domain Description Key Components
healthcare Healthcare PatientService, DiagnosticService, AppointmentManager
pharmacy Pharmacy PrescriptionManager, MedicineInventory, DosageCalculator
veterinary Veterinary clinic PetService, VetScheduleService, VaccinationTracker

Service (20+)

Domain Description Key Components
booking Reservations ReservationService, SlotManager, AvailabilityChecker
hotel Hotels RoomService, CheckInManager, HousekeepingScheduler
restaurant Restaurants MenuManager, TableService, KitchenOrderSystem
gym Fitness MembershipService, ClassScheduler, TrainerAssignment
delivery Delivery DeliveryService, RouteOptimizer, TrackingManager
parking Parking SpaceManager, EntryExitController, FeeCalculator

Technology (8)

Domain Description Key Components
iot IoT DeviceManager, TelemetryProcessor, AlertService
security Security AuthService, PermissionManager, AuditLogger
ai AI ModelService, InferenceEngine, TrainingPipeline
analytics Analytics ReportGenerator, MetricsCollector, DashboardService

Domain Detection

Automatic Detection

MUSUBIX analyzes text for domain keywords:

import { domainDetector } from '@nahisaho/musubix-core';

const result = domainDetector.detect(`
  ペットの予約管理システムを作りたい。
  獣医師のスケジュール管理と、ワクチン接種記録も必要。
`);

// Result:
// {
//   primaryDomain: { id: 'veterinary', name: 'Veterinary', nameJa: '動物病院' },
//   confidence: 0.92,
//   matchedKeywords: ['ペット', '獣医', 'ワクチン', '予約'],
//   suggestedComponents: ['PetService', 'ReservationService', 'VetScheduleService']
// }

CLI Usage

# Analyze requirements file
npx musubix design patterns --detect-domain storage/specs/REQ-001.md

# Get component recommendations
npx musubix design generate storage/specs/REQ-001.md --infer-components

Component Inference

Domain-Specific Components

Each domain has predefined components with:

  • Type: Service, Repository, Controller, Factory, etc.
  • Layer: Presentation, Application, Domain, Infrastructure
  • Dependencies: Required collaborators
  • Patterns: Recommended design patterns
  • Methods: Domain-specific operations

Example: Veterinary Domain

const veterinaryComponents = [
  {
    name: 'PetService',
    type: 'service',
    layer: 'application',
    description: 'ペット管理のビジネスロジック',
    dependencies: ['PetRepository', 'PetHistoryRepository'],
    patterns: ['Service'],
    methods: [
      { name: 'register', returnType: 'Promise<Pet>' },
      { name: 'update', returnType: 'Promise<Pet>' },
      { name: 'getByOwner', returnType: 'Promise<Pet[]>' },
      { name: 'getHistory', returnType: 'Promise<PetHistory[]>' },
    ]
  },
  {
    name: 'ReservationService',
    type: 'service',
    layer: 'application',
    methods: [
      { name: 'create', returnType: 'Promise<Reservation>' },
      { name: 'confirm', returnType: 'Promise<Reservation>' },
      { name: 'cancel', returnType: 'Promise<Reservation>' },
      { name: 'getAvailableSlots', returnType: 'Promise<TimeSlot[]>' },
    ]
  },
  // ...more components
];

Architecture Recommendations

Based on domain, MUSUBIX recommends:

Domain Category Architecture Style Scaling Strategy
Business Layered + DDD Vertical with caching
Technology Microservices Horizontal scaling
Healthcare Layered + Audit Vertical with compliance
Service Layered Vertical with caching

Multi-Domain Projects

For projects spanning multiple domains:

const result = domainDetector.detect(`
  ECサイトで商品を販売し、配送追跡も行いたい。
  在庫管理とサブスクリプション機能も必要。
`);

// Result:
// {
//   primaryDomain: { id: 'ecommerce' },
//   secondaryDomains: [
//     { id: 'delivery' },
//     { id: 'inventory' },
//     { id: 'subscription' }
//   ]
// }

Using in Design Documents

# DES-SHOP-001: ECサイト設計

## ドメイン分析
- **主ドメイン**: ecommerce
- **副ドメイン**: inventory, payment, delivery

## 推奨コンポーネント

### ecommerce ドメイン
| コンポーネント | 種別 | 責務 |
|---------------|------|------|
| CartService | Service | カート管理 |
| ProductCatalog | Service | 商品カタログ |
| OrderProcessor | Service | 注文処理 |

### inventory ドメイン
| コンポーネント | 種別 | 責務 |
|---------------|------|------|
| StockManager | Service | 在庫管理 |
| ReorderService | Service | 発注管理 |

Related Skills

  • musubix-c4-design - Create architecture with inferred components
  • musubix-code-generation - Generate code for components
  • musubix-sdd-workflow - Full workflow with domain awareness