> Use when building an Amplifier-powered workflow or automation tool and deciding how to expose it — as standalone .dot attractor pipelines (incl. inside the Resolve dot-graph resolver), an importable Python lib, agent-callable tool modules, or a CLI. Covers the four leverage levels, the DRY rule that keeps logic in ONE home, the judgment for which levels a real consumer actually needs (and when adding a level is just ceremony), and the maximally-DRY attractor-only specialization where the .dot pipeline is the sole logic home.
npx skills add https://github.com/microsoft/amplifier-bundle-skills --skill amplifier-tool-leverage-patterns
Problem: You've built a workflow/automation tool on Amplifier. Different consumers want to use it different ways — an attractor pipeline wants to compose it, a web app wants to import it, an agent wants to call it as a tool, a human wants a CLI. You don't want four copies of the logic.
Approach: Pick ONE home for the logic, then expose up to four leverage levels as *thin adapters* over that home. Build only the levels a real consumer demands.
| Level | Surface | Consumer | What it is |
|-------|---------|----------|------------|
| L1 | .dot attractor pipelines | Other pipelines / Resolve | One .dot per command + a shared subgraph (folder-shape), run on the loop-pipeline engine (amplifier-bundle-attractor) |
| L2 | Python lib | Other codebases | Each command an importable method; clean public API in __init__.py |
| L3 | Amplifier tool modules | Agents | bundle.md + modules/tool-<name>/ wrapping each command as an agent-callable tool |
| L4 | CLI | Humans / scripts | Thin click/argparse wrapper over the lib |
L1 — Standalone .dot attractor pipelines. One .dot per command, plus a shared subgraph factored out via a folder-shape node. Runs on the loop-pipeline engine anywhere — including inside the Amplifier Resolve dot-graph resolver: register a <name>.dot + <name>.resolver.yaml in the resolver's pipelines/ dir. Inside the graph, parallelogram nodes shell out to the tool's CLI (deterministic steps); box nodes are full LLM agents (synthesis steps). This is the level that lets your tool *compose into larger attractor flows*.
L2 — Python lib. Each command is an importable method. Export a deliberate public API from __init__.py. This is what lets another codebase embed the tool directly — e.g. a web app importing it rather than shelling out.
L3 — Amplifier tool modules. A bundle.md plus modules/tool-<name>/ exposing each command as an agent-callable tool. Obey the mount() Iron Law; keep each tool a thin wrapper over the lib (run blocking work via asyncio.to_thread). This is what lets an agent call your tool as a tool.
L4 — CLI. A thin click/argparse surface over the lib. Almost always worth it — it's the cheapest level and it's what L1's parallelogram nodes shell out to.
The logic lives in ONE place; every level is a thin adapter over it. Where "one place" is depends on the nature of the work:
.dot files. The prompts and graph *are* the logic. L2/L3/L4 orchestrate runs of those graphs..dot files are *thin orchestration that shells out to the CLI/lib*.Two failure modes to refuse:
.dot. If the core is deterministic, the .dot calls it — it does not reproduce it..dot. Keep dependencies behind their public CLI/subprocess boundary. Low coupling beats a fast path that reaches into someone else's internals.When one leverage-repo builds on another (repo-weaver on wiki-weaver), you'll reuse something across a repo boundary. Split the decision by cost and coupling:
.dot as a subgraph (L1). Never import its internals — this is failure mode #2 above.To import across repos without vendoring:
upstream @ git+https://…@main (companion repos usually aren't on PyPI). Hatchling needs [tool.hatch.metadata] allow-direct-references = true to build a wheel with a direct-URL dep.main first (so @main resolves the new symbols), then the downstream flips its pin and merges. Same producer→consumer ordering as any cross-repo change.Evidence: repo-weaver imports wiki-weaver's WIKI_DIR / _sources / path-helper constants exactly this way (single source of truth for corpus layout), while keeping the synthesis engine behind the subprocess boundary.
Do NOT build all four by default. Build the level a *real consumer* demands:
| Build... | When a real consumer needs... |
|----------|-------------------------------|
| L1 | Resolve / attractor composition |
| L2 | an app that will import it |
| L3 | an agent that will call it as a tool |
| L4 | almost always (cheapest; L1 shells out to it) |
Building a level "to complete the set" is over-engineering. Prove each level with a real consumer: L1 is proven by being *registered and RUN* in the resolver; L2 by an actual import; L3 by an agent invocation. A level that is never run by its consumer is ceremony — delete it or don't build it yet.
cli-packaging-patterns.repo-weaver demonstrates all four levels, each proven:
.dot pipeline ran end-to-end in the Resolve dot-graph resolver inside a DTU.tool-repo-weaver (3 tools), proven to return real cited output.repo-weaver crosses into wiki-weaver at two deliberately different boundaries. Its deterministic git→docs core lives in the lib; the heavy LLM synthesis engine stays behind wiki-weaver's CLI/subprocess boundary (never imported — low coupling). But the cheap, structural corpus-layout constants are a direct Python import from wiki-weaver's lib (wiki-weaver @ git+…@main), so layout has one source of truth instead of duplicated literals — guarded by a contract test that fails if the two drift. See "Sharing across repos without vendoring" above, and its ARCHITECTURE.md, for the boundary in detail.
MCP/REST service wrappers and self-hosted web UIs are natural further leverage levels over the same lib. Add them when a consumer needs them — same rule: prove the consumer first.
cli-packaging-patterns — how to build L4 (and the L2 packaging) cleanly.plugin-discovery-patterns — entry-point discovery for L3 tool modules and resolver pipelines.creating-amplifier-modules — the mount() Iron Law and module structure for L3.dot-patterns / dot-syntax — authoring the L1 .dot graphs (folder-shape subgraphs, parallelogram vs box nodes).Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take microsoft/amplifier-tool-leverage-patterns from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.