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
Process
Look up method in schema (schema.json or schema.unstable.json) for:
- Parameters structure
- Result structure
- Whether it's stable or unstable
Create Method enum in appropriate file:
- Session methods →
Client/Methods/SessionMethods.swift - Initialize methods →
Client/Methods/Initialize.swift - New category → Create new file
- Session methods →
Add deprecation warning if unstable:
@available(*, deprecated, message: "Unstable ACP API - may change without notice")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) )) } }Add golden test if available
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:
camelCasewith CodingKeys for snake_case JSON - IDs: Use
IDsuffix (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 testpasses