Loading repository data…
Loading repository data…
fchastanet / repository
AI Linter is a validation tool for AI skills and agent configurations. It enforces structure, frontmatter, content length, token limits, and file reference checks for SKILL.md and AGENTS.md files. Includes YAML config, pre-commit, and VS Code integration for robust, automated linting in AI projects
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
AI Linter is a validation tool specifically designed for AI skills and agent configurations. It provides comprehensive linting and validation for:
SKILL.md files including frontmatter, content length, token count, and file referencesAGENTS.md files and ensures proper structure without frontmatter.github/prompts and .github/agents directoriespip install ai-linter
# Clone the repository
git clone git@github.com:fchastanet/ai-linter.git
cd ai-linter
# Install the package
pip install .
See .pre-commit-hooks.yaml for ready-to-use pre-commit hooks. Add to your
.pre-commit-config.yaml:
Lint entire workspace:
repos:
- repo: https://github.com/fchastanet/ai-linter
rev: 0.3.3
hooks:
- id: ai-linter-workspace
args: [--max-warnings, '5']
Lint entire workspace including skills:
repos:
- repo: https://github.com/fchastanet/ai-linter
rev: 0.3.3
hooks:
- id: ai-linter-workspace
args: [--skills, --max-warnings, '5']
Lint only changed files:
repos:
- repo: https://github.com/fchastanet/ai-linter
rev: 0.3.3
hooks:
- id: ai-linter-changed-files
args: [--max-warnings, '5']
Add the following task to your .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "AI Linter: Validate Workspace",
"type": "shell",
"command": "ai-linter",
"args": [
"--skills",
"."
],
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": {
"owner": "ai-linter",
"fileLocation": "absolute",
"pattern": {
"regexp": "^level=\"(WARNING|ERROR)\"\\s+rule=\"([^\"]+)\"\\s+path=\"([^\"]+)\"(?:\\s+line=\"(\\d+)\")?\\s+message=\"([^\"]+)\"",
"file": 3,
"line": 4,
"severity": 1,
"message": 5
}
}
},
{
"label": "AI Linter: Validate Current Directory",
"type": "shell",
"command": "ai-linter",
"args": [
"--skills",
"${workspaceFolder}"
],
"group": {
"kind": "test",
"isDefault": false
},
"problemMatcher": {
"owner": "ai-linter",
"fileLocation": "absolute",
"pattern": {
"regexp": "^level=\"(WARNING|ERROR)\"\\s+rule=\"([^\"]+)\"\\s+path=\"([^\"]+)\"(?:\\s+line=\"(\\d+)\")?\\s+message=\"([^\"]+)\"",
"file": 3,
"line": 4,
"severity": 1,
"message": 5
}
}
}
]
}
usage: ai-linter [-h]
[--skills]
[--max-warnings MAX_WARNINGS]
[--ignore IGNORE_PATTERN [IGNORE_PATTERNS ...]]
[--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 IGNORE_PATTERN [IGNORE_PATTERNS ...]
Glob patterns for files and directories to ignore across all validations
--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
After installation, you can use AI Linter via the ai-linter command or directly with Python.
# 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/ai_linter.py --skills examples/
# Set maximum allowed warnings
ai-linter --max-warnings 5 /path/to/directory
# Ignore specific directories
ai-linter --ignore 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
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:
- .git
- __pycache__
- node_modules
- build
- dist
Code blocks in markdown files should not exceed a configurable line limit (default: 3 lines). Large code snippets should be moved to external files and referenced from documentation.
Configuration:
# .ai-linter-config.yaml
code_snippet_max_lines: 3 # Adjust as needed
Example:
See the implementation in [process.py](scripts/process.py)
All files in references/, assets/, and scripts/ directories must be referenced in at least one markdown file. This
prevents accumulation of unused files and ensures documentation stays synchronized with resources.
Configuration:
resource_dirs:
- references
- assets
- scripts
unreferenced_file_level: ERROR # or WARNING, INFO
Detection Methods:
[text](path/to/file)<img src="path"><attachment filePath="path">source: path/to/filePrompt and agent files are validated for:
Configuration:
prompt_dirs:
- .github/prompts
agent_dirs:
- .github/agents
Projects should have an AGENTS.md file in the root directory to provide AI assistants with project context and
guidance.
Configuration:
missing_agents_file_level: WARNING # or ERROR, INFO
SKILL.md file must existAGENTS.md file structure validationname: string
description: string
license: string
allowed-tools: array
metadata: object
compatibility: object
code-snippet-too-large: Code block exceeds maximum line countunreferenced-resource-file: File in resource directory not referenced in any markdownprompt-content-too-long: File exceeds maximum line countprompt-token-count-exceeded: File exceeds maximum token countagents-file-missing: AGENTS.md not found in root directoryINFO in config, or use --ignore to skip directories.tiktoken library to approximate token counts. If
tiktoken is not installed, it falls back to a heuristic of len(text) // 4. Actual model tokenization may still
differ slightly, so the limit should be treated as a practical guideline rather than an exact value.