Prime-agentai

Narrowpy — Development skill for Claude Code

Development community

Deep modules, narrow interfaces: a structural linter and agent gate for Python.

How to install Narrowpy

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Prime-agentai/narrowpy and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Narrowpy does

Deep modules, narrow interfaces: a structural linter and agent gate for Python. Finds module cycles (including the ones agents hide in function-local imports), field leaks, tangles and shallow modules; blocks Claude Code from stopping when it made the structure worse. Ratchet, SARIF, MCP. Zero deps.

Alternatives in Development

  • Claude API — Build apps with the Claude API or Anthropic SDK 94.1k ★
  • Fix Imports — Fix Broken Imports 2.8k ★
  • Superpowers To Watchtower — Use when a superpowers plan (writing-plans / brainstorming output saved locally) is ready and you want durable 130 ★

README

narrowpy

Your coding agent fixed the circular import by moving it into a function. narrowpy notices.
A structural linter for Python, built on one idea (deep modules, narrow interfaces), and a gate that
won't let Claude Code stop while its changes made the structure worse.

CI Python 3.11-3.13 zero dependencies Claude Code Stop hook MCP tool MIT

This is from a real Claude Code session ([full transcript notes](docs/live-claude-code.md)). The agent was asked to add `Order.checkout()`, which needs `shop/emails.py`, and `emails.py` already imports `orders.py`. It said *"a top-level import would be circular. I'll import inside the method"*, then tried to stop:

narrowpy: your changes since 33e88c95c126 made the structure worse (1 new, 0 worse). Fix these before you stop:

error[module-cycle] [new]: 2 modules in `shop` import each other in a circle: `shop.emails`, `shop.orders`
  --> shop/emails.py:3
  = cheapest tie to cut: `shop.emails` → `shop.orders` (1 import: shop/emails.py:3)
  = at import time there is no circle: only the hidden imports close it
  = 1 of 2 imports in this circle are hidden (function-local or TYPE_CHECKING): shop/orders.py:28
    shop.emails  ──imports──▶  shop.orders   (1×, first shop/emails.py:3)
    shop.orders  ──imports──▶  shop.emails   (1×, first shop/orders.py:28)  [function-local]