Skip to content

Commit b385a57

Browse files
akoclaude
andcommitted
docs: add resolve-forward-references skill; fix OR REPLACE bug in overview-pages
- New skill: `.claude/skills/mendix/resolve-forward-references.md` — documents the placeholder pattern (why forward refs fail, three common patterns, ordering rules, CREATE OR MODIFY vs ALTER SNIPPET, full CRUD scaffold template) - Fix: `overview-pages.md` used `CREATE OR REPLACE SNIPPET` for the fill-in step, which destroys the placeholder UUID and breaks all page bindings; corrected to `CREATE OR MODIFY SNIPPET` with an explanation and cross-reference - Update: `check-syntax.md` — adds "snippet not found / page not found" error section with fix options and the declaration ordering rule; links to new skill Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 74595ec commit b385a57

3 files changed

Lines changed: 371 additions & 5 deletions

File tree

.claude/skills/mendix/check-syntax.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,36 @@ widgets (
219219
220220
## Troubleshooting Parse Errors
221221
222+
### Error: "snippet not found" / "page not found"
223+
224+
A reference to a document that hasn't been created yet in the script:
225+
226+
```
227+
Error: snippet not found: MyModule.NavMenu
228+
Error: page not found: MyModule.Customer_NewEdit
229+
```
230+
231+
Script execution is sequential — each `CREATE` commits immediately. Forward references
232+
fail because the target doesn't exist in the database at the moment the referencing
233+
document is created.
234+
235+
**Fix options:**
236+
1. **Reorder** — move the target document's `CREATE` earlier in the script (simplest fix)
237+
2. **Placeholder pattern** — for circular dependencies (e.g. a snippet that shows pages
238+
that embed the snippet), create a minimal placeholder first, then create the referencing
239+
documents, then fill in the placeholder with `CREATE OR MODIFY` — which preserves the
240+
original UUID so all existing bindings remain valid
241+
(see [Resolve Forward References](./resolve-forward-references.md))
242+
243+
Declaration order that avoids most forward references:
244+
```
245+
enumerations → entities → snippets (placeholder) → pages → snippets (fill-in) → microflows → navigation
246+
```
247+
248+
> **Never use `CREATE OR REPLACE` for the placeholder fill-in step.** OR REPLACE deletes
249+
> the placeholder and creates a new document with a different UUID, silently breaking
250+
> every page or snippet that references it.
251+
222252
### Error: "mismatched input 'X'"
223253
224254
The word `X` is either:
@@ -244,4 +274,5 @@ Extra tokens found:
244274
245275
- [/write-microflows](./write-microflows.md) - Detailed microflow syntax
246276
- [/overview-pages](./overview-pages.md) - Page building syntax
277+
- [/resolve-forward-references](./resolve-forward-references.md) - Placeholder pattern and declaration ordering
247278
- [/migrate-oracle-forms](./migrate-oracle-forms.md) - Migration-specific guidance

.claude/skills/mendix/overview-pages.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,10 @@ create page Module.Customer_Overview
527527
}
528528
/
529529

530-
-- Step 3: Replace snippet with full navigation (pages now exist)
531-
create or replace snippet Module.NavigationMenu
530+
-- Step 3: Fill in the snippet with real content (pages now exist)
531+
-- Use CREATE OR MODIFY (preserves the snippet's ID → page bindings stay valid)
532+
-- Do NOT use CREATE OR REPLACE — that would assign a new ID and break existing page references
533+
create or modify snippet Module.NavigationMenu
532534
{
533535
layoutgrid navGrid {
534536
row row1 {
@@ -543,15 +545,19 @@ create or replace snippet Module.NavigationMenu
543545

544546
### Key Points
545547

546-
- The placeholder snippet must exist before pages are created (for SNIPPETCALL to resolve)
547-
- Use `create or replace snippet` to update the placeholder after pages exist
548-
- Page references in the final snippet will resolve correctly because pages already exist
548+
- The placeholder snippet must exist before pages are created (for `snippetcall` to resolve)
549+
- Use `create or modify snippet` for the fill-in step — it preserves the snippet's UUID so pages that already reference it remain valid
550+
- **Do not use `create or replace snippet`** — that deletes the placeholder and creates a fresh UUID, silently breaking every page that references the old one
551+
- Page references in the final snippet resolve correctly because pages already exist
552+
553+
See [Resolve Forward References](./resolve-forward-references.md) for the full pattern including page→page and microflow→page cases, declaration ordering rules, and the choice between `CREATE OR MODIFY` and `ALTER SNIPPET`.
549554

550555
## Related Skills
551556

552557
- [Create Page](./create-page.md) - Basic page creation syntax
553558
- [ALTER PAGE/SNIPPET](./alter-page.md) - Modify existing pages/snippets in-place (SET, INSERT, DROP, REPLACE)
554559
- [Master-Detail Pages](./master-detail-pages.md) - Selection binding pattern
560+
- [Resolve Forward References](./resolve-forward-references.md) - Placeholder pattern, declaration ordering
555561

556562
## Snippet Commands Reference
557563

0 commit comments

Comments
 (0)