x402agent/SolanaOS / skills/openclaw-claude-code-skill-main
claude-code-skill
VerifiedControl Claude Code via MCP protocol. Trigger with "plan" to write a precise execution plan then feed it to Claude Code. Also supports direct commands, persistent sessions, agent teams, and advanced tool control.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 277 B |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 13.9 KB |
| SKILL.md | skill md | 16.0 KB |
| examples/basic-mcp.ts | script | 1.4 KB |
| examples/chat-store.ts | script | 3.6 KB |
| mcp_config.example.json | config | 648 B |
| package-lock.json | manifest | 20.9 KB |
| package.json | manifest | 679 B |
| src/index.ts | script | 35.3 KB |
| src/mcp/actions.ts | script | 9.4 KB |
| src/mcp/client.ts | script | 1.4 KB |
| src/mcp/index.ts | script | 189 B |
| src/mcp/logger.ts | script | 1.2 KB |
| src/mcp/types.ts | script | 3.2 KB |
| src/mcp/utils.ts | script | 477 B |
| src/store/index.ts | script | 148 B |
| src/store/indexeddb-storage.ts | script | 1.6 KB |
| src/store/persist.ts | script | 2.2 KB |
| src/store/sync.ts | script | 3.1 KB |
| tsconfig.json | config | 399 B |
examples/chat-store.ts
View on GitHub/**
* Persistent Chat Store Example
*
* This example shows how to create a persistent chat store
* with automatic context recovery.
*/
import {
createPersistStore,
indexedDBStorage,
mergeSessions,
Session,
} from "../src";
// Define chat message type
interface ChatMessage {
id: string;
role: "user" | "assistant" | "system";
content: string;
date: Date;
}
// Define chat session type
interface ChatSession extends Session {
id: string;
topic: string;
messages: ChatMessage[];
lastUpdate: Date;
}
// Define store state
interface ChatState {
sessions: ChatSession[];
currentSessionId: string | null;
}
// Create the persistent chat store
const useChatStore = createPersistStore<
ChatState,
{
createSession: (topic?: string) => string;
deleteSession: (id: string) => void;
addMessage: (sessionId: string, message: Omit<ChatMessage, "id" | "date">) => void;
setCurrentSession: (id: string) => void;
syncWithRemote: (remoteSessions: ChatSession[]) => void;
}
>(
// Initial state
{
sessions: [],
currentSessionId: null,
},
// Methods
(set, get) => ({
createSession: (topic = "New Chat") => {
const id = `session-${Date.now()}`;
const newSession: ChatSession = {
id,
topic,
messages: [],
lastUpdate: new Date(),
};
set({
sessions: [newSession, ...get().sessions],
currentSessionId: id,
});
return id;
},
deleteSession: (id: string) => {
const { sessions, currentSessionId } = get();
const newSessions = sessions.filter((s) => s.id !== id);
set({
sessions: newSessions,
currentSessionId:
currentSessionId === id
? newSessions[0]?.id ?? null
: currentSessionId,
});
},
addMessage: (sessionId: string, message: Omit<ChatMessage, "id" | "date">) => {
const sessions = get().sessions.map((session) => {
if (session.id !== sessionId) return session;
return {
...session,
messages: [
...session.messages,
{
...message,
id: `msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,
date: new Date(),
},
],
lastUpdate: new Date(),
};
});
set({ sessions });
},
setCurrentSession: (id: string) => {
set({ currentSessionId: id });
},
syncWithRemote: (remoteSessions: ChatSession[]) => {
const { sessions } = get();
const mergedSessions = mergeSessions(
sessions,
remoteSessions,
) as ChatSession[];
set({ sessions: mergedSessions });
},
}),
// Persist options
{
name: "chat-store",
version: 1,
},
// Use IndexedDB storage
indexedDBStorage,
);
// Usage example
async function main() {
const store = useChatStore.getState();
// Wait for hydration
if (!store._hasHydrated) {
console.log("Waiting for state to hydrate...");
await new Promise<void>((resolve) => {
const unsubscribe = useChatStore.subscribe((state) => {
if (state._hasHydrated) {
unsubscribe();
resolve();
}
});
});
}
console.log("State hydrated! Existing sessions:", store.sessions.length);
// Create a new session
const sessionId = store.createSession("Test Chat");
console.log("Created session:", sessionId);
// Add a message
store.addMessage(sessionId, {
role: "user",
content: "Hello, world!",
});
console.log("Current sessions:", useChatStore.getState().sessions);
}
main().catch(console.error);
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |