一键导入
dart-skills-lint-setup
// Use this skill when you need to set up validation for AI agent skills in a Dart project for the first time. This includes adding dependencies, configuring the linter, setting up tests, and creating a CI workflow.
// Use this skill when you need to set up validation for AI agent skills in a Dart project for the first time. This includes adding dependencies, configuring the linter, setting up tests, and creating a CI workflow.
How to integrate, update, and configure the dart_skills_lint validation tool within a repository. Make sure to use this skill whenever the user asks to update dart_skills_lint, configure skills validation tests, fix skills linter dependency drifts, verify repository state before editing, optimize lint rules execution, or draft pull request submission commands.
Contains well-defined rules for creating natural, accurate, and readable writing. Use whenever authoring longer text, like analysis documents, PR or CL descriptions, or documentation.
Mandatory checks to run before completing any task that touches md files or dart code in this repository.
Use this skill when you need to validate that AI agent skills meet the specification. This includes running the linter via CLI, authoring custom rules, and following the validation workflow.
Performs a comprehensive, multi-step code review of pull requests or local code changes, using iterative refinement (generation, critique, synthesis) to ensure high-quality, actionable feedback. Use when you need to review code changes thoroughly.
Use the `http` package to execute GET, POST, PUT, or DELETE requests. Use when you need to fetch from or send data to a REST API.
| name | dart-skills-lint-setup |
| description | Use this skill when you need to set up validation for AI agent skills in a Dart project for the first time. This includes adding dependencies, configuring the linter, setting up tests, and creating a CI workflow. |
Setup validation in your Dart project:
Add dart_skills_lint to your pubspec.yaml as a dev_dependency. If it is published to pub.dev:
dev_dependencies:
dart_skills_lint: ^0.2.0
If it is a local package or hosted on Git, use a path or git dependency:
dev_dependencies:
dart_skills_lint:
git:
url: https://github.com/flutter/skills.git
path: tool/dart_skills_lint
Note: The test example below also requires package:logging and package:test to be added to your dev_dependencies if they are not already present.
Integrate the linter into your automated tests by importing the package and calling validateSkills. This ensures your skills are automatically validated whenever you run dart test.
Example test/lint_skills_test.dart:
import 'dart:async';
import 'package:dart_skills_lint/dart_skills_lint.dart';
import 'package:logging/logging.dart';
import 'package:test/test.dart';
void main() {
test('Run skills linter', () 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 {
// Load configuration from the default file (dart_skills_lint.yaml)
final config = await ConfigParser.loadConfig();
final isValid = await validateSkills(
config: config,
);
expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.');
} finally {
Logger.root.level = oldLevel;
await subscription.cancel();
}
});
}
Recommended: Create a configuration file dart_skills_lint.yaml in the root of your project to centralize your rules and directory settings. This ensures both the CLI and your automated tests use the same configuration.
Note: If you use validateSkills directly in tests, you can load the dart_skills_lint.yaml file using ConfigParser.loadConfig() and pass it to validateSkills to share the same configuration as the CLI.
dart_skills_lint:
rules:
check-relative-paths: error
check-trailing-whitespace: error
directories:
- path: ".agents/skills"
Note: The following rules are enabled by default and do not need to be listed unless you want to change their severity or disable them: check-absolute-paths, valid-yaml-metadata, invalid-skill-name, description-too-long.
When adding dart_skills_lint to a repository for the first time, follow these best practices:
tool/pubspec.yaml) rather than the root.pubspec.yaml files (e.g., root and a tool package), ensure the ref (commit hash) is identical to avoid resolution conflicts.dart run dart_skills_lint:cli --skills-directory=.agents/skills --generate-baseline
To enforce skill validation in CI, add a GitHub workflow file (e.g., .github/workflows/dart_skills_validation.yaml):
name: dart_skills_validation
permissions: read-all
on:
pull_request:
paths:
- '.agents/skills/**'
- 'tool/**' # Adjust to your tool package path
push:
branches: [ main ]
paths:
- '.agents/skills/**'
- 'tool/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
working-directory: tool # Adjust to your tool package path
- name: Run skills validation
run: dart test
working-directory: tool # Adjust to your tool package path