Agent skill

Build Afm

by scouzi1966 in scouzi1966/maclocal-api

Build AFM from scratch — submodules, patches, webui, and Swift build.

MITAuto-check: notesMobile

Install Build Afm

skills CLI
$ npx skills add scouzi1966/maclocal-api --skill build-afm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install scouzi1966/maclocal-api build-afm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/scouzi1966/maclocal-api.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/build-afm .claude/skills/build-afm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
build-afm
GitHub stars
346
Token cost
~1.8k tokens
SKILL.md length
757 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Build AFM from scratch — submodules, patches, webui, and Swift build.

  • Works in 5 steps: Validate Prerequisites → Build → Monitor → …
  • User types /build-afm
  • SKILL.md covers Usage and Instructions
  • Calls brew, swift and npm; reaches raw.githubusercontent.com

What it does

Build Afm is an agent skill from scouzi1966/maclocal-api. Build AFM from scratch — submodules, patches, webui, and Swift build. Use when user types /build-afm, asks to build afm, or needs a fresh build from a clean clone.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile, covering iOS development. It works with Xcode, macOS, Homebrew and Git. The repository describes itself as: 'afm' command cli: macOS server and single prompt mode that exposes Apple's Foundation and MLX Models and other APIs running on your Mac through a single aggregated…. The licence is MIT.

When your agent uses it

  • User types /build-afm
  • Asks to build afm
  • Needs a fresh build from a clean clone

Example prompts

  • “/build-afm”

Requirements

  • Node.js

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Validate Prerequisites
  2. Build
  3. Monitor
  4. Report Results
  5. Handle Failures

What it can do on your machine

