resources/boost/skills/neuron-debugger/SKILL.md
Debug and monitor Neuron AI applications with Inspector APM, event observability, logging, and performance analysis. Use this skill whenever the user mentions debugging, monitoring, observability, performance analysis, tracing, Inspector, or needs to understand why an agent is behaving a certain way. Also trigger for tasks involving agent execution timeline, tool call inspection, response quality issues, latency problems, or general troubleshooting of Neuron AI applications.
npx skillsauth add neuron-core/neuron-laravel neuron-debuggerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps you debug and monitor Neuron AI applications using Inspector APM and the framework's observability system.
Inspector provides deep insights into agent execution, helping you understand:
# .env file
INSPECTOR_INGESTION_KEY=your_ingestion_key_here
After running an agent, visit your Inspector dashboard to see:
[AI Inference] → [Tool Call: search_database] → [AI Inference] → [Response]
↓ ↓ ↓
850ms 1.2s 920ms
Each segment shows:
Neuron uses a static EventBus for monitoring all framework events.
All components emit events automatically:
use NeuronAI\Observability\EventBus;
// Workflows emit events like:
// - 'workflow-start'
// - 'workflow-resume'
// - 'workflow-end'
// - 'workflow-node-start'
// - 'workflow-node-end'
// - 'middleware-before-start'
// - 'middleware-after-end'
// - 'tool-calling'
// - 'tool-called'
// - 'rag-retrieving'
// - 'rag-retrieved'
// - 'inference-start'
// - 'inference-end'
use NeuronAI\Observability\ObserverInterface;
class CustomObserver implements ObserverInterface
{
public function handle(string $event, object $source, mixed $data): void
{
// Handle events
echo "Event: {$event}\n";
echo "Source: " . $source::class . "\n";
var_dump($data);
}
}
use NeuronAI\Observability\EventBus;
// Register globally
EventBus::observe(new CustomObserver());
// Or register via workflow/agent
$workflow->observe(new CustomObserver());
Create custom observers that maintain all default tracking:
use NeuronAI\Observability\InspectorObserver;
class MyInspectorObserver extends InspectorObserver
{
protected array $methodsMap = [
// Include parent mappings
...parent::$methodsMap,
// Add custom event mappings
'my-custom-event' => 'handleCustomEvent',
];
public function handleCustomEvent(object $source, string $event, mixed $data): void
{
$segment = $this->inspector->addSegment('custom', $event);
// Custom tracking logic
$this->trackCustomMetrics($data);
$segment->end();
}
private function trackCustomMetrics(mixed $data): void
{
// Your custom metrics
}
}
// Register before any execution
EventBus::setDefaultObserver(MyInspectorObserver::instance());
Symptoms: Agent ignores available tools
Diagnosis Steps:
// Add explicit tool instruction
protected function instructions(): string
{
return (string) new SystemPrompt(
background: [
"You have access to database tools to query user data.",
"Use the search_user tool when asked about users.",
]
);
}
Symptoms: High latency, slow responses
Diagnosis Steps:
Check Inspector timeline - identify slow segments
Common bottlenecks:
Optimization strategies:
// Enable parallel tool execution
$agent->parallelToolCalls(true);
Symptoms: Hallucinations, irrelevant responses
Diagnosis Steps:
Check Inspector - what context was provided?
Review LLM calls:
Common fixes:
// Improve retrieval quality
$rag->addPostProcessor(new RerankProcessor(
reranker: new CohereReranker($apiKey),
topK: 5
));
// Better system prompt
protected function instructions(): string
{
return (string) new SystemPrompt(
background: [
"You are a helpful assistant answering questions",
"about our product using only the provided context.",
],
steps: [
"Never make up information.",
"If you don't know, say so clearly.",
"Cite sources when possible.",
]
);
}
Symptoms: Agent tries to call tools but fails
Diagnosis Steps:
Check Inspector timeline - see error details
Verify tool configuration:
Add error handling:
class MyTool extends Tool
{
public function execute(array $arguments): mixed
{
try {
// Tool logic
return $result;
} catch (\Exception $e) {
// Return error in a format the LLM can understand
return [
'error' => $e->getMessage(),
'type' => get_class($e),
'hint' => 'Check your parameters and try again.',
];
}
}
}
use NeuronAI\Observability\LogObserver;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$logger = new Logger('neuron');
$logger->pushHandler(new StreamHandler('php://stdout'));
$agent->observe(new LogObserver($logger));
use NeuronAI\Observability\ObserverInterface;
class FileLogger implements ObserverInterface
{
private $file;
public function __construct(string $filepath)
{
$this->file = fopen($filepath, 'a');
}
public function handle(string $event, object $source, mixed $data): void
{
$timestamp = date('Y-m-d H:i:s');
$log = "[{$timestamp}] {$event} from {$source::class}\n";
fwrite($this->file, $log);
}
public function __destruct()
{
fclose($this->file);
}
}
use PHPUnit\Framework\TestCase;
class AgentTest extends TestCase
{
public function testAgentResponseQuality(): void
{
// Use fake provider for deterministic testing
$agent = new MyAgent(new FakeAIProvider([
'expected_response' => 'Helpful answer here'
]));
$response = $agent->chat(
new UserMessage('Test question')
)->getMessage();
$this->assertStringContainsString('key information', $response->getContent());
}
}
public function testToolExecution(): void
{
$tool = new MyTool();
$result = $tool->execute(['param' => 'value']);
$this->assertIsArray($result);
$this->assertArrayHasKey('result', $result);
}
Inspector provides detailed error analysis:
use NeuronAI\Workflow\EventBus;
use NeuronAI\Workflow\NodeInterface;
class TracingObserver implements ObserverInterface
{
public function handle(string $event, object $source, mixed $data): void
{
if ($source instanceof NodeInterface) {
echo "Node {$source::class}: {$event}\n";
}
}
}
EventBus::observe(new TracingObserver());
use NeuronAI\Workflow\Exporter\MermaidExporter;
$workflow->setExporter(new MermaidExporter());
$diagram = $workflow->export();
file_put_contents('workflow_diagram.mmd', $diagram);
When troubleshooting:
If issues persist:
development
Build custom Neuron AI workflows with nodes, events, middleware, and human-in-the-loop patterns. Use this skill whenever the user mentions workflows, orchestration, event-driven systems, custom agents, complex multi-step processes, human-in-the-loop patterns, or wants to build a custom agentic system from scratch. Also trigger for tasks involving node creation, event routing, workflow middleware, persistence, or interruption patterns.
tools
Create custom tools, toolkits, and MCP integrations for Neuron AI agents. Use this skill when the user mentions creating tools, building toolkits, extending Tool class, defining tool properties, implementing tool execution, MCP server integration, Model Context Protocol, connecting external tools, or tool guidelines. Also trigger for any task involving ToolProperty, ArrayProperty, ObjectProperty, AbstractToolkit, McpConnector, or StdioTransport/SseHttpTransport/StreamableHttpTransport.
tools
Write tests for Neuron AI agents, RAG systems, workflows, and tools using the built-in testing utilities. Use this skill when the user mentions testing agents, writing unit tests, mocking AI providers, testing tool execution, verifying RAG retrieval, testing workflow behavior, or creating test cases for Neuron AI components. Also trigger for any task involving PHPUnit tests, fake providers, test assertions, or quality assurance in Neuron AI projects.
data-ai
Design and implement structured output classes for Neuron AI agents using SchemaProperty attributes and validation rules. Use this skill when the user mentions structured output, JSON schema extraction, data validation, output classes, DTOs for AI responses, extracting structured data from LLM, or configuring property schemas. Also trigger for any task involving SchemaProperty attribute, validation rules like NotBlank/Email/Url, nested objects, arrays of objects, enums, polymorphic types with anyOf, or the Validator class.