format-code
Format and lint JavaScript, Python, and HubL code for automation platforms (Zapier, n8n, Pipedream, Make, HubSpot). Wraps code in each platform's runtime shell so standard formatters don't break on top-level await, bare return, or injected globals.
Skill body
format-code
Use this skill when a user wants formatted or lint-checked code for a code-step inside an automation platform: Zapier “Code by Zapier”, n8n Code node, Pipedream actions/sources, Make Custom JS/Python, HubSpot Data Hub, or HubSpot CMS (HubL templates).
When to use
- The user pastes code from an automation-platform code step and asks for formatting, cleanup, or lint diagnostics.
- Standard formatters (prettier, black) fail because the code uses
top-level
await, barereturn, or platform-injected globals (inputData,$input,steps,event,input_data, …). - The user wants HubL template formatting (
{% %},{{ }},{# #}).
How to invoke
Option A — JSON API
curl -sS https://codefmt.dev/api/format \
-H 'content-type: application/json' \
--data @- <<'JSON'
{
"code": "const name=inputData.name\nreturn {greeting:\"hi \"+name}",
"platform": "zapier",
"formatOptions": {
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf",
"semicolons": true,
"quoteStyle": "single",
"trailingCommas": "all",
"bracketSpacing": true,
"arrowParens": "always",
"singleAttributePerLine": false,
"objectWrap": "preserve",
"quoteProperties": "as-needed",
"jsxQuoteStyle": "double",
"bracketSameLine": false,
"organizeImports": false
},
"lintOptions": {
"enabled": true,
"severity": "default",
"typescriptPlugin": false,
"reactPlugin": false,
"unicornPlugin": false,
"promisePlugin": true,
"nodePlugin": true,
"securityPlugin": true,
"perfCategory": false,
"noConsole": false
}
}
JSON
All four of code, platform, formatOptions and lintOptions are required
and have no server-side defaults, so dropping either option block is a 400 and
not a fallback. Swap platform for any id in the Inputs list. For python, add
pythonFormatOptions + pythonLintOptions and set
platformVariants.language to python; for hubl, add hublFormatOptions.
Complete bodies for all three: https://codefmt.dev/llms-full.txt
Full request/response schema: https://codefmt.dev/api/openapi.json
Parameter reference: https://codefmt.dev/llms.txt
Option B — MCP tool
Connect to https://codefmt.dev/api/mcp (Streamable HTTP, protocols
2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26) and call the format_code tool with
{ code, platform, language? }. Server card:
https://codefmt.dev/.well-known/mcp/server-card.json.
Claude Code (run once in a terminal):
claude mcp add --transport http codefmt https://codefmt.dev/api/mcp
Claude Desktop and claude.ai (Settings > Connectors > Add custom connector, with this URL; calls come from Anthropic’s servers, so the per-ip rate limit is shared with other connector users):
https://codefmt.dev/api/mcp
Cursor (add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project)):
{
"mcpServers": {
"codefmt": {
"url": "https://codefmt.dev/api/mcp"
}
}
}
VS Code (add to .vscode/mcp.json):
{
"servers": {
"codefmt": {
"type": "http",
"url": "https://codefmt.dev/api/mcp"
}
}
}
Option C — WebMCP (in-browser)
When codefmt.dev is open in a browser with WebMCP enabled
(document.modelContext, Chrome 150 or later), the page registers the MCP
server’s three tools (format_code, format_json and ask_codefmt),
so an agent driving that page can call them without an MCP connection. WebMCP
is not on by default in Chrome: it comes through Chrome’s WebMCP origin trial,
which codefmt.dev has joined, or through the
chrome://flags/#enable-webmcp-testing flag for local testing.
Inputs
code(required) — the source to format.platform(required) — one ofzapier,n8n,pipedream,make,hubspot,hubl.language(optional, defaultjavascript) —javascriptorpython. Every platform except hubl supports python. On Option A send it asplatformVariants.languageor as a top-levellanguage;platformVariantswins when both are sent, and it is all-or-nothing: send every field of it, or omit the object and take the platform defaults. On Options B and C it is the top-levellanguageargument. Every option readsjs,ts,typescriptandpythe same way; an unrecognised value is an error on B and C, and on A it is ignored with awarningsentry.
Output
Option A (POST /api/format) returns the formatted source under code:
{
"code": "<formatted source>",
"diagnostics": [
{ "line": 3, "column": 12, "severity": "warning", "message": "...", "rule": "..." }
],
"duration": 12
}
code, diagnostics and duration are always present. Most paths also
return diagnosticsFrame ("input" or "output"), saying whether diagnostic
positions point at the source you sent or at the formatted output, and error
(a string) appears only on a partial failure. There is no formatted_code
field on this endpoint.
Options B and C (the MCP / WebMCP format_code tool) return the agent-tool
shape instead: the formatted source is formatted_code, and error is always
present as a string or null.
{
"formatted_code": "<formatted source>",
"diagnostics": [
{ "line": 3, "column": 12, "severity": "warning", "message": "...", "rule": "..." }
],
"diagnostics_frame": "output",
"error": null
}
Limits
code≤ 50KB.- 60 requests per minute per IP.
Work with this as data
Every skill here is available over the APIs.io API and to AI agents over MCP.