Script review

From petrowsky/agentic-fm · View interactive version

Script review is an AI agent skill from the GitHub repository petrowsky/agentic-fm. Code review a FileMaker script and its full call tree — all subscripts reached via Perform Script are loaded and analysed together. Evaluates error handling, structure, naming, performance, parameter contracts, and cross-script issues. Use when the developer says "review", "code review", "evaluate",

How to use this skill

Skill file

Script Review

Perform a thorough code review of a FileMaker script and every script it calls. The review covers the full call tree — not just the entry-point script in isolation.

CRITICAL: Debugging breakpoints within FileMaker scripts are not a runtime issue. Breakpoints are only active when a developer explicitly invokes the FileMaker debugger. Do not flag them.


Step 1: Locate the target script

Use the script-lookup skill to find the script if not already identified. Read the human-readable version from agent/xml_parsed/scripts_sanitized/.


Step 2: Resolve the call tree (parallel loading)

Before analysing any logic, build the full picture of every script involved. The goal is to minimize tool calls by loading subscripts in parallel batches — one batch per depth level.

Performance target: For a script with N subscripts at depth 1, the call tree should load in 2 tool calls (1 grep + 1 parallel read), not N+1 sequential calls.

2a. Extract ALL Perform Script references in one pass

Grep the entry script's sanitized text for every Perform Script line at once. Extract all target script names from the results.

grep -i "Perform Script" "agent/xml_parsed/scripts_sanitized/{solution}/{path}.txt"

This returns lines like:

2b. Batch-resolve names to file paths

Take ALL extracted script names and resolve them to file paths in a single grep against the scripts index:

grep -E "Subscript A|Subscript B|Subscript C" "agent/context/{solution}/scripts.index"

This returns pipe-delimited rows (ScriptName|ScriptID|FolderPath) for every match. From each row, derive the sanitized file path:

Since folder directory names include an ID suffix not in the index, use a glob to resolve the exact path if needed.

2c. Parallel-read ALL subscripts

Read ALL resolved subscript files in a single message with multiple Read tool calls — one per subscript. This replaces the old sequential "find one, read one, find next, read next" pattern.

For example, if the entry script calls 5 subscripts, issue 5 Read tool calls in a single message. All 5 load in parallel.

2d. Recurse (parallel per depth level)

After loading depth-1 subscripts, scan ALL of them for further Perform Script references. Collect any new (not yet visited) script names across all depth-1 subscripts, then repeat 2b–2c for the next depth level.

Track visited scripts by name to avoid cycles. Continue until no new references are found.

Each depth level adds at most 2 tool calls (1 batch grep + 1 parallel read), regardless of how many subscripts exist at that level.

2e. Present the call tree

Before starting the review, present the resolved call tree so the developer can see the full scope:

## Call tree: [Entry Script Name]

1. Entry Script Name
   ├── Subscript A
   │   └── Subscript A1
   ├── Subscript B
   └── Subscript C
       └── Subscript A  (already loaded)

Flag these edge cases:


Step 3: Analyse — entry script

Review the entry-point script against these categories:

Error handling

Structure

Naming and conventions

Performance

Parameter contract


Step 4: Analyse — subscripts and cross-script issues

Review each subscript using the same categories as Step 3. Additionally, look for issues that only emerge when scripts are considered together:

Parameter contract alignment

Layout context assumptions

Error propagation

Variable scope leakage

Transaction boundaries


Step 5: Present findings

Organise the review as a single report covering the full call tree. Group by severity:

## Code Review: [Entry Script Name]

### Call tree
(from Step 2d)

### Critical
Issues that will cause failures or data corruption:
- [Script Name, line N] — Set Field after Perform Find with no error 401 check
- [Subscript A, line N] — Commits inside caller's transaction

### Important
Issues that affect reliability or maintainability:
- [Script Name, line N] — Error data captured in separate steps (use single-expression pattern)
- [Script Name → Subscript B] — Caller doesn't check Get(ScriptResult)

### Suggestions
Improvements that are not urgent:
- [Script Name, line N] — Magic number "30" should be a variable ($dayThreshold)
- [Subscript A] — Missing $README documentation block

### Positive
Things the script does well (acknowledge good patterns):
- Clean parameter validation with early exit
- Consistent variable naming

Line number references must always refer to the human-readable (scripts_sanitized) version, never the XML.


Two script formats — know the difference

There are two distinct XML formats in this project. They are not interchangeable:

| Format | Location | Usable as output? |

|---|---|---|

| FileMaker "Save As XML" export | agent/xml_parsed/scripts/ | No — read-only reference only |

| FileMaker clipboard / fmxmlsnippet | agent/scripts/ or agent/sandbox/ | Yes — this is the output format |

When applying review findings as code changes, follow the refactoring workflow:

  1. Find or create the fmxmlsnippet version — check agent/sandbox/ first. If none exists, convert via python3 agent/scripts/fm_xml_to_snippet.py.
  2. Apply only the targeted changes — unchanged steps remain verbatim.
  3. Validate: python3 agent/scripts/validate_snippet.py agent/sandbox/{script_name}
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.