4d-check-syntax
1
总安装量
1
周安装量
#47691
全站排名
安装命令
npx skills add https://github.com/e-marchand/skills --skill 4d-check-syntax
Agent 安装分布
amp
1
opencode
1
kimi-cli
1
codex
1
claude-code
1
Skill 文档
4D Syntax Checker
Compile a 4D project to check for syntax errors and type mismatches.
Prerequisites
Uses the 4d-run skill to execute the compilation method. Ensure tool4d is available.
The _compile Method
Compilation requires a _compile method in the project. If not present, copy assets/_compile.4dm to Project/Sources/Methods/_compile.4dm.
Compilation Output
Success
{"success":true,"errors":[]}
Errors
{
"success": false,
"errors": [
{
"message": "Syntax error",
"isError": true,
"code": {
"type": "classFunction",
"className": "MyClass",
"functionName": "myMethod",
"path": "[class]/MyClass/myMethod",
"file": "[object File]"
},
"line": 10,
"lineInFile": 42
}
]
}
Error Properties
message: Error descriptionisError: true for errors, false for warningscode.type: “projectMethod”, “classFunction”, etc.code.className: Class name (for class methods)code.functionName: Function nameline: Line within the functionlineInFile: Absolute line in the file
Workflow
- Check for _compile method: Look in
Project/Sources/Methods/_compile.4dm - Create if missing: Write the _compile method using the template above
- Find tool4d: Use 4d-run skill to locate tool4d
- Run compilation: Execute
_compilemethod with--dataless - Parse results: Extract JSON from ALERT output
Running Compilation
"<tool4d_path>" --project="<project_path>" --startup-method=_compile --dataless 2>&1
Output format:
{"success":true,"errors":[]}
The JSON is output directly to system standard output via LOG EVENT.
Common Compilation Errors
| Error | Cause | Fix |
|---|---|---|
| “Syntax error” | Invalid 4D syntax | Check line for typos |
| “Object syntax is not valid” | Invalid object property access | Use [index] for 4D.Blob properties |
| “Cannot make an assignment with those types” | Type mismatch | Check variable types |
| “Undeclared property ‘X’ used” | Missing property declaration | Add property X : Type to class |
| “The variable $X has not been explicitly declared” | Missing var declaration | Add var $X : Type |
| “signed integer overflow handling differs” | PCH cache issue | Not a code error, can ignore |
Integration Example
# Find tool4d
TOOL4D=$(".claude/skills/4d-run/scripts/find_tool4d.sh")
# Run compilation and parse JSON result
OUTPUT=$("$TOOL4D" --project="/path/to/Project/MyProject.4DProject" --startup-method=_compile --dataless 2>&1)
# The JSON is output directly via LOG EVENT
echo "$OUTPUT" | jq .