{"id":"b15d329c-a894-45c6-a756-17579582a980","shortId":"76KMyN","kind":"skill","title":"xcode-compilation-analyzer","tagline":"Analyze Swift and mixed-language compile hotspots using build timing summaries and Swift frontend diagnostics, then produce a recommend-first source-level optimization plan. Use when a developer reports slow compilation, type-checking warnings, expensive clean-build compile phase","description":"# Xcode Compilation Analyzer\n\nUse this skill when compile time, not just general project configuration, looks like the bottleneck.\n\n## Core Rules\n\n- Start from evidence, ideally a recent `.build-benchmark/` artifact or raw timing-summary output.\n- Prefer analysis-only compiler flags over persistent project edits during investigation.\n- Rank findings by expected **wall-clock** impact, not cumulative compile-time impact. When compile tasks are heavily parallelized (sum of compile categories >> wall-clock median), note that fixing individual hotspots may improve parallel efficiency without reducing build wait time.\n- When the evidence points to parallelized work rather than serial bottlenecks, label recommendations as \"Reduces compiler workload (parallel)\" rather than \"Reduces build time.\"\n- Do not edit source or build settings without explicit developer approval.\n\n## What To Inspect\n\n- `Build Timing Summary` output from clean and incremental builds\n- long-running `CompileSwiftSources` or per-file compilation tasks\n- `SwiftEmitModule` time -- can reach 60s+ after a single-line change in large modules; if it dominates incremental builds, the module is likely too large or macro-heavy\n- `Planning Swift module` time -- if this category is disproportionately large in incremental builds (up to 30s per module), it signals unexpected input invalidation or macro-related rebuild cascading\n- ad hoc runs with:\n  - `-Xfrontend -warn-long-expression-type-checking=<ms>`\n  - `-Xfrontend -warn-long-function-bodies=<ms>`\n- deeper diagnostic flags for thorough investigation:\n  - `-Xfrontend -debug-time-compilation` -- per-file compile times to rank the slowest files\n  - `-Xfrontend -debug-time-function-bodies` -- per-function compile times (unfiltered, complements the threshold-based warning flags)\n  - `-Xswiftc -driver-time-compilation` -- driver-level timing to isolate driver overhead\n  - `-Xfrontend -stats-output-dir <path>` -- detailed compiler statistics (JSON) per compilation unit for root-cause analysis\n- mixed Swift and Objective-C surfaces that increase bridging work\n\n## Analysis Workflow\n\n1. Identify whether the main issue is broad compilation volume or a few extreme hotspots.\n2. Parse timing-summary categories and rank the biggest compile contributors.\n3. Run the diagnostics script to surface type-checking hotspots:\n   ```bash\n   python3 scripts/diagnose_compilation.py \\\n     --project App.xcodeproj \\\n     --scheme MyApp \\\n     --configuration Debug \\\n     --destination \"platform=iOS Simulator,name=iPhone 16\" \\\n     --threshold 100 \\\n     --output-dir .build-benchmark\n   ```\n   This produces a ranked list of functions and expressions that exceed the millisecond threshold. Use the diagnostics artifact alongside source inspection to focus on the most expensive files first.\n4. Map the evidence to a concrete recommendation list.\n5. Separate code-level suggestions from project-level or module-level suggestions.\n\n## Apple-Derived Checks\n\nLook for these patterns first:\n\n- missing explicit type information in expensive expressions\n- complex chained or nested expressions that are hard to type-check\n- delegate properties typed as `AnyObject` instead of a concrete protocol\n- oversized Objective-C bridging headers or generated Swift-to-Objective-C surfaces\n- header imports that skip framework qualification and miss module-cache reuse\n- classes missing `final` that are never subclassed\n- overly broad access control (`public`/`open`) on internal-only symbols\n- monolithic SwiftUI `body` properties that should be decomposed into subviews\n- long method chains or closures without intermediate type annotations\n\n## Reporting Format\n\nFor each recommendation, include:\n\n- observed evidence\n- likely affected file or module\n- expected wait-time impact (e.g. \"Expected to reduce your clean build by ~2s\" or \"Reduces parallel compile work but unlikely to reduce build wait time\")\n- confidence\n- whether approval is required before applying it\n\nIf the evidence points to project configuration instead of source, hand off to [`xcode-project-analyzer`](../xcode-project-analyzer/SKILL.md) by reading its SKILL.md and applying its workflow to the same project context.\n\n## Preferred Tactics\n\n- Suggest ad hoc flag injection through the build command before recommending persistent build-setting changes.\n- Prefer narrowing giant view builders, closures, or result-builder expressions into smaller typed units.\n- Recommend explicit imports and protocol typing when they reduce compiler search space.\n- Call out when mixed-language boundaries are the real issue rather than Swift syntax alone.\n\n## Additional Resources\n\n- For the detailed audit checklist, see [references/code-compilation-checks.md](references/code-compilation-checks.md)\n- For the shared recommendation structure, see [references/recommendation-format.md](references/recommendation-format.md)\n- For source citations, see [references/build-optimization-sources.md](references/build-optimization-sources.md)","tags":["xcode","compilation","analyzer","build","optimization","agent","skill","avdlee","agent-skills","ios","ios-development","skills"],"capabilities":["skill","source-avdlee","skill-xcode-compilation-analyzer","topic-agent","topic-agent-skills","topic-ios","topic-ios-development","topic-skills","topic-xcode"],"categories":["Xcode-Build-Optimization-Agent-Skill"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/AvdLee/Xcode-Build-Optimization-Agent-Skill/xcode-compilation-analyzer","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add AvdLee/Xcode-Build-Optimization-Agent-Skill","source_repo":"https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 1014 github stars · SKILL.md body (4,999 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-02T18:52:55.727Z","embedding":null,"createdAt":"2026-04-18T21:56:25.772Z","updatedAt":"2026-05-02T18:52:55.727Z","lastSeenAt":"2026-05-02T18:52:55.727Z","tsv":"'/xcode-project-analyzer/skill.md':633 '1':353 '100':408 '16':406 '2':368 '2s':595 '3':380 '30s':239 '4':444 '5':453 '60s':199 'access':541 'ad':253,650 'addit':708 'affect':578 'alon':707 'alongsid':433 'analysi':87,339,351 'analysis-on':86 'analyz':4,5,51,632 'annot':568 'anyobject':500 'app.xcodeproj':395 'appl':469 'apple-deriv':468 'appli':614,639 'approv':172,610 'artifact':78,432 'audit':713 'base':307 'bash':391 'benchmark':77,414 'biggest':377 'bodi':269,296,552 'bottleneck':66,149 'boundari':698 'bridg':349,510 'broad':360,540 'build':14,46,76,136,160,167,176,184,213,236,413,593,605,656,662 'build-benchmark':75,412 'build-set':661 'builder':669,674 'c':345,509,518 'cach':530 'call':692 'cascad':252 'categori':120,230,373 'caus':338 'chain':485,562 'chang':205,664 'check':41,263,389,471,495 'checklist':714 'citat':728 'class':532 'clean':45,181,592 'clean-build':44 'clock':103,123 'closur':564,670 'code':456 'code-level':455 'command':657 'compil':3,11,38,47,50,56,89,108,112,119,154,193,280,284,300,314,329,333,361,378,599,689 'compile-tim':107 'compileswiftsourc':188 'complement':303 'complex':484 'concret':450,504 'confid':608 'configur':62,398,622 'context':646 'contributor':379 'control':542 'core':67 'cumul':106 'debug':278,293,399 'debug-time-compil':277 'debug-time-function-bodi':292 'decompos':557 'deeper':270 'deleg':496 'deriv':470 'destin':400 'detail':328,712 'develop':35,171 'diagnost':20,271,383,431 'dir':327,411 'disproportion':232 'domin':211 'driver':312,316,321 'driver-level':315 'driver-time-compil':311 'e.g':587 'edit':94,164 'effici':133 'evid':71,141,447,576,618 'exceed':425 'expect':100,582,588 'expens':43,441,482 'explicit':170,478,681 'express':261,423,483,488,675 'extrem':366 'file':192,283,290,442,579 'final':534 'find':98 'first':26,443,476 'fix':127 'flag':90,272,309,652 'focus':437 'format':570 'framework':524 'frontend':19 'function':268,295,299,421 'general':60 'generat':513 'giant':667 'hand':626 'hard':491 'header':511,520 'heavi':223 'heavili':115 'hoc':254,651 'hotspot':12,129,367,390 'ideal':72 'identifi':354 'impact':104,110,586 'import':521,682 'improv':131 'includ':574 'increas':348 'increment':183,212,235 'individu':128 'inform':480 'inject':653 'input':245 'inspect':175,435 'instead':501,623 'intermedi':566 'intern':547 'internal-on':546 'invalid':246 'investig':96,275 'io':402 'iphon':405 'isol':320 'issu':358,702 'json':331 'label':150 'languag':10,697 'larg':207,219,233 'level':29,317,457,462,466 'like':64,217,577 'line':204 'list':419,452 'long':186,260,267,560 'long-run':185 'look':63,472 'macro':222,249 'macro-heavi':221 'macro-rel':248 'main':357 'map':445 'may':130 'median':124 'method':561 'millisecond':427 'miss':477,527,533 'mix':9,340,696 'mixed-languag':8,695 'modul':208,215,226,241,465,529,581 'module-cach':528 'module-level':464 'monolith':550 'myapp':397 'name':404 'narrow':666 'nest':487 'never':537 'note':125 'object':344,508,517 'objective-c':343,507 'observ':575 'open':544 'optim':30 'output':84,179,326,410 'output-dir':409 'over':539 'overhead':322 'overs':506 'parallel':116,132,144,156,598 'pars':369 'pattern':475 'per':191,240,282,298,332 'per-fil':190,281 'per-funct':297 'persist':92,660 'phase':48 'plan':31,224 'platform':401 'point':142,619 'prefer':85,647,665 'produc':22,416 'project':61,93,394,461,621,631,645 'project-level':460 'properti':497,553 'protocol':505,684 'public':543 'python3':392 'qualif':525 'rank':97,287,375,418 'rather':146,157,703 'raw':80 'reach':198 'read':635 'real':701 'rebuild':251 'recent':74 'recommend':25,151,451,573,659,680,721 'recommend-first':24 'reduc':135,153,159,590,597,604,688 'references/build-optimization-sources.md':730,731 'references/code-compilation-checks.md':716,717 'references/recommendation-format.md':724,725 'relat':250 'report':36,569 'requir':612 'resourc':709 'result':673 'result-build':672 'reus':531 'root':337 'root-caus':336 'rule':68 'run':187,255,381 'scheme':396 'script':384 'scripts/diagnose_compilation.py':393 'search':690 'see':715,723,729 'separ':454 'serial':148 'set':168,663 'share':720 'signal':243 'simul':403 'singl':203 'single-lin':202 'skill':54 'skill-xcode-compilation-analyzer' 'skill.md':637 'skip':523 'slow':37 'slowest':289 'smaller':677 'sourc':28,165,434,625,727 'source-avdlee' 'source-level':27 'space':691 'start':69 'stat':325 'statist':330 'stats-output-dir':324 'structur':722 'subclass':538 'subview':559 'suggest':458,467,649 'sum':117 'summari':16,83,178,372 'surfac':346,386,519 'swift':6,18,225,341,515,705 'swift-to-objective-c':514 'swiftemitmodul':195 'swiftui':551 'symbol':549 'syntax':706 'tactic':648 'task':113,194 'thorough':274 'threshold':306,407,428 'threshold-bas':305 'time':15,57,82,109,138,161,177,196,227,279,285,294,301,313,318,371,585,607 'timing-summari':81,370 'topic-agent' 'topic-agent-skills' 'topic-ios' 'topic-ios-development' 'topic-skills' 'topic-xcode' 'type':40,262,388,479,494,498,567,678,685 'type-check':39,387,493 'unexpect':244 'unfilt':302 'unit':334,679 'unlik':602 'use':13,32,52,429 'view':668 'volum':362 'wait':137,584,606 'wait-tim':583 'wall':102,122 'wall-clock':101,121 'warn':42,259,266,308 'warn-long-expression-type-check':258 'warn-long-function-bodi':265 'whether':355,609 'without':134,169,565 'work':145,350,600 'workflow':352,641 'workload':155 'xcode':2,49,630 'xcode-compilation-analyz':1 'xcode-project-analyz':629 'xfrontend':257,264,276,291,323 'xswiftc':310","prices":[{"id":"5f59ee50-34de-4ac7-a910-282d9be74f44","listingId":"b15d329c-a894-45c6-a756-17579582a980","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"AvdLee","category":"Xcode-Build-Optimization-Agent-Skill","install_from":"skills.sh"},"createdAt":"2026-04-18T21:56:25.772Z"}],"sources":[{"listingId":"b15d329c-a894-45c6-a756-17579582a980","source":"github","sourceId":"AvdLee/Xcode-Build-Optimization-Agent-Skill/xcode-compilation-analyzer","sourceUrl":"https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill/tree/main/skills/xcode-compilation-analyzer","isPrimary":false,"firstSeenAt":"2026-04-18T21:56:25.772Z","lastSeenAt":"2026-05-02T18:52:55.727Z"}],"details":{"listingId":"b15d329c-a894-45c6-a756-17579582a980","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"AvdLee","slug":"xcode-compilation-analyzer","github":{"repo":"AvdLee/Xcode-Build-Optimization-Agent-Skill","stars":1014,"topics":["agent","agent-skills","ios","ios-development","skills","xcode"],"license":"mit","html_url":"https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill","pushed_at":"2026-04-15T16:57:33Z","description":"An Agent Skill helping you to optimize Xcode incremental and clean builds by running benchmarks and optimizing build settings.","skill_md_sha":"0ecf5d0fc7750c611cff4e8274ace375d213bb8c","skill_md_path":"skills/xcode-compilation-analyzer/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill/tree/main/skills/xcode-compilation-analyzer"},"layout":"multi","source":"github","category":"Xcode-Build-Optimization-Agent-Skill","frontmatter":{"name":"xcode-compilation-analyzer","description":"Analyze Swift and mixed-language compile hotspots using build timing summaries and Swift frontend diagnostics, then produce a recommend-first source-level optimization plan. Use when a developer reports slow compilation, type-checking warnings, expensive clean-build compile phases, long CompileSwiftSources tasks, warn-long-function-bodies output, or wants to speed up Swift type checking."},"skills_sh_url":"https://skills.sh/AvdLee/Xcode-Build-Optimization-Agent-Skill/xcode-compilation-analyzer"},"updatedAt":"2026-05-02T18:52:55.727Z"}}