Skip to content
Back to skills

Add Package

ASecurity

This skill should be used when about to add a Dart or Flutter package dependency — running flutter pub add, dart pub add, or editing pubspec.yaml to introduce a new package. Also load when choosing a specific version constraint for a new package. Skip for upgrading existing packages (pub upgrade), removing packages, or pub commands that don't introduce a new dependency.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 26, 2026
tools

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add devoncarew/flutter-slipstream --skill add-package --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Package?

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

Security grade badge for Add Package
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/devoncarew-add-package/badge)](https://www.skillsdirectory.com/skills/devoncarew-add-package)

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
---
name: add-package
description: >-
  This skill should be used when about to add a Dart or Flutter package
  dependency — running flutter pub add, dart pub add, or editing pubspec.yaml to
  introduce a new package. Also load when choosing a specific version constraint
  for a new package. Skip for upgrading existing packages (pub upgrade),
  removing packages, or pub commands that don't introduce a new dependency.
user-invocable: false
---

# Adding a Dart/Flutter Package Dependency

## Preferred approach

Use `flutter pub add <package>` (or `dart pub add`) rather than editing
`pubspec.yaml` directly. The pub command output is the primary signal for
package health; direct edits bypass it.

## Read pub output after every add

After running `pub add`, read the output carefully before proceeding. Two
classes of problem appear inline:

### Discontinued packages

```
+ flutter_markdown 0.7.7+1 (discontinued replaced by flutter_markdown_plus)
...
1 package is discontinued.
```

Action:

- If a replacement is listed: remove the discontinued package and add the
  replacement instead (`flutter pub remove <pkg>` then
  `flutter pub add <replacement>`).
- If no replacement is listed: find a well-maintained alternative before
  proceeding.

### Version pinned behind current major

```
+ lints 4.0.0 (6.1.0 available)
...
4 packages have newer versions incompatible with dependency constraints.
```

The `(X.Y.Z available)` annotation on a package you just added means the version
you requested is behind the current release — often by a major version.

Action:

- Run `flutter pub outdated` to see the structured breakdown:

  ```
  Package Name  Current  Upgradable  Resolvable  Latest
  lints         *4.0.0   *4.0.0      6.1.0       6.1.0
  ```

- If a direct dependency you just added shows a major-version gap between
  Current and Latest, remove the version pin or update the constraint to the
  current major (`flutter pub add 'lints:^6.0.0'`).
- Transitive dependency gaps are generally not actionable — note them but don't
  block on them.

## When editing pubspec.yaml directly

If you add a dependency by editing `pubspec.yaml` instead of using `pub add`,
run `flutter pub get` immediately after and apply the same output-reading rules.

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.

Comments

Loading comments…

Newsletter

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