jutsu-cocoapods

Validation and quality enforcement for CocoaPods dependency management in iOS, macOS, tvOS, watchOS, and visionOS projects.

View on GitHub
Author The Bushido Collective
Namespace @TheBushidoCollective/han
Category Technique
Version 1.0.0
Stars 66
Downloads 4
self.md verified
Table of content

Validation and quality enforcement for CocoaPods dependency management in iOS, macOS, tvOS, watchOS, and visionOS projects.

Installation

npx claude-plugins install @TheBushidoCollective/han/jutsu-cocoapods

Contents

Folders: skills

Files: CHANGELOG.md, README.md, han-plugin.yml

Documentation

Validation and quality enforcement for CocoaPods dependency management in iOS, macOS, tvOS, watchOS, and visionOS projects.

What This Jutsu Provides

Validation Hooks

Skills

This jutsu provides the following skills for CocoaPods development:

Installation

Install via the Han marketplace:

han plugin install jutsu-cocoapods

Or install manually:

claude plugin marketplace add thebushidocollective/han
claude plugin install jutsu-cocoapods@han

Usage

Once installed, this jutsu automatically validates your CocoaPods code:

What Gets Validated

The hook runs in directories containing:

And validates when these files change:

Validation Command

pod lib lint --quick --fail-fast

This ensures:

Requirements

Installing CocoaPods

# Using gem (recommended)
sudo gem install cocoapods

# Or using Homebrew
brew install cocoapods

# Verify installation
pod --version

Validation Workflow

Automatic Validation

When you make changes to:

  1. Podspec files (*.podspec)
  2. Source code (*.swift, *.h, *.m, *.mm)
  3. Privacy manifests (*.xcprivacy)

The jutsu automatically runs validation when you stop a conversation or complete agent work.

Manual Validation

You can also run validation manually:

# Quick validation (recommended during development)
pod lib lint --quick

# Full validation (with build)
pod lib lint

# Validate for publishing
pod spec lint

Common Validation Errors

Missing Required Attributes

ERROR | [MyLibrary] Missing required attribute `license`

Fix: Add license to podspec:

spec.license = { :type => 'MIT', :file => 'LICENSE' }

Invalid Source Files Pattern

ERROR | [MyLibrary] The `source_files` pattern did not match any file

Fix: Update source_files pattern:

spec.source_files = 'Source/**/*.{swift,h,m}'

Platform Not Specified

ERROR | [MyLibrary] The platform attribute is required

Fix: Add platform deployment target:

spec.ios.deployment_target = '13.0'

Privacy Manifest Missing (iOS 17+)

WARNING | [MyLibrary] Missing privacy manifest for iOS 17+

Fix: Add privacy manifest:

spec.resource_bundles = {
  'MyLibrary' => ['Resources/PrivacyInfo.xcprivacy']
}

Skipping Validation

If you need to skip validation temporarily:

# Set environment variable
HAN_SKIP_HOOKS=1

# Or disable the plugin
claude plugin disable jutsu-cocoapods

Advanced Configuration

Custom Validation Options

Create han-config.yml in your project to customize validation:

jutsu-cocoapods:
  lint:
    command: pod lib lint --quick --fail-fast --allow-warnings

Platform-Specific Validation

jutsu-cocoapods:
  lint:
    command: pod lib lint --platforms=ios --quick

Best Practices

Podspec Structure

