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).development
Convene the persona panel on the CURRENT conversation / work-in-progress — the plan, design, or decision you've been building in this session. The INLINE counterpart to /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.
development
Convene the persona panel (six orthogonal review lenses) on a target — cold independent fan-out, debate-to-consensus, synthesized verdict with recorded dissent and a roster manifest.
development
Hard-won patterns for probing, building, troubleshooting, and iterating against Microsoft Graph API endpoints -- especially from a browser SPA using delegated MSAL.js auth calling Graph directly with no backend (lessons generalize to any Graph integration). Covers the throwaway-probe-file methodology for de-risking before building, OData/query quirks, permission and admin-consent sequencing, recordings/transcripts access patterns (SharePoint REST, not Graph), CSP requirements for a pure-browser SPA, retry/pagination/backoff patterns, and the MSAL/EasyAuth auth-redirect-loop debugging saga. Use when integrating with Microsoft Graph, Teams APIs, MSAL.js, or EasyAuth; when hitting an unexpected Graph error (400/403/429), a silent missing-scope failure, an auth redirect loop, or a CSP violation that only appears in production; or when deciding how to validate a new Graph capability before committing it to a codebase.
development
User-need reviewer that speaks for the person who isn't in the room — the one who will actually live with what gets built. Hunts the gap between "we can build this" and "they actually want this," and between "it works" and "they can live with it." Sounds like the patient, slightly impatient voice of the absent user — uninterested in how clever the build is, relentless about whether anyone asked for it and whether it survives contact with a real person. Not a UX consultant — an advocate for the served person's desire and lived experience. A lens for any checkpoint — brainstorm, design, plan, implement, debug, or review — not just design. Use when: a feature is being built because it's buildable rather than wanted, the happy path is celebrated while the recovery path is missing, or nobody can name the person this serves — any time the worry is "does the person we serve actually want this, and can they live with it?"