dev-cli-development
FreeNo executable scriptsNot checkedGuide for developing AIDB dev-cli commands and services. Covers Click framework patterns, service architecture, command development, decorators, error…
About this skill
Dev-CLI Development Guide
Purpose
The AIDB dev-cli (src/aidb_cli/) is a Click-based command-line interface for AIDB development workflows. This skill guides developers in:
- Adding new CLI commands and command groups
- Creating reusable services following BaseService pattern
- Using custom decorators (@handle_exceptions, @require_repo_context)
- Integrating with Docker, test, and adapter systems
- Following Click framework best practices
- Proper error handling and output formatting
When to Use This Skill
Auto-activates when:
- Editing files in
src/aidb_cli/ - Mentioning "dev-cli", "CLI command", "Click", "CliOutput"
- Adding commands, services, or CLI utilities
- Working with test orchestration or Docker integration
Related Skills
When developing CLI commands, you may also need:
- testing-strategy - CLI orchestrates test execution via test coordinator service
- code-reuse-enforcement - CLI must use existing constants and avoid magic strings
Architecture Overview
For comprehensive architecture details, see docs/developer-guide/cli-reference.md and source code in src/aidb_cli/.
Component Structure
src/aidb_cli/
├── commands/ # CLI command definitions (13 modules)
├── services/ # Business logic services (41+ files)
├── managers/ # High-level orchestration (singleton pattern)
├── core/ # Decorators, utilities, constants, param types
└── generators/ # Code generation for test scenarios
Key Patterns
- Commands - Thin wrappers that delegate to services
- Services - Reusable business logic with CommandExecutor
- Managers - Singleton orchestrators for complex workflows
- Context Injection - Dependencies via Click's
ctx.obj - Unified Error Handling -
@handle_exceptionsdecorator - Dynamic Parameter Types - Custom types with shell completion
Quick Start: Adding a Command
Step 1: Create Command File
Create src/aidb_cli/commands/mycommand.py:
"""My new command description."""
import click
from aidb_cli.core.decorators import handle_exceptions
from aidb_logging import get_cli_logger
logger = get_cli_logger(__name__)
@click.group(name="mycommand")
@click.pass_context
def group(ctx: click.Context) -> None:
"""Command group description."""
pass
@group.command()
@click.option("--option", "-o", help="Option description")
@click.pass_context
@handle_exceptions
def subcommand(ctx: click.Context, option: str) -> None:
"""Subcommand description."""
# Get dependencies from context
output = ctx.obj.output
repo_root = ctx.obj.repo_root
executor = ctx.obj.command_executor
# Delegate to service
from aidb_cli.services.myservice import MyService
service = MyService(repo_root, executor)
result = service.do_something(option)
# User-facing output (via OutputStrategy)
output.success(f"Done: {result}")
Step 2: Register Command
In src/aidb_cli/cli.py:
from aidb_cli.commands import mycommand
# In main CLI setup
cli.add_command(mycommand.group)
Step 3: Test
./dev-cli mycommand subcommand --option value
Command Development Patterns
Decorator Order (CRITICAL)
Always stack decorators in this exact order:
@group.command() # 1. Click command
@click.option("--opt", "-o") # 2. Options
@click.pass_context # 3. Context (BEFORE handle_exceptions)
@handle_exceptions # 4. Error handling (LAST)
def command(ctx: click.Context, opt: str) -> None:
"""Implementation."""
Wrong order causes cryptic errors!
Custom Parameter Types
Use custom types for validation and autocompletion:
from aidb_cli.core.param_types import TestSuiteParamType
@click.option("--suite", type=TestSuiteParamType(), required=True)
def command(ctx: click.Context, suite: str) -> None:
"""Command with validated suite parameter."""
Available: TestSuiteParamType, LanguageParamType, DockerProfileParamType, TestMarkerParamType
For comprehensive Click patterns, see click-framework-patterns.md:
- Decorator stacking rules explained
- All custom parameter types with examples
- Context management patterns
- Error handling with @handle_exceptions
- Command groups and subcommands
- Advanced Click patterns
Service Development Patterns
BaseService Pattern (Recommended)
Most services extend BaseService for consistent dependency injection and utilities:
from aidb_cli.managers.base.service import BaseService
class MyService(BaseService):
def __init__(self, repo_root: Path, command_executor=None, ctx=None):
super().__init__(repo_root, command_executor, ctx)
# Inherited: command_executor, resolved_env, logging methods, path utilities
def do_something(self) -> str:
self.log_info("Starting operation...")
return self.command
Install dev-cli-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 dev-cli-development skill do?
Guide for developing AIDB dev-cli commands and services. Covers Click framework patterns, service architecture, command development, decorators, error handling, CommandExecutor, CliOutput, BaseService, BaseManager patterns. Use when working with src/aidb_cli/, adding CLI commands, creating services, or integrating with Docker/test/adapter systems.
How do I install the dev-cli-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 dev-cli-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