Read from SKILL.md and the folder at commit 138ca5d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • brew
    • swift
    • npm
    • git
    • node
    • bash
    • curl
    • xcodebuild
    • nvm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • raw.githubusercontent.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Build Afm loads about 1.8k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 757 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePipes a well-known installer script into a shellSKILL.md:51
    ger — Git, Node.js depend on it | `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/in
  • NoteRuns commands with sudoSKILL.md:60
    per/CommandLineTools`, switch to Xcode: `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer`
  • NoteRuns commands with sudoSKILL.md:61
    r installing Xcode, accept the license: `sudo xcodebuild -license accept`
  • NotePipes a well-known installer script into a shellSKILL.md:65
    + npm** (via nvm instead of Homebrew): `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from scouzi1966/maclocal-api at commit 138ca5d, republished under its MIT licence (© scouzi1966). 757 words, ~1,824 tokens.

Download SKILL.mdSave it as .claude/skills/build-afm/SKILL.md (or your agent's skills folder).
name
build-afm
description
Build AFM from scratch — submodules, patches, webui, and Swift build. Use when user types /build-afm, asks to build afm, or needs a fresh build from a clean clone.
user_invocable
true

Build AFM

Build the afm binary from scratch, suitable for a fresh clone or a full rebuild.

Usage

  • /build-afm — release build (default)
  • /build-afm debug — debug build
  • /build-afm release — explicit release build

Instructions

Step 0: Validate Prerequisites

Before building, check that all required tools and environment are present. Run these checks and collect results:

bash
# 1. Apple Silicon check (MLX requires arm64)
uname -m   # must be "arm64"

# 2. macOS version (Package.swift requires macOS 26+)
sw_vers -productVersion   # must be 26.0 or higher

# 3. Homebrew (must come before brew-installed tools)
brew --version

# 4. Xcode (full install — mlx-swift uses Metal framework SDK, not available in standalone CLI Tools)
xcode-select -p           # must point to Xcode.app, NOT /Library/Developer/CommandLineTools
swift --version           # needs Swift 5.9+ (swift-tools-version: 5.9)

# 5. Git (for submodule operations — installed via brew or Xcode)
git --version

# 6. Node.js + npm (for llama.cpp webui build — Svelte/Vite frontend)
node --version            # Node 18+ recommended
npm --version

Present results as a checklist to the user in dependency order (install top-to-bottom). For each item, show pass/fail, reason, and install command (even on pass, for copy-paste on other machines):

#PrerequisiteCheckStatusReasonInstall
1Apple Siliconuname -m = arm64pass/failMLX framework requires ARM64 GPUN/A (hardware requirement)
2macOS 26+ (Tahoe)sw_vers >= 26.0pass/failFoundation Models backend + SDK APIsSystem Settings > Software Update
3Homebrewbrew --versionpass/failPackage manager — Git, Node.js depend on it/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4Xcode (full)xcode-select -p points to Xcode.apppass/failmlx-swift uses Metal SDK (not in standalone CLI Tools)Install from App Store → search "Xcode"
5Swift 5.9+swift --versionpass/failswift-tools-version: 5.9 in Package.swiftIncluded with Xcode
6Gitgit --versionpass/failSubmodule init (mlx-swift-lm, llama.cpp)brew install git
7Node.js 18+node --versionpass/failllama.cpp webui build (Svelte/Vite)brew install node
8npmnpm --versionpass/failnpm install + npm run build for webuiIncluded with Node.js

Important Xcode notes:

  • Standalone CLI Tools (xcode-select --install) are NOT sufficient — mlx-swift imports the Metal framework which requires the full Xcode SDK
  • If xcode-select -p returns /Library/Developer/CommandLineTools, switch to Xcode: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
  • After installing Xcode, accept the license: sudo xcodebuild -license accept

If anything is missing, present the failing items with install commands and ask the user to confirm when ready. Alternative Node.js install:

  • Node.js + npm (via nvm instead of Homebrew): curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash && nvm install 22

Do NOT proceed with the build until all prerequisites pass.

Step 1: Build

Parse the argument: if the user passes debug, use --debug. Otherwise default to release.

Run the full build script with NO skip flags:

bash
./Scripts/build-from-scratch.sh        # release (default)
./Scripts/build-from-scratch.sh --debug # debug

All direct SwiftPM builds must go through Scripts/swiftpm-reliable.sh rather than invoking swift build or swift test directly. Xcode 27 can corrupt its explicit-module scanner cache and report missing CAsyncHTTPClient, CSystem, CNIO*, or _NumericsShims modules. On Xcode 27 Beta 3 the wrapper selects the native driver immediately; on other versions it switches only after recognizing that failure. It preserves checkouts, patches, and normal .build artifact paths. If native incremental module state is also stale, it cleans products and retries native once. Logs live in .build-reliable-logs/; persistent driver identity lives in .build-reliable-state/ outside SwiftPM's cleanable tree. Set AFM_SWIFTPM_DRIVER=swiftbuild only for default-driver diagnosis.

The wrapper fingerprints vendor/mlx-swift-lm before every invocation. When a Swift or custom-Metal kernel patch changes that local package, it invalidates compiled products so Xcode 27 Beta 3 cannot silently reuse a stale binary. The manifest compiles this vendor directly when initialized; a submodule-free consumer falls back to the pinned pre-patched URL fork. Run Scripts/check-mlx-source-selection.sh after dependency changes.

For test, the wrapper permanently stages the canonical committed Sources/AFMKitMLX/Resources/default.metallib as mlx.metallib beside every XCTest executable before each build/run attempt. It also exports MACAFM_MLX_METALLIB for AFMKit's own locator. Do not add one-off metallib copies or paths to test commands; fix the wrapper if a new test layout ever needs support.

bash
Scripts/swiftpm-reliable.sh build -c release --product afm
Scripts/swiftpm-reliable.sh test -c release

IMPORTANT: Never add --skip-submodules, --skip-patches, or --skip-webui. The point of this skill is a complete from-scratch build.

Show full SKILL.md (204 more words)Show less
Step 2: Monitor

The script already handles:

  • git submodule update --init --recursive
  • Scripts/apply-mlx-patches.sh (apply + verify)
  • llama.cpp webui build (npm install + build)
  • Swift package resolve + clean + build
  • Version injection: writes the git commit SHA into BuildInfo.swift (then restores it after build)
  • Strip symbols for release builds
  • Metallib bundle verification
  • Info.plist embedding verification — fails the build if the __TEXT,__info_plist section is missing or doesn't contain NSSpeechRecognitionUsageDescription. Required by Sources/MacLocalAPI/Info.plist + Package.swift linker flags (-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __info_plist -Xlinker …). Without this, macOS 26 SIGABRTs any Speech Recognition / microphone / camera call.
Step 3: Report Results

After the build succeeds, report to the user:

  • The build configuration (debug or release)
  • The full absolute path to the compiled afm binary (from the script output)
  • The version string by running: <binary-path>/afm --version

Do NOT add example run commands, CLI options, or environment variables. Just report the binary path and version — the user knows how to run it.

Step 4: Handle Failures

If the build fails, show the error output and suggest checking:

  • Xcode Command Line Tools are installed (xcode-select -p)
  • Node.js/npm available for webui build
  • Submodules initialized properly
  • Re-run Step 0 prerequisite checks to catch environment issues
  • For Xcode module-scanner failures, confirm the build used Scripts/swiftpm-reliable.sh; logs are in .build-reliable-logs/

© scouzi1966, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/build-afm of scouzi1966/maclocal-api.

Open the folder on GitHubat commit 138ca5d

Compare with similar skills

Build Afm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Build Afm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Build Afm this skillscouzi1966/maclocal-api346—~1.8kAutomated safety check: NotesMIT
Releasevaayne/mori303—~1.2kAutomated safety check: PassMIT
Build Run Debugrobinebers/openusage4.3k—~1.8kAutomated safety check: PassMIT
macOS Build Run Debugrobinebers/openusage4.3k—~1.8kAutomated safety check: PassMIT
macOS Spm App PackagingDimillian/Skills4k5 repos~1.2kAutomated safety check: PassMIT
Orca iOS Simulator Controlstablyai/orca89k1 repos~584Automated safety check: PassApache-2.0

Similar skills

  • Release

    vaayne/mori

    Release workflow for Mori macOS workspace terminal and MoriRemote iOS app.

    303 GitHub stars~1.2k tokensUpdated 2 mo ago
    MobileAuto-check passed
  • Build Run Debug

    robinebers/openusage

    Build, run, and debug local macOS apps and desktop executables using shell-first Xcode and Swift workflows.

    4.3k GitHub stars~1.8k tokensUpdated yesterday
    MobileAuto-check passed
  • macOS Build Run Debug

    robinebers/openusage

    Build, run, and debug macOS apps with shell-first Xcode and Swift workflows.

    4.3k GitHub stars~1.8k tokensUpdated yesterday
    MobileAuto-check passed
  • macOS Spm App Packaging

    Dimillian/Skills

    Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project.

    4k GitHub starsUsed in 5 repos~1.2k tokens
    MobileAuto-check passed
  • iOS Simulator control from inside Orca, with the live device view in Orca's emulator pane. Use when driving a booted Apple Simulator on macOS: taps, gestures…

    89k GitHub starsUsed in 1 repo~584 tokens
    MobileAuto-check passed
  • Official

    Resolves .NET runtime frames in Apple .ips crash logs to function names, source files and line numbers using dSYM symbols, atos and the Microsoft symbol server.

    5.6k GitHub starsUsed in 1 repo~2.4k tokens
    MobileAuto-check passed

More from scouzi1966/maclocal-api

All 12 skills in this repo
  • Afm

    scouzi1966/maclocal-api

    Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR.

    346 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Codex Promptfoo Agentic Eval

    scouzi1966/maclocal-api

    Run and review the Promptfoo-based AFM agentic evaluation suite.

    346 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Test Afm Binary

    scouzi1966/maclocal-api

    Test a pre-built afm binary at any path — runs pre-flight safety checks, then any combination of unit tests, assertions, smart analysis, promptfoo evals, batch validation, OpenAI compat, GPU…

    346 GitHub stars~3.8k tokensUpdated yesterday
    Auto-check passed
  • Afm Release Wheel

    scouzi1966/maclocal-api

    A skill your agent uses when user wants to build a PyPI wheel from an existing compiled afm binary and publish to PyPI.

    346 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check: warnings
  • Test Macafm

    scouzi1966/maclocal-api

    Run the maclocal-api (AFM/MLX) test suite — automated assertions and smart analysis.

    346 GitHub stars~7k tokensUpdated yesterday
    Auto-check passed
  • Test Opencode Tooling

    scouzi1966/maclocal-api

    A skill your agent uses when testing tool call reliability between OpenCode and afm — captures streaming XML tool call errors, classifies them as afm translation bugs vs model generation errors, and…

    346 GitHub stars~4.2k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Build Afm

What does Build Afm do?

Build AFM from scratch — submodules, patches, webui, and Swift build. Build Afm is an agent skill from scouzi1966/maclocal-api. Build AFM from scratch — submodules, patches, webui, and Swift build.

When should I use Build Afm?

Build Afm fits situations like: user types /build-afm; asks to build afm; needs a fresh build from a clean clone.

How do I install Build Afm in Claude Code?

Run `npx skills add scouzi1966/maclocal-api --skill build-afm -a claude-code`. Or copy the skill folder (.claude/skills/build-afm in scouzi1966/maclocal-api) into .claude/skills/build-afm in your project. Claude Code loads it when a task matches its description.

How do I install Build Afm in Codex?

Run `npx skills add scouzi1966/maclocal-api --skill build-afm -a codex`. Or copy the skill folder (.claude/skills/build-afm in scouzi1966/maclocal-api) into .agents/skills/build-afm in your project. Codex loads it when a task matches its description.

Can I use Build Afm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add scouzi1966/maclocal-api --skill build-afm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/build-afm, .gemini/skills/build-afm, .github/skills/build-afm and .opencode/skills/build-afm in your project.

What does Build Afm need to run?

Going by SKILL.md and its folder, Build Afm needs the command-line tools its instructions call (brew, swift, npm, git, node and bash). Our summary lists: Node.js.

Does Build Afm access the network?

SKILL.md names 1 domain. In commands or code: raw.githubusercontent.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Build Afm safe to install?

Our automated static check of SKILL.md found notes only (pipes a well-known installer script into a shell; runs commands with sudo), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Build Afm use?

Build Afm is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Build Afm use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Build Afm?

Skills that share tags, products or a category with Build Afm: Release (vaayne/mori, 303 stars), Build Run Debug (robinebers/openusage, 4.3k stars), macOS Build Run Debug (robinebers/openusage, 4.3k stars) and macOS Spm App Packaging (Dimillian/Skills, 4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Build Afm?

scouzi1966 (a GitHub user) maintains it in scouzi1966/maclocal-api, which has 346 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 10, 2026.

Source: scouzi1966/maclocal-api on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.