Agent skill

Polylith Migrate Analyze Imports

by DavidVujic in DavidVujic/python-polylith

[Internal sub-skill of polylith-migrate-orchestrator. An agent skill from DavidVujic/python-polylith.

MITAuto-check passed

Install Polylith Migrate Analyze Imports

skills CLI
$ npx skills add DavidVujic/python-polylith --skill polylith-migrate-analyze-imports -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install DavidVujic/python-polylith polylith-migrate-analyze-imports --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/DavidVujic/python-polylith.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/polylith/migrate-project/polylith-migrate-analyze-imports .claude/skills/polylith-migrate-analyze-imports && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
polylith-migrate-analyze-imports
GitHub stars
554
Token cost
~1.3k tokens
SKILL.md length
560 words
Files
1
Skills in repo
37
Repo updated
First seen
Licence
MIT

At a glance

[Internal sub-skill of polylith-migrate-orchestrator. An agent skill from DavidVujic/python-polylith.

  • Works in 4 steps: Identify references to the original… → List symbols exported by the original… → Decide the rewrite strategy… → …
  • SKILL.md covers Goal, Inputs, The three reference forms… and Steps, plus 3 more sections
  • Calls git

What it does

Polylith Migrate Analyze Imports is an agent skill from DavidVujic/python-polylith. [Internal sub-skill of polylith-migrate-orchestrator. Do not load directly — load polylith-migrate-orchestrator first, which drives all phases.] Analyze the project's import graph to find how the original namespace is referenced, choose the namespace-rewrite strategy (shim vs shimless), detect circular imports, and list symbols exported by the original namespace.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Tooling support for the Polylith Architecture in Python. The licence is MIT.

Example prompts

  • “/polylith-migrate-analyze-imports”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Identify references to the original namespace
  2. List symbols exported by the original namespace
  3. Decide the rewrite strategy (SHIM_STRATEGY)
  4. Detect potential circular imports

What it can do on your machine

Read from SKILL.md and the folder at commit a7a80f2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Polylith Migrate Analyze Imports loads about 1.3k tokens when it runs. Until then it costs about 101 tokens; SKILL.md has 560 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~101
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from DavidVujic/python-polylith at commit a7a80f2, republished under its MIT licence (© DavidVujic). 560 words, ~1,299 tokens.

Download SKILL.mdSave it as .claude/skills/polylith-migrate-analyze-imports/SKILL.md (or your agent's skills folder).
name
polylith-migrate-analyze-imports
description
[Internal sub-skill of `polylith-migrate-orchestrator`. Do not load directly — load `polylith-migrate-orchestrator` first, which drives all phases.] Analyze the project's import graph to find how the original namespace is referenced, choose the namespace-rewrite strategy (shim vs shimless), detect circular imports, and list symbols exported by the original namespace.

Skill: polylith-migrate-analyze-imports

Goal

Analyze the project's import graph to:

  1. Find every reference to the original namespace (in all three forms — see below).
  2. Choose the namespace-rewrite strategy: SHIM_STRATEGY=shim|shimless.
  3. List symbols exported by the original namespace's __init__.py.
  4. Detect potential circular imports.

This drives the namespace rewrite (phase 4) and, when SHIM_STRATEGY=shim, the shim sub-track (phase 4b). See the polylith-migrate-orchestrator table for phase numbers.

Inputs

  • Project name (from migration/<project-name>/state.md)
  • Original namespace ORIG_TOP_NS (from migration/<project-name>/state.md)

The three reference forms (cover all of them)

A namespace rewrite is incomplete unless it covers every form below. A naive "replace from <ns>. " misses forms 2 and 3:

  1. Dotted import — from ${ORIG_TOP_NS}.<sub> import …, import ${ORIG_TOP_NS}.<sub>.
  2. Bare submodule import — from ${ORIG_TOP_NS} import <sub> — single, multi-name (a, b, c), and mixed lines where only some names move. Easy to miss: there is no dot after the namespace.
  3. Quoted string module paths — mock.patch("${ORIG_TOP_NS}.x.Y"), logging dict-config "${ORIG_TOP_NS}.logging.HealthFilter", importlib / getattr targets. Not import statements, but they must be rewritten too.

⚠ Do not rewrite unquoted local variables that merely share a name with the namespace (e.g. a FastAPI app = FastAPI() instance's app.include_router(...)). Target import statements and quoted module paths only.

Steps

1. Identify references to the original namespace
  1. Search for all three forms above across all .py files in the project (and pyproject.toml / config files for string paths).
  2. Record the paths and statements in migration/${PROJECT}/import_analysis.md, grouped as: internal (inside ${ORIG_TOP_NS}/), external consumers (entrypoints, alembic, scripts), and tests. The external + test groups are what the strategy decision below hinges on.
2. List symbols exported by the original namespace
  1. Inspect ${ORIG_TOP_NS}/__init__.py (typically projects/${PROJECT}/src/${ORIG_TOP_NS}/__init__.py or projects/${PROJECT}/${ORIG_TOP_NS}/__init__.py) and list public symbols (not starting with _).
  2. Record them, and note whether __init__.py is effectively empty (docstring only).
Show full SKILL.md (272 more words)Show less
3. Decide the rewrite strategy (SHIM_STRATEGY)

Choose based on the findings and record it in state.md:

  • shimless — when imports are predominantly submodule-qualified (from ${ORIG_TOP_NS}.<sub> import … / from ${ORIG_TOP_NS} import <sub>) and ${ORIG_TOP_NS}/__init__.py exports little or nothing. A single top-level re-export shim would resolve none of those submodule paths, and a full package shim mirroring every module is high-effort/high-risk. Phase 4 rewrites all references (internal + external + tests) directly to the new namespace, and the phase 4b sub-track is skipped.
  • shim — when consumers import top-level symbols (from ${ORIG_TOP_NS} import X) that a single ${ORIG_TOP_NS}/__init__.py re-export can satisfy, and you want to defer rewriting external consumers. Run the phase 4b sub-track after phase 4.
  • When in doubt, prefer shimless — it leaves no transitional shim to remove later (the definition-of-done forbids undocumented shims), at the cost of a wider but mechanical rewrite. Confirm with the user if the consumer surface is large.

Record:

SHIM_STRATEGY=<shim|shimless>
4. Detect potential circular imports
  1. Inspect the import graph for cycles — especially base ↔ shim once a shim is in place (shim strategy only).
  2. Record any chains in import_analysis.md. A pure namespace rename (shimless) preserves the original graph, so cycles there usually mean the project already had them.

Output

  • migration/<project-name>/import_analysis.md with: references by form & group, exported symbols, the chosen strategy + rationale, and circular-import chains (if any).
  • SHIM_STRATEGY set in migration/<project-name>/state.md.

Verify

  1. migration/<project-name>/import_analysis.md exists and is not empty.
  2. It records all three reference forms, the exported symbols, and any cycles.
  3. SHIM_STRATEGY is set in state.md (shim or shimless) with a recorded rationale.

Commit

bash
git add migration/${PROJECT}/import_analysis.md migration/${PROJECT}/state.md
git commit -m "migrate(${PROJECT}): phase <N> — analyze-imports"

<N> is this phase's number from the polylith-migrate-orchestrator table (the single source of truth) — do not hardcode it.

© DavidVujic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/polylith/migrate-project/polylith-migrate-analyze-imports of DavidVujic/python-polylith.

Open the folder on GitHubat commit a7a80f2

Compare with similar skills

Polylith Migrate Analyze Imports next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Polylith Migrate Analyze Imports compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Polylith Migrate Analyze Imports this skillDavidVujic/python-polylith554—~1.3kAutomated safety check: PassMIT
Migrate Internal Package into GhostTryGhost/Ghost56k—~3.8kAutomated safety check: PassMIT
Reversible MigrationJuliusBrussee/caveman111k1 repos~196Automated safety check: PassApache-2.0
Importasgeirtj/system_prompts_leaks69k—~3.5kAutomated safety check: PassCC0-1.0
Database Migrationsaffaan-m/ECC276k4 repos~3kAutomated safety check: PassMIT
Database Migrationsaffaan-m/ECC276k1 repos~2.4kAutomated safety check: PassMIT

Similar skills

  • Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.

    56k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Reversible Migration

    JuliusBrussee/caveman

    Implement reversible compatibility-safe transitions. Use for schema, data, API, protocol, configuration, or dependency migrations requiring rollback and…

    111k GitHub starsUsed in 1 repo~196 tokens
    DevelopmentAuto-check passed
  • Import

    asgeirtj/system_prompts_leaks

    Handle explicit /import requests for read-only transcript recovery and a resume checkpoint, or continue work from other coding agents and unnamed artifacts.

    69k GitHub stars~3.5k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL…

    276k GitHub starsUsed in 4 repos~3k tokens
    DatabasesAuto-check passed
  • Şema değişiklikleri, veri migration'ları, rollback'ler ve PostgreSQL, MySQL ve yaygın ORM'ler (Prisma, Drizzle, Django, TypeORM, golang-migrate) arasında sıfır kesinti deployment'ları için…

    276k GitHub starsUsed in 1 repo~2.4k tokens
    DatabasesAuto-check passed
  • Od Code Migration

    nexu-io/open-design

    Default reference pipeline for the code-migration taskKind — code-import → design-extract → token-map → rewrite-plan → patch-edit ↔ build-test devloop → diff-review → handoff.

    100k GitHub stars~378 tokensUpdated today
    DevelopmentAuto-check passed

More from DavidVujic/python-polylith

All 37 skills in this repo
  • Polylith Base Creation

    DavidVujic/python-polylith

    Create a Polylith base with poly create base — the entry point of a deployable application (HTTP API, CLI, message-queue consumer, AWS Lambda handler, GCP Cloud Function, scheduled job).

    554 GitHub stars~757 tokensUpdated 5 days ago
    Auto-check passed
  • Polylith Check

    DavidVujic/python-polylith

    Validate a Polylith workspace with poly check — the canonical CI gate.

    554 GitHub stars~972 tokensUpdated 5 days ago
    Auto-check passed
  • Polylith Component Creation

    DavidVujic/python-polylith

    Create a Polylith component with poly create component — a reusable, isolated brick implementing business logic, a feature, a domain module, or a capability.

    554 GitHub stars~800 tokensUpdated 5 days ago
    Auto-check passed
  • Polylith Dependency Management

    DavidVujic/python-polylith

    Add or manage third-party dependencies in a Polylith workspace.

    554 GitHub stars~643 tokensUpdated 5 days ago
    Auto-check passed
  • Polylith Dependency Visualization

    DavidVujic/python-polylith

    Visualize brick × brick dependencies with poly deps — find circular dependencies, inspect a brick's public interface, and detect interface-bypass violations.

    554 GitHub stars~906 tokensUpdated 5 days ago
    Auto-check passed
  • Polylith Diff

    DavidVujic/python-polylith

    List Polylith bricks whose implementation changed since a git tag using poly diff.

    554 GitHub stars~1.1k tokensUpdated 5 days ago
    Auto-check passed

Questions about Polylith Migrate Analyze Imports

What does Polylith Migrate Analyze Imports do?

[Internal sub-skill of polylith-migrate-orchestrator. An agent skill from DavidVujic/python-polylith. Polylith Migrate Analyze Imports is an agent skill from DavidVujic/python-polylith. [Internal sub-skill of polylith-migrate-orchestrator.

How do I install Polylith Migrate Analyze Imports in Claude Code?

Run `npx skills add DavidVujic/python-polylith --skill polylith-migrate-analyze-imports -a claude-code`. Or copy the skill folder (.agents/skills/polylith/migrate-project/polylith-migrate-analyze-imports in DavidVujic/python-polylith) into .claude/skills/polylith-migrate-analyze-imports in your project. Claude Code loads it when a task matches its description.

How do I install Polylith Migrate Analyze Imports in Codex?

Run `npx skills add DavidVujic/python-polylith --skill polylith-migrate-analyze-imports -a codex`. Or copy the skill folder (.agents/skills/polylith/migrate-project/polylith-migrate-analyze-imports in DavidVujic/python-polylith) into .agents/skills/polylith-migrate-analyze-imports in your project. Codex loads it when a task matches its description.

Can I use Polylith Migrate Analyze Imports in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add DavidVujic/python-polylith --skill polylith-migrate-analyze-imports -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/polylith-migrate-analyze-imports, .gemini/skills/polylith-migrate-analyze-imports, .github/skills/polylith-migrate-analyze-imports and .opencode/skills/polylith-migrate-analyze-imports in your project.

What does Polylith Migrate Analyze Imports need to run?

Going by SKILL.md and its folder, Polylith Migrate Analyze Imports needs the command-line tools its instructions call (git).

Does Polylith Migrate Analyze Imports access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Polylith Migrate Analyze Imports safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Polylith Migrate Analyze Imports use?

Polylith Migrate Analyze Imports is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Polylith Migrate Analyze Imports use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Polylith Migrate Analyze Imports?

Skills that share tags, products or a category with Polylith Migrate Analyze Imports: Migrate Internal Package into Ghost (TryGhost/Ghost, 56k stars), Reversible Migration (JuliusBrussee/caveman, 111k stars), Import (asgeirtj/system_prompts_leaks, 69k stars) and Database Migrations (affaan-m/ECC, 276k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Polylith Migrate Analyze Imports?

DavidVujic (a GitHub user) maintains it in DavidVujic/python-polylith, which has 554 GitHub stars. The repository holds 37 skills in this directory. The repository was last updated on October 4, 2026.

Source: DavidVujic/python-polylith on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.