pr-shared-extraction

Audits pull requests for misplaced helpers and extracts them into shared_utils modules.

6|1|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/jl-cmd/claude-dev-env --skill pr-shared-extraction-jl-cmd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pr-shared-extraction
Source: https://github.com/jl-cmd/claude-dev-env/tree/main/skill-archive/pr-shared-extraction
Command: npx skills add https://github.com/jl-cmd/claude-dev-env --skill pr-shared-extraction-jl-cmd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Reusable helpers, constants, and test fixtures often end up buried inside workflow-specific packages instead of a shared library, creating duplicate implementations, layer inversions, and maintenance drift. This Skill audits pull requests and packages for those architectural offenses and applies prioritized extraction fixes in small, tested commits. ## Core Features & Use Cases - Offense Detection: Greps PR diffs for ten classified offense patterns (thin wrappers, layer inversions, parallel stacks, duplicate constants) and assigns P0–P3 priorities using a documented taxonomy. - Guided Extraction Workflow: Moves behavior into canonical shared_utils modules, rewires call sites, deletes old modules, and migrates tests alongside the code. - Mode Routing: Supports preflight-proposal, audit-only, and normal fix modes so reviews can be report-only or produce applied changes. - Use Case: A reviewer points at PR #1965 and asks for an extraction audit; the Skill scopes the diff, flags a _default_db_flipper wrapper as P1, extracts it into shared_utils, and runs scoped pytest as evidence. ## Quick Start Ask the assistant to run an extraction audit on PR #1965 and fix any helpers that belong in shared_utils.

Frequently Asked Questions about pr-shared-extraction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a pull request for code that belongs in a shared library?▼

Point the Skill at a PR number and it scopes the diff, greps for offense patterns like `_default_*` wrappers and duplicate constants, then reports prioritized P0–P3 findings. In normal mode it also applies the extraction fixes in small tested commits.

What counts as a layer inversion in a Python monorepo?▼

A layer inversion occurs when a shared library such as shared_utils imports from a consumer package like a workflow pipeline or skill directory. The fix moves the imported symbol into shared_utils so consumers import the shared module instead.

Can I run the extraction audit without applying any code changes?▼

Yes, the audit-only mode is report-only and ends after the prioritized findings report. The preflight-proposal mode runs in an isolated worktree and records proposal evidence without mutating the main branch.

How are extraction fixes verified before merging?▼

Each extraction lands as a small commit followed by scoped pytest runs on the affected packages, with output counts provided as evidence. Tests move with the behavior so shared modules get shared tests and orchestration keeps integration tests only.

When should I not extract a helper into shared_utils?▼

Keep code in the workflow package when it is orchestration, CLI wiring, sweep loops, or workflow-specific constants used by only one consumer. The load-bearing rule is that only symbols another package would import belong in shared_utils.