UNPKG

@afterxleep/doc-bot

Version:

Generic MCP server for intelligent documentation access in any project

117 lines (91 loc) 4.23 kB
# CODE GENERATION COMPLIANCE MATRIX **Engineering Task**: ${task} **Mandatory Coding Standards**: The following rules are ENFORCED for all code generation: ${rulesContent} ## CODE IMPLEMENTATION PROTOCOL: 1. **Architecture Alignment**: Generated code MUST follow project architecture patterns 2. **Type Safety**: Enforce type constraints and validation requirements 3. **Error Handling**: Apply project-specific error handling patterns 4. **Performance**: Adhere to performance optimization guidelines 5. **Security**: Implement security patterns as defined in rules ## ENGINEERING ENFORCEMENT MATRIX: | Violation Type | Required Action | Example | |----------------|-----------------|---------| | Architecture Violation | BLOCK + Suggest Pattern | "Use Repository pattern, not direct DB access" | | Security Violation | BLOCK + Explain Risk | "Never expose API keys in client code" | | Performance Anti-pattern | WARN + Provide Alternative | "Use batch operations instead of N+1 queries" | | Style Violation | AUTO-CORRECT | "Apply project formatting standards" | ## COMPLIANCE VERIFICATION CHECKLIST: - [ ] Code follows architectural patterns defined above - [ ] All security requirements are implemented - [ ] Performance guidelines are respected - [ ] Error handling matches project standards - [ ] Code style adheres to project conventions ## 🔍 DEVELOPER DOCUMENTATION SEARCH PROTOCOL: **⚡ PERFORMANCE IMPACT**: Inefficient searches delay implementation. Master these patterns: ### CODE-FIRST SEARCH METHODOLOGY: #### 1. **Parse Developer Intent → Extract Technical Entities** ```typescript // Developer request: "implement OAuth2 with refresh tokens" const searchEntities = { primary: ["OAuth2", "OAuth"], // Protocol/Standard names secondary: ["RefreshToken", "Token"], // Component names framework: ["Authentication", "Auth"] // Framework context }; ``` #### 2. **Technical Taxonomy Search Hierarchy** ``` Layer 1: Framework/Library → "React", "Express", "Django" Layer 2: Design Pattern → "Observer", "Factory", "Singleton" Layer 3: Implementation → "useState", "middleware", "decorator" Layer 4: Configuration → "webpack", "tsconfig", "eslint" ``` #### 3. **API Resolution Strategy** Transform natural language to API nomenclature: ```javascript const searchTransform = { "make API calls": ["fetch", "axios", "HttpClient"], "handle errors": ["try-catch", "ErrorBoundary", "exception"], "manage state": ["Redux", "Context", "useState", "Vuex"], "test my code": ["Jest", "Mocha", "Testing", "TestCase"], "deploy app": ["Docker", "CI/CD", "Kubernetes", "Deploy"] }; ``` ### 🎯 SEARCH OPTIMIZATION MATRIX: | Developer Says | Primary Search | Fallback Search | Framework Hint | |----------------|----------------|-----------------|----------------| | "REST API endpoints" | "REST", "API" | "Controller", "Route" | Express/FastAPI | | "state management" | "State", "Store" | "Redux", "Context" | React/Vue | | "async operations" | "async", "Promise" | "await", "then" | JavaScript | | "database queries" | "Query", "ORM" | "Model", "Schema" | TypeORM/Prisma | | "authentication flow" | "Auth", "JWT" | "Login", "Session" | Passport/Auth0 | ### 💡 INTELLIGENT SEARCH PATTERNS: ```python def optimize_search_query(user_input): # 1. Remove implementation verbs query = remove_verbs(["implement", "create", "build", "add"]) # 2. Extract technical nouns entities = extract_entities(query) # 3. Expand abbreviations expanded = expand_abbreviations({ "API": "Application Programming Interface", "DB": "Database", "Auth": "Authentication", "UI": "UserInterface" }) # 4. Try incremental searches return progressive_search(entities, max_attempts=3) ``` ### 🚀 EXECUTION PIPELINE: ```mermaid graph LR A[Parse Task] --> B[Extract Entities] B --> C{Found Docs?} C -->|Yes| D[explore_api] C -->|No| E[Broaden Search] E --> F[Try Synonyms] F --> C D --> G[Implement Code] ``` **🧠 REMEMBER**: You're querying a codebase knowledge graph, not a search engine. Think in types, classes, and interfaces. **Status**: Rules loaded and active for current session