apply_quality_rules
Enhance code quality by enforcing predefined quality rules for naming, structure, accessibility, or language-specific standards such as JavaScript, TypeScript, or React. Automatically triggered by keywords like 'apply rules' or 'follow conventions.'
Instructions
IMPORTANT: This tool should be automatically called when users say "규칙 적용", "표준 적용", "apply rules", "apply standards", "follow conventions", "적용해" or similar keywords. Apply quality rules
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Programming language context | |
| scope | Yes | Application scope |
Implementation Reference
- The main handler function that executes the tool logic, selecting and returning applicable quality rules based on scope and language.export async function applyQualityRules(args: { scope: string; language?: string }): Promise<ToolResult> { const { scope, language: contextLanguage = 'general' } = args; const applicableRules = []; if (scope === 'naming' || scope === 'all') { applicableRules.push({ category: 'Naming Conventions', rules: QUALITY_RULES.NAMING }); } if (scope === 'structure' || scope === 'all') { applicableRules.push({ category: 'Code Structure', rules: QUALITY_RULES.STRUCTURE }); } if (scope === 'typescript' || scope === 'all') { applicableRules.push({ category: 'TypeScript Guidelines', rules: QUALITY_RULES.ANTIPATTERNS.typescript }); } if (scope === 'react' || scope === 'all') { applicableRules.push({ category: 'React Guidelines', rules: QUALITY_RULES.ANTIPATTERNS.react }); } if (scope === 'accessibility' || scope === 'all') { applicableRules.push({ category: 'Accessibility Guidelines', rules: [ 'Use semantic HTML elements', 'Provide alt text for images', 'Ensure keyboard navigation', 'Maintain color contrast ratios', 'Use ARIA labels when needed' ] }); } const qualityRulesResult = { action: 'apply_quality_rules', scope, language: contextLanguage, rules: applicableRules, asyncStates: QUALITY_RULES.ASYNC_STATES, stateManagement: QUALITY_RULES.STATE_MANAGEMENT, status: 'success' }; const rulesSummary = applicableRules.map(r => `${r.category}: ${Array.isArray(r.rules) ? r.rules.length + ' rules' : Object.keys(r.rules).length + ' items'}`).join(', '); return { content: [{ type: 'text', text: `Scope: ${scope}\nLanguage: ${contextLanguage}\nRules Applied: ${rulesSummary}\n\nAsync States: ${QUALITY_RULES.ASYNC_STATES.join(', ')}\n\nState Mgmt:\n${Object.entries(QUALITY_RULES.STATE_MANAGEMENT).map(([k, v]) => `- ${k}: ${v}`).join('\n')}` }] }; }
- The ToolDefinition object specifying the tool's name, description, input schema, and annotations.export const applyQualityRulesDefinition: ToolDefinition = { name: 'apply_quality_rules', description: '규칙 적용|표준 적용|apply rules|apply standards|follow conventions|적용해 - Apply quality rules', inputSchema: { type: 'object', properties: { scope: { type: 'string', description: 'Application scope', enum: ['naming', 'structure', 'typescript', 'react', 'accessibility', 'all'] }, language: { type: 'string', description: 'Programming language context', enum: ['javascript', 'typescript', 'react', 'vue', 'general'] } }, required: ['scope'] }, annotations: { title: 'Apply Quality Rules', audience: ['user', 'assistant'] } };
- src/index.ts:185-186 (registration)Registration in the main switch statement that dispatches tool calls to the applyQualityRules handler.case 'apply_quality_rules': return await applyQualityRules(args as any) as CallToolResult;
- src/index.ts:86-86 (registration)Inclusion of the tool definition in the tools array returned by ListToolsRequestHandler.applyQualityRulesDefinition,