Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

adapter-development

FreeNo executable scriptsNot checked

Comprehensive guide for AIDB debug adapter development. Covers component-based architecture, language-specific patterns (Python/debugpy…

ai-debugger-incby ai-debugger-inc★ 22 GitHub stars6 installs in other catalogs

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

  1. Component Delegation: Adapters delegate to focused components (ProcessManager, PortManager, LaunchOrchestrator)
  2. Lifecycle Hooks: Customize behavior via hooks rather than overriding entire methods
  3. Resource Management: Centralized cleanup via ResourceManager
  4. Human-Cadence Debugging: Operations happen at human speed, not API speed
  5. 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:

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)

#
Full SKILL.md on GitHub

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
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

resources/java-adapter-patterns.mdresources/javascript-adapter-patterns.mdresources/python-adapter-patterns.md

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

Compare adapter-development with