Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 402
Add dart_skills_lint to devtools and configure it to run in the cli and in tests#9770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2661c38fed7a849c290a1eb5547b92e8b56cbc4b02edbe03aed99a024d074719376f108364a23f8302fcFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!-- | ||
| Copyright 2026 The Flutter Authors | ||
| Use of this source code is governed by a BSD-style license that can be | ||
| found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| --> | ||
| # Agent Skills | ||
| This directory contains AI agent skills for this repository. | ||
| ## Validation | ||
| To ensure skills meet the required specification, they are automatically validated in pre-submit checks. | ||
| You should also validate your skills locally before submitting a review. | ||
| ### Running the Linter Locally | ||
| To validate skills locally before review, run the linter from the `tool` directory: | ||
| ```bash | ||
| cd tool && dart run dart_skills_lint:cli | ||
| ``` | ||
| This will use the configuration in `tool/dart_skills_lint.yaml` to validate all skills in the `.agents/skills` directory. | ||
| Or for a single skill (also from the `tool` directory): | ||
| ```bash | ||
| cd tool && dart run dart_skills_lint:cli --skill ../.agents/skills/my-skill | ||
| ``` | ||
| ### Running via Dart Test | ||
| Alternatively, you can run the validation as a test from the `tool` directory: | ||
| ```bash | ||
| cd tool && dart test test/validate_skills_test.dart | ||
| ``` | ||
| This ensures that the validation logic is executed in the same way as in CI. | ||
reidbaker marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "skills": { | ||
| "adding-release-notes": [ | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still required because the example for image does not resolve. | ||
| { | ||
| "rule_id": "check-relative-paths", | ||
| "file_name": "SKILL.md" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright 2026 The Flutter Authors | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| dart_skills_lint: | ||
| rules: | ||
| check-relative-paths: error | ||
| check-absolute-paths: error | ||
| check-trailing-whitespace: error | ||
| directories: | ||
| - path: "../.agents/skills" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright 2026 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| import 'dart:async'; | ||
reidbaker marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| import 'package:dart_skills_lint/dart_skills_lint.dart'; | ||
| import 'package:logging/logging.dart'; | ||
| import 'package:test/test.dart'; | ||
| void main() { | ||
| test('Validate DevTools Skills', () async { | ||
| final Level oldLevel = Logger.root.level; | ||
| Logger.root.level = Level.ALL; | ||
| final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) { | ||
| print(record.message); | ||
| }); | ||
| try { | ||
| // TODO(https://github.com/flutter/skills/issues/85): Update test | ||
| // to use dart_skills_lint.yaml for config when available. | ||
| final bool isValid = await validateSkills( | ||
| skillDirPaths: ['../.agents/skills'], | ||
| resolvedRules: { | ||
| 'check-relative-paths': AnalysisSeverity.error, | ||
| 'check-absolute-paths': AnalysisSeverity.error, | ||
| 'check-trailing-whitespace': AnalysisSeverity.error, | ||
reidbaker marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }, | ||
| ); | ||
| expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.'); | ||
| } finally { | ||
| Logger.root.level = oldLevel; | ||
| await subscription.cancel(); | ||
| } | ||
| }); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.