Pod::Spec.new do |spec|
  # Identity
  spec.name         = 'MyLibrary'
  spec.version      = '1.0.0'

  # Metadata
  spec.summary      = 'Brief description'
  spec.homepage     = 'https://github.com/username/MyLibrary'
  spec.license      = { :type => 'MIT', :file => 'LICENSE' }
  spec.authors      = { '

...(truncated)

## Included Skills

This plugin includes 5 skill definitions:

### podspec-fundamentals

> Use when creating or modifying CocoaPods podspec files. Covers required attributes, file patterns, dependencies, and platform specifications for iOS, macOS, tvOS, watchOS, and visionOS projects.

<details>
<summary>View skill definition</summary>

# CocoaPods - Podspec Fundamentals

Essential patterns for creating and maintaining podspec files that define CocoaPods libraries.

## Required Attributes

Every podspec must include these attributes:

```ruby
Pod::Spec.new do |spec|
  # Identity
  spec.name         = 'MyLibrary'
  spec.version      = '1.0.0'

  # Metadata
  spec.license      = { :type => 'MIT', :file => 'LICENSE' }
  spec.homepage     = 'https://github.com/username/MyLibrary'
  spec.authors      = { 'Your Name' => 'email@example.com' }
  spec.summary      = 'Brief description under 140 characters'

  # Source
  spec.source       = { :git => 'https://github.com/username/MyLibrary.git', :tag => spec.version.to_s }

  # Platform Support
  spec.ios.deployment_target = '13.0'
  spec.osx.deployment_target = '10.15'
end

Platform Specifications

Current Platform Support (2024)

# iOS (iPhone, iPad)
spec.ios.deployment_target = '13.0'

# macOS (Mac computers)
spec.osx.deployment_target = '10.15'

# tvOS (Apple TV)
spec.tvos.deployment_target = '13.0'

# watchOS (Apple Watch)
spec.watchos.deployment_target = '6.0'

# visionOS (Apple Vision Pro) - Added in CocoaPods 1.15.0+
spec.visionos.deployment_target = '1.0'

Multi-Platform Support

# Simple approach - all platforms same version
spec.platform = :ios, '13.0'

# Recommended - specify per platform
spec.ios.deployment_target = '13.0'
spec.osx.deployment_target = '10.15'
spec.tvos.deployment_target = '13.0'
spec.watchos.deployment_ta

...(truncated)

</details>

### privacy-manifests

> Use when implementing iOS 17+ privacy manifests for CocoaPods libraries. Covers PrivacyInfo.xcprivacy file creation, required reasons API declarations, and proper resource bundle integration for App Store compliance.

<details>
<summary>View skill definition</summary>

# CocoaPods - Privacy Manifests

Implement iOS 17+ privacy manifests for App Store compliance and user transparency.

## What Are Privacy Manifests?

Privacy manifests (`PrivacyInfo.xcprivacy`) are XML property list files that declare:

- Data collection and usage practices
- Required Reasons API usage
- Tracking domains
- Privacy-sensitive APIs

### Why Privacy Manifests?

Starting with iOS 17 and Xcode 15, Apple requires privacy manifests for:

- Apps using privacy-sensitive APIs
- Third-party SDKs and frameworks
- Any code accessing user data

## Privacy Manifest File Format

### Basic Structure

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSPrivacyTracking</key>
    <false/>
    <key>NSPrivacyTrackingDomains</key>
    <array/>
    <key>NSPrivacyCollectedDataTypes</key>
    <array/>
    <key>NSPrivacyAccessedAPITypes</key>
    <array/>
</dict>
</plist>

Including in Podspec

Pod::Spec.new do |spec|
  spec.name = 'MyLibrary'
  spec.version = '1.0.0'

  spec.source_files = 'Source/**/*.swift'

  # Include privacy manifest in resource bundle
  spec.resource_bundles = {
    'MyLibrary' => [
      'Resources/**/*.xcprivacy',
      'Resources/**/*.{png,jpg,xcassets}'
    ]
  }
end

Direct Resources (Alternative)

spec.resources = 'Resources/PrivacyInfo.xcprivacy'

# Or with

...(truncated)

</details>

### publishing-workflow

> Use when publishing CocoaPods libraries to CocoaPods Trunk. Covers pod trunk registration, podspec validation, version management, and publishing best practices for successful library distribution.

<details>
<summary>View skill definition</summary>

# CocoaPods - Publishing Workflow

Complete guide to publishing your CocoaPods library to the official CocoaPods Trunk.

## Publishing Overview

### Process Steps

1. **Register with CocoaPods Trunk** (one-time)
2. **Prepare your podspec**
3. **Validate locally** (`pod lib lint`)
4. **Validate for publishing** (`pod spec lint`)
5. **Tag version in git**
6. **Push to Trunk** (`pod trunk push`)

## Trunk Registration

### Register Email (One-Time)

```bash
# Register your email
pod trunk register email@example.com 'Your Name'

# Verify email (check inbox for verification link)
# Click link in email to activate account

Check Registration

# Verify registration
pod trunk me

# Sample output:
# - Name:     Your Name
# - Email:    email@example.com
# - Since:    January 1st, 2024
# - Pods:     None

Podspec Preparation

Version Management

Pod::Spec.new do |spec|
  # Semantic versioning: MAJOR.MINOR.PATCH
  spec.version = '1.0.0'

  # Must match git tag
  spec.source = {
    :git => 'https://github.com/username/MyLibrary.git',
    :tag => spec.version.to_s
  }
end

Required Metadata

Pod::Spec.new do |spec|
  # Identity (required)
  spec.name         = 'MyLibrary'
  spec.version      = '1.0.0'

  # Description (required)
  spec.summary      = 'Brief one-line description'
  spec.description  = 'Longer description with more details about what the library does'

  # Links (required)
  spec.homepage     = 'https://github.com/username/

...(truncated)

</details>

### subspecs-organization

> Use when organizing complex CocoaPods libraries into subspecs. Covers modular architecture, dependency management between subspecs, and default subspecs patterns for better code organization and optional features.

<details>
<summary>View skill definition</summary>

# CocoaPods - Subspecs Organization

Organize complex libraries into modular subspecs for better maintainability and optional features.

## What Are Subspecs?

Subspecs allow you to split a pod into logical modules that can be installed independently or as a group.

### Benefits

- **Modularity**: Separate core functionality from optional features
- **Selective Installation**: Users install only what they need
- **Reduced Dependencies**: Optional features don't force unnecessary dependencies
- **Better Organization**: Clear separation of concerns

## Basic Subspec Pattern

```ruby
Pod::Spec.new do |spec|
  spec.name = 'MyLibrary'
  spec.version = '1.0.0'

  # Main spec has no source files - all in subspecs
  spec.default_subspecs = 'Core'

  # Core subspec - installed by default
  spec.subspec 'Core' do |core|
    core.source_files = 'Source/Core/**/*.swift'
    core.frameworks = 'Foundation'
  end

  # Optional feature subspec
  spec.subspec 'Networking' do |networking|
    networking.source_files = 'Source/Networking/**/*.swift'
    networking.dependency 'MyLibrary/Core'  # Depends on Core
    networking.dependency 'Alamofire', '~> 5.0'
  end

  # Another optional feature
  spec.subspec 'UI' do |ui|
    ui.source_files = 'Source/UI/**/*.swift'
    ui.dependency 'MyLibrary/Core'
    ui.ios.frameworks = 'UIKit'
    ui.osx.frameworks = 'AppKit'
  end
end

Dependency Patterns

Subspec Dependencies

Pod::Spec.new do |spec|
  spec.name = 'MySDK'

  # Foundation

...(truncated)

</details>

### test-specs

> Use when adding automated tests to CocoaPods libraries using test specs. Covers test spec configuration, app host requirements, and testing patterns that integrate with pod lib lint validation.

<details>
<summary>View skill definition</summary>

# CocoaPods - Test Specs

Integrate automated tests into your CocoaPods library that run during validation.

## What Are Test Specs?

Test specs define test targets that CocoaPods builds and runs automatically during `pod lib lint` and `pod spec lint` validation.

### Benefits

- **Automatic Testing**: Tests run during every lint validation
- **Confidence**: Validates library works as expected before publishing
- **CI Integration**: Consistent testing across all environments
- **Documentation**: Tests serve as usage examples

## Basic Test Spec

```ruby
Pod::Spec.new do |spec|
  spec.name = 'MyLibrary'
  spec.version = '1.0.0'

  # Main library source
  spec.source_files = 'Source/**/*.swift'

  # Test spec
  spec.test_spec 'Tests' do |test_spec|
    test_spec.source_files = 'Tests/**/*.swift'

    # Test dependencies
    test_spec.dependency 'Quick', '~> 7.0'
    test_spec.dependency 'Nimble', '~> 12.0'
  end
end

App Host Requirements

Tests Without App Host

spec.test_spec 'Tests' do |test_spec|
  test_spec.source_files = 'Tests/**/*.swift'

  # Unit tests that don't need app environment
  test_spec.requires_app_host = false  # Default
end

Tests With App Host

spec.test_spec 'UITests' do |test_spec|
  test_spec.source_files = 'Tests/UITests/**/*.swift'

  # Tests that need app environment (UIKit, storyboards, etc.)
  test_spec.requires_app_host = true

  test_spec.dependency 'MyLibrary'
end

Multiple Test Specs

Pod::Spec.

...(truncated)

</details>

## Source

[View on GitHub](https://github.com/TheBushidoCollective/han)
Tags: Technique cocoapodsvalidationpodspeciosmacosswiftobjective-cqualityenforcement