module-development
Skill12 starsChanged 7 months agoMITView on GitHub
Guide for creating new Amplifier modules including protocol implementation, entry points, mount functions, and testing patterns. Use when creating new modules or understanding module architecture.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 223
One responsibility per module: - Don't create mega-modules
- Distinctive: line 224
Config via mount(): - No hard-coded defaults in modules
- Distinctive: line 225
Async everywhere: - All I/O must be async
- Distinctive: line 227
Test at protocol level: - Test behavior, not internals
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Module Development Guide
Creating a New Module
Step 1: Choose Protocol
Determine which protocol your module implements:
- Tool: Agent capability (filesystem, bash, web, database)
- Provider: LLM backend (Anthropic, OpenAI, Ollama)
- Context: Conversation state management (simple, persistent)
- Orchestrator: Execution loop strategy (basic, streaming, events)
- Hook: Lifecycle observer (logging, approval, redaction)
Step 2: Implement Protocol
from typing import Any
from amplifier_core import ModuleCoordinator, ToolResult
class MyTool:
"""Tool for doing something useful."""
name = "my-tool"
description = "Does something useful"
def __init__(self: "MyTool", config: dict[str, Any]) -> None:
"""Initialize tool with configuration."""
self.config = config
self.timeout = config.get("timeout", 30)
@property
def input_schema(self: "MyTool") -> dict:
"""Return JSON schema for tool parameters."""
return {
"type": "object",
"properties": {
"param": {"type": "string", "description": "Parameter description"}
},
"required": ["param"]
}
async def execute(self: "MyTool", input: dict[str, Any]) -> ToolResult:
"""Execute tool operation."""
param = input.get("param")
if not param:
return ToolResult(
success=False,
error={"message": "param is required"}
)
# Implementation here
result = f"Processed: {param}"
return ToolResult(
success=True,
output={"result": result}
)Step 3: Create Mount Function
async def mount(coordinator: ModuleCoordinator, config: dict[str, Any] | None = None) -> None:
"""
Mount the tool module.
Args:
coordinator: Module coordinator providing infrastructure
config: Module configuration from profile
Returns:
Optional cleanup function
"""
config = config or {}
tool = MyTool(config)
await coordinator.mount("tools", tool, name=tool.name)
logger.info("Mounted MyTool")
returnStep 4: Register Entry Point
# pyproject.toml
[project]
name = "amplifier-module-tool-mytool"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = [
"amplifier-core",
]
[project.entry-points."amplifier.modules"]
tool-mytool = "amplifier_module_tool_mytool:mount"
[tool.uv.sources]
amplifier-core = { path = "../amplifier-core", editable = true }Module Structure
Required files:
amplifier-module-tool-mytool/
├── amplifier_module_tool_mytool/
│ ├── __init__.py # mount() + tool class
│ └── (optional modules)
├── tests/
│ └── test_mytool.py
├── pyproject.toml
├── Makefile
└── README.mdUsing Coordinator Infrastructure
The coordinator provides infrastructure context:
async def mount(coordinator: ModuleCoordinator, config: dict[str, Any] | None = None) -> None:
# Access infrastructure
session_id = coordinator.session_id # Current session
parent_id = coordinator.parent_id # Parent session (if child)
session_config = coordinator.config # Full session configuration
loader = coordinator.loader # Dynamic module loading
# Emit events
await coordinator.hooks.emit("module:mounted", {
"module_type": "tool",
"module_name": "my-tool"
})
# Register capabilities (optional)
coordinator.register_capability("my-tool.version", "1.0.0")
# Register cleanup (optional)
async def cleanup():
logger.info("Cleaning up MyTool")
coordinator.register_cleanup(cleanup)Testing Modules
Use TestCoordinator:
import pytest
from amplifier_core.testing import TestCoordinator
from amplifier_module_tool_mytool import mount
@pytest.mark.asyncio
async def test_tool_execution():
coordinator = TestCoordinator()
# Mount module
await mount(coordinator, {"timeout": 10})
# Get tool
tool = coordinator.get("tools", "my-tool")
assert tool is not None
# Execute
result = await tool.execute({"param": "test"})
assert result.success
assert "Processed: test" in result.output["result"]Common Patterns
Configuration Handling
class MyTool:
def __init__(self: "MyTool", config: dict[str, Any]) -> None:
# Required config
self.required = config.get("required_param")
if not self.required:
raise ValueError("required_param must be provided")
# Optional config with defaults
self.timeout = config.get("timeout", 30)
self.retries = config.get("retries", 3)Event Emission
async def execute(self: "MyTool", input: dict[str, Any]) -> ToolResult:
# Events emitted by orchestrator via hooks, not by tools directly
# Tools just return results
result = await self._process(input)
return ToolResult(success=True, output=result)Error Patterns
# Return error, don't raise
return ToolResult(
success=False,
error={"message": "Clear error message", "code": "ERROR_CODE"}
)
# Log for debugging
logger.error(f"Failed to process {input}: {e}")
return ToolResult(success=False, error={"message": str(e)})Remember
- One responsibility per module - Don't create mega-modules
- Config via mount() - No hard-coded defaults in modules
- Async everywhere - All I/O must be async
- Protocols not inheritance - Implement interface, don't inherit
- Test at protocol level - Test behavior, not internals
Other versions1 project uses a version of this.
Word for word · 1
- microsoft/amplifier-module-tool-skills★ 8100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- amplifier-philosophySkill
- python-standardsSkill
- adapt-skillSkill
- bet-sizerSkill
- bug-reportSkill
- code-reviewSkill
- council-hereSkill
- councilifySkill
- councilSkill
- cranky-old-samSkill
- create-demo-videoSkill
- crusty-old-engineerSkill
- engineering-patternsSkill
- image-visionSkill
- intent-keeperSkill
- mass-changeSkill
- monitorSkill
- outcome-cartographerSkill
- outcomistSkill
- personafySkill
- positioning-criticSkill
- product-council-hereSkill
- product-councilSkill
- restless-old-brianSkill
- retrospectiveSkill
- second-opinionSkill
- session-debugSkill
- skillifySkill
- skills-assistSkill
- tester-breakerSkill
- user-advocateSkill
- verification-disciplineSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

