skills/seam-audit/SKILL.md
Audit a codebase's module boundaries — enumerate modules, map their seams (import edges between modules), produce a layered topology diagram, and classify each module as narrow, hub-by-design, or accidental hub (with separate flags for cycles, layer violations, and uncertain import graphs). Outputs a diagram plus a flagged-for-review list; does not change code. Use when assessing whether abstractions live at the right boundaries, before/after a refactor to verify the boundaries improved, or when an unfamiliar codebase needs an architectural map. Not for intra-module refactoring (see improve-code-structure), bug hunting, or feature work.
npx skillsauth add shhac/skills seam-auditInstall 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.
Diagnostic pass over a codebase's boundaries — not the code inside modules, but the places where modules meet. The output is a map and a flagged list, never a change to the code.
The skill leans on three definitions. Use them explicitly when reporting:
A has an outgoing seam to B iff A imports B. B's incoming seam from A is the same edge viewed from the other side. Static import / require / use is the default surface; tricky cases (dynamic imports, DI, framework routing) are covered in references/import-graph-traps.md.The skill emits no file changes. If the audit's findings should be acted on, hand off to a refactor skill (e.g. improve-code-structure).
Four steps. Each produces an artifact the next consumes. Total length: typically 10-50 modules' worth of analysis, deliverable in one response.
The agent running the skill MAY parallelize step 2 if its platform supports concurrent file reads or grep. The procedure does not depend on parallelism — sequential execution is equivalent in correctness, only slower.
Decide what counts as a module for this run. In priority order:
src/ divided by purpose: src/auth/, src/payments/, etc.), default to those subsystems.If the chosen granularity produces more than ~50 modules, pause and ask the user to scope down (per the monorepo rule above).
Whatever you pick, state it explicitly in the first sentence of the report: "For this audit, a module is N."
For each module in scope:
export, Python __all__ / underscore convention, Go capitalized names, Rust pub, Java public classes, etc.import { a, b } from "x" = one seam to x, not two). Each external package counts as one outgoing seam (so import a from "react" + import b from "lodash" = two outgoing seams, displayed in the diagram and table collapsed under external:*).How to gather this:
import / require / use syntax: grep across the scope.references/import-graph-traps.md (dynamic imports, DI, framework routing, barrel re-exports, plugin systems, string-based resolvers): apply the rubric in that file. If the traces aren't determinable, flag the affected modules with uncertain-import-graph and add a Limitations line to the report.Record per module: { name, role, outgoing-seams[list-of-names], incoming-seams[list-of-names], out-count, in-count, notes }.
Produce a layered ASCII diagram following one explicit arrow convention:
A → BmeansA imports B. Place callers / entry surfaces at the top. Place foundations / dependencies at the bottom. Most arrows point downward.
Layer rule (plain language):
Dependencies should point downward toward more foundational modules. An import that points upward (a foundational module importing an application module) is a
layer-violationflag.
Cycles:
Draw small cycles (≤4 modules) inline:
A → B → C → A. Collapse larger cycles as a labeled node (cycle group: A/B/C/D) and list the full path in the flagged-list entry.
Cross-cuts (modules consumed across many layers — types, design system, foundational helpers):
Draw as a separate band at the bottom or as labeled side-gutter arrows. Don't thread them through the main vertical flow.
The diagram is the most useful artifact this skill produces — invest in making it readable. If it doesn't fit on a single screen, either summarize (collapse layers into groups) or pause and ask the user to narrow scope. Do not silently narrow scope mid-run.
Full diagram conventions + a sample skeleton: references/output-format.md.
Each module gets one classification + zero or more flags. These are two independent axes — a module can be hub-by-design AND in a cycle.
Classifications (pick exactly one):
Flags (zero or more, additive):
cycle — module is part of an import cycle.layer-violation — module imports upward.external-heavy — most outgoing seams target external packages, not in-scope modules.uncertain-import-graph — static analysis is incomplete for this module (see references/import-graph-traps.md). The classification is best-effort.Thresholds depend on granularity and project idioms. Pick a cutoff for the run and state it in the report:
outgoing >5 or incoming >10 is a candidate for the hub bucket.outgoing >3 or incoming >6.Adjust to outliers for this codebase. The skill's job is the flagging; the fix lives in a refactor skill.
Single report with the sections specified in references/output-format.md § Required sections, in order:
references/output-format.md)accidental hub classification OR any flag besides external-heavy. Each entry: 1-2 sentences explaining why it's flagged + a direction for follow-up (not an implementation plan).If there's nothing flagged: "The boundaries are intentional — nothing flagged." That's the most useful possible outcome.
Follow-up direction examples:
dateAdd and dateSubtract into a new file time-helpers.ts, update imports in foo.ts and bar.ts, …" — that's a refactor plan; hand off to improve-code-structure instead.references/import-graph-traps.md before reporting — DI / dynamic imports / framework routing can hide significant seams.improve-code-structure if changes are desired.testing
Investigate and solve problems using a team of specialist agents. Use when facing complex, multi-faceted problems that benefit from parallel research and structured implementation.
tools
Sync a forked repository with its upstream. Fetches both remotes, shows divergence, resets shared branches to upstream, re-merges local-only branches, cleans up branches already merged upstream, and pushes. Use when upstream has accepted PRs or moved ahead and you need to bring your fork in line.
data-ai
Manage stacked branches — rebase cascades, detect landed PRs, show stack status. Use when branches are stacked (B on A on main), trunk has advanced, a mid-stack branch changed, or a PR has landed and descendants need rebasing. Lightweight alternative to Graphite that infers the stack from git history.
development
Repeatedly invokes a target skill until its output settles — meaning the target makes no further substantive changes or recommendations. Detects cycles (oscillation between two or more states) and stalls (inner skill keeps recommending but changes don't land) and handles each appropriately. Optionally chains to a follow-up skill after settling. Use when one pass of a skill is rarely enough and each pass tends to uncover more work until eventually there's none — e.g. "repeat-until-settled improve-code-structure then release".