AgentSkillsCN

lobster-dev

致力于 Lobster AI——这一多智能体生物信息学引擎的开发、扩展与贡献。 适用于在 Lobster 代码库中开展工作、创建智能体或服务、深入理解架构、修复漏洞、新增功能,或为开源项目贡献力量时使用。 重要提示:在创建新智能体或新软件包之前,请务必先遵循规划流程(详见“在动手构建之前”)。 触发短语: “添加智能体”、“创建服务”、“扩展 Lobster”、“贡献”、“理解架构”、“Lobster 中 X 的运行机制”、“修复漏洞”、“新增功能”、“编写测试”、“Lobster 开发”、“智能体开发”、“生物信息学代码”、“为…构建新智能体”、“新增支持”、“创建插件”、“新领域”

SKILL.md
--- frontmatter
name: lobster-dev
description: |
  Develop, extend, and contribute to Lobster AI — the multi-agent bioinformatics engine.
  Use when working on Lobster codebase, creating agents/services, understanding architecture,
  fixing bugs, adding features, or contributing to the open-source project.

  IMPORTANT: Before creating new agents or packages, ALWAYS follow the planning
  workflow first (see "Before You Build").

  Trigger phrases: "add agent", "create service", "extend lobster", "contribute",
  "understand architecture", "how does X work in lobster", "fix bug", "add feature",
  "write tests", "lobster development", "agent development", "bioinformatics code",
  "build a new agent for", "add support for", "create plugin", "new domain"

Lobster AI Development Guide

Lobster AI is a multi-agent bioinformatics platform using LangGraph for orchestration. This skill teaches you how to work with, extend, and contribute to the codebase.

Quick Navigation

TaskDocumentation
Planning new capabilitiesreferences/planning-workflow.md
Domain knowledge (bioSkills)references/bioskills-bridge.md
Architecture overviewreferences/architecture.md
Plugin architecture (omics types, providers, adapters)references/plugin-architecture.md
Creating new agentsreferences/creating-agents.md
Creating new servicesreferences/creating-services.md
Code layout & finding filesreferences/code-layout.md
Testing patternsreferences/testing.md
CLI referencereferences/cli.md

Before You Build

STOP. Before creating any new agent, service, or package, follow this workflow.

PhasePurpose
1. Understand NeedStructured Q&A -- what domain, workflow, tools, data formats
2. Check What ExistsDynamically scan Lobster packages + core services for overlap
3. Find Domain KnowledgeDynamically discover relevant bioSkills for the domain
4. Present FindingsShow developer what exists vs. what's missing
5. Recommend ApproachExtend existing vs. new package vs. service-only vs. not Lobster
6. Build & TestApply lobster-dev patterns with domain knowledge

Full workflow details: references/planning-workflow.md

Skip this if: fixing a bug, adding a tool to an existing agent, or working on core infrastructure. This workflow is for NEW capabilities only.

Critical Rules

  1. ComponentRegistry is truth — Agents discovered via entry points, NOT hardcoded
  2. AGENT_CONFIG at module top — Define before heavy imports for <50ms discovery
  3. Services return 3-tuple(AnnData, Dict, AnalysisStep) always
  4. Always pass irlog_tool_usage(..., ir=ir) for reproducibility
  5. No lobster/__init__.py — PEP 420 namespace package

Package Structure

code
lobster/
├── packages/                    # Agent packages (PEP 420)
│   ├── lobster-transcriptomics/ # transcriptomics_expert, annotation_expert, de_analysis_expert
│   ├── lobster-research/        # research_agent, data_expert_agent
│   ├── lobster-visualization/   # visualization_expert
│   ├── lobster-metadata/        # metadata_assistant
│   ├── lobster-structural-viz/  # protein_structure_visualization_expert
│   ├── lobster-genomics/        # genomics_expert
│   ├── lobster-proteomics/      # proteomics_expert
│   └── lobster-ml/              # machine_learning_expert
└── lobster/                     # Core SDK
    ├── agents/supervisor.py     # Supervisor (stays in core)
    ├── agents/graph.py          # LangGraph builder
    ├── core/                    # Infrastructure (registry, data_manager, provenance)
    ├── services/                # Analysis services
    └── tools/                   # Agent tools

Quick Commands

bash
# Setup (development)
make dev-install              # Full dev setup with editable install
make test                     # Run all tests
make format                   # black + isort

