$npx -y skills add flutter/agent-plugins --skill dart-skills-lint-validationUse this skill when you need to validate AI agent skills with dart_skills_lint — running the linter, interpreting failures, fixing violations, and authoring custom rules.
| 1 | # Validating Skills with dart_skills_lint |
| 2 | |
| 3 | This skill covers **day-to-day use**: running the linter, walking |
| 4 | through a failing run, and writing a custom rule when defaults |
| 5 | aren't enough. For first-time wiring (adding the dep, creating the |
| 6 | config file, generating a baseline) see |
| 7 | [`dart-skills-lint-setup`](../dart-skills-lint-setup/SKILL.md). The |
| 8 | full rule reference (default severities, diagnostic shapes, |
| 9 | fixability) lives in [`RULES.md`](../../RULES.md). |
| 10 | |
| 11 | ## Running the linter |
| 12 | |
| 13 | If `dart_skills_lint` is in `pubspec.yaml`: |
| 14 | |
| 15 | ```bash |
| 16 | dart run dart_skills_lint:cli -d .agents/skills |
| 17 | ``` |
| 18 | |
| 19 | If it's installed globally with `dart pub global activate`: |
| 20 | |
| 21 | ```bash |
| 22 | dart pub global run dart_skills_lint:cli -d .agents/skills |
| 23 | ``` |
| 24 | |
| 25 | Run `dart run dart_skills_lint:cli --help` for the full flag list |
| 26 | (skip the inline duplicate so it never goes stale). |
| 27 | |
| 28 | ## Workflow for a failing run |
| 29 | |
| 30 | 1. **Run the validator.** |
| 31 | 2. **Read the errors.** Each diagnostic names the rule that fired, |
| 32 | the offending value, and a suggested fix when one applies. |
| 33 | 3. **Fix the violations.** For fixable rules |
| 34 | (`check-absolute-paths`, `check-trailing-whitespace`, |
| 35 | `invalid-skill-name`), pass `--fix` to write the corrections |
| 36 | to disk; add `--dry-run` to preview the diff first. |
| 37 | 4. **Re-run** to confirm the run is clean. |
| 38 | |
| 39 | ### Task progress |
| 40 | |
| 41 | - [ ] Run validator |
| 42 | - [ ] Read errors |
| 43 | - [ ] Fix violations (manual or `--fix` / `--fix --dry-run`) |
| 44 | - [ ] Verify clean run |
| 45 | |
| 46 | ## Authoring a custom rule |
| 47 | |
| 48 | Extend `SkillRule` and pass the rule into `validateSkills`: |
| 49 | |
| 50 | ```dart |
| 51 | import 'package:dart_skills_lint/dart_skills_lint.dart'; |
| 52 | |
| 53 | class DeprecatedSkillRule extends SkillRule { |
| 54 | @override |
| 55 | final String name = 'deprecated-skill'; |
| 56 | |
| 57 | @override |
| 58 | final AnalysisSeverity severity = AnalysisSeverity.warning; |
| 59 | |
| 60 | @override |
| 61 | Future<List<ValidationError>> validate(SkillContext context) async { |
| 62 | final errors = <ValidationError>[]; |
| 63 | final yaml = context.parsedYaml; |
| 64 | if (yaml == null) return errors; |
| 65 | |
| 66 | if (yaml['metadata']?['deprecated'] == true) { |
| 67 | errors.add(ValidationError( |
| 68 | ruleId: name, |
| 69 | severity: severity, |
| 70 | file: 'SKILL.md', |
| 71 | message: 'This skill is marked as deprecated.', |
| 72 | )); |
| 73 | } |
| 74 | return errors; |
| 75 | } |
| 76 | } |
| 77 | ``` |
| 78 | |
| 79 | Wire it up in a Dart test: |
| 80 | |
| 81 | ```dart |
| 82 | import 'package:dart_skills_lint/dart_skills_lint.dart'; |
| 83 | import 'package:test/test.dart'; |
| 84 | |
| 85 | void main() { |
| 86 | test('skills pass with deprecated-skill custom rule', () async { |
| 87 | final config = await ConfigParser.loadConfig(); |
| 88 | expect( |
| 89 | config.directoryConfigs, |
| 90 | isNotEmpty, |
| 91 | reason: 'Configuration directoryConfigs should not be empty.', |
| 92 | ); |
| 93 | await validateSkills( |
| 94 | config: config, |
| 95 | customRules: [DeprecatedSkillRule()], |
| 96 | ); |
| 97 | }); |
| 98 | } |
| 99 | ``` |
| 100 | |
| 101 | ## Related |
| 102 | |
| 103 | - [`dart-skills-lint-setup`](../dart-skills-lint-setup/SKILL.md) — |
| 104 | first-time wiring. |
| 105 | - [`RULES.md`](../../RULES.md) — canonical rule reference. |
| 106 | - [`README.md`](../../README.md) — installation, configuration, |
| 107 | integration recipes. |