|
1 | 1 | # Guide Format Validator
|
2 | 2 |
|
3 |
| -A comprehensive validation tool for markdown guide files that ensures compliance with documentation style guide rules. |
| 3 | +A simple validation tool for markdown guide files that ensures compliance with documentation style guide rules. |
4 | 4 |
|
5 |
| -**🎯 Get started in seconds:** |
| 5 | +**🎯 Two Ways to Validate Your Guides:** |
| 6 | + |
| 7 | +**Option 1: Ultra-Simple (Recommended)** |
6 | 8 | ```bash
|
7 | 9 | ./validate /path/to/your/guide.md
|
8 | 10 | ```
|
9 | 11 |
|
10 |
| -The validator supports both rule-based validation (fast, no API required) and LLM-based validation (more nuanced, requires API key). |
| 12 | +**Option 2: Manual Validation** |
| 13 | +```bash |
| 14 | +./validate-prompt steps --prompt |
| 15 | +``` |
11 | 16 |
|
12 | 17 | ## 🚀 Getting Started
|
13 | 18 |
|
14 |
| -1. **Install the validator:** |
| 19 | +1. **Install:** |
15 | 20 | ```bash
|
16 | 21 | cd guide-format-validator
|
17 | 22 | ./install.sh
|
18 | 23 | ```
|
19 | 24 |
|
20 |
| -2. **Validate any guide:** |
| 25 | +2. **Choose your validation method:** |
| 26 | + |
| 27 | + **Method 1: Automatic Validation (Recommended)** |
21 | 28 | ```bash
|
22 | 29 | ./validate /path/to/your/guide.md
|
23 | 30 | ```
|
| 31 | + - ✅ Fast and reliable |
| 32 | + - ✅ No setup required |
| 33 | + - ✅ Shows exactly what to fix |
24 | 34 |
|
25 |
| -3. **That's it!** You'll get detailed validation results showing what needs to be fixed. |
| 35 | + **Method 2: Manual Validation** |
| 36 | + ```bash |
| 37 | + ./validate-prompt steps --prompt |
| 38 | + ``` |
| 39 | + - ✅ Use with any LLM tool (ChatGPT, Claude, etc.) |
| 40 | + - ✅ Copy-paste validation prompts |
| 41 | + - ✅ No dependencies required |
26 | 42 |
|
27 | 43 | ### Example Output
|
28 | 44 | ```bash
|
@@ -73,160 +89,51 @@ export ANTHROPIC_API_KEY=your-api-key-here
|
73 | 89 |
|
74 | 90 | **Or simply ignore it** - rule-based validation works great for most guides!
|
75 | 91 |
|
76 |
| -## Features |
77 |
| - |
78 |
| -- **Rule-based validation** (default): Fast, reliable validation without external dependencies |
79 |
| -- **LLM validation** (optional): Advanced validation using Anthropic Claude for deeper analysis |
80 |
| -- **Multiple validators**: Overview, Prerequisites, Steps, Troubleshooting, and Callout validation |
81 |
| -- **Configuration-driven**: Validation rules defined in YAML within prompt files |
82 |
| -- **Easy to extend**: Add new validators by creating prompt files with YAML rules |
83 |
| -- **Configurable**: Customize validation behavior via configuration file |
84 |
| -- **Flexible output**: Multiple output formats and verbosity levels |
85 |
| -- **Error handling**: Graceful fallback when LLM is unavailable |
86 |
| - |
87 |
| -## Validation Methods |
| 92 | +## Which Method Should You Use? |
88 | 93 |
|
89 |
| -### Rule-Based Validation (Default) |
90 |
| -**Pros:** |
91 |
| -- ✅ **Fast**: No API calls, instant results |
92 |
| -- ✅ **Reliable**: Works offline, no network dependencies |
93 |
| -- ✅ **Free**: No API costs or credits required |
94 |
| -- ✅ **Deterministic**: Same input always produces same output |
95 |
| -- ✅ **CI/CD Ready**: Perfect for automated pipelines |
| 94 | +| Method | When to Use | Pros | Cons | |
| 95 | +|--------|-------------|------|------| |
| 96 | +| **Automatic** (`./validate`) | Most cases | ✅ Fast, reliable, no setup | ❌ Basic validation only | |
| 97 | +| **Manual** (`./validate-prompt`) | Custom needs | ✅ Use any LLM tool, flexible | ❌ Requires copy-paste | |
96 | 98 |
|
97 |
| -**Cons:** |
98 |
| -- ❌ **Limited Scope**: Only checks formatting and basic structure |
99 |
| -- ❌ **No Context**: Cannot understand content meaning or flow |
100 |
| -- ❌ **Rigid Rules**: May miss subtle issues or edge cases |
101 |
| - |
102 |
| -**Best For:** Development, CI/CD, quick checks, basic format validation |
103 |
| - |
104 |
| -### LLM Validation (Optional) |
105 |
| -**Pros:** |
106 |
| -- ✅ **Contextual**: Understands content meaning and logical flow |
107 |
| -- ✅ **Comprehensive**: Can catch content quality issues beyond formatting |
108 |
| -- ✅ **Nuanced**: Identifies subtle problems rule-based validation misses |
109 |
| -- ✅ **Intelligent**: Can suggest improvements and better practices |
| 99 | +**Recommendation:** Start with **Automatic** validation. Use **Manual** validation only when you need custom analysis or want to use your own LLM tools. |
110 | 100 |
|
111 |
| -**Cons:** |
112 |
| -- ❌ **Slower**: Requires API calls and network requests |
113 |
| -- ❌ **Cost**: Requires Anthropic API credits |
114 |
| -- ❌ **Dependency**: Needs internet connection and valid API key |
115 |
| -- ❌ **Variable**: Results may vary slightly between runs |
| 101 | +## Examples |
116 | 102 |
|
117 |
| -**Best For:** Final review, content quality validation, comprehensive documentation review |
118 |
| - |
119 |
| -### Manual Validation (Prompt Helper) |
120 |
| -**Pros:** |
121 |
| -- ✅ **No Dependencies**: Works without Python or API keys |
122 |
| -- ✅ **Flexible**: Use any LLM tool (ChatGPT, Claude, Cursor AI) |
123 |
| -- ✅ **Educational**: Learn validation criteria by reading prompts |
124 |
| -- ✅ **Customizable**: Modify prompts for specific needs |
125 |
| - |
126 |
| -**Cons:** |
127 |
| -- ❌ **Manual**: Requires copy-paste and manual review |
128 |
| -- ❌ **Time-consuming**: Slower than automated validation |
129 |
| -- ❌ **Inconsistent**: Results depend on user's LLM tool choice |
130 |
| - |
131 |
| -**Best For:** Learning, one-off validation, custom validation workflows, when you don't want to install dependencies |
132 |
| - |
133 |
| -## Quick Start |
134 |
| - |
135 |
| -### 1. Installation |
136 |
| - |
137 |
| -**Option A: Automated Installation (Recommended)** |
| 103 | +**Validate a guide:** |
138 | 104 | ```bash
|
139 |
| -# Clone or download the validator |
140 |
| -cd guide-format-validator |
141 |
| - |
142 |
| -# Run the installation script |
143 |
| -./install.sh |
144 |
| -``` |
145 |
| - |
146 |
| -**Option B: Manual Installation** |
147 |
| -```bash |
148 |
| -# Clone or download the validator |
149 |
| -cd guide-format-validator |
150 |
| - |
151 |
| -# Install dependencies |
152 |
| -pip install -r requirements.txt |
153 |
| - |
154 |
| -# For LLM validation (optional) |
155 |
| -pip install anthropic |
156 |
| -``` |
157 |
| - |
158 |
| -The installation script will: |
159 |
| -- Check for Python 3 and pip |
160 |
| -- Install all required dependencies |
161 |
| -- Make scripts executable |
162 |
| -- Run tests to verify installation |
163 |
| -- Provide usage instructions |
164 |
| - |
165 |
| -### 2. Basic Usage |
166 |
| - |
167 |
| -**🎯 Primary Method: Ultra-Simple Validation** |
168 |
| -```bash |
169 |
| -# Validate any guide file - everything is automatic |
170 | 105 | ./validate /path/to/your/guide.md
|
171 |
| - |
172 |
| -# Real-world example |
173 |
| -./validate /Users/raj/raj-professional-tasks/turbot/guardrails/guardrails-docs/docs/guides/hosting-guardrails/installation/install-ted/index.md |
174 |
| - |
175 |
| -# Relative path example |
176 |
| -./validate examples/bad-guide.md |
177 | 106 | ```
|
178 | 107 |
|
179 |
| -**That's it!** The validator automatically: |
180 |
| -- ✅ Uses the prompts folder for validation rules |
181 |
| -- ✅ Runs rule-based validation (fast, reliable) |
182 |
| -- ✅ Shows detailed results with pass/fail status |
183 |
| -- ✅ Works with any markdown guide file |
184 |
| - |
185 |
| -**Note:** You might see a warning about `ANTHROPIC_API_KEY` - this is normal! The validator automatically uses rule-based validation (which is recommended) and works perfectly without any API keys. |
186 |
| - |
187 |
| -**🔧 Advanced Options (Optional)** |
| 108 | +**Get validation prompts for manual use:** |
188 | 109 | ```bash
|
189 |
| -# Manual validation prompts (no dependencies) |
190 | 110 | ./validate-prompt steps --prompt
|
191 |
| - |
192 |
| -# Full validation with LLM (requires API key) |
193 |
| -export ANTHROPIC_API_KEY=your-api-key-here |
194 |
| -python3 scripts/validate_guides.py guide.md --use-llm |
195 | 111 | ```
|
196 | 112 |
|
197 |
| -### Quick Reference |
198 |
| - |
199 |
| -| Command | Purpose | Example | |
200 |
| -|---------|---------|---------| |
201 |
| -| `./validate <file>` | **🎯 Primary method - Ultra-simple** | `./validate /path/to/guide.md` | |
202 |
| -| `./validate-prompt <section>` | **Manual validation prompts** | `./validate-prompt steps --prompt` | |
203 |
| -| `python3 scripts/validate_guides.py <file>` | **Advanced options** | `python3 scripts/validate_guides.py guide.md --use-llm` | |
204 |
| - |
205 |
| -### 3. Manual Validation (Prompt Helper) |
206 |
| - |
207 |
| -If you prefer to validate manually or want to reference the validation criteria without running the full validator, you can use the prompt helper: |
| 113 | +## Manual Validation Details |
208 | 114 |
|
| 115 | +**List all sections:** |
209 | 116 | ```bash
|
210 |
| -# List all available validation sections |
211 | 117 | ./validate-prompt --list
|
| 118 | +``` |
212 | 119 |
|
213 |
| -# Show validation rules for a specific section |
| 120 | +**Get validation rules:** |
| 121 | +```bash |
214 | 122 | ./validate-prompt overview --rules
|
| 123 | +``` |
215 | 124 |
|
216 |
| -# Show LLM prompt for manual validation |
| 125 | +**Get LLM prompt:** |
| 126 | +```bash |
217 | 127 | ./validate-prompt steps --prompt
|
218 |
| - |
219 |
| -# Show both rules and prompt |
220 |
| -./validate-prompt troubleshooting |
221 | 128 | ```
|
222 | 129 |
|
223 |
| -**Use Cases:** |
224 |
| -- **Manual Review**: Copy the LLM prompt and paste it into ChatGPT, Claude, or Cursor AI |
225 |
| -- **Reference**: Quickly check what rules apply to each section |
226 |
| -- **Learning**: Understand the validation criteria without running the validator |
227 |
| -- **Custom Validation**: Use the prompts as templates for your own validation tools |
| 130 | +**Use the prompt with any LLM tool:** |
| 131 | +1. Copy the prompt output |
| 132 | +2. Paste into ChatGPT, Claude, or Cursor AI |
| 133 | +3. Replace `<PASTE FILE CONTENT HERE>` with your guide content |
| 134 | +4. Review the validation results |
228 | 135 |
|
229 |
| -### 4. Configuration |
| 136 | +## Configuration |
230 | 137 |
|
231 | 138 | Create a `config.yaml` file to customize validation:
|
232 | 139 |
|
|
0 commit comments