| 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
-
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
-
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
public enum MethodName: Method {
public static let name = "method/name"
public struct Parameters: Codable, Hashable, Sendable {
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 {
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