[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KR20MF29E3732Z83NQ3WN5":3,"skill-same:01M6KR20MF29E3732Z83NQ3WN5":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":27,"linkOnly":28,"markdownContent":29,"markdownBody":30,"frontMatter":31,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":14,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":37,"install":38,"resources":51},"01M6KR20MF29E3732Z83NQ3WN5","interface-implementation",null,"Add a built-in implementation of an interface in OtterAgent. Use when implementing a new built-in for an existing interface (e.g. a new SessionManager, AuthStorage, or UIProvider).","BowerJames\u002FOtterAgent","BowerJames","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F62060556?v=4","01M6KR1BF6JNAW7HEXJV80181E","James Bower","01M6KR1BKRQZCD0KQ334WS7QHJ",0,"MIT","https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Finterface-implementation\u002FSKILL.md",[],[19,20,21,22,23,24,25,26],"implementation","interface","interface implementation","use","add","implementing","for","Existing","2026-11-10 10:12:30",false,"---\nname: interface-implementation\ndescription: Add a built-in implementation of an interface in OtterAgent. Use when implementing a new built-in for an existing interface (e.g. a new SessionManager, AuthStorage, or UIProvider).\n---\n\nFollow this pattern exactly when adding a built-in implementation of an OtterAgent interface.\n\n## Folder Structure\n\nImplementations of a given interface live together in a dedicated folder:\n\n```\nsrc\u002F\n  \u003Cinterface-name-plural>\u002F         e.g. session-managers\u002F, auth-storages\u002F\n    \u003Cimpl-name>.ts                 e.g. in-memory-session-manager.ts\n    \u003Cimpl-name>.test.ts            e.g. in-memory-session-manager.test.ts\n    index.ts                       namespace + re-exports for the whole folder\n```\n\nIf the folder already exists (other implementations are present), add the new `.ts` and `.test.ts` files alongside them and add the new factory to the existing `index.ts` namespace.\n\n## 1. Implementation File (`\u003Cimpl-name>.ts`)\n\n- Define the implementation as an **exported class**.\n- Export a `createXxx()` factory function as a convenience wrapper.\n- The class must explicitly `implements` the interface so TypeScript enforces completeness.\n\n```typescript\n\u002F\u002F src\u002Fsession-managers\u002Fin-memory-session-manager.ts\n\nimport type { SessionManager } from \"..\u002Finterfaces\u002Fsession-manager.js\";\n\nexport class InMemorySessionManager implements SessionManager {\n  \u002F\u002F ... implementation\n}\n\n\u002F**\n * Creates an in-memory {@link SessionManager} with no filesystem persistence.\n *\u002F\nexport function createInMemorySessionManager(): InMemorySessionManager {\n  return new InMemorySessionManager();\n}\n```\n\n## 2. Namespace \u002F Index File (`index.ts`)\n\nThis file does three things:\n1. Re-exports the class and factory function(s) from implementation files.\n2. Declares a **namespace** whose name matches the interface, merged with an empty interface extension. This makes the interface name serve as both a **type** and a **value** (the namespace) from a single import.\n\n```typescript\n\u002F\u002F src\u002Fsession-managers\u002Findex.ts\n\nimport type { SessionManager as ISessionManager } from \"..\u002Finterfaces\u002Fsession-manager.js\";\nimport { createInMemorySessionManager, InMemorySessionManager } from \".\u002Fin-memory-session-manager.js\";\n\nexport { createInMemorySessionManager, InMemorySessionManager } from \".\u002Fin-memory-session-manager.js\";\n\n\u002F\u002F Empty interface extension enables TypeScript declaration merging with the\n\u002F\u002F namespace below. Consumers get SessionManager as both a type and a value.\n\u002F\u002F eslint-disable-next-line @typescript-eslint\u002Fno-empty-object-type\nexport interface SessionManager extends ISessionManager {}\n\n\u002F\u002F eslint-disable-next-line @typescript-eslint\u002Fno-namespace\nexport namespace SessionManager {\n  export function inMemory(): InMemorySessionManager {\n    return createInMemorySessionManager();\n  }\n\n  \u002F\u002F Add new built-ins here as additional methods on the same namespace.\n  \u002F\u002F export function sqlite(path: string): SqliteSessionManager { ... }\n}\n```\n\n**Why the empty interface?** TypeScript does not allow merging a namespace with a plain type alias or an imported interface re-export. The empty `interface Xxx extends IXxx {}` declares a *local* interface that TypeScript can merge with the namespace in the same file.\n\n## 3. Root Barrel (`src\u002Findex.ts`)\n\nExport the class and namespace from the implementations index. A single `export { Xxx }` is enough for the namespace — TypeScript carries both the type (via the merged interface) and the value (the namespace) through one export. The class gets its own named export alongside.\n\n**Do NOT also add a separate `export type { Xxx }` for the same name** — this causes `TS2300: Duplicate identifier`.\n\n```typescript\n\u002F\u002F src\u002Findex.ts\n\n\u002F\u002F Remove the interface from the plain type export block if it was there:\nexport type {\n  AgentEnvironment,\n  AuthStorage,\n  \u002F\u002F SessionManager,   ← moved to session-managers export below\n  ToolDefinition,\n  UIProvider,\n} from \".\u002Finterfaces\u002Findex.js\";\n\n\u002F\u002F Add the namespace export (carries both type and factory value)\n\u002F\u002F and the class export:\nexport {\n  InMemorySessionManager,\n  createInMemorySessionManager,\n  SessionManager,\n} from \".\u002Fsession-managers\u002Findex.js\";\n```\n\nIf the interface was previously exported as `export type { Xxx }` from `interfaces\u002Findex.js`, remove it from that block and replace it with the single `export { Xxx }` from the implementations folder.\n\n## 4. Consumer Usage\n\nAfter wiring, consumers get a clean API with a single import:\n\n```typescript\nimport { SessionManager, InMemorySessionManager } from \"@otter-agent\u002Fcore\";\n\n\u002F\u002F As a type:\nfunction accepts(sm: SessionManager) { ... }\n\n\u002F\u002F As a factory (recommended convenience API):\nconst sm = SessionManager.inMemory();\n\n\u002F\u002F Direct class construction (for subclassing, instanceof, or impl-specific APIs):\nconst sm = new InMemorySessionManager();\n```\n\nBoth the namespace factory and direct construction produce the same class instance, so `instanceof` works regardless of how the instance was created:\n\n```typescript\nconst sm1 = SessionManager.inMemory();\nconst sm2 = createInMemorySessionManager();\nconst sm3 = new InMemorySessionManager();\n\nsm1 instanceof InMemorySessionManager; \u002F\u002F true\nsm2 instanceof InMemorySessionManager; \u002F\u002F true\nsm3 instanceof InMemorySessionManager; \u002F\u002F true\n```\n\n## 5. Tests\n\nPlace tests in `\u003Cimpl-name>.test.ts` alongside the implementation. Tests should be comprehensive and cover:\n- Every interface method: returns a unique `EntryId`, correct data stored\u002Fexcluded\n- `buildSessionContext()` (or equivalent read method): correct output for all scenarios\n- Edge cases specific to the implementation\n- The namespace factory method (e.g. `SessionManager.inMemory()`) produces a working, independent instance\n- Direct class construction via `new` produces a working instance\n- `instanceof` checks pass for all creation paths (direct, factory, namespace)\n\n## Reference Implementation\n\nSee `src\u002Fsession-managers\u002F` for the canonical worked example:\n- `in-memory-session-manager.ts` — exported class + factory\n- `index.ts` — namespace merging + class re-export\n- `in-memory-session-manager.test.ts` — tests covering all interface methods, edge cases, factory, direct construction, and instanceof\n","Follow this pattern exactly when adding a built-in implementation of an OtterAgent interface.\n\n## Folder Structure\n\nImplementations of a given interface live together in a dedicated folder:\n\n```\nsrc\u002F\n  \u003Cinterface-name-plural>\u002F         e.g. session-managers\u002F, auth-storages\u002F\n    \u003Cimpl-name>.ts                 e.g. in-memory-session-manager.ts\n    \u003Cimpl-name>.test.ts            e.g. in-memory-session-manager.test.ts\n    index.ts                       namespace + re-exports for the whole folder\n```\n\nIf the folder already exists (other implementations are present), add the new `.ts` and `.test.ts` files alongside them and add the new factory to the existing `index.ts` namespace.\n\n## 1. Implementation File (`\u003Cimpl-name>.ts`)\n\n- Define the implementation as an **exported class**.\n- Export a `createXxx()` factory function as a convenience wrapper.\n- The class must explicitly `implements` the interface so TypeScript enforces completeness.\n\n```typescript\n\u002F\u002F src\u002Fsession-managers\u002Fin-memory-session-manager.ts\n\nimport type { SessionManager } from \"..\u002Finterfaces\u002Fsession-manager.js\";\n\nexport class InMemorySessionManager implements SessionManager {\n  \u002F\u002F ... implementation\n}\n\n\u002F**\n * Creates an in-memory {@link SessionManager} with no filesystem persistence.\n *\u002F\nexport function createInMemorySessionManager(): InMemorySessionManager {\n  return new InMemorySessionManager();\n}\n```\n\n## 2. Namespace \u002F Index File (`index.ts`)\n\nThis file does three things:\n1. Re-exports the class and factory function(s) from implementation files.\n2. Declares a **namespace** whose name matches the interface, merged with an empty interface extension. This makes the interface name serve as both a **type** and a **value** (the namespace) from a single import.\n\n```typescript\n\u002F\u002F src\u002Fsession-managers\u002Findex.ts\n\nimport type { SessionManager as ISessionManager } from \"..\u002Finterfaces\u002Fsession-manager.js\";\nimport { createInMemorySessionManager, InMemorySessionManager } from \".\u002Fin-memory-session-manager.js\";\n\nexport { createInMemorySessionManager, InMemorySessionManager } from \".\u002Fin-memory-session-manager.js\";\n\n\u002F\u002F Empty interface extension enables TypeScript declaration merging with the\n\u002F\u002F namespace below. Consumers get SessionManager as both a type and a value.\n\u002F\u002F eslint-disable-next-line @typescript-eslint\u002Fno-empty-object-type\nexport interface SessionManager extends ISessionManager {}\n\n\u002F\u002F eslint-disable-next-line @typescript-eslint\u002Fno-namespace\nexport namespace SessionManager {\n  export function inMemory(): InMemorySessionManager {\n    return createInMemorySessionManager();\n  }\n\n  \u002F\u002F Add new built-ins here as additional methods on the same namespace.\n  \u002F\u002F export function sqlite(path: string): SqliteSessionManager { ... }\n}\n```\n\n**Why the empty interface?** TypeScript does not allow merging a namespace with a plain type alias or an imported interface re-export. The empty `interface Xxx extends IXxx {}` declares a *local* interface that TypeScript can merge with the namespace in the same file.\n\n## 3. Root Barrel (`src\u002Findex.ts`)\n\nExport the class and namespace from the implementations index. A single `export { Xxx }` is enough for the namespace — TypeScript carries both the type (via the merged interface) and the value (the namespace) through one export. The class gets its own named export alongside.\n\n**Do NOT also add a separate `export type { Xxx }` for the same name** — this causes `TS2300: Duplicate identifier`.\n\n```typescript\n\u002F\u002F src\u002Findex.ts\n\n\u002F\u002F Remove the interface from the plain type export block if it was there:\nexport type {\n  AgentEnvironment,\n  AuthStorage,\n  \u002F\u002F SessionManager,   ← moved to session-managers export below\n  ToolDefinition,\n  UIProvider,\n} from \".\u002Finterfaces\u002Findex.js\";\n\n\u002F\u002F Add the namespace export (carries both type and factory value)\n\u002F\u002F and the class export:\nexport {\n  InMemorySessionManager,\n  createInMemorySessionManager,\n  SessionManager,\n} from \".\u002Fsession-managers\u002Findex.js\";\n```\n\nIf the interface was previously exported as `export type { Xxx }` from `interfaces\u002Findex.js`, remove it from that block and replace it with the single `export { Xxx }` from the implementations folder.\n\n## 4. Consumer Usage\n\nAfter wiring, consumers get a clean API with a single import:\n\n```typescript\nimport { SessionManager, InMemorySessionManager } from \"@otter-agent\u002Fcore\";\n\n\u002F\u002F As a type:\nfunction accepts(sm: SessionManager) { ... }\n\n\u002F\u002F As a factory (recommended convenience API):\nconst sm = SessionManager.inMemory();\n\n\u002F\u002F Direct class construction (for subclassing, instanceof, or impl-specific APIs):\nconst sm = new InMemorySessionManager();\n```\n\nBoth the namespace factory and direct construction produce the same class instance, so `instanceof` works regardless of how the instance was created:\n\n```typescript\nconst sm1 = SessionManager.inMemory();\nconst sm2 = createInMemorySessionManager();\nconst sm3 = new InMemorySessionManager();\n\nsm1 instanceof InMemorySessionManager; \u002F\u002F true\nsm2 instanceof InMemorySessionManager; \u002F\u002F true\nsm3 instanceof InMemorySessionManager; \u002F\u002F true\n```\n\n## 5. Tests\n\nPlace tests in `\u003Cimpl-name>.test.ts` alongside the implementation. Tests should be comprehensive and cover:\n- Every interface method: returns a unique `EntryId`, correct data stored\u002Fexcluded\n- `buildSessionContext()` (or equivalent read method): correct output for all scenarios\n- Edge cases specific to the implementation\n- The namespace factory method (e.g. `SessionManager.inMemory()`) produces a working, independent instance\n- Direct class construction via `new` produces a working instance\n- `instanceof` checks pass for all creation paths (direct, factory, namespace)\n\n## Reference Implementation\n\nSee `src\u002Fsession-managers\u002F` for the canonical worked example:\n- `in-memory-session-manager.ts` — exported class + factory\n- `index.ts` — namespace merging + class re-export\n- `in-memory-session-manager.test.ts` — tests covering all interface methods, edge cases, factory, direct construction, and instanceof\n",{"name":5,"description":7},"main","c9be61391a9b53d0c80f6ac184972ddc98e9db3d",".pi\u002Fskills\u002Finterface-implementation","https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent","https:\u002F\u002Fgithub.com\u002FBowerJames","2026-04-23 07:54:45",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add BowerJames\u002FOtterAgent --skill interface-implementation",{"tool":44,"command":45},"bunx","bunx skills add BowerJames\u002FOtterAgent --skill interface-implementation",{"tool":47,"command":48},"pnpm","pnpm dlx skills add BowerJames\u002FOtterAgent --skill interface-implementation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Finterface-implementation\u002FSKILL.md",true,[],[53,68,73],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":27},"01M6KR1SB6931D0YQ8HVKHSZDP","overview","Overview of the repository, core components, and open GitHub issues","https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Foverview\u002FSKILL.md",[],[55,60,61,62,63,64,65,66,67],"open","core components","repository","issues","github issues","core","components","github",{"skillNo":69,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":27},"01M6KR1N6GNBS717C70RMJFCW1","https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Finterface-implementation\u002FSKILL.md",[],[19,21,20,26,25,24,23,22],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":89,"publishedAt":27},"01M6KR1H88KKEVET02TKRYY81C","code-review","Run an independent code review using pi-coding-agent. Use after completing an implementation to get a second opinion before pushing. Pass the issue number or a short description of what was implemented.","https:\u002F\u002Fgithub.com\u002FBowerJames\u002FOtterAgent\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcode-review\u002FSKILL.md",[79,84],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",{"categoryNo":85,"categoryName":86,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[90,91,92,93,94,95,96,97,98,99,19,100,22,101,102],"code review","review","code","run","second opinion","coding","get a second opinion","number","get","issue","Coding-Agent","pi","short"]