skillforge-sdk
v1.0.1
Published
TypeScript SDK for SkillClaw — AI agent skill marketplace on Base
Maintainers
Readme
@skillforge/sdk
TypeScript SDK for SkillForge — the AI agent skill marketplace on Base.
Installation
npm install @skillforge/sdkQuick Start
import { SkillForge } from '@skillforge/sdk';
const sf = new SkillForge({
apiKey: 'sf_your_api_key_here',
baseUrl: 'https://skillforge-api.example.com', // optional, defaults to localhost:3001
});Authentication (Wallet Sign-In)
// 1. Get a nonce for your wallet address
const nonce = await sf.getNonce('0xYourWalletAddress');
// 2. Sign the nonce message with your wallet (e.g., ethers.js)
import { Wallet } from 'ethers';
const wallet = new Wallet('your-private-key');
const message = `Sign this message to authenticate with SkillForge:\n\n${nonce}`;
const signature = await wallet.signMessage(message);
// 3. Verify and get JWT + API key
const { token, apiKey } = await sf.verify('0xYourWalletAddress', signature, nonce);
console.log('Your API key:', apiKey); // sf_xxxxxxxxxxxx...Generate a Skill
const result = await sf.generate({
description: 'Monitor Ethereum gas prices and alert when below 20 gwei',
});
console.log(result.skill); // Generated skill manifest
console.log(result.files); // { skillJson, handlerTs, description }Publish to Marketplace
const { skillId, txHash } = await sf.publish({
name: 'Gas Monitor',
description: 'Monitors ETH gas prices and sends alerts',
price: 0.005, // USDC
});Browse Marketplace
// List all skills
const { skills, total } = await sf.listSkills({ page: 1, limit: 20 });
// Get skill details
const skill = await sf.getSkill(1);
// Filter by creator
const mySkills = await sf.listSkills({ creator: '0xMyAddress' });Install a Skill
const { txHash } = await sf.install({ skillId: 1 });With x402 Payment (for paid skills)
const { txHash } = await sf.install({
skillId: 1,
paymentProof: {
txHash: '0xPaymentTxHash',
chain: 'base-sepolia',
amount: 0.005,
payer: '0xYourAddress',
},
});Creator Dashboard
const stats = await sf.getCreatorStats('0xCreatorAddress');
console.log(`Total skills: ${stats.totalSkills}`);
console.log(`Pending earnings: ${stats.pendingEarnings} USDC`);
const earnings = await sf.getEarnings('0xCreatorAddress');Platform Stats & Health
const stats = await sf.getStats();
console.log(stats.version, stats.uptime, stats.contracts);
const health = await sf.getHealth();
console.log(health.status); // "ok"Error Handling
import { SkillForgeError } from '@skillforge/sdk';
try {
await sf.getSkill(999);
} catch (err) {
if (err instanceof SkillForgeError) {
console.log(err.status); // 404
console.log(err.message); // "Failed to fetch skill"
}
}License
MIT
