t3ta

Claude Code Mastra — Testing skill for Claude Code

Testing community

Claude Code SDK integration for Mastra Framework - TypeScript Agent implementation with comprehensive testing.

How to install Claude Code Mastra

This entry records only its repository, not the path inside it, so there is no exact command to give. Open t3ta/claude-code-mastra and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Code Mastra does

Claude Code SDK integration for Mastra Framework - TypeScript Agent implementation with comprehensive testing.

Alternatives in Testing

  • Fix Issue — by metabase - Addresses GitHub issues by taking issue number as parameter, analyzing context, implementing sol 46.5k ★
  • Debug — You are tasked with helping debug issues during manual testing or implementation 10k ★
  • OpenAgentsControl — AI agent framework for plan-first development workflows with approval-based execution 4.8k ★

README

Claude Code × Mastra Agent Integration

This library integrates the Claude Code TypeScript SDK as an Agent within the Mastra framework.

Overview

This library adapts the Claude Code SDK to the Mastra Agent interface, enabling powerful coding assistance features of Claude Code within the Mastra framework.

Features

  • Mastra Agent Compatible: Fully implements the Mastra Framework Agent interface
  • Custom Tools: Supports Mastra Agent's tools feature
  • MCP External Tools: Integrates external tools via Model Context Protocol
  • Streaming Support: Real-time response processing
  • Session Management: Tracks session state and manages resources
  • Error Handling: Robust error handling mechanisms
  • Configurable: Supports Claude Code-specific options
  • Type Safe: Complete TypeScript type definitions

Installation

npm install @anthropic-ai/claude-code @mastra/core

Basic Usage

Simple Generation

import { ClaudeCodeAgent } from './claude-code-agent.js';

const agent = new ClaudeCodeAgent({
  maxTurns: 3,
  permissionMode: 'default'
});

const response = await agent.generate(
  'Write a TypeScript function to calculate fibonacci numbers'
);

console.log(response.content);
console.log(response.metadata); // Session info, cost, etc.

Streaming

for await (const chunk of agent.stream('Create a REST API with Express.js')) {
  if (chunk.type === 'content') {
    console.log('Content:', chunk.data.content);
  } else if (chunk.type === 'complete') {
    console.log('Total cost:', chunk.data.totalCost);
  }
}

Configuration Options

interface ClaudeCodeAgentOptions {
  maxTurns?: number;                    // Max turns (default: 10)
  allowedTools?: string[];              // Allowed tools
  permissionMode?: 'default' | 'acceptEdits' | 'bypassPermissions';
  workingDirectory?: string;            // Working directory
  timeout?: number;                     // Timeout (ms,