adapter-development
FreeNo executable scriptsNot checkedComprehensive guide for AIDB debug adapter development. Covers component-based architecture, language-specific patterns (Python/debugpy…
About this skill
AIDB Adapter Development Skill
Executive Summary
AIDB debug adapters provide language-agnostic debugging capabilities through the Debug Adapter Protocol (DAP). The architecture is component-based - adapters delegate to specialized components rather than implementing everything in monolithic classes.
For comprehensive architecture details, see docs/developer-guide/overview.md for the complete system architecture and data flow diagrams.
Core Architecture
DebugAdapter (base class)
├── ProcessManager - Process lifecycle (launch, monitor, stop, cleanup)
├── PortManager - Port acquisition, verification, release
├── LaunchOrchestrator - Launch sequence coordination
├── TargetResolver - Target type detection and normalization
├── SourcePathResolver - Source path resolution for remote debugging
└── AdapterHooksMixin - Lifecycle hooks for extension points
Key Principles
- Component Delegation: Adapters delegate to focused components (ProcessManager, PortManager, LaunchOrchestrator)
- Lifecycle Hooks: Customize behavior via hooks rather than overriding entire methods
- Resource Management: Centralized cleanup via ResourceManager
- Human-Cadence Debugging: Operations happen at human speed, not API speed
- Language-Agnostic Interface: Same Python interface works across Python, JavaScript, Java
Resource Files
This skill is organized into focused resource files for language-specific patterns:
- python-adapter-patterns.md - debugpy configuration, module vs script patterns
- javascript-adapter-patterns.md - vscode-js-debug, child sessions, Node.js patterns
- java-adapter-patterns.md - java-debug + JDT LS integration, compilation
Related Skills
When working on adapter development, you may also need:
- dap-protocol-guide - Adapters heavily rely on DAP protocol types and request/response patterns
- testing-strategy - Adapters must be tested using E2E patterns with DebugInterface abstraction
- code-reuse-enforcement - Always check for existing utilities before implementing adapter components
Quick Start: Creating a New Adapter
from aidb.adapters.base import DebugAdapter
from aidb.adapters.base.config import AdapterConfig
class MyLanguageAdapter(DebugAdapter):
"""My language debug adapter using component architecture."""
def __init__(self, session, ctx=None, config=None, **kwargs):
if config is None:
config = MyLanguageConfig()
super().__init__(
session=session,
ctx=ctx,
config=config,
**kwargs
)
# Register language-specific hooks
self._register_my_language_hooks()
def _register_my_language_hooks(self):
"""Register language-specific lifecycle hooks."""
self.register_hook(
LifecycleHook.PRE_LAUNCH,
self._validate_environment,
priority=90 # High priority = runs first
)
async def _validate_environment(self, context: HookContext):
"""Pre-launch hook to validate environment."""
# Validation logic here
pass
async def _build_launch_command(self, target, adapter_host,
adapter_port, args=None):
"""Build the command to launch the debug adapter."""
return [
"/path/to/debug/adapter",
"--host", adapter_host,
"--port", str(adapter_port),
target
]
def _add_adapter_specific_vars(self, env: dict) -> dict:
"""Add language-specific environment variables."""
env["MY_LANG_DEBUG"] = "1"
return env
def _create_target_resolver(self) -> "TargetResolver":
"""Create language-specific target resolver."""
return MyLanguageTargetResolver(adapter=self, ctx=self.ctx)
def _create_source_path_resolver(self) -> "SourcePathResolver":
"""Create language-specific source path resolver for remote debugging."""
return MyLanguageSourcePathResolver(adapter=self, ctx=self.ctx)
def _get_process_name_pattern(self) -> str:
"""Get process name pattern for cleanup."""
return "my-language-debug"
Component Access Patterns
ProcessManager Usage
See ProcessManager in src/aidb/adapters/base/components/process_manager.py for full implementation.
from aidb.resources.process_tags import ProcessType
# Launch subprocess with session tagging
proc = await self._process_manager.launch_subprocess(
cmd=cmd,
env=env,
session_id=self.session.id,
language=self.config.language,
process_type=ProcessType.ADAPTER, # String constant: "adapter", "debuggee", or "lsp_server"
kwargs={}
)
# Wait for adapter readiness
await self._process_manager.wait_for_adapter_ready(port, start_time)
#
Install adapter-development in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the adapter-development skill do?
Comprehensive guide for AIDB debug adapter development. Covers component-based architecture, language-specific patterns (Python/debugpy, JavaScript/vscode-js-debug, Java/java-debug), lifecycle hooks, process management, port management, launch orchestration, resource cleanup, child sessions, and common pitfalls. Essential for developing or maintaining AIDB debug adapters.
How do I install the adapter-development skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the adapter-development skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic