Swift portable json application

From jordanhubbard/literate-ai · View interactive version

Swift portable json application is an AI agent skill from the GitHub repository jordanhubbard/literate-ai. Swift portable JSON application. Use for Literate AI workflow tasks.

How to use this skill

Skill file

Swift portable JSON application

Implement the selected Swift Flavor as direct, auditable source rooted at

source/main.swift and compilable by one swiftc invocation. Put generated runtime

tests at source/tests/litai_test.swift and dispatch the Standard --litai-test and

--litai-smoke modes before normal argument parsing. Use only the Swift standard

library. Read one complete UTF-8 JSON arguments array from CommandLine.arguments[1],

validate all specified shapes and invariants, perform the general computation, and

write exactly one deterministic JSON value plus a newline to standard output. Implement

the required JSON parser and escaping locally with correct Unicode escape-pair,

integer-bound, nesting, and trailing-input handling. Write concise failures only to

standard error and exit nonzero.

Keep every API available without importing Foundation. In particular, decode UTF-8 byte

collections with String(decoding: bytes, as: UTF8.self) when replacement is acceptable,

or String(validating: bytes, as: UTF8.self) when invalid UTF-8 must be rejected. Do not

emit Foundation-only String(bytes:encoding:) calls. When assembling generated-test JSON,

concatenate the outcomes.joined(separator: ",") value between literal prefix and suffix

strings; do not escape the separator literal inside string interpolation.

The native builder compiles every .swift file beneath source/ together into one

executable. Put the only top-level executable statements in source/main.swift;

support and test files contain declarations only. Do not use @main with this

main.swift entrypoint, or generate an independent Swift cleanup/tool executable

inside this tree. Before returning the tree, compile the complete, recursively

collected Swift source set in one invocation of the selected swiftc, with -O

and without -parse-as-library, then run the resulting executable's generated

test and smoke modes. Checking only the main and test files misses helper conflicts.

Treat toolchain installation as selected realization policy, not source-generation

policy. For missing prerequisites, defer to <https://www.swift.org/install/macos/>,

<https://www.swift.org/install/linux/>, or

<https://www.swift.org/install/windows/> according to the locked OS/toolchain pair.

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.