Skip to content

refactor: improve wallet-integration skill for agent consumption#67

Open
marc0olo wants to merge 1 commit intomainfrom
refactor/wallet-integration-agent-focus
Open

refactor: improve wallet-integration skill for agent consumption#67
marc0olo wants to merge 1 commit intomainfrom
refactor/wallet-integration-agent-focus

Conversation

@marc0olo
Copy link
Member

@marc0olo marc0olo commented Mar 4, 2026

Summary

Refactors the wallet-integration skill (merged via #16) to be more efficient for agent consumption.

  • Rename headings: H1 now matches skill name; "Mistakes That Break Your Build" → "Pitfalls" (conventional, scannable)
  • Fix pitfall #5 accuracy: requestPermissionsNotGranted() is a UX optimization (batch permissions upfront), not a requirement — the signer prompts on demand via ask_on_use default. Verified against library source and e2e tests.
  • Self-contained code blocks: IcpWallet/IcrcWallet examples now include connect() + accounts() so agents get copy-paste correct code without needing to reference other sections
  • Add error class imports: RelyingPartyResponseError and RelyingPartyDisconnectedError added to the import map — these are used in the error handling block but were missing (not yet exported by the library; import path is a draft pending dfinity/oisy-wallet-signer update)
  • Remove low-value sections: "Build Your Project" (generic TS commands), "Verify It Works" manual QA checklist
  • Add "Expected Behavior": Condensed section with return types and behavioral facts (permission idempotency, account shape, block index types) not stated elsewhere in the skill

- Rename H1 to match skill name (Wallet Integration)
- Rename "Mistakes That Break Your Build" to "Pitfalls"
- Fix pitfall #5: clarify that requestPermissionsNotGranted() is a UX
  optimization, not a requirement (verified against library source)
- Make IcpWallet/IcrcWallet code blocks self-contained (add connect +
  accounts so agents get copy-paste correct code)
- Add error class imports to import map (RelyingPartyResponseError,
  RelyingPartyDisconnectedError)
- Remove "Build Your Project" section (generic TS commands)
- Replace "Verify It Works" with condensed "Expected Behavior" section
  focused on return types and behavioral facts not stated elsewhere
// Classes and errors — from dedicated subpaths
import {Signer} from '@dfinity/oisy-wallet-signer/signer';
import {RelyingParty} from '@dfinity/oisy-wallet-signer/relying-party';
import {RelyingParty, RelyingPartyResponseError, RelyingPartyDisconnectedError} from '@dfinity/oisy-wallet-signer/relying-party';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be confirmed by @AntonioVentilii

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the latest release v4.1.1 exports those types

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AntonioVentilii as discussed on Slack, the export currently misses the runtime values which is why the advertised instanceof check would still not work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah my bad, I missed it when I reviewed dfinity/oisy-wallet-signer#817.
@AntonioVentilii we should not have exported those as type but, plain.

@marc0olo marc0olo requested a review from AntonioVentilii March 4, 2026 16:30
@marc0olo marc0olo marked this pull request as ready for review March 4, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants