Skip to content

Commit f2bf861

Browse files
committed
Initial commit
0 parents  commit f2bf861

16 files changed

Lines changed: 2196 additions & 0 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "apple-platform-build-tools",
3+
"owner": {
4+
"name": "Kyle Hughes",
5+
"email": "kyle@kylehugh.es"
6+
},
7+
"metadata": {
8+
"description": "Build, test, and archive Swift packages and Xcode projects for Apple platforms.",
9+
"version": "0.1.0"
10+
},
11+
"plugins": [
12+
{
13+
"name": "apple-platform-build-tools",
14+
"description": "Reference documentation for xcodebuild and swift build, plus an autonomous build agent that absorbs verbose logs and preserves your context window.",
15+
"source": "./",
16+
"strict": false,
17+
"skills": ["./skills/building-apple-platform-products"],
18+
"agents": ["./agents/apple-platform-builder.md"]
19+
}
20+
]
21+
}

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: softprops/action-gh-release@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.claude/settings.local.json

CLAUDE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## What This Repository Contains
6+
7+
This repository contains an **Agent Skill** and **Subagent** for Claude Code called `building-apple-platform-products`.
8+
9+
- **Skill**: Teaches Claude the xcodebuild and swift build command patterns (reference documentation)
10+
- **Agent**: Executes build commands autonomously, discovering schemes and destinations as needed
11+
12+
## Repository Structure
13+
14+
```
15+
skills/
16+
└── building-apple-platform-products/
17+
├── SKILL.md # Entry point with YAML frontmatter
18+
└── references/ # Detailed documentation loaded on-demand
19+
20+
agents/
21+
└── apple-platform-builder.md # Autonomous build executor
22+
```
23+
24+
**Skill components**:
25+
- **SKILL.md**: Quick reference tables and links to reference files
26+
- **references/**: Progressive disclosure—Claude loads these only when needed
27+
28+
**Agent**: Discovers project structure, constructs correct commands, executes autonomously
29+
30+
## Key Design Principles
31+
32+
1. **Reference manual style**: Use tables and clear categories, not decision trees
33+
2. **Standalone Swift packages only**: `swift build`/`swift test` do NOT work for Swift Package Manager submodules in Xcode projects—must use `xcodebuild` with the appropriate scheme
34+
3. **Simulator name volatility**: Device names change with Xcode releases; always document `xcrun simctl list devices available`
35+
4. **No code signing complexity**: Scope is Build, Test & Archive; distribution/signing is out of scope
36+
37+
## File Organization
38+
39+
Every reference file follows this structure:
40+
41+
1. **Title** — H1 with one-line purpose
42+
2. **Important note**`**Important**:` callout for critical constraints
43+
3. **Core content** — Topic-specific sections
44+
4. **Quick Reference** — Table with Goal | Command columns
45+
5. **Complete Example** — Minimal example + Full CI example
46+
6. **Troubleshooting** — Cause/Solution format for topic-specific errors
47+
48+
Conventions:
49+
- Emphasis markers use `**Keyword**:` format (e.g., `**Important**:`, `**Cause**:`)
50+
- Tables use Goal | Command format (what you want → how to get it)
51+
- Code blocks have no trailing blank lines
52+
- `troubleshooting.md` is an index pointing to other files' Troubleshooting sections
53+
54+
## Installation
55+
56+
```bash
57+
# Install skill (reference documentation)
58+
cp -r skills/building-apple-platform-products ~/.claude/skills/
59+
60+
# Install agent (autonomous executor)
61+
cp agents/apple-platform-builder.md ~/.claude/agents/
62+
```

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2025 Kyle Hughes
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Apple Platform Build Tools Claude Code Plugin
2+
3+
[![Agent Skill](https://img.shields.io/badge/Claude_Code_Plugin-555?logo=claude)](https://code.claude.com/docs/en/plugins)
4+
[![Latest Release](https://img.shields.io/github/v/release/kylehughes/apple-platform-build-tools-claude-code-plugin)](https://github.com/kylehughes/apple-platform-build-tools-claude-code-plugin/releases)
5+
6+
*Build, test, and archive Swift packages and Xcode projects for Apple platforms with Claude Code.*
7+
8+
## About
9+
10+
Apple Platform Build Tools Claude Plugin is a Claude Code plugin containing an Agent Skill and a Subagent for building Apple platform products.
11+
12+
- **Agent Skill**: Reference documentation for `xcodebuild` and `swift build` command patterns.
13+
- **Subagent**: Autonomous executor that discovers schemes, runs builds, and returns concise results. Uses the Agent Skill.
14+
15+
## Usage
16+
17+
The Subagent is useful for delegating build and test commands from your main programming agent. It can report the results of these commands without exposing the build logs. This keeps the main agent on track and prevents its context window from being polluted.
18+
19+
The Agent Skill is useful for understanding `xcodebuild` and `swift` options, debugging build failures, or constructing complex commands manually or by an agent when more control is needed than the Subagent provides.
20+
21+
### Automatic
22+
23+
The Agent Skill and Subagent are both exposed to Claude Code, along with descriptions about when to use them. Theoretically, Claude should know to read the Agent Skill when composing a complex `xcodebuild` command, or to invoke the Subagent when a build needs to be run. This is nondeterministic in practice and may change with Claude models and Claude Code versions.
24+
25+
### Manual
26+
27+
To explicitly invoke the Agent Skill or Subagent, use natural language in Claude Code.
28+
29+
e.g.
30+
31+
> use the builder agent to build the app
32+
33+
> check with the builder agent that the tests pass
34+
35+
> use the build skill to help me write an xcodebuild command for CI
36+
37+
## What's Included
38+
39+
### Agent Skill: `building-apple-platform-products`
40+
41+
Quick-reference tables and detailed documentation for:
42+
43+
- Project discovery (schemes, targets, configurations)
44+
- Swift Package Manager commands
45+
- `xcodebuild` commands (build, test, archive)
46+
- Destination specifiers for all Apple platforms
47+
- Test filtering, parallel execution, coverage
48+
- CI configuration and code signing
49+
- Troubleshooting common errors
50+
51+
### Subagent: `apple-platform-builder`
52+
53+
Autonomous build executor that:
54+
55+
- Discovers project structure automatically
56+
- Constructs correct commands for the project type
57+
- Handles errors using troubleshooting guidance
58+
- Returns success/failure with only relevant details
59+
- Uses the `building-apple-platform-products` skill
60+
61+
## Installation
62+
63+
### Claude Code
64+
65+
#### Personal Usage
66+
67+
To install this plugin for your personal use in Claude Code:
68+
69+
1. Add the marketplace:
70+
```bash
71+
/plugin marketplace add kylehughes/apple-platform-build-tools-claude-code-plugin
72+
```
73+
74+
2. Install the plugin:
75+
```bash
76+
/plugin install apple-platform-build-tools@apple-platform-build-tools-claude-code-plugin
77+
```
78+
79+
#### Project Configuration
80+
81+
To automatically provide this plugin to everyone working in a repository, configure the repository's `.claude/settings.json`:
82+
83+
```json
84+
{
85+
"enabledPlugins": {
86+
"apple-platform-build-tools@apple-platform-build-tools-claude-code-plugin": true
87+
},
88+
"extraKnownMarketplaces": {
89+
"apple-platform-build-tools-claude-code-plugin": {
90+
"source": {
91+
"source": "github",
92+
"repo": "kylehughes/apple-platform-build-tools-claude-code-plugin"
93+
}
94+
}
95+
}
96+
}
97+
```
98+
99+
When team members open the project, Claude Code will prompt them to install the plugin.
100+
101+
### Manual Installation
102+
103+
The raw Agent Skill and Subagent content is available in this repository's `skills/` and `agents/` directories.
104+
105+
## Contributions
106+
107+
Apple Platform Build Tools Claude Code Plugin is not accepting source contributions at this time. Bug reports will be considered.
108+
109+
## Author
110+
111+
[Kyle Hughes](https://kylehugh.es)
112+
113+
[![Bluesky][bluesky_image]][bluesky_url]
114+
[![LinkedIn][linkedin_image]][linkedin_url]
115+
[![Mastodon][mastodon_image]][mastodon_url]
116+
117+
[bluesky_image]: https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff
118+
[bluesky_url]: https://bsky.app/profile/kylehugh.es
119+
[linkedin_image]: https://img.shields.io/badge/LinkedIn-0A66C2?logo=linkedin&logoColor=fff
120+
[linkedin_url]: https://www.linkedin.com/in/kyle-hughes
121+
[mastodon_image]: https://img.shields.io/mastodon/follow/109356914477272810?domain=https%3A%2F%2Fmister.computer&style=social
122+
[mastodon_url]: https://mister.computer/@kyle
123+
124+
## License
125+
126+
Apple Platform Build Tools Claude Code Plugin is available under the **MIT License**. See `LICENSE` for details.

agents/apple-platform-builder.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: apple-platform-builder
3+
description: "STRONGLY PREFER to delegate Apple platform builds and tests to this agent to preserve your context window. This agent absorbs verbose build logs and returns only success/failure with the relevant error if any. Use for: verifying code compiles, running tests, checking builds aren't broken. Discovers schemes and simulators automatically."
4+
color: red
5+
tools: Bash, Read, Glob, Grep
6+
model: sonnet
7+
skills: building-apple-platform-products
8+
---
9+
10+
You execute Apple platform build commands autonomously, shielding the caller from verbose build output.
11+
12+
**Why you exist**: A single xcodebuild invocation produces thousands of lines of output. Running builds directly in the main conversation pollutes the context window with noise. You absorb that noise and return only the signal.
13+
14+
## Workflow
15+
16+
### Step 1: Classify the Request
17+
18+
**Specific request** (user provides scheme, destination, or command):
19+
→ Validate the inputs exist, then execute.
20+
21+
**Ambiguous request** (user says "build this", "run tests", etc.):
22+
→ Run discovery first.
23+
24+
### Step 2: Discover (if needed)
25+
26+
Run in sequence, stopping when you have enough information:
27+
28+
1. Find project files: `ls Package.swift *.xcworkspace *.xcodeproj 2>/dev/null`
29+
2. Determine tool:
30+
- Standalone `Package.swift` (no .xcodeproj) → `swift build`
31+
- `.xcodeproj``xcodebuild` (handles SPM dependencies automatically)
32+
- `.xcworkspace``xcodebuild -workspace` (only for CocoaPods/multi-project)
33+
3. List schemes: `xcodebuild -list` or `swift package describe` (local package targets appear as individual schemes)
34+
4. Get simulators (if needed): `xcrun simctl list devices available`
35+
36+
### Step 3: Execute
37+
38+
Construct the command using patterns from the skill. Run it.
39+
40+
### Step 4: Handle Errors
41+
42+
If a command fails, consult the skill's troubleshooting guidance and retry with the suggested fix.
43+
44+
## Output Format
45+
46+
Return a concise summary for the caller:
47+
48+
1. **What you did**: The command executed (e.g., "Built MyApp scheme for iOS Simulator")
49+
2. **Result**: Success or failure
50+
3. **If failed**: The key error message and what fix was attempted
51+
52+
Keep output brief. The caller doesn't need full build logs—just whether it worked and why if it didn't.

release.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Release script for Apple Platform Build Tools Claude Code Plugin
5+
#
6+
# Usage: ./scripts/release.sh <version>
7+
# Example: ./scripts/release.sh 1.0.1
8+
9+
if [ $# -ne 1 ]; then
10+
echo "Usage: $0 <version>"
11+
echo "Example: $0 1.0.1"
12+
exit 1
13+
fi
14+
15+
VERSION="$1"
16+
MARKETPLACE_JSON=".claude-plugin/marketplace.json"
17+
18+
# Validate version format (basic semver)
19+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
20+
echo "Error: Version must be in format X.Y.Z (e.g., 1.0.1)"
21+
exit 1
22+
fi
23+
24+
# Check for uncommitted changes
25+
if ! git diff --quiet || ! git diff --cached --quiet; then
26+
echo "Error: You have uncommitted changes. Please commit or stash them first."
27+
exit 1
28+
fi
29+
30+
# Check we're on main branch
31+
BRANCH=$(git branch --show-current)
32+
if [ "$BRANCH" != "main" ]; then
33+
echo "Warning: You're on branch '$BRANCH', not 'main'. Continue? (y/N)"
34+
read -r response
35+
if [[ ! "$response" =~ ^[Yy]$ ]]; then
36+
exit 1
37+
fi
38+
fi
39+
40+
# Update version in marketplace.json
41+
echo "Updating version to $VERSION in $MARKETPLACE_JSON..."
42+
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" "$MARKETPLACE_JSON"
43+
44+
# Commit
45+
echo "Committing..."
46+
git add "$MARKETPLACE_JSON"
47+
git commit -m "Release $VERSION"
48+
49+
# Tag
50+
echo "Creating tag $VERSION..."
51+
git tag "$VERSION"
52+
53+
# Push
54+
echo "Pushing to origin..."
55+
git push
56+
git push --tags
57+
58+
echo ""
59+
echo "Released $VERSION"
60+
echo "GitHub Action will create the release at:"
61+
echo "https://github.com/kylehughes/apple-platform-build-tools-claude-code-plugin/releases/tag/$VERSION"

0 commit comments

Comments
 (0)