migrate-filemaker · diff
git:20260521.704a765 to git:20260715.fce6024
109 added, 437 removed. Audit A to A.
---
name: migrate-filemaker
- description: >
- Guide a full migration from FileMaker Pro to an open-source stack. Includes a built-in DDR
- parser that extracts structured specs from FileMaker Database Design Report XML exports.
- Parses the DDR, discovers requirements, recommends a tech stack, and generates a detailed
- rebuild plan with SQL schema and API design. Use when the user provides a FileMaker DDR XML
- export or directory, asks to migrate a FileMaker app, requests FileMaker-to-SQL/API/UI
- planning, or wants modernization recommendations for a FileMaker solution.
- argument-hint: [path-to-ddr-xml-or-directory]
+ description: Guide complete FileMaker Pro migrations from DDR XML to verified discovery, schema, authorization, business-logic, API, UI, and cutover artifacts. Use when analyzing FileMaker Database Design Report XML or parsed specs, comparing implementations, recovering scripts/calculations/layout/security semantics, recommending a replacement architecture, or planning and validating a FileMaker rebuild.
---
# FileMaker Migration Planner
- Orchestrate a complete migration from a FileMaker Pro solution to a modern open-source stack. This skill runs in four phases, each producing a checkpoint file so work can be resumed across sessions.
-
- This skill targets Claude Code and assumes Claude Code interactive question tools are available.
-
- **Reference documents** (consult these during analysis):
- - [FileMaker Concepts → Modern Equivalents](reference/filemaker-concepts.md)
- - [Schema Translation Guide](reference/schema-translation-guide.md)
- - [Script Translation Patterns](reference/script-translation-patterns.md)
- - [Tech Stack Decision Matrix](reference/tech-stack-decision-matrix.md)
- - [DDR XML Structure Reference](reference/ddr-xml-reference.md)
-
- **Output templates** (use these structures for all generated documents):
- - [templates/00_app_summary.md](templates/00_app_summary.md)
- - [templates/01_discovery_answers.md](templates/01_discovery_answers.md)
- - [templates/02_recommendations.md](templates/02_recommendations.md)
- - [templates/03_migration_plan.md](templates/03_migration_plan.md)
- - [templates/04_database_schema.sql](templates/04_database_schema.sql)
- - [templates/05_api_design.md](templates/05_api_design.md)
- - [templates/06_ui_spec.md](templates/06_ui_spec.md)
- - [templates/07_business_logic.md](templates/07_business_logic.md)
- - [templates/08_auth_roles.md](templates/08_auth_roles.md)
-
- ---
+ Treat a FileMaker migration as source recovery, not document generation. A plausible artifact is not evidence. Preserve provenance, reconcile every derived catalog to its source, and mark unavailable semantics instead of inventing them.
- ## Before Starting: Check for Previous Progress
+ ## Set paths once
- Before running any phase, check which checkpoint files and explorer directories already exist:
+ Infer these paths from the repository or ask when they cannot be discovered safely:
- ```
- migration/
- 00_app_summary.md ← Phase 1 output
- fm-scripts-explorer/ ← Phase 1.5 output (Script Explorer)
- fm-cf-explorer/ ← Phase 1.5 output (CF Explorer)
- fm-hide-explorer/ ← Phase 1.5 output (Hide-Object-When Explorer)
- fm-calc-explorer/ ← Phase 1.5 output (Calculated Fields Explorer)
- fm-func-explorer/ ← Phase 1.5 output (Custom Functions Explorer)
- 01_discovery_answers.md ← Phase 2 output
- 02_recommendations.md ← Phase 3 output
- 03_migration_plan.md ← Phase 4 output
- 04_database_schema.sql ← Phase 4 output
- 05_api_design.md ← Phase 4 output
- 06_ui_spec.md ← Phase 4 output
- 07_business_logic.md ← Phase 4 output
- 08_auth_roles.md ← Phase 4 output
+ ```bash
+ SKILL_DIR="/path/to/migrate-filemaker"
+ RAW_DIR="/path/to/implementation/raw"
+ SPECS_DIR="/path/to/implementation/specs"
+ ANALYSIS_DIR="/path/to/implementation/analysis"
+ CORE_DIR="/path/to/canonical/core"
```
- If `00_app_summary.md` exists but `01_discovery_answers.md` does not, Phase 1.5 (Deep Exploration) is the next step — not Phase 2. Check which explorer directories already exist and run only the missing ones before proceeding to discovery.
-
- If a phase's output file exists, ask:
- > "Phase N (description) appears complete — I found `migration/NN_filename.md`. Would you like to review it, redo it, or continue to Phase N+1?"
-
- **Redo cascading:** If the user chooses to redo a phase, warn them before proceeding:
- > "Redoing Phase N will make the outputs from Phase N+1 onward stale — they were generated from the previous answers. I'll redo this phase, then list which downstream files still exist so you can decide whether to regenerate them."
+ Do not substitute hardcoded `ddr/specs` or `migration/` paths inside later steps. Keep implementation-specific evidence under its implementation directory. Put cross-implementation conclusions in an explicitly named comparison/canonical directory.
- After redoing, check which downstream checkpoint files still exist and ask: "These files reflect the old answers — would you like to regenerate them now, or review them first?"
+ ## Non-negotiable evidence rules
- Resume from the earliest incomplete phase.
+ 1. Treat raw DDR XML as immutable and sensitive. Never commit it or print credential literals.
+ 2. Treat parsed JSON as trusted only when `_provenance.json` verifies the raw hashes, parser hash, spec hashes, topology declarations, and passing parser tests.
+ 3. Stop on a failed extraction or provenance check. Do not ask whether to continue with corrupted inputs.
+ 4. Treat counts as coverage evidence, not semantic evidence. Inspect representative source values and retain golden edge cases for calculations, steps, security predicates, and layout behavior.
+ 5. Use stable source identities, never mutable array positions, for explorer state. Require exact identity-set equality before generating reports.
+ 6. Use `07_security.json` as the primary authorization catalog. Hide-object rules are secondary UI/exception evidence and never grant server access.
+ 7. Distinguish facts, inferences, product decisions, and unavailable evidence in every generated artifact.
+ 8. Never claim an implementation-complete UI from the current layout JSON alone. Require raw-layout evidence and screenshots for labels, geometry, controls, tabs, triggers, and unnamed objects.
- ---
+ Read [reference/explorer-contract.md](reference/explorer-contract.md) before running an explorer. Read other resources only for the phase that needs them:
- ## Phase 1: Parse & Understand
+ - DDR extraction: [reference/ddr-xml-reference.md](reference/ddr-xml-reference.md)
+ - FileMaker semantics: [reference/filemaker-concepts.md](reference/filemaker-concepts.md)
+ - Schema decisions: [reference/schema-translation-guide.md](reference/schema-translation-guide.md)
+ - Script behavior: [reference/script-translation-patterns.md](reference/script-translation-patterns.md)
+ - Logic detection: [reference/business-logic-detection.md](reference/business-logic-detection.md)
+ - Architecture selection: [reference/tech-stack-decision-matrix.md](reference/tech-stack-decision-matrix.md)
- ### Step 1.1: Run the DDR Parser
+ ## Phase 0: Establish trustworthy inputs
- First, verify Python is available:
+ Run the regression suite from the loaded skill directory:
```bash
- python3 --version 2>/dev/null || python --version 2>/dev/null
+ cd "$SKILL_DIR"
+ python3 -m unittest discover -s tests
```
- If neither command succeeds, stop and tell the user:
- > "The DDR parser requires Python (3.6+). Please install Python and try again — on macOS: `brew install python3`, on Ubuntu/Debian: `sudo apt install python3`."
-
- Run the built-in DDR parser to extract specs from the DDR XML. Always pass `ddr/specs` as the output directory so downstream steps find the files in the expected location. The parser auto-detects multi-file solutions — if the directory contains multiple `FMPReport type="Report"` XMLs, all are parsed and merged:
+ Then verify an existing extraction:
```bash
- python3 ~/.claude/skills/migrate-filemaker/scripts/parse_ddr.py "$ARGUMENTS" ddr/specs
+ python3 "$SKILL_DIR/scripts/provenance.py" verify \
+ "$RAW_DIR" "$SPECS_DIR" --parser "$SKILL_DIR/scripts/parse_ddr.py"
```
- If the script is not at the personal skills path, try the project-local path:
+ If verification fails or the manifest is missing, regenerate all specs from raw XML and create a new manifest. Do not merge new JSON with an older extraction.
```bash
- python3 .claude/skills/migrate-filemaker/scripts/parse_ddr.py "$ARGUMENTS" ddr/specs
+ rm -rf "$SPECS_DIR.new"
+ python3 "$SKILL_DIR/scripts/parse_ddr.py" "$RAW_DIR" "$SPECS_DIR.new"
+ python3 "$SKILL_DIR/scripts/provenance.py" create \
+ "$RAW_DIR" "$SPECS_DIR.new" --parser "$SKILL_DIR/scripts/parse_ddr.py"
```
- If neither path contains the parser, stop and tell the user:
- > "The DDR parser script could not be found. Expected locations: `~/.claude/skills/migrate-filemaker/scripts/parse_ddr.py` or `.claude/skills/migrate-filemaker/scripts/parse_ddr.py`. Please ensure the migrate-filemaker skill is installed correctly and try again."
-
- If `ddr/specs/` already exists with all 11 JSON files (including `00_topology.json`, `09_conditional_formatting.json`, and `10_hide_object_when.json`), skip parsing and use the existing specs. Confirm with the user: "Found existing specs — using those. Re-run the parser if you want fresh extraction."
-
- ### Step 1.2: Verify Extraction Quality
-
- Verify the parser output before proceeding:
- 1. **Topology** (`00_topology.json`): Confirm file count matches expectations. For multi-file solutions, verify cross-file references are resolved (check `unresolved_references` is empty or only has expected missing files)
- 2. Tables have fields properly separated into `fields`, `calculated`, `summary`, `globals`
- 3. Table occurrences all have a non-null `base_table`. For multi-file solutions, TOs with `external_file_reference` should have `resolved_source_file`
- 4. Relationships have join predicates with both left and right field names
- 5. Major layouts have populated fields/portals/buttons arrays
- 6. Scripts have parsed steps with params (not just step names). Cross-file script calls should have `external_file` in params
- 7. Value lists have their entries or source fields
- 8. Custom functions have calculation text
-
- If any check fails, report the issue and ask whether to continue or fix first.
-
- ### Step 1.3: Analyze & Produce App Summary
-
- Read all spec files (01 through 08, plus 09 and 10 if they contain data) and produce `migration/00_app_summary.md` using the template structure. The analysis must include:
-
- **Application Profile:**
- - Derive the app name from the DDR filename or table naming patterns
- - For multi-file solutions: note the file structure (e.g., "UI + Data separation file") and which tables belong to which file
- - Infer the domain/purpose from table names, field names, and script names
- - Calculate a complexity score using these thresholds:
- - **Simple:** <5 real tables, <10 scripts, <5 layouts
- - **Medium:** 5–15 real tables, 10–50 scripts, 5–20 layouts
- - **Complex:** 15–30 real tables, 50–150 scripts, 20–50 layouts
- - **Enterprise:** >30 real tables, >150 scripts, >50 layouts
- - Count "real tables" as those with at least one schema field (not globals-only tables)
-
- **Data Model Summary:**
- - List each real table with its schema field count, calculated field count, and record count
- - Identify the core entity tables vs. junction/lookup tables
- - Note any tables that are globals-only (app-state tables, not real data)
- - Summarize relationship graph: key joins, one-to-many patterns, self-joins
-
- **Feature Map:**
- - Group scripts by their `group` path to identify functional domains
- - Map each domain to likely application features (e.g., "Invoice Scripts" → invoicing)
- - Note scripts that are clearly UI-only (navigation, dialog) vs. business logic
- - Identify any script patterns suggesting integrations (email, export, API calls)
-
- **UI Summary:**
- - Count layouts by table assignment
- - Identify list/detail layout pairs
- - Note layouts with portals (master-detail patterns)
- - Flag layouts with many buttons (complex user workflows)
-
- **Security Model:**
- - List privilege sets and their access levels
- - Note any extended privileges
- - Count active vs. inactive accounts
-
- **Red Flags** (items that will need special attention during migration):
- - Complex unstored calculations that reference related data
- - Heavy use of global fields for state management
- - Container fields (file storage)
- - Cross-file script calls (scripts calling into other FM files — tightly coupled multi-file logic)
- - Unresolved external file references (DDR missing for a referenced file)
- - Heavy conditional formatting / hide-object-when rules (check `09_conditional_formatting.json` and `10_hide_object_when.json` counts) — these often encode authorization models, workflow state machines, and business rules invisible in the data model. If counts are significant (>100 rules), recommend running the Conditional Formatting and Hide-Object-When Explorer workflows for deep analysis.
-
- **Specialized Business Logic Detection:**
-
- Scan scripts for domain-specific logic that can't be inferred from the app type. See [reference/business-logic-detection.md](reference/business-logic-detection.md) for detection signals, plumbing filters, and the required output format. Present findings as a "Specialized Business Logic" section in the app summary, or note none found.
-
- Present the summary to the user before proceeding.
-
- ---
-
- ## Phase 1.5: Deep Exploration (Required Gate)
-
- **Do not start Phase 2 until all applicable explorers are complete.**
-
- Run all explorers that have data. This is not optional — the explorers extract the information that makes Phase 2 discovery meaningful and Phase 4 planning precise. Script categories, the auth model, business logic thresholds, and custom function translations are all in hand before you ask the user a single question. There is no downside to running them.
-
- Each explorer is incremental — run a batch at a time (`count` to see what's there, `all` to process everything, `reports` to generate reports from completed CSVs). All items get a documented row. Nothing is silently dropped.
-
- Check which explorers apply based on the Phase 1 summary, then run each one:
-
- ---
+ Inspect the new directory before replacing the old one. Preserve or archive old derived artifacts for comparison, but do not let explorers resume against changed specs.
- ### Script Explorer — Always Run
- Read [workflows/fm-script-explorer.md](workflows/fm-script-explorer.md) and follow its methodology. Produces per-folder CSV catalogs + six reports in `migration/fm-scripts-explorer/`. Every migration has scripts. Run this first — the script categorization feeds directly into Phase 4 business logic mapping.
+ Verify the extraction contract:
- ---
+ - All files `00_topology.json` through `10_hide_object_when.json` exist.
+ - Topology source identities match the supplied DDR set; unresolved references are enumerated and explained.
+ - Tables distinguish regular, calculated, summary, and global fields.
+ - Table occurrences resolve to base tables and source files where the DDR set permits.
+ - Every relationship predicate has both sides and an observed operator token.
+ - Layouts, scripts, value lists, security, custom functions, conditional formatting, and hide rules reconcile with the parser's self-check.
+ - Sample semantic fixtures include field operands in calculations, root scripts, populated `step_text`, conditional-formatting payloads, record/field/layout privileges, and redaction.
- ### Conditional Formatting Explorer — Run If Any CF Rules Found
- Read [workflows/fm-cf-explorer.md](workflows/fm-cf-explorer.md) and follow its methodology. Produces per-layout CSV catalogs + three reports in `migration/fm-cf-explorer/`. CF formulas encode financial thresholds, status pipelines, and authorization states that are invisible in the data model. Skip only if Phase 1 found zero CF rules.
+ Current `07_security.json` does not contain FileMaker extended-privilege definitions. If they matter, inspect the raw `ExtendedPrivilege` catalog or obtain a manual export and label the result `raw/manual`; otherwise state `unavailable`, never `none`.
- ---
+ ## Phase 1: Inventory and source coverage
- ### Hide-Object-When Explorer — Run If Any Rules Found
- Read [workflows/fm-hide-explorer.md](workflows/fm-hide-explorer.md) and follow its methodology. Produces per-layout CSV catalogs + four reports in `migration/fm-hide-explorer/`. These rules frequently encode the full authorization model and workflow state machines. Skip only if Phase 1 found zero hide-object-when rules.
+ Create the implementation app summary from [templates/00_app_summary.md](templates/00_app_summary.md). Read every spec catalog, including empty catalogs, and record its provenance hash/status.
- ---
+ Include:
- ### Calculated Fields Explorer — Run If Any Calculated Fields Found
- Read [workflows/fm-calc-explorer.md](workflows/fm-calc-explorer.md) and follow its methodology. Produces per-table CSV catalogs + three reports in `migration/fm-calc-explorer/`. Skip only if all tables have zero calculated fields.
+ - source-file topology and unresolved dependencies;
+ - base tables, table occurrences, relationship predicates, layouts, scripts, value lists, security, custom functions, conditional formatting, and hide rules;
+ - field categories and data types using the JSON tokens actually emitted;
+ - integration directions and script calls;
+ - known unavailable evidence, especially extended privileges and unextracted UI details;
+ - specialized logic candidates found with [reference/business-logic-detection.md](reference/business-logic-detection.md).
- ---
+ Do not infer authorization from role names or hide formulas. Do not infer keys from a field named `ID`. Do not describe a global as shared configuration without proving its use and initialization.
- ### Custom Functions Explorer — Run If Any Custom Functions Found
- Read [workflows/fm-func-explorer.md](workflows/fm-func-explorer.md) and follow its methodology. Produces a single CSV + three reports in `migration/fm-func-explorer/`. Custom functions are the shared logic layer called from scripts, calculated fields, and layout formulas. Skip only if the solution has zero custom functions.
+ ## Phase 1.5: Deep exploration
- ---
+ Run every explorer whose source catalog contains entries. An explorer directory is not a completion signal. Its source snapshot must match the current spec hash, and its CSVs must cover every `source_id` exactly once with the matching `source_hash`.
- When all applicable explorers are complete, present a brief summary to the user:
+ Use `scripts/catalog_contract.py` as specified in the shared explorer contract; do not recreate its identity or coverage logic ad hoc.
- > "Deep exploration complete. Here's what the explorers found:
- > - Scripts: [N scripts across N groups — key findings]
- > - Conditional formatting: [N rules — notable patterns]
- > - Hide-object-when: [N rules — auth model notes]
- > - Calculated fields: [N fields — business logic detected]
- > - Custom functions: [N functions — shared logic]
- >
- > Ready to start Phase 2 discovery."
+ - Scripts: [workflows/fm-script-explorer.md](workflows/fm-script-explorer.md)
+ - Calculated fields: [workflows/fm-calc-explorer.md](workflows/fm-calc-explorer.md)
+ - Custom functions: [workflows/fm-func-explorer.md](workflows/fm-func-explorer.md)
+ - Conditional formatting: [workflows/fm-cf-explorer.md](workflows/fm-cf-explorer.md)
+ - Hide-object rules: [workflows/fm-hide-explorer.md](workflows/fm-hide-explorer.md)
+ - UI evidence: [workflows/fm-ui-spec.md](workflows/fm-ui-spec.md)
+ - Schema decisions: [workflows/fm-schema-builder.md](workflows/fm-schema-builder.md)
- If the user closed the session after Phase 1 and is resuming, check which explorer output directories already exist (`migration/fm-scripts-explorer/`, `migration/fm-cf-explorer/`, etc.) and skip completed explorers. Only run what's missing.
+ For scripts, read both structured `params` and `step_text` for every active step. Preserve populated comments as developer evidence. Classify persistent effects by where they must be enforced, not by whether a layout trigger invoked them.
- ---
+ For conditional formatting, separate shared conditions from presentation variants. For hide rules with no stable object attribution, label the target `unattributed`; do not guess.
## Phase 2: Discovery
- This phase is interactive. Ask questions in small conversational groups (2–3 questions at a time), not as a survey dump. Adapt follow-up groups based on earlier answers. Skip questions that become irrelevant.
-
- Use the AskUserQuestion tool for each group with appropriate options. Allow "You decide" / "No preference" as valid answers.
-
- ### Group 1 — Goals & Scope
-
- Ask about:
- 1. **Migration driver:** What's motivating the move away from FileMaker? (Licensing costs, scalability limits, web/mobile access, team growth, vendor lock-in, other)
- 2. **Rebuild scope:** Full rebuild of all features, or partial? Any features to drop or simplify?
- 3. **Priority:** What's the single most important thing the new system must do well?
-
- ### Group 2 — Users & Scale
-
- Ask about:
- 1. **Current users:** How many concurrent users today? Expected growth?
- 2. **Access patterns:** Desktop only, or also mobile/tablet? Need offline capability?
- 3. **User roles:** How many distinct roles/permission levels? (Reference the privilege sets found in Phase 1)
-
- ### Group 3 — UI Style & Design
-
- Ask about:
- 1. **Screenshots of current FM app:** Ask the user to provide screenshots of their current FileMaker layouts — especially the most-used screens. Use the Read tool to view any provided image files. Note what works and what doesn't about the current UI from the user's perspective.
- 2. **Desired UI style:** What visual direction do they want? Options:
- - **Clean & minimal** — lots of whitespace, simple forms, modern SaaS look
- - **Data-dense & dashboard-heavy** — tables, charts, dense information display
- - **Match current FM look** — keep it familiar, minimize user retraining
- - **Something different entirely** — ask them to describe or provide references
- 3. **Reference apps or sites:** Ask for screenshots or links to any apps, websites, or products whose look and feel they admire. These become the design north star for the frontend build.
-
- Record which screenshots were provided and note key observations: layout density, color usage, navigation patterns, form complexity. These feed directly into the Frontend and CSS/Component Library recommendations in Phase 3 and the UI Spec in Phase 4.
-
- ### Group 4 — Technical Preferences
-
- Ask about:
- 1. **Coding mode:** Who is primarily writing this — AI-generated (vibe-coded), human developers, or a hybrid?
- 2. **Stack preferences:** Any hard requirements? (e.g., must use PostgreSQL, specific cloud provider, Docker required)
- 3. **Deployment target:** Cloud (which provider?), on-premise, or hybrid?
- 4. **Separate frontend need:** Is there a specific reason you'd need a separate frontend app — such as a native mobile app, offline access, or real-time collaborative editing? (Most internal tools and B2B apps don't need one.)
-
- **Based on the coding mode answer, branch here:**
-
- **If AI / vibe-coded:**
- > "AI-generated code works best with full-stack MVC frameworks — Django, Laravel, and Rails. These have one obvious way to do everything: one ORM, one migration tool, one auth library. AI-generated React code almost universally misuses state management and data fetching in ways that appear to work in development but fail under real conditions. We'll use an MVC framework. The only remaining question is which language fits your team."
- Skip to the language sub-question in the decision matrix. Do not ask about separate frontend preference unless real-time collab or native mobile came up in Groups 1–3.
-
- **If human / hybrid:**
- > "What language does your team primarily write in?"
-
- Then use the WebSearch tool to pull current, real-world data before recommending anything. Search for:
- - `"[language] web framework 2025 most popular production"`
- - `"[framework A] vs [framework B] 2025"`
- - Stack Overflow Developer Survey current year results for that language's top frameworks
- - GitHub star history and recent commit activity for the top 2–3 candidates
-
- Present the search findings to the user in plain language — community size, production adoption, recent momentum, any notable concerns — and let them weigh in before you make a recommendation. The goal is that they feel like they researched this, not that they accepted your default.
-
- ### Group 5 — Constraints
-
- Ask about:
- 1. **Timeline:** When do you need this running? Is there a hard deadline?
- 2. **Budget:** Any budget constraints for hosting/infrastructure?
- 3. **Parallel operation:** Will the FM system run alongside the new one during transition?
-
- *Skip Group 5 if the user indicated in Group 1 that this is exploratory / no timeline pressure.*
-
- ### Group 6 — Data & Integrations
-
- Ask about:
- 1. **Data migration:** Need to migrate existing records? How many records in the largest table? (Reference record counts from Phase 1)
- 2. **External integrations:** Any connections to external systems (email, payment, other databases, APIs)?
- 3. **Reporting:** Any critical reports that must be replicated?
-
- *Skip if Phase 1 shows a simple app with <1000 total records and no integration scripts.*
-
- ### Group 7 — Specialized Business Logic
-
- *Only ask this group if Phase 1 detected specialized business logic scripts.*
-
- Present the flagged script groups from the App Summary and ask about each domain:
-
- > "I found [N] areas with specialized business logic that can't be inferred from the app type:
- >
- > 1. **[Domain]** — [brief description from Phase 1 detection]
- > 2. **[Domain]** — [brief description]
- > ...
- >
- > For each of these, can you describe the business rules? Specifically:
- > - What is this logic supposed to accomplish?
- > - Are the rules fixed, or do they change (e.g., pricing tiers updated annually)?
- > - Must the rules be preserved exactly, or is this an opportunity to simplify?"
-
- After discussing the flagged scripts, ask:
-
- > "Are there any other scripts or business rules in the system that are critical to how your business operates — things that wouldn't be obvious from the data model? For example, custom calculations, compliance rules, or specialized workflows that took significant effort to build."
-
- Record the answers with enough detail to drive the Phase 4 business logic mapping — capture the *why* behind the logic, not just the *what*.
-
- *Skip if Phase 1 found no specialized business logic AND the app complexity is Simple or Medium.*
-
- ### Save Discovery Results
+ Use [templates/01_discovery_answers.md](templates/01_discovery_answers.md). Ask only questions whose answers cannot be established from verified artifacts. Cover:
- Write all answers to `migration/01_discovery_answers.md` using the template structure. Include the raw answers and any inferences drawn from the conversation.
+ - migration goals, scope, deadlines, and parallel operation;
+ - current/future users and device/offline needs;
+ - identity provider, account provisioning, service accounts, and authorization expectations;
+ - active workflows, critical business invariants, exception handling, and reports;
+ - data volume, source timezone/DST policy, containers, and integrations;
+ - screenshots and UI behavior missing from the DDR;
+ - which legacy behaviors should be preserved, tightened, simplified, or retired.
- ---
+ When source evidence and a stakeholder description conflict, record both and open a decision. Do not silently choose one.
## Phase 3: Recommend
- Analyze the specs (Phase 1) and discovery answers (Phase 2) together. Consult the [Tech Stack Decision Matrix](reference/tech-stack-decision-matrix.md) for scoring guidance.
-
- Produce `migration/02_recommendations.md` using the template structure:
-
- ### 3.1: Tech Stack Selection
-
- The default is a **full-stack MVC monolith** (Django, Laravel, or Rails). These frameworks cover database, ORM, auth, admin, migrations, email, background jobs, and server-rendered UI in a single package — 2–3 decisions before writing features, not 12–15. This is the right default for almost every FileMaker migration: internal tools, B2B SaaS, single-team applications.
-
- Only recommend a separate frontend (React, Vue, Svelte) if discovery answers document a specific need: native mobile app, offline-first PWA, real-time collaborative editing, or a team already deeply invested in a JS framework. "It's what everyone uses" is not a reason.
-
- For each layer, recommend a **primary** choice and one **alternative**, with reasoning:
-
- - **Database:** PostgreSQL vs. MySQL vs. SQLite — based on complexity, scale, feature needs. PostgreSQL is the default.
- - **Full-Stack Framework:** Django (Python), Laravel (PHP), or Rails (Ruby) — match team language. Django if no preference. If a separate frontend is genuinely justified, recommend an MVC API backend + frontend framework combination and document what justified the split.
- - **Interactivity layer:** For MVC monoliths — HTMX/Alpine.js (Django/Laravel) or Hotwire (Rails). Only recommend a full JS framework if the separate frontend case is met.
- - **Authentication:** Based on the FM security model and deployment context. Default to framework built-in auth.
- - **Deployment:** Based on budget, scale, team ops experience. PaaS (Railway, Render) is the default.
-
- ### 3.2: Architecture Pattern
-
- Choose one with justification:
- - **Monolith:** Simple apps, small teams, fast to build
- - **Modular Monolith:** Medium complexity, clear domain boundaries, easy to split later
- - **Microservices:** Only if genuinely needed (high scale, multiple teams, independent deployment)
-
- Default recommendation should be **modular monolith** for most FileMaker migrations — they are typically single-team applications with clear domain boundaries.
-
- ### 3.3: Migration Strategy
-
- Recommend one:
- - **Phased:** Build core features first, migrate data, add remaining features iteratively. Lower risk. Preferred for most FM migrations.
- - **Big Bang:** Build everything, switch over at once. Only for very simple apps or hard deadlines.
-
- ### 3.4: Feature Priority
-
- Order the functional domains identified in Phase 1 by migration priority:
- 1. Core data management (CRUD for main entities)
- 2. Business logic (scripts that enforce rules)
- 3. Reporting and views
- 4. User management and auth
- 5. Integrations
- 6. Nice-to-have features
-
- ### Present & Adjust
-
- Present the full recommendation document to the user. Ask:
- > "Do these recommendations look right? Anything you'd like me to adjust before I generate the detailed migration plan?"
-
- Incorporate any feedback before proceeding to Phase 4.
-
- ---
-
- ## Phase 4: Plan
-
- Generate the detailed rebuild artifacts. Consult the reference documents for translation patterns:
- - [Schema Translation Guide](reference/schema-translation-guide.md) for data types and patterns
- - [Script Translation Patterns](reference/script-translation-patterns.md) for business logic mapping
- - [FileMaker Concepts](reference/filemaker-concepts.md) for concept mapping
-
- ### Before Generating: Confirm the Plan
-
- Before writing any file, confirm with the user what Phase 4 will produce:
-
- > "I'm ready to generate the Phase 4 artifacts:
- >
- > - `03_migration_plan.md` — phased build plan with effort estimates and risk register
- > - `04_database_schema.sql` — schema builder (confirms decisions with you before writing)
- > - `05_api_design.md` — RESTful endpoints plus custom business logic endpoints
- > - `06_ui_spec.md` — UI spec builder (full page inventory, component mapping, form specs)
- > - `07_business_logic.md` — script categorization and specialized logic translation
- > - `08_auth_roles.md` — privilege set mapping and access control model
- >
- > Shall I proceed?"
-
- Incorporate any feedback, then proceed.
-
- ### 4.1: Migration Plan (`migration/03_migration_plan.md`)
-
- Using the template, produce:
- - **Phase breakdown** with clear milestones and dependencies
- - **Effort estimates** per phase (relative sizing: S/M/L/XL, not hours)
- - **Risk register** with mitigations
- - **Data migration plan** (if applicable): extraction approach, transformation rules, validation strategy
- - **Testing strategy** per phase
- - **Rollback plan** if the new system has issues
-
- ### 4.2: Database Schema (`migration/04_database_schema.sql`)
-
- Read [workflows/fm-schema-builder.md](workflows/fm-schema-builder.md) and follow its methodology to generate the database schema. It reads `ddr/specs/` and the tech stack choice from `migration/02_recommendations.md`, presents all key schema decisions for user confirmation, and writes `migration/04_database_schema.sql`.
-
- See [workflows/fm-schema-builder.md](workflows/fm-schema-builder.md) for the full generation methodology.
-
- ### 4.3: API Design (`migration/05_api_design.md`)
-
- Using the template, produce:
- - **RESTful endpoints** for each real table (standard CRUD)
- - **Custom endpoints** derived from business-logic scripts
- - **Authentication endpoints** based on the security model
- - **Batch/import endpoints** if data migration is needed
- - Group endpoints by domain (matching the feature map from Phase 1)
-
- ### 4.4: Business Logic Mapping (`migration/07_business_logic.md`)
-
- **If Script Explorer was run** (`migration/fm-scripts-explorer/` exists): read the CSV catalogs and reports — especially `reports/summary.md`, `reports/tier1-critical.md`, and `reports/data-writes.md`. Use the per-script classifications (type, logic_tier) to drive categorization instead of re-analyzing raw scripts. The explorer's module assignments, backbone script identification, and "hardest to migrate" analysis should directly inform this document.
-
- Using [templates/07_business_logic.md](templates/07_business_logic.md), produce `migration/07_business_logic.md` with two sections:
-
- **Section 1 — Script Categorization**
-
- Categorize every script (or script group) as one of:
- - **Drop:** Navigation-only scripts, UI helpers that the new framework handles
- - **API Endpoint:** Scripts that perform data operations triggered by user action
- - **Service Function:** Background logic, validation rules, calculations
- - **UI Handler:** Client-side logic (form validation, conditional visibility)
-
- Present as a table grouped by domain: `Script Group | Script Name | Category | Notes`.
-
- **Section 2 — Specialized Logic Detail**
-
- For each specialized business logic domain flagged in Phase 1 and explored in Phase 2 Group 7:
+ Use [templates/02_recommendations.md](templates/02_recommendations.md) and [reference/tech-stack-decision-matrix.md](reference/tech-stack-decision-matrix.md).
- 1. **Document the business rules** in plain language using the user's descriptions from Discovery
- 2. **Trace the script logic** — walk through the actual parsed steps and calculations to produce pseudocode or a logic flowchart that captures the algorithm
- 3. **Map custom functions** used by these scripts — include the function's calculation text and translate it to a modern equivalent (e.g., a utility function signature with documented inputs/outputs)
- 4. **Specify the implementation target** — where this logic lives in the new system (database function, service layer function, API middleware, etc.) with enough detail that a developer can implement it without referencing the original FileMaker scripts
- 5. **Flag any ambiguity** — if the parsed script logic doesn't fully match the user's description from Discovery, or if calculations are too opaque to confidently translate, note it as requiring manual verification during implementation
+ Honor an established repository stack unless discovery establishes a reason to change it. Choose architecture from constraints: team capability, offline/native clients, integration boundaries, authorization complexity, operational ownership, scale, and delivery risk. Separate authentication capability from authorization coverage.
- ### 4.5: Auth & Roles Mapping (`migration/08_auth_roles.md`)
+ When current ecosystem facts affect a recommendation, verify them against current primary sources using the current year. Label preference and inference separately from measured facts.
- **If Hide-Object-When Explorer was run** (`migration/fm-hide-explorer/` exists): read `reports/summary.md` and `reports/auth-model.md`. These contain the full authorization model extracted from hide-object-when formulas — often more complete than the privilege set catalog alone, because FM developers frequently implement fine-grained access control through hide conditions rather than privilege sets.
+ ## Phase 4: Produce rebuild contracts
- Using [templates/08_auth_roles.md](templates/08_auth_roles.md), produce `migration/08_auth_roles.md` with:
- - **Role definitions** — each FM privilege set mapped to a named role with its permission boundaries
- - **Record-level access** — row-level security rules or middleware checks derived from FM record access privileges
- - **Route/page permissions** — FM layout access restrictions mapped to route guards
- - **Authorization layer map** — if the Hide-Object-When Explorer identified multiple authorization layers (role checks, permission flags, record sensitivity, SQL-based checks), document each layer explicitly and map it to its modern equivalent (middleware, store guard, component-level conditional, database RLS policy)
- - **Session variables** — any `$$` globals used as permission state, with their modern equivalents (session store, JWT claims, server-side session)
- - **Open questions** — any privilege rules that are ambiguous or require business clarification before implementation
+ Generate the following from verified evidence and record each input hash:
- ### 4.6: UI Spec (`migration/06_ui_spec.md`)
+ 1. `03_migration_plan.md` from [templates/03_migration_plan.md](templates/03_migration_plan.md)
+ 2. `04_database_schema.sql` through [workflows/fm-schema-builder.md](workflows/fm-schema-builder.md)
+ 3. `05_api_design.md` from [templates/05_api_design.md](templates/05_api_design.md)
+ 4. `06_ui_spec.md` through [workflows/fm-ui-spec.md](workflows/fm-ui-spec.md)
+ 5. `07_business_logic.md` from [templates/07_business_logic.md](templates/07_business_logic.md)
+ 6. `08_auth_roles.md` from [templates/08_auth_roles.md](templates/08_auth_roles.md)
- Read [workflows/fm-ui-spec.md](workflows/fm-ui-spec.md) and follow its methodology to generate the frontend specification. It reads the discovery answers, layout specs, and Hide-Object-When / Conditional Formatting Explorer reports (if run), then writes `migration/06_ui_spec.md` — a complete page inventory, component mapping, form specs, and responsive requirements.
+ Apply these gates:
- See [workflows/fm-ui-spec.md](workflows/fm-ui-spec.md) for the full specification methodology.
+ - **Schema:** preserve source keys until uniqueness and relationship evidence support a mapping. Resolve relationship sides through table occurrences. Preserve compound predicates. Add a surrogate key only as an explicit, reversible decision. Treat SQL constraints stricter than FileMaker validation as product decisions backed by profiling.
+ - **API:** derive operations from use cases and authorization rules, not one CRUD surface per table. Default deny at route, row, and field level. Distinguish outbound `Insert from URL` calls from inbound webhooks.
+ - **UI:** produce an evidence-bounded inventory unless screenshots/raw-layout analysis supply the missing presentation semantics. Never attach an unnamed hide rule to a guessed control.
+ - **Business logic:** reconcile scripts, calculations, custom functions, validations, value lists, conditional formatting, hide rules, and security predicates. A trigger can invoke server-owned domain logic.
+ - **Authorization:** reconcile account provisioning, privilege sets, table/record/field/layout/script/value-list access, access channels, service principals, route guards, and UI visibility. Deny by default and specify negative tests.
+ - **Data migration:** go beyond row counts and random samples. Require column profiles, stable-value hashes, duplicate/orphan checks, rejected-row accounting, business totals, encoding/timezone tests, and targeted edge cases.
- ### Present Final Deliverables
+ ## Phase 5: Completion audit
- Summarize what was generated and where to find each file:
+ Before declaring the migration plan complete:
- ```
- migration/
- 00_app_summary.md ← Application analysis
- 01_discovery_answers.md ← Requirements gathered
- 02_recommendations.md ← Tech stack & architecture
- 03_migration_plan.md ← Phased rebuild plan
- 04_database_schema.sql ← Database DDL
- 05_api_design.md ← API endpoint design
- 06_ui_spec.md ← Frontend UI specification
- 07_business_logic.md ← Script categorization & specialized logic
- 08_auth_roles.md ← Role definitions & access control model
- ```
+ 1. Re-run provenance verification.
+ 2. Re-run each explorer's catalog coverage verifier.
+ 3. Trace at least one high-risk conclusion in every logic/security/UI category back to raw XML or a screenshot, not only parsed JSON.
+ 4. Verify every source catalog has a disposition in the business-logic coverage matrix.
+ 5. Verify every source security dimension has an enforcement owner and negative test.
+ 6. Verify every relationship target resolves to an evidenced unique key or is explicitly unresolved.
+ 7. Verify generated artifacts contain no credential literals.
+ 8. List unavailable evidence and open decisions honestly.
- Suggest next steps:
- 1. Review all documents with the team
- 2. Set up the development environment with the recommended stack
- 3. Begin Phase 1 of the migration plan (core data model + CRUD)
+ If any gate fails, the output is incomplete even when all expected files exist.