--- name: filemaker-fmscript description: Create, edit, review, or troubleshoot FileMaker `.fmscript` files that follow the open fmscript grammar and can be validated or converted with ai2fm. Use for complete FileMaker scripts, script fragments, ai2fm text, `.fmscript` syntax questions, script refactoring, and conversion-readiness reviews. --- # FileMaker fmscript Create deterministic FileMaker script text without inventing FileMaker objects, business rules, script steps, or parameter syntax. The files in `examples/` are the authoritative catalog of permitted script steps and their fmscript format. ## Follow the applicable instructions 1. Read every applicable project `AGENTS.md` and any referenced script example. 2. Treat project rules as authoritative for naming, indentation, file location, output style, supported FileMaker version, and required verification. 3. Before generating or materially editing a script, read the relevant file or files in `examples/`. Use `rg` to find a step when its category is unclear. A script step is permitted only when its step name appears in this catalog. 4. Copy the matching example's step name, brackets, parameter labels, label order, punctuation, and spacing exactly. Replace only its placeholders with confirmed project values. Do not infer omitted parameters or invent another parameter form from FileMaker knowledge, the grammar, or a similar step. 5. Read [references/fmscript-0.90.md](references/fmscript-0.90.md) for language-level parsing and control-structure rules, but never use it to authorize a step or parameter form absent from `examples/`. 6. Read [references/examples.md](references/examples.md) to select the right category file. 7. Preserve established project conventions when they are compatible with the grammar. Report meaningful conflicts instead of silently choosing a format. ## Authoritative script-step catalog Read the applicable category file directly; do not merge or rewrite its copied examples. Its lines are the source of truth for both step availability and format. - [Accounts](examples/Accounts.fmscript) - [Artificial Intelligence](examples/Artificial%20Intelligence.fmscript) - [Control](examples/Control.fmscript) - [Editing](examples/Editing.fmscript) - [Fields](examples/Fields.fmscript) - [Files](examples/Files.fmscript) - [Found Sets](examples/Found%20Sets.fmscript) - [Miscellaneous](examples/Miscellaneous.fmscript) - [Navigation](examples/Navigation.fmscript) - [Open Menu Item](examples/Open%20Menu%20Item.fmscript) - [Records](examples/Records.fmscript) - [Spelling](examples/Spelling.fmscript) - [Windows](examples/Windows.fmscript) If no matching example exists, do not emit a substitute script step. Explain that the catalog has no approved format for it and request a copied example or permission to extend the catalog. Comments, blank lines, and calculation continuation indentation are not script steps; preserve the project's existing style for them. ## Establish the script semantics - Confirm the affected FileMaker tables, table occurrences, fields, layouts, scripts, value lists, custom functions, privileges, and relationships from project sources or a supplied FileMaker export. - Preserve existing behavior, error handling, and supported FileMaker version. - Separate confirmed behavior from proposed logic. - Ask a concise question when a required business rule or object is missing. - Never manufacture an uncertain script step, parameter form, field reference, function, object name, or relationship path. ## Generate or edit the script - For a script-generation request, return only the script text without Markdown fences or explanation unless the user requests otherwise. - Include concise section comments, blank lines, and readable multiline calculations unless the user requests a minimal script. - Use the catalog's English step name and exact parameter form, unless the project supplies an explicit approved localized equivalent. - Emit one logical script step per line. Keep multiline calculations and multiline comment steps intact. - For ai2fm output, keep script-step lines flush left, including steps inside control blocks. Indent only continuation lines inside a multiline parameter or calculation when it improves readability. - Use complete matching closing steps for control blocks. - Preserve inline comments inside calculation bodies. - Retain disabled steps unless the requested change explicitly removes them. - Preserve a different established project indentation convention when the project supplies a known-good ai2fm export that requires it. - Save complete scripts only when the user or project instructions authorize a file change, using the required project location and filename. ## Verify conversion readiness 1. Check the script against the grammar checklist in the reference. 2. Compare every emitted step and parameter form with its source line in the applicable `examples/` file. 3. Validate with ai2fm when that workflow is available. 4. If deterministic validation is unavailable, identify the unverified step or variant instead of claiming that the script will round-trip.