skills/amplifier-tool-leverage-patterns/SKILL.md
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 skillsauth add microsoft/amplifier-bundle-skills amplifier-tool-leverage-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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).tools
Plan a batch of independent work into isolated lanes, get your approval, then run each lane as its own autonomous /goal session — one git worktree, one branch, one tmux session each — and verify and merge the results yourself. Use when work decomposes into pieces that can run at the same time: "run these in parallel", "goal-batch", "launch lanes for these", "work these N tasks simultaneously", "batch these as goals". Nothing launches until you have seen the lane split and said go. This is NOT fire-and-forget: the orchestrating session re-runs the full test suite itself after every merge and never accepts a lane's own claim that it finished. NOT for bounded edits that each end in their own PR — use mass-change for that. Requires git, tmux, the amplifier CLI on PATH, and the goalify and monitor skills.
development
Momentum-driven engineering reviewer that holds one uncompromising gate — is it REAL, proven end-to-end as a user would — while driving work forward. Demands proof over claims, plumbing before polish, fail-loud over fallbacks, trust in the model over instructions, and protects the critical path so good-but-costly ideas don't stall the work. Warm, blunt, forward-driving — not a curmudgeon. A lens for any checkpoint — brainstorm, design, plan, implement, debug, or ship — not just the finish. Use when: pressure-testing whether an idea/design/plan is provable and on the critical path, whether you're building in the right order, whether a fix is real or a band-aid, or whether work is actually done/ready — any time the worry is "are we fooling ourselves about what's real?"
development
Convene the Product Development Council (six orthogonal product-delivery lenses, anchored by a mandatory problem-validation gate) on a target — cold independent fan-out, debate-to-consensus, synthesized verdict with recorded dissent and a roster manifest.
development
Convene the Product Development Council on the CURRENT conversation / work-in-progress — the plan, roadmap, or scope decision you've been building in this session. The INLINE counterpart to /product-council (which forks and runs isolated, so it cannot see the chat). Use when you want the council to critique what we're working on right now.