# Setup (end-user testing via uv tool)
uv tool install 'lobster-ai[full,anthropic]'   # Install as users see it
uv tool upgrade lobster-ai                      # Upgrade to latest

# Running
lobster chat                  # Interactive mode
lobster query "your request"  # Single-turn

# Testing
pytest tests/unit/            # Fast unit tests
pytest tests/integration/     # Integration tests

Service Pattern (Essential)

All services return a 3-tuple:

python
def analyze(self, adata, **params) -> Tuple[AnnData, Dict, AnalysisStep]:
    # Your analysis logic
    stats = {"n_cells": adata.n_obs, "status": "complete"}
    ir = AnalysisStep(
        activity_type="analyze",
        inputs={"n_obs": adata.n_obs},
        outputs=stats,
        params=params
    )
    return processed_adata, stats, ir

Tools wrap services:

python
@tool
def analyze_modality(modality_name: str, **params) -> str:
    result, stats, ir = service.analyze(adata, **params)
    data_manager.log_tool_usage("analyze", params, stats, ir=ir)  # IR mandatory!
    return f"Complete: {stats}"

Agent Registration (Entry Points)

Agents register via pyproject.toml:

toml
[project.entry-points."lobster.agents"]
my_agent = "lobster.agents.my_domain.my_agent:AGENT_CONFIG"

AGENT_CONFIG must be defined at module top (before imports):

python
# lobster/agents/mydomain/my_agent.py
from lobster.config.agent_registry import AgentRegistryConfig

AGENT_CONFIG = AgentRegistryConfig(
    name="my_agent",
    display_name="My Expert Agent",
    description="What this agent does",
    factory_function="lobster.agents.mydomain.my_agent.my_agent",
    handoff_tool_name="handoff_to_my_agent",
    handoff_tool_description="Assign tasks for my domain analysis",
    tier_requirement="free",  # All official agents are free
)

# Heavy imports AFTER config
from lobster.core.data_manager_v2 import DataManagerV2
# ... rest of implementation

Key Files

FilePurpose
lobster/agents/graph.pyLangGraph orchestration
lobster/core/component_registry.pyAgent + plugin discovery (7 entry point groups)
lobster/core/omics_registry.pyOmics type metadata, DataTypeDetector
lobster/core/data_manager_v2.pyData/workspace management
lobster/core/provenance.pyW3C-PROV tracking
lobster/cli.pyCLI implementation

Online Documentation

Full documentation at docs.omics-os.com (or local docs-site/):

  • Getting Started: docs/getting-started/
  • Core SDK: docs/core/
  • Agents: docs/agents/
  • Developer Guide: docs/developer/
  • API Reference: docs/api-reference/

Common Tasks

Adding a New Agent

  1. Create package: packages/lobster-mydomain/
  2. Define AGENT_CONFIG at top of agent file
  3. Register entry point in pyproject.toml
  4. Implement agent with tools
  5. Add tests in tests/unit/agents/

See references/creating-agents.md for full guide.

Adding a New Service

  1. Create service class in appropriate package
  2. Implement 3-tuple return pattern
  3. Wrap in tool with log_tool_usage
  4. Add unit tests

See references/creating-services.md for full guide.

Adding a New Omics Type (Plugin)

  1. Define OmicsTypeConfig with detection keywords, preferred databases, QC thresholds
  2. Create adapter factory functions → register via lobster.adapters entry point
  3. Create provider class (if new database) → register via lobster.providers entry point
  4. Create download service + queue preparer → register via entry points
  5. Register OmicsTypeConfiglobster.omics_types entry point
  6. Zero core changes needed — everything via pyproject.toml entry points

See references/plugin-architecture.md for full guide with code examples.

Understanding Data Flow

code
User Query → CLI → LobsterClientAdapter → AgentClient
                                              ↓
                            LangGraph (supervisor → agents)
                                              ↓
                               Services → DataManagerV2
                                              ↓
                                    Results + Provenance

Testing

bash
# Unit tests (fast, no external deps)
pytest tests/unit/ -v

# Integration tests (may need env vars)
pytest tests/integration/ -v

# Specific test
pytest tests/unit/test_my_feature.py -v

# With coverage
pytest --cov=lobster tests/

Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/my-feature
  3. Make changes following patterns above
  4. Run tests: make test
  5. Format code: make format
  6. Submit PR with clear description