A validation tool for AI skills and agent configurations
Project description
AI Linter
- 1. Purpose
- 2. Features
- 3. Installation
- 4. Command help
- 5. Usage
- 6. Validation Rules
- 7. Exit Codes
- 8. Inspiration
- 9. Contributing
- 10. License
1. Purpose
AI Linter is a validation tool specifically designed for AI skills and agent configurations. It provides comprehensive linting and validation for:
- AI Skills: Validates
SKILL.mdfiles including frontmatter, content length, token count, and file references - AI Agents: Validates
AGENTS.mdfiles and ensures proper structure without frontmatter - File References: Checks that all referenced files exist and are accessible
- Content Quality: Enforces limits on content length and token counts to ensure optimal performance
- Project Structure: Validates overall project organization and file relationships
2. Features
- 🔍 Comprehensive Validation: Validates both skills and agents with detailed error reporting
- 📊 Token Counting: Uses tiktoken for accurate token count validation
- 📝 Frontmatter Parsing: Validates YAML frontmatter in skill files
- 🚫 File Reference Checking: Ensures all referenced files exist
- ⚙️ Configurable: Support for YAML configuration files
- 🎯 Selective Processing: Can process specific directories or auto-discover skills
- 📋 Detailed Logging: Multiple log levels with structured error reporting
- 🔧 Pre-commit Integration: Easy integration with pre-commit hooks
3. Installation
3.1. From PyPI (Coming Soon)
pip install ai-linter
3.2. From Source
# Clone the repository
git clone git@github.com:fchastanet/ai-linter.git
cd ai-linter
# Install the package
pip install .
3.3. Development Installation
# Clone and install for development
git clone git@github.com:fchastanet/ai-linter.git
cd ai-linter
# Install in development mode with all dev dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks
pre-commit install
4. Command help
usage: aiLinter.py [-h]
[--skills]
[--max-warnings MAX_WARNINGS]
[--ignore-dirs IGNORE_DIRS [IGNORE_DIRS ...]]
[--log-level {ERROR,WARNING,INFO,DEBUG}]
[--version]
[--config-file CONFIG_FILE]
directories [directories ...]
Quick validation script for skills
positional arguments:
directories Directories to validate
options:
-h, --help show this help message and exit
--skills Indicates that the input directories contain skills
--max-warnings MAX_WARNINGS
Maximum number of warnings allowed before failing
--ignore-dirs IGNORE_DIRS [IGNORE_DIRS ...]
List of directory patterns to ignore when validating AGENTS.md files
--log-level {ERROR,WARNING,INFO,DEBUG}
Set the logging level
--version Show the version of the AI Linter
--config-file CONFIG_FILE
Path to the AI Linter configuration file
5. Usage
After installation, you can use AI Linter via the ai-linter command or directly with Python.
5.1. Basic Usage
# Using the console script (recommended)
ai-linter /path/to/directory
# Auto-discover and validate all skills in a directory
ai-linter --skills /path/to/skills/directory
# Using the Python module directly
python src/aiLinter.py --skills examples/
5.2. Advanced Options
# Set maximum allowed warnings
ai-linter --max-warnings 5 /path/to/directory
# Ignore specific directories
ai-linter --ignore-dirs node_modules build /path/to/directory
# Set log level
ai-linter --log-level DEBUG /path/to/directory
# Use custom config file
ai-linter --config-file custom-config.yaml /path/to/directory
# Show version
ai-linter --version
5.3. Configuration File
Create a .ai-linter-config.yaml file in your project root:
# Logging configuration
log_level: INFO # DEBUG, INFO, WARNING, ERROR
# Maximum warnings before failing
max_warnings: 10
# Directories to ignore during validation
ignore_dirs:
- .git
- __pycache__
- node_modules
- build
- dist
6. Validation Rules
6.1. Skills Validation
- ✅
SKILL.mdfile must exist - ✅ Valid YAML frontmatter with required properties
- ✅ Content length must not exceed 500 lines
- ✅ Token count must not exceed 5000 tokens
- ✅ All file references must exist and be accessible
- ✅ Frontmatter must contain valid metadata
6.2. Agents Validation
- ✅
AGENTS.mdfile structure validation - ✅ No frontmatter allowed in agent files
- ✅ Content length must not exceed 500 lines
- ✅ Token count must not exceed 5000 tokens
- ✅ All file references must be valid
6.3. Allowed Frontmatter Properties
name: string
description: string
license: string
allowed-tools: array
metadata: object
compatibility: object
6.4. Pre-commit Integration
- ✅ .pre-commit-hooks.yaml - Hook definitions for external use
- ✅ .pre-commit-config.yaml - Local development configuration with:
- AI Linter validation
- Black code formatting
- isort import sorting
- flake8 linting
- mypy type checking
- bandit security scanning
- YAML/Markdown validation
See .pre-commit-hooks.yaml for ready-to-use pre-commit hooks. Add to your
.pre-commit-config.yaml:
repos:
- repo: https://github.com/fchastanet/ai-linter
rev: v0.1.0
hooks:
- id: ai-linter-skills
args: [--max-warnings, '5']
7. Exit Codes
- 0: Success (no errors, warnings within limits)
- 1: Failure (errors found or too many warnings)
7.1. Development Workflow
# Setup development environment
make install-dev
# Run all checks
make check-all
# Test the linter
make validate
8. Inspiration
This tool was inspired by Anthropic's skill validation script and adapted for broader AI development workflows.
9. Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
10. License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_linter-0.2.0.tar.gz.
File metadata
- Download URL: ai_linter-0.2.0.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0396d36ae373a38f1beca2696aa1d7f083bce452c59376fa3eb202215512870b
|
|
| MD5 |
ce67bc8f49956c2d18f7b77a9ad11d45
|
|
| BLAKE2b-256 |
4eafd5ff2299bbde03ebaf515be58a1eec2a2e984d68f240c4f02d01df7dce31
|
File details
Details for the file ai_linter-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_linter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
896a6cd50b8fc8e10d51745c41da35575d9b6d21bff845d82a08b2a5b0cbfffb
|
|
| MD5 |
7015627b999487778dd66cf88bcd6863
|
|
| BLAKE2b-256 |
aab88948ee0d882648e621e6672e7e8ab66ec9df43ed585bb02fcf4c22e33e28
|