$npx -y skills add Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-agent-architectUse when designing multi-app Frappe architectures, deciding whether to split functionality into separate apps, or implementing cross-app communication patterns. Prevents monolithic app sprawl, circular dependencies between apps, and broken override chains. Covers multi-app archit
| 1 | # Multi-App Architecture Agent |
| 2 | |
| 3 | Designs Frappe/ERPNext multi-app architectures by analyzing business requirements, deciding app boundaries, and generating implementation roadmaps. |
| 4 | |
| 5 | **Purpose**: Make the right architecture decisions BEFORE writing code — prevent costly refactoring later. |
| 6 | |
| 7 | ## When to Use This Agent |
| 8 | |
| 9 | ``` |
| 10 | ARCHITECTURE TRIGGER |
| 11 | | |
| 12 | +-- New project with multiple modules |
| 13 | | "We need CRM, inventory, and custom billing" |
| 14 | | --> USE THIS AGENT |
| 15 | | |
| 16 | +-- Deciding whether to extend ERPNext or build custom |
| 17 | | "Should we customize Sales Invoice or create our own DocType?" |
| 18 | | --> USE THIS AGENT |
| 19 | | |
| 20 | +-- Multiple teams building on same Frappe instance |
| 21 | | "Team A does HR, Team B does manufacturing" |
| 22 | | --> USE THIS AGENT |
| 23 | | |
| 24 | +-- Existing monolith needs splitting |
| 25 | | "Our single custom app has 50 DocTypes" |
| 26 | | --> USE THIS AGENT |
| 27 | | |
| 28 | +-- Cross-app communication needed |
| 29 | | "App A needs to react when App B creates a document" |
| 30 | | --> USE THIS AGENT |
| 31 | ``` |
| 32 | |
| 33 | ## Architecture Workflow |
| 34 | |
| 35 | ``` |
| 36 | STEP 1: ANALYZE REQUIREMENTS |
| 37 | Business needs → DocTypes, workflows, integrations |
| 38 | |
| 39 | STEP 2: DECIDE APP BOUNDARIES |
| 40 | Single app vs multiple apps decision framework |
| 41 | |
| 42 | STEP 3: DESIGN CROSS-APP DEPENDENCIES |
| 43 | required_apps, shared DocTypes, hook contracts |
| 44 | |
| 45 | STEP 4: DESIGN DATA MODEL |
| 46 | DocTypes, relationships, naming conventions |
| 47 | |
| 48 | STEP 5: GENERATE IMPLEMENTATION ROADMAP |
| 49 | Build order, milestones, team assignments |
| 50 | ``` |
| 51 | |
| 52 | See [references/workflow.md](references/workflow.md) for detailed steps. |
| 53 | |
| 54 | ## Step 1: Requirement Analysis Matrix |
| 55 | |
| 56 | Map each business requirement to Frappe mechanisms: |
| 57 | |
| 58 | | Requirement Type | Frappe Mechanism | Example | |
| 59 | |-----------------|-----------------|---------| |
| 60 | | Data storage | DocType | "Track customer contracts" | |
| 61 | | Business rules | Controller/Server Script | "Auto-calculate totals" | |
| 62 | | Approval flow | Workflow | "Manager must approve orders >10k" | |
| 63 | | Scheduled tasks | Scheduler/hooks.py | "Daily report email" | |
| 64 | | External sync | Integration/API | "Sync with Shopify" | |
| 65 | | Custom UI | Client Script/Page | "Dashboard for warehouse" | |
| 66 | | Reports | Script Report/Query Report | "Monthly sales by region" | |
| 67 | | Permissions | Role Permission | "Sales team sees own data only" | |
| 68 | | Print output | Print Format (Jinja) | "Custom invoice layout" | |
| 69 | | Portal access | Website/Portal | "Customer can view orders" | |
| 70 | |
| 71 | ## Step 2: App Boundary Decision Framework |
| 72 | |
| 73 | ### Single App: Use When |
| 74 | |
| 75 | - Total DocTypes < 15 |
| 76 | - Single team maintains the code |
| 77 | - All DocTypes share the same business domain |
| 78 | - No plans to distribute/sell components separately |
| 79 | - All DocTypes have tight data dependencies |
| 80 | |
| 81 | ### Multiple Apps: Use When |
| 82 | |
| 83 | - Total DocTypes > 15 |
| 84 | - Multiple teams with separate release cycles |
| 85 | - Clear domain boundaries exist (HR vs Manufacturing vs CRM) |
| 86 | - Components may be installed independently |
| 87 | - Some modules are reusable across projects |
| 88 | - Different licensing needs per module |
| 89 | |
| 90 | ### Decision Tree |
| 91 | |
| 92 | ``` |
| 93 | HOW MANY DOCTYPES? |
| 94 | | |
| 95 | +-- < 15 total |
| 96 | | +-- Single domain? --> SINGLE APP |
| 97 | | +-- Multiple domains? --> Consider splitting |
| 98 | | |
| 99 | +-- 15-30 total |
| 100 | | +-- Tight coupling between all? --> SINGLE APP (with modules) |
| 101 | | +-- Clear domain boundaries? --> 2-3 APPS |
| 102 | | |
| 103 | +-- > 30 total |
| 104 | | --> ALWAYS SPLIT into multiple apps |
| 105 | | Group by domain/team/release cycle |
| 106 | ``` |
| 107 | |
| 108 | See [references/decision-tree.md](references/decision-tree.md) for the complete decision framework. |
| 109 | |
| 110 | ## Step 3: Cross-App Dependency Patterns |
| 111 | |
| 112 | ### required_apps Declaration |
| 113 | |
| 114 | ALWAYS declare dependencies explicitly in `hooks.py`: |
| 115 | |
| 116 | ```python |
| 117 | # myapp/hooks.py |
| 118 | required_apps = ["frappe", "erpnext"] # NEVER omit frappe |
| 119 | ``` |
| 120 | |
| 121 | ### Dependency Rules |
| 122 | |
| 123 | - NEVER create circular dependencies (App A requires App B requires App A) |
| 124 | - ALWAYS declare ALL dependencies (direct and indirect) |
| 125 | - ALWAYS put shared/base apps first in required_apps |
| 126 | - NEVER depend on a specific version — use compatible APIs only |
| 127 | |
| 128 | ### Dependency Diagram Pattern |
| 129 | |
| 130 | ``` |
| 131 | frappe (base framework) |
| 132 | └── erpnext (ERP modules) |
| 133 | ├── custom_manufacturing (extends Manufacturing) |
| 134 | └── custom_crm (extends CRM) |
| 135 | └── crm_analytics (extends custom_crm) |
| 136 | |
| 137 | RULE: Dependencies flow DOWN only. Never up, never sideways. |
| 138 | ``` |
| 139 | |
| 140 | ### Cross-App Communication Patterns |
| 141 | |
| 142 | | Pattern | M |