add-method

star 4

Adds a new ACP protocol method to the SDK with proper typing, documentation, and tests.

rebornix By rebornix schedule Updated 2/1/2026

name: add-method description: Adds a new ACP protocol method to the SDK with proper typing, documentation, and tests.

Add ACP Method Skill

Adds a new ACP protocol method to the SDK.

Trigger

User says: "/add-method " (e.g., "/add-method session/fork")

Process

  1. Look up method in schema (schema.json or schema.unstable.json) for:

    • Parameters structure
    • Result structure
    • Whether it's stable or unstable
  2. Create Method enum in appropriate file:

    • Session methods → Client/Methods/SessionMethods.swift
    • Initialize methods → Client/Methods/Initialize.swift
    • New category → Create new file
  3. Add deprecation warning if unstable:

    @available(*, deprecated, message: "Unstable ACP API - may change without notice")
    
  4. Add convenience method to Client (if appropriate):

    extension Client {
        public func forkSession(sessionID: String) async throws -> SessionFork.Result {
            try await send(SessionFork.request(
                id: .sequential(from: &nextRequestID),
                SessionFork.Parameters(sessionID: sessionID)
            ))
        }
    }
    
  5. Add golden test if available

  6. Run tests to verify:

    swift test
    

Template

// MARK: - method/name

/// Description of what this method does.
public enum MethodName: Method {
    public static let name = "method/name"

    public struct Parameters: Codable, Hashable, Sendable {
        /// Description of parameter.
        public var param: String

        private enum CodingKeys: String, CodingKey {
            case param = "paramName"
        }

        public init(param: String) {
            self.param = param
        }
    }

    public struct Result: Codable, Hashable, Sendable {
        /// Description of result.
        public var result: String

        public init(result: String) {
            self.result = result
        }
    }
}

Naming Conventions

  • Method enum: PascalCase (e.g., SessionNew, SessionPrompt)
  • Method name: Keep original (e.g., "session/new", "session/prompt")
  • Parameters/Result: Nested structs
  • Properties: camelCase with CodingKeys for snake_case JSON
  • IDs: Use ID suffix (e.g., sessionID, toolCallID)

Checklist

  • Method enum created with correct name
  • Parameters struct with all fields
  • Result struct with all fields
  • CodingKeys for snake_case mapping
  • Public init for all structs
  • Documentation comments
  • Deprecation warning if unstable
  • Convenience method on Client (if appropriate)
  • Tests added
  • swift test passes
Install via CLI
npx skills add https://github.com/rebornix/acp-swift-sdk --skill add-method
Repository Details
star Stars 4
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator