Enforces strict project-specific documentation usage with tool-first response generation for GitHub Copilot
A comprehensive protocol for GitHub Copilot that enforces strict adherence to project-specific documentation through the doc-bot MCP server, preventing generic responses and ensuring all code generation and project inquiries are validated against actual project rules.
This skill creates a multi-phase enforcement system that:
**Before processing any request:**
1. Check if the project contains a `doc-bot/` directory
2. Verify if the doc-bot MCP server is available (either `doc-bot` or `@afterxleep/doc-bot`)
3. If both conditions are met:
- Activate strict documentation enforcement mode
- Disable general knowledge fallbacks for project-specific queries
- Set project documentation as the sole authoritative source
**Classify every user request into one of these categories:**
#### CLASS A: CODE_GENERATION
#### CLASS B: PROJECT_INQUIRY
#### CLASS C: DOCUMENTATION_DISCOVERY
#### CLASS D: DOCUMENT_ACCESS
**Special Note**: For file-specific queries (e.g., "working on src/utils.js"), use `search_documentation` with both the file name and context keywords rather than a separate tool.
**Pre-Response Validation:**
1. Classify the user's request using the classification matrix
2. If classification is NOT "UNRELATED":
- Execute the mandatory tool for that classification
- If tool returns an error, provide error recovery response
- If tool succeeds, inject tool result into response context
- Mark tool result as authoritative source
- Disable general knowledge fallback
3. Do NOT generate response until tool execution completes
**Response Constraint Rules:**
**Response Validation (after generating):**
1. Check if response contradicts tool result
- If YES: Regenerate response using ONLY tool result
2. Check if response lacks tool attribution
- If YES: Append attribution showing source document/rule
3. Validate response compliance with project rules
- If FAIL: Regenerate with corrections
**Failure Detection & Recovery:**
- Log violation: "Tool bypass detected"
- Immediately regenerate response with proper tool execution
- Prepend warning: "Corrected response using project documentation:"
**ABSOLUTE PROHIBITIONS (Never do these):**
**MANDATORY BEHAVIORS (Always do these):**
**Test these scenarios to verify proper behavior:**
1. **Documentation discovery:**
- User: "What documentation is available?"
- Expected: Immediate call to `get_global_rules()`, no general response
2. **Project inquiry:**
- User: "How do I implement auth?"
- Expected: Immediate call to `search_documentation("authentication")`, no generic auth patterns
3. **Code generation:**
- User: "Create a new component"
- Expected: Immediate call to `check_project_rules("create component")`, no standard React/Vue/etc. patterns
4. **File-specific work:**
- User: "Working on src/utils.js"
- Expected: Call to `search_documentation("src/utils.js utils")`, context-aware suggestions
**Expected Behavior**: Tool execution within 2 seconds of request classification, zero responses from general knowledge.
**Failure Indicators**: Any response without tool execution, generic programming advice, standard framework suggestions without project context.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/project-documentation-enforcement-protocol/raw