Skip to content

Commit c00ad26

Browse files
Add dart_skills_lint to devtools and configure it to run in the cli and in tests (#9770)
* add dart skills lint test and yaml config with instructions for how to use * Add ignore file for valid links that are triggering false positives * resolve readme to correct location * Copyright added to new files and issue linked in pubspec * Add link to yaml configuration feature * presubmit feedback * Update tool/test/validate_skills_test.dart Co-authored-by: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> * Update pubspec.yaml Co-authored-by: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> * Fix one relative path issues, update version of dart_skills_lint * remove the root dependency on dart_skills_lint * Change todo format * Remove double trailing line --------- Co-authored-by: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com>
1 parent bf72bf9 commit c00ad26

8 files changed

Lines changed: 114 additions & 2 deletions

File tree

.agents/skills/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
Copyright 2026 The Flutter Authors
3+
Use of this source code is governed by a BSD-style license that can be
4+
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
5+
-->
6+
7+
# Agent Skills
8+
9+
This directory contains AI agent skills for this repository.
10+
11+
## Validation
12+
13+
To ensure skills meet the required specification, they are automatically validated in pre-submit checks.
14+
You should also validate your skills locally before submitting a review.
15+
16+
### Running the Linter Locally
17+
18+
To validate skills locally before review, run the linter from the `tool` directory:
19+
20+
```bash
21+
cd tool && dart run dart_skills_lint:cli
22+
```
23+
24+
This will use the configuration in `tool/dart_skills_lint.yaml` to validate all skills in the `.agents/skills` directory.
25+
26+
Or for a single skill (also from the `tool` directory):
27+
28+
```bash
29+
cd tool && dart run dart_skills_lint:cli --skill ../.agents/skills/my-skill
30+
```
31+
32+
### Running via Dart Test
33+
34+
Alternatively, you can run the validation as a test from the `tool` directory:
35+
36+
```bash
37+
cd tool && dart test test/validate_skills_test.dart
38+
```
39+
40+
This ensures that the validation logic is executed in the same way as in CI.

.agents/skills/adding-release-notes/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ Add images to `packages/devtools_app/release_notes/images/` and reference them:
8484
**Constraint**: Use **dark mode** for screenshots.
8585

8686
## Resources
87-
- [README.md](../../packages/devtools_app/release_notes/README.md): Official project guidance.
87+
- [README.md](../../../packages/devtools_app/release_notes/README.md): Official project guidance.

.agents/skills/authoring-skills/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ When creating or modifying skills in this repository, follow these best practice
1717
- **Naming**: Use the gerund form (**verb-ing-noun**) or **noun-phrase** (e.g., `authoring-skills`, `adding-release-notes`). Use only lowercase letters, numbers, and hyphens.
1818
- **Conciseness**: Prioritize brevity in `SKILL.md`. Agents are already highly capable; only provide context they don't already have.
1919
- **Automation**: Any utility scripts placed in the `scripts/` directory MUST be written in **Dart**.
20+
- **Validation**: Skills are automatically validated using `dart_skills_lint`. Ensure your skills pass the linter before submitting. See the `README.md` in `.agents/skills/` for instructions on how to run the linter locally.
2021
- **Progressive Disclosure**: Use the patterns below to organize instructions effectively:
2122
- [CHECKLIST.md](CHECKLIST.md): Template for tracking skill development progress.
2223
- [EXAMPLES.md](EXAMPLES.md): Local examples and anti-patterns.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"skills": {
3+
"adding-release-notes": [
4+
{
5+
"rule_id": "check-relative-paths",
6+
"file_name": "SKILL.md"
7+
}
8+
]
9+
}
10+
}

pubspec.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,15 @@ packages:
209209
url: "https://pub.dev"
210210
source: hosted
211211
version: "0.0.3"
212+
dart_skills_lint:
213+
dependency: transitive
214+
description:
215+
path: "tool/dart_skills_lint"
216+
ref: "2420128e11101002e2eac98eb90512103a388714"
217+
resolved-ref: "2420128e11101002e2eac98eb90512103a388714"
218+
url: "https://github.com/flutter/skills"
219+
source: git
220+
version: "0.2.0"
212221
dart_style:
213222
dependency: transitive
214223
description:

tool/dart_skills_lint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2026 The Flutter Authors
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
4+
dart_skills_lint:
5+
rules:
6+
check-relative-paths: error
7+
check-absolute-paths: error
8+
check-trailing-whitespace: error
9+
directories:
10+
- path: "../.agents/skills"

tool/pubspec.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ dependencies:
2121
meta: ^1.18.0
2222
path: ^1.9.0
2323
yaml: ^3.1.2
24-
24+
2525
dev_dependencies:
26+
# TODO(https://github.com/flutter/devtools/issues/9771): Update to published version
27+
dart_skills_lint:
28+
git:
29+
url: https://github.com/flutter/skills
30+
path: tool/dart_skills_lint
31+
ref: 2420128e11101002e2eac98eb90512103a388714
32+
logging: ^1.1.1
2633
test: ^1.25.8
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2026 The Flutter Authors
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
4+
5+
import 'dart:async';
6+
import 'package:dart_skills_lint/dart_skills_lint.dart';
7+
import 'package:logging/logging.dart';
8+
import 'package:test/test.dart';
9+
10+
void main() {
11+
test('Validate DevTools Skills', () async {
12+
final Level oldLevel = Logger.root.level;
13+
Logger.root.level = Level.ALL;
14+
final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) {
15+
print(record.message);
16+
});
17+
18+
try {
19+
// TODO(https://github.com/flutter/skills/issues/85): Update test
20+
// to use dart_skills_lint.yaml for config when available.
21+
final bool isValid = await validateSkills(
22+
skillDirPaths: ['../.agents/skills'],
23+
resolvedRules: {
24+
'check-relative-paths': AnalysisSeverity.error,
25+
'check-absolute-paths': AnalysisSeverity.error,
26+
'check-trailing-whitespace': AnalysisSeverity.error,
27+
},
28+
);
29+
expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.');
30+
} finally {
31+
Logger.root.level = oldLevel;
32+
await subscription.cancel();
33+
}
34+
});
35+
}

0 commit comments

Comments
 (0)