laravel-dependencies-trim-packages
Scannednpx machina-cli add skill noartem/skills/laravel-dependencies-trim-packages --openclawFiles (1)
SKILL.md
417 B
Trim Dependencies
- Audit packages:
composer show --treeand remove unused ones - Prefer first-party or built-in features before adding new packages
- Regularly update; pin major versions via constraints and test
composer remove vendor/package
Source
git clone https://github.com/noartem/skills/blob/main/skills/laravel-dependencies-trim-packages/SKILL.mdView on GitHub Overview
Trim Dependencies helps you audit Laravel Composer packages with composer show --tree, remove unused ones with composer remove, and prefer built-in features to reduce boot time, memory usage, and security surface. It also emphasizes regularly updating dependencies with pinned major versions and thorough testing.
How This Skill Works
Technically, you inspect the dependency tree (composer show --tree), mark unused packages for removal, and execute composer remove vendor/package. You should favor first-party or built-in features before adding new packages and regularly update by constraining major versions and running tests.
When to Use It
- During initial Laravel setup to prune unused dependencies.
- Before production deployment to minimize boot time and security surface.
- After evaluating a new package that may duplicate core functionality.
- During quarterly maintenance to prune outdated or unused packages.
- When upgrading dependencies to ensure compatibility with major-version constraints.
Quick Start
- Step 1: Run composer show --tree to audit dependencies.
- Step 2: Remove unused packages with composer remove vendor/package1 vendor/package2.
- Step 3: Update composer.json to pin major versions and run tests.
Best Practices
- Audit with composer show --tree to map the dependency tree and identify unused packages.
- Remove unused packages with composer remove and tidy up assets if applicable.
- Prioritize first-party or built-in features over adding new packages.
- Regularly update dependencies and pin major versions via constraints, then test.
- Run the full test suite after trimming to catch breaking changes.
Example Use Cases
- Removed a large third-party debugging package in a Laravel app to cut boot time and memory usage.
- Pruned unused packages in a Laravel API project to reduce the security surface.
- Replaced an external logging package with Laravel's built-in logging where possible.
- Pinned major versions after trimming and refreshed composer.lock to ensure stability.
- Audited and removed unused assets in the public directory as part of cleanup.
Frequently Asked Questions
Add this skill to your agents