add schema validation and markdown linting#68
Merged
Merged
Conversation
- Add JSON schema for agent definitions - Add markdown linting configuration - Enhance validation script with schema and linting - Add CI/CD validation job - Update documentation close #46
JeremyDev87
marked this pull request as ready for review
December 21, 2025 14:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add JSON Schema Validation and Markdown Linting for AI Rules
📋 Summary
Adds comprehensive validation infrastructure for AI rules including JSON schema validation for agent definitions and Markdown linting for rule files. This ensures consistent structure and quality of AI rule files through automated validation.
Closes #46
🎯 Problem
Manual Validation Issues
AI rules were validated manually with no automated checks:
No JSON Schema Validation
No Markdown Linting
Limited Validation Script
No CI/CD Integration
Business Impact
✨ Solution
1. JSON Schema for Agent Definitions (
agent.schema.json, 258 lines)New File: Comprehensive JSON Schema Draft 7 schema
Features:
Required Fields Validation
name- Agent display name (string, minLength: 1)description- Brief description (string, minLength: 10)role- Role definition (object, requirestitle)context_files- Context file paths (array, pattern:^\.ai-rules/.*)Agent Type Support
activationfieldactivationfieldmodesfield (planning, implementation, evaluation)Comprehensive Property Definitions
activation- Activation configurationmodes- Mode-specific configurationworkflow- Workflow configurationcommunication- Communication preferencesevaluation_framework- Evaluation frameworkcode_quality_checklist- Code quality itemsSchema Highlights:
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Codingbuddy Agent Definition", "required": ["name", "description", "role", "context_files"], "properties": { "name": { "type": "string", "minLength": 1, "examples": ["Frontend Developer", "Code Reviewer"] }, "context_files": { "type": "array", "items": { "type": "string", "pattern": "^\\.ai-rules/.*" }, "minItems": 1 } } }Benefits:
2. Schema Documentation (
schemas/README.md, 66 lines)New File: Complete schema usage guide
Sections:
Available Schemas
Usage Instructions
Schema Development
Key Features:
3. Markdown Linting Configuration (
.markdownlint.json, 28 lines)New File: Markdown linting rules
Configuration Highlights:
{ "default": true, "MD003": { "style": "atx" }, "MD004": { "style": "dash" }, "MD007": { "indent": 2 }, "MD013": false, // Line length (disabled for code blocks) "MD022": false, // Headings (disabled for flexibility) "MD046": { "style": "fenced" }, "MD048": { "style": "backtick" } }Rules:
# Heading)- Item)Benefits:
4. Enhanced Validation Script (
validate-rules.sh, +191 lines)Major Enhancements:
Command-Line Options
--schema-only- Run only JSON schema validation--markdown-only- Run only Markdown linting--skip-schema- Skip schema validation--skip-markdown- Skip markdown linting-h, --help- Show help messageThree-Phase Validation
Phase 1: Directory Structure (if not schema/markdown-only)
.ai-rules/directory existsPhase 2: JSON Schema Validation (if not markdown-only)
ajv-clifor validationPhase 3: Markdown Linting (if not schema-only)
.ai-rules/markdownlint-cli2Improved Output
Before:
# Only structure validation ./scripts/validate-rules.shAfter:
5. CI/CD Integration (
.github/workflows/dev.yml, +25 lines)New Job:
rules-validationFeatures:
ajv-climarkdownlint-cli2Workflow Integration:
Benefits:
6. Yarn Scripts (
package.json, +3 scripts)New Scripts:
{ "validate:rules": "cd .. && ./scripts/validate-rules.sh", "validate:rules:schema": "cd .. && ./scripts/validate-rules.sh --schema-only", "validate:rules:markdown": "cd .. && ./scripts/validate-rules.sh --markdown-only" }Usage:
Benefits:
7. Documentation Updates
CONTRIBUTING.md (+3 lines)
validate:rulescommand to testing sectiondevelopment.md (+21 lines)
Key Additions:
CLI Validation
Manual Validation
🔗 Related Documentation
📝 Design Decisions
Why JSON Schema Draft 7?
Why Markdownlint?
Why Three-Phase Validation?
Why Command-Line Options?
Why CI/CD Integration?
✅ Acceptance Criteria
🚀 Impact
Validation Coverage
Error Detection
Developer Experience
CI/CD Quality
💡 Future Enhancements
Potential Improvements
📊 Before/After Comparison
Before
After
🎓 Lessons Learned
Best Practices
Common Patterns