Skip to content
Back to skills

Docker.Shrink Requirements

ASecurity

Find unused packages in requirements.txt not needed by the project code

  • 158 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 7, 2026
researchgodocker

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add gpsaggese/helpers --skill docker.shrink_requirements --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker.Shrink Requirements?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker.Shrink Requirements
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gpsaggese-docker-shrink-requirements/badge)](https://www.skillsdirectory.com/skills/gpsaggese-docker-shrink-requirements)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Find unused packages in requirements.txt not needed by the project code
model: haiku
---

# Goal
- Act as an expert in Docker
- Given a project dir `<TARGET_DIR>`, find the packages in `requirements.txt`
  that its code does not need

# Workflow

## Methodology
- Find actual imports in all `.py` files in `<TARGET_DIR>` with
  `grep -r "import <PKG>"` or AST-based analysis
- Map each package in `requirements.txt` to its import name (e.g., `Pillow` ->
  `PIL`, `scikit-learn` -> `sklearn`, `PyYAML` -> `yaml`)
- Also check `setup.py`, `pyproject.toml`, `tasks.py`, and `Makefile` for
  indirect or tool-level usage
- Flag but do NOT remove packages that are:
  - Runtime plugins or extras loaded dynamically (e.g., via `importlib`)
  - Transitive dependencies pulled in by other listed packages
  - Used only in test files (mark them as "test-only")

## Output
- Print a table with columns:
  ```verbatim
  package | import_name | used_in_code | verdict
  ```
  - `verdict` is one of: `remove`, `keep`, `investigate`, `test-only`
- Propose the trimmed `requirements.txt` contents and write it to disk

# Verification
- [ ] Confirm every package in `requirements.txt` has a verdict
- [ ] Confirm no package marked `remove` is still imported anywhere in
      `<TARGET_DIR>`
- [ ] Confirm the trimmed `requirements.txt` was written to disk

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in research →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.