dev-cli-development
БесплатноБез исполняемых скриптовНе проверенGuide for developing AIDB dev-cli commands and services. Covers Click framework patterns, service architecture, command development, decorators, error…
Об этом скилле
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
Установить dev-cli-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл dev-cli-development?
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.
Как установить скилл dev-cli-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dev-cli-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
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…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от 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…
от Anthropic