Feature Context: Comprehensive Claude Code Plugin Linter
Document Metadata
- Generated: 2026-02-13
- Input Type: complex_requirement_document
- Source: User feature request with official schemas and backlog issues
- Status: DISCOVERY_COMPLETE
Original Request
Extend ./plugins/plugin-creator/scripts/plugin_validator.py (2934+ lines) into a comprehensive ruff-like static analysis linter that validates ALL 7 component types in the Claude Code plugin ecosystem against official schemas.
Official Schema Sources (already fetched and verified):
- Skills (SKILL.md) — 10 frontmatter fields
- Commands — SAME schema as skills
- Agents — 12 frontmatter fields
- Hooks (hooks.json) — nested JSON structure with 15 event types
- Plugin manifest (plugin.json) — component paths and metadata
- MCP config (.mcp.json) — server definitions
- LSP config (.lsp.json) — language server definitions
Known Issues (from backlog, verified 2026-02-13):
- UX: report counts validators not files (lines 2928-2931)
- SK005 fires on commands (DescriptionValidator has no file-type awareness, line 1802)
- Hooks not recognized (FileType has no HOOK variant, lines 141-165)
- Dead code in _resolve_skill_reference nested pattern (lines 904-911)
Core Intent Analysis
WHO (Target Users)
- Plugin developers — need confidence their plugins meet schema requirements
- Pre-commit hooks — need fast validation to block invalid commits
- CI/CD pipelines — need machine-parseable validation reports
- Marketplace reviewers — need comprehensive quality assessment
WHAT (Desired Outcome)
A single comprehensive static analysis tool that validates all Claude Code plugin components against official schemas with actionable error messages.
WHEN (Trigger Conditions)
- Before committing plugin changes (pre-commit hook)
- During plugin development (manual validation)
- Before marketplace submission (quality gate)
- In CI/CD pipelines (automated checks)
WHY (Problem Being Solved)
Current Pain Points:
- Incomplete coverage — no validation for hooks, MCP, LSP configs
- Type confusion — validator treats commands as skills, no file-type-specific validation
- UX issues — reports count validators not files, unclear which file has problems
- Scattered validation — bash scripts + Python scripts + Claude CLI commands, no unified tool
Impact: Plugin developers ship broken configs, marketplace receives invalid plugins, users encounter runtime errors from malformed schemas.
Codebase Research
Similar Patterns Found
Pattern 1: Existing Validator Architecture
- Location:
plugins/plugin-creator/scripts/plugin_validator.py:249-286
- Relevance: Protocol-based validator pattern with validate/can_fix/fix methods
- Reusable:
- Validator protocol interface
- ValidationResult/ValidationIssue data models
- Error code generation and documentation URL linking
- Rich console output with color support
Pattern 2: FileType Detection
- Location:
plugins/plugin-creator/scripts/plugin_validator.py:138-165
- Relevance: Enum-based file type classification
- Gap: No HOOK, MCP_CONFIG, LSP_CONFIG variants
- Reusable: detect_file_type() static method pattern
Pattern 3: Token-Based Complexity Measurement
- Location:
plugins/plugin-creator/scripts/plugin_validator.py:1939-2122 (ComplexityValidator class)
- Relevance: Uses tiktoken library for accurate AI cost estimation
- Reusable:
- Token counting via tiktoken encoding
- Threshold-based status determination (ok/warning/error)
- Frontmatter vs body token separation
Pattern 4: Pydantic Schema Validation
- Location:
plugins/plugin-creator/scripts/plugin_validator.py:1030-1236
- Relevance: Type-safe frontmatter validation with field validators
- Reusable:
- SkillFrontmatter, AgentFrontmatter, CommandFrontmatter models
- CSV normalization validators
- Colon validation in descriptions (FM009)
- Pattern validation for names (FM010)
Existing Infrastructure
9 Validator Classes (lines 249-2713):
- Validator (Protocol) — interface definition
- ProgressiveDisclosureValidator — checks for references/examples/scripts dirs
- InternalLinkValidator — markdown link validity
- NamespaceReferenceValidator — cross-plugin references (Skill(), Task(), @agent, /command)
- FrontmatterValidator — Pydantic schema validation
- NameFormatValidator — name field pattern checking
- DescriptionValidator — description quality (length, trigger phrases)
- ComplexityValidator — token-based skill complexity
- PluginStructureValidator — plugin.json schema and component paths
23 Error Codes across 6 categories:
- FM001-FM010: Frontmatter errors (10 codes)
- SK001-SK007: Skill errors (7 codes)
- LK001-LK002: Link errors (2 codes)
- PD001-PD003: Progressive disclosure (3 codes)
- PL001-PL005: Plugin errors (5 codes)
- NR001-NR002: Namespace reference errors (2 codes)
Test Coverage (11 test files):
- test_frontmatter_validator.py
- test_name_format_validator.py
- test_description_validator.py
- test_complexity_validator.py
- test_internal_link_validator.py
- test_progressive_disclosure_validator.py
- test_plugin_structure_validator.py
- test_token_counting.py
- test_cli.py
- test_external_tools.py
- test_auto_sync_manifests.py
Code References
plugins/plugin-creator/scripts/plugin_validator.py:71-109 — error code constants
plugins/plugin-creator/scripts/plugin_validator.py:138-165 — FileType enum
plugins/plugin-creator/scripts/plugin_validator.py:249-286 — Validator protocol
plugins/plugin-creator/scripts/plugin_validator.py:1030-1236 — Pydantic models
plugins/plugin-creator/scripts/plugin_validator.py:2928-2931 — UX issue: report counts validators not files
plugins/plugin-creator/scripts/plugin_validator.py:1802 — SK005 fires on commands (no file-type awareness)
plugins/plugin-creator/scripts/plugin_validator.py:904-911 — dead code in nested skill reference resolution
Use Scenarios
Scenario 1: Plugin Developer Pre-Commit
Actor: Developer modifying a skill
Trigger: git commit with staged SKILL.md changes
Goal: Validate changes before commit succeeds
Expected Outcome:
- Pre-commit hook runs validator
- Reports errors with file:line references
- Blocks commit if errors found
- Passes silently if valid
Scenario 2: Marketplace Submission Review
Actor: Marketplace reviewer
Trigger: Developer submits plugin for listing
Goal: Verify plugin meets all schema requirements
Expected Outcome:
- Validator runs against all 7 component types
- Generates comprehensive report with scores
- Flags any non-standard patterns
- Provides improvement suggestions
Scenario 3: CI/CD Pipeline Validation
Actor: CI/CD automation
Trigger: Pull request opened with plugin changes
Goal: Automated quality gate
Expected Outcome:
- Machine-parseable output (JSON/SARIF)
- Non-zero exit code on failure
- GitHub annotations on specific lines
- Summary comment on PR
Scenario 4: Developer Manual Validation
Actor: Developer creating new hook configuration
Trigger: uv run plugin_validator.py hooks.json
Goal: Verify hook config before testing
Expected Outcome:
- Validates against 15 event type schemas
- Checks matcher regex validity
- Validates hook type fields (command/prompt/agent)
- Reports unknown event types or malformed hooks
Gap Analysis
Identified Gaps
| # |
Category |
Gap Description |
Impact |
| 1 |
Component Coverage |
No validation for hooks.json structure |
Broken hooks fail at runtime, no pre-commit detection |
| 2 |
Component Coverage |
No validation for .mcp.json schema |
Invalid MCP configs silently fail, server doesn't start |
| 3 |
Component Coverage |
No validation for .lsp.json schema |
LSP server connections fail, no diagnostics available |
| 4 |
File Type Detection |
FileType enum missing HOOK, MCP_CONFIG, LSP_CONFIG |
Cannot dispatch to appropriate validator |
| 5 |
Type-Specific Validation |
DescriptionValidator fires SK005 on commands |
False positives, commands don't need trigger phrases |
| 6 |
UX |
Report counts validators not files |
Developer sees "9 validators passed" instead of "5 files validated" |
| 7 |
Error Codes |
No HK, MC, LS prefixes for new component types |
Inconsistent error categorization |
| 8 |
Dead Code |
Nested skill reference resolution unreachable |
Maintenance burden, confusing to future developers |
| 9 |
Test Coverage |
No tests for hook/MCP/LSP validation |
Cannot verify new validators work correctly |
| 10 |
Schema Sources |
Hook/MCP/LSP schemas hardcoded or undocumented |
Schema drift risk, no single source of truth |
Questions Requiring Resolution
Q1: Schema Source of Truth
- Category: Integration
- Gap: Where are the official hook/MCP/LSP schemas defined?
- Question: Should validator embed schemas, fetch from Claude Code CLI, or reference external files?
- Options:
- A) Embed schemas in validator code (fastest, risk of drift)
- B) Parse schemas from Claude Code installation (accurate, complex discovery)
- C) Reference
.schema.json files in plugin (maintainable, requires schema files)
- Why It Matters: Schema drift causes false positives/negatives. Wrong schema source = unreliable validation.
- Resolution: pending
Q2: Error Code Namespace Expansion
- Category: Scope
- Gap: Need error codes for 3 new component types
- Question: Add HK (hooks), MC (MCP), LS (LSP) prefixes with 001-010 codes each?
- Options:
- A) Yes, add 30 new error codes (10 per category)
- B) Reuse existing prefixes where semantically similar
- C) Use single HC (hook config) prefix for all JSON configs
- Why It Matters: Error code organization affects documentation, error lookup, and developer experience.
- Resolution: pending
Q3: File Type Detection Heuristics
- Category: Behavior
- Gap: How to detect hook/MCP/LSP config files?
- Question: Match by filename, path pattern, or content inspection?
- Options:
- A) Exact filename match (
hooks.json, .mcp.json, .lsp.json)
- B) Path pattern (
*/hooks.json, */.mcp.json, etc.)
- C) Content inspection (parse and check top-level keys)
- Why It Matters: Wrong detection = validator runs inappropriate checks or skips files entirely.
- Resolution: pending
Q4: Validator Auto-Fix Capability
- Category: Behavior
- Gap: Should hook/MCP/LSP validators support auto-fix?
- Question: What can be auto-fixed in JSON configs vs what requires human decision?
- Options:
- A) No auto-fix for JSON configs (too risky, complex structure)
- B) Auto-fix simple issues (missing optional fields with defaults)
- C) Interactive fix mode (prompt for corrections)
- Why It Matters: Auto-fix can corrupt complex nested structures if done incorrectly.
- Resolution: pending
Q5: Command vs Skill Differentiation
- Category: Behavior
- Gap: Commands use same schema as skills but need different validation rules
- Question: How should DescriptionValidator handle commands?
- Options:
- A) Skip SK005 (trigger phrase check) for commands
- B) Different trigger phrase requirements for commands
- C) Commands don't need descriptions (wrong, they do per schema)
- Why It Matters: Current behavior fires SK005 on valid commands, causing false positives.
- Resolution: pending
Q6: Performance Constraints
- Category: User
- Gap: Pre-commit hook must be fast (<5s)
- Question: Should validator cache results, parallelize checks, or optimize file I/O?
- Options:
- A) Cache validation results by file hash
- B) Parallelize independent validators using multiprocessing
- C) Read files once, pass content to all validators
- D) No optimization, rely on Python speed
- Why It Matters: Slow pre-commit hooks get disabled by developers.
- Resolution: pending
Q7: Report Format Requirements
- Category: Integration
- Gap: Different consumers need different output formats
- Question: Support multiple output formats (human, JSON, SARIF, GitHub annotations)?
- Options:
- A) Human-readable only (Rich console output)
- B) Add
--format json|sarif|github flag
- C) Always output all formats to different files
- Why It Matters: CI/CD and IDE integrations require machine-parseable formats.
- Resolution: pending
Goals (Pending Resolution)
These goals will be finalized after questions are resolved.
- Extend FileType enum with HOOK, MCP_CONFIG, LSP_CONFIG variants
- Create HookValidator class validating hooks.json against 15 event type schemas
- Create MCPConfigValidator class validating .mcp.json server definitions
- Create LSPConfigValidator class validating .lsp.json language server configs
- Fix SK005 false positives by adding file-type awareness to DescriptionValidator
- Fix UX issue: report file counts instead of validator counts
- Remove dead code in NamespaceReferenceValidator._resolve_skill_reference
- Add 30 new error codes (HK001-HK010, MC001-MC010, LS001-LS010)
- Create comprehensive test suite for new validators (3 new test files)
- Update ERROR_CODES.md with new error code documentation
- Performance optimization: single file read, pass content to validators
- Add --format flag for JSON/SARIF/GitHub output
Next Steps
After questions are resolved:
- Update "Resolution" fields in Questions section
- Finalize Goals section with concrete acceptance criteria
- Proceed to RT-ICA assessment (verify information completeness)
- Then proceed to architecture design phase
- Create task decomposition for implementation
Risk Assessment
High Risk Areas
Schema Drift — If validator embeds schemas that diverge from Claude Code's actual schemas, validation becomes unreliable.
- Mitigation: Reference official schema files or parse from Claude CLI
Performance Regression — Adding 3 new validators + JSON parsing could slow pre-commit hook.
- Mitigation: Benchmark current performance, set <5s budget, optimize file I/O
Breaking Changes — Fixing SK005 bug might reveal hundreds of existing violations in codebase.
- Mitigation: Add gradual rollout strategy, warn first then error
Medium Risk Areas
Test Coverage Gap — No existing tests for hook/MCP/LSP validation means new code could be buggy.
- Mitigation: Write tests before implementation (TDD)
Error Code Proliferation — 30 new error codes means more documentation to maintain.
- Mitigation: Consolidate where possible, template error documentation
Low Risk Areas
Dead Code Removal — Removing unreachable nested skill reference code is safe.
- Evidence: Code is after early return, never executed
UX Fix — Changing report count from validators to files is cosmetic.
- Evidence: No behavior change, only string formatting
Technical Complexity Assessment
Straightforward Components
- FileType enum extension — Add 3 enum values, update detect_file_type()
- Dead code removal — Delete lines 904-911 after verification
- UX report fix — Change lines 2928-2931 to count validated files
- Error code constants — Add 30 new constants following existing pattern
Moderate Complexity Components
- SK005 file-type awareness — Pass FileType to DescriptionValidator.validate()
- Hook validator — Parse JSON, validate against 15 event type schemas
- MCP validator — Validate required fields (command), optional fields (args/env)
- LSP validator — Validate required fields (command, extensionToLanguage)
High Complexity Components
- Hook matcher regex validation — Must validate user-provided regex without executing
- Performance optimization — Requires profiling, multiprocessing coordination
- Multiple output formats — SARIF/GitHub annotations have complex schemas
- Schema source integration — Parsing schemas from Claude CLI is complex discovery
Dependencies on External Systems
- Claude Code CLI — May need to query for official schemas
- Pre-commit framework — Hook must follow pre-commit protocol
- tiktoken library — Already in use for token counting
- pydantic — Already in use for schema validation
- pytest — Test framework for new test suite
Backward Compatibility Concerns
CLI Interface — Current invocation: uv run plugin_validator.py <path>
- New flags must not break existing usage
- Existing error codes must remain stable
- Exit codes must remain 0 (pass) or non-zero (fail)
Pre-Commit Hook — Currently configured in .pre-commit-config.yaml
- New validators must not slow hook below 5s threshold
- Must remain compatible with prek (pre-commit replacement)
Error Code Documentation — ERROR_CODES.md references URLs
- New error codes must follow existing URL pattern
- Old error codes must not change meaning
Related Work
Similar Tools in Python Ecosystem:
ruff — Fast Python linter (model: single binary, many rules)
mypy — Type checker (model: plugin architecture)
pylint — Comprehensive linter (model: checker classes with register/run)
Existing Validation in Codebase:
validate-skill-structure.sh — REMOVED (logic ported to plugin_validator.py)
count-skill-lines.sh — REMOVED (superseded by token metrics in plugin_validator.py)
validate-task-file.sh — Task file validation
claude plugin validate — Built-in CLI command (black box)
Success Criteria
Functional Requirements
Performance Requirements
Quality Requirements
Usability Requirements
Open Research Questions
Requires additional investigation:
- What is the exact JSON schema for hooks.json? (Need to parse official docs or examples)
- What regex flavor does matcher field use? (Python re, PCRE, JavaScript?)
- How does Claude Code resolve ${CLAUDE_PLUGIN_ROOT} in MCP command field?
- Are there undocumented LSP fields we should validate or warn about?
- What is the performance impact of adding 3 new validators? (Need benchmarking)
- How many existing plugins will fail validation after SK005 fix? (Need to audit)
Cannot be resolved during discovery phase — requires experimentation or upstream documentation.
1---2name: feature-context-comprehensive-claude-code-plugin-linter-33description: Extend ./plugins/plugin-creator/scripts/plugin_validator.py (2934+ lines) into a comprehensive ruff-like static analysis linter that validates ALL 7 component types in the Claude Code plugin ecosystem against official…4---5# Feature Context: Comprehensive Claude Code Plugin Linter67## Document Metadata89- **Generated**: 2026-02-1310- **Input Type**: complex_requirement_document11- **Source**: User feature request with official schemas and backlog issues12- **Status**: DISCOVERY_COMPLETE1314---1516## Original Request1718Extend `./plugins/plugin-creator/scripts/plugin_validator.py` (2934+ lines) into a comprehensive `ruff`-like static analysis linter that validates ALL 7 component types in the Claude Code plugin ecosystem against official schemas.1920**Official Schema Sources (already fetched and verified)**:21- Skills (SKILL.md) — 10 frontmatter fields22- Commands — SAME schema as skills23- Agents — 12 frontmatter fields24- Hooks (hooks.json) — nested JSON structure with 15 event types25- Plugin manifest (plugin.json) — component paths and metadata26- MCP config (.mcp.json) — server definitions27- LSP config (.lsp.json) — language server definitions2829**Known Issues (from backlog, verified 2026-02-13)**:301. UX: report counts validators not files (lines 2928-2931)312. SK005 fires on commands (DescriptionValidator has no file-type awareness, line 1802)323. Hooks not recognized (FileType has no HOOK variant, lines 141-165)334. Dead code in _resolve_skill_reference nested pattern (lines 904-911)3435---3637## Core Intent Analysis3839### WHO (Target Users)4041- **Plugin developers** — need confidence their plugins meet schema requirements42- **Pre-commit hooks** — need fast validation to block invalid commits43- **CI/CD pipelines** — need machine-parseable validation reports44- **Marketplace reviewers** — need comprehensive quality assessment4546### WHAT (Desired Outcome)4748A single comprehensive static analysis tool that validates all Claude Code plugin components against official schemas with actionable error messages.4950### WHEN (Trigger Conditions)5152- Before committing plugin changes (pre-commit hook)53- During plugin development (manual validation)54- Before marketplace submission (quality gate)55- In CI/CD pipelines (automated checks)5657### WHY (Problem Being Solved)5859**Current Pain Points**:601. **Incomplete coverage** — no validation for hooks, MCP, LSP configs612. **Type confusion** — validator treats commands as skills, no file-type-specific validation623. **UX issues** — reports count validators not files, unclear which file has problems634. **Scattered validation** — bash scripts + Python scripts + Claude CLI commands, no unified tool6465**Impact**: Plugin developers ship broken configs, marketplace receives invalid plugins, users encounter runtime errors from malformed schemas.6667---6869## Codebase Research7071### Similar Patterns Found7273#### Pattern 1: Existing Validator Architecture7475- **Location**: `plugins/plugin-creator/scripts/plugin_validator.py:249-286`76- **Relevance**: Protocol-based validator pattern with validate/can_fix/fix methods77- **Reusable**:78 - Validator protocol interface79 - ValidationResult/ValidationIssue data models80 - Error code generation and documentation URL linking81 - Rich console output with color support8283#### Pattern 2: FileType Detection8485- **Location**: `plugins/plugin-creator/scripts/plugin_validator.py:138-165`86- **Relevance**: Enum-based file type classification87- **Gap**: No HOOK, MCP_CONFIG, LSP_CONFIG variants88- **Reusable**: detect_file_type() static method pattern8990#### Pattern 3: Token-Based Complexity Measurement9192- **Location**: `plugins/plugin-creator/scripts/plugin_validator.py:1939-2122` (ComplexityValidator class)93- **Relevance**: Uses tiktoken library for accurate AI cost estimation94- **Reusable**:95 - Token counting via tiktoken encoding96 - Threshold-based status determination (ok/warning/error)97 - Frontmatter vs body token separation9899#### Pattern 4: Pydantic Schema Validation100101- **Location**: `plugins/plugin-creator/scripts/plugin_validator.py:1030-1236`102- **Relevance**: Type-safe frontmatter validation with field validators103- **Reusable**:104 - SkillFrontmatter, AgentFrontmatter, CommandFrontmatter models105 - CSV normalization validators106 - Colon validation in descriptions (FM009)107 - Pattern validation for names (FM010)108109### Existing Infrastructure110111**9 Validator Classes** (lines 249-2713):1121. Validator (Protocol) — interface definition1132. ProgressiveDisclosureValidator — checks for references/examples/scripts dirs1143. InternalLinkValidator — markdown link validity1154. NamespaceReferenceValidator — cross-plugin references (Skill(), Task(), @agent, /command)1165. FrontmatterValidator — Pydantic schema validation1176. NameFormatValidator — name field pattern checking1187. DescriptionValidator — description quality (length, trigger phrases)1198. ComplexityValidator — token-based skill complexity1209. PluginStructureValidator — plugin.json schema and component paths121122**23 Error Codes** across 6 categories:123- FM001-FM010: Frontmatter errors (10 codes)124- SK001-SK007: Skill errors (7 codes)125- LK001-LK002: Link errors (2 codes)126- PD001-PD003: Progressive disclosure (3 codes)127- PL001-PL005: Plugin errors (5 codes)128- NR001-NR002: Namespace reference errors (2 codes)129130**Test Coverage** (11 test files):131- test_frontmatter_validator.py132- test_name_format_validator.py133- test_description_validator.py134- test_complexity_validator.py135- test_internal_link_validator.py136- test_progressive_disclosure_validator.py137- test_plugin_structure_validator.py138- test_token_counting.py139- test_cli.py140- test_external_tools.py141- test_auto_sync_manifests.py142143### Code References144145- `plugins/plugin-creator/scripts/plugin_validator.py:71-109` — error code constants146- `plugins/plugin-creator/scripts/plugin_validator.py:138-165` — FileType enum147- `plugins/plugin-creator/scripts/plugin_validator.py:249-286` — Validator protocol148- `plugins/plugin-creator/scripts/plugin_validator.py:1030-1236` — Pydantic models149- `plugins/plugin-creator/scripts/plugin_validator.py:2928-2931` — UX issue: report counts validators not files150- `plugins/plugin-creator/scripts/plugin_validator.py:1802` — SK005 fires on commands (no file-type awareness)151- `plugins/plugin-creator/scripts/plugin_validator.py:904-911` — dead code in nested skill reference resolution152153---154155## Use Scenarios156157### Scenario 1: Plugin Developer Pre-Commit158159**Actor**: Developer modifying a skill160**Trigger**: `git commit` with staged SKILL.md changes161**Goal**: Validate changes before commit succeeds162**Expected Outcome**:163- Pre-commit hook runs validator164- Reports errors with file:line references165- Blocks commit if errors found166- Passes silently if valid167168### Scenario 2: Marketplace Submission Review169170**Actor**: Marketplace reviewer171**Trigger**: Developer submits plugin for listing172**Goal**: Verify plugin meets all schema requirements173**Expected Outcome**:174- Validator runs against all 7 component types175- Generates comprehensive report with scores176- Flags any non-standard patterns177- Provides improvement suggestions178179### Scenario 3: CI/CD Pipeline Validation180181**Actor**: CI/CD automation182**Trigger**: Pull request opened with plugin changes183**Goal**: Automated quality gate184**Expected Outcome**:185- Machine-parseable output (JSON/SARIF)186- Non-zero exit code on failure187- GitHub annotations on specific lines188- Summary comment on PR189190### Scenario 4: Developer Manual Validation191192**Actor**: Developer creating new hook configuration193**Trigger**: `uv run plugin_validator.py hooks.json`194**Goal**: Verify hook config before testing195**Expected Outcome**:196- Validates against 15 event type schemas197- Checks matcher regex validity198- Validates hook type fields (command/prompt/agent)199- Reports unknown event types or malformed hooks200201---202203## Gap Analysis204205### Identified Gaps206207| # | Category | Gap Description | Impact |208|---|----------|-----------------|--------|209| 1 | Component Coverage | No validation for hooks.json structure | Broken hooks fail at runtime, no pre-commit detection |210| 2 | Component Coverage | No validation for .mcp.json schema | Invalid MCP configs silently fail, server doesn't start |211| 3 | Component Coverage | No validation for .lsp.json schema | LSP server connections fail, no diagnostics available |212| 4 | File Type Detection | FileType enum missing HOOK, MCP_CONFIG, LSP_CONFIG | Cannot dispatch to appropriate validator |213| 5 | Type-Specific Validation | DescriptionValidator fires SK005 on commands | False positives, commands don't need trigger phrases |214| 6 | UX | Report counts validators not files | Developer sees "9 validators passed" instead of "5 files validated" |215| 7 | Error Codes | No HK, MC, LS prefixes for new component types | Inconsistent error categorization |216| 8 | Dead Code | Nested skill reference resolution unreachable | Maintenance burden, confusing to future developers |217| 9 | Test Coverage | No tests for hook/MCP/LSP validation | Cannot verify new validators work correctly |218| 10 | Schema Sources | Hook/MCP/LSP schemas hardcoded or undocumented | Schema drift risk, no single source of truth |219220---221222## Questions Requiring Resolution223224### Q1: Schema Source of Truth225226- **Category**: Integration227- **Gap**: Where are the official hook/MCP/LSP schemas defined?228- **Question**: Should validator embed schemas, fetch from Claude Code CLI, or reference external files?229- **Options**:230 - A) Embed schemas in validator code (fastest, risk of drift)231 - B) Parse schemas from Claude Code installation (accurate, complex discovery)232 - C) Reference `.schema.json` files in plugin (maintainable, requires schema files)233- **Why It Matters**: Schema drift causes false positives/negatives. Wrong schema source = unreliable validation.234- **Resolution**: _pending_235236### Q2: Error Code Namespace Expansion237238- **Category**: Scope239- **Gap**: Need error codes for 3 new component types240- **Question**: Add HK (hooks), MC (MCP), LS (LSP) prefixes with 001-010 codes each?241- **Options**:242 - A) Yes, add 30 new error codes (10 per category)243 - B) Reuse existing prefixes where semantically similar244 - C) Use single HC (hook config) prefix for all JSON configs245- **Why It Matters**: Error code organization affects documentation, error lookup, and developer experience.246- **Resolution**: _pending_247248### Q3: File Type Detection Heuristics249250- **Category**: Behavior251- **Gap**: How to detect hook/MCP/LSP config files?252- **Question**: Match by filename, path pattern, or content inspection?253- **Options**:254 - A) Exact filename match (`hooks.json`, `.mcp.json`, `.lsp.json`)255 - B) Path pattern (`*/hooks.json`, `*/.mcp.json`, etc.)256 - C) Content inspection (parse and check top-level keys)257- **Why It Matters**: Wrong detection = validator runs inappropriate checks or skips files entirely.258- **Resolution**: _pending_259260### Q4: Validator Auto-Fix Capability261262- **Category**: Behavior263- **Gap**: Should hook/MCP/LSP validators support auto-fix?264- **Question**: What can be auto-fixed in JSON configs vs what requires human decision?265- **Options**:266 - A) No auto-fix for JSON configs (too risky, complex structure)267 - B) Auto-fix simple issues (missing optional fields with defaults)268 - C) Interactive fix mode (prompt for corrections)269- **Why It Matters**: Auto-fix can corrupt complex nested structures if done incorrectly.270- **Resolution**: _pending_271272### Q5: Command vs Skill Differentiation273274- **Category**: Behavior275- **Gap**: Commands use same schema as skills but need different validation rules276- **Question**: How should DescriptionValidator handle commands?277- **Options**:278 - A) Skip SK005 (trigger phrase check) for commands279 - B) Different trigger phrase requirements for commands280 - C) Commands don't need descriptions (wrong, they do per schema)281- **Why It Matters**: Current behavior fires SK005 on valid commands, causing false positives.282- **Resolution**: _pending_283284### Q6: Performance Constraints285286- **Category**: User287- **Gap**: Pre-commit hook must be fast (<5s)288- **Question**: Should validator cache results, parallelize checks, or optimize file I/O?289- **Options**:290 - A) Cache validation results by file hash291 - B) Parallelize independent validators using multiprocessing292 - C) Read files once, pass content to all validators293 - D) No optimization, rely on Python speed294- **Why It Matters**: Slow pre-commit hooks get disabled by developers.295- **Resolution**: _pending_296297### Q7: Report Format Requirements298299- **Category**: Integration300- **Gap**: Different consumers need different output formats301- **Question**: Support multiple output formats (human, JSON, SARIF, GitHub annotations)?302- **Options**:303 - A) Human-readable only (Rich console output)304 - B) Add `--format json|sarif|github` flag305 - C) Always output all formats to different files306- **Why It Matters**: CI/CD and IDE integrations require machine-parseable formats.307- **Resolution**: _pending_308309---310311## Goals (Pending Resolution)312313_These goals will be finalized after questions are resolved._3143151. Extend FileType enum with HOOK, MCP_CONFIG, LSP_CONFIG variants3162. Create HookValidator class validating hooks.json against 15 event type schemas3173. Create MCPConfigValidator class validating .mcp.json server definitions3184. Create LSPConfigValidator class validating .lsp.json language server configs3195. Fix SK005 false positives by adding file-type awareness to DescriptionValidator3206. Fix UX issue: report file counts instead of validator counts3217. Remove dead code in NamespaceReferenceValidator._resolve_skill_reference3228. Add 30 new error codes (HK001-HK010, MC001-MC010, LS001-LS010)3239. Create comprehensive test suite for new validators (3 new test files)32410. Update ERROR_CODES.md with new error code documentation32511. Performance optimization: single file read, pass content to validators32612. Add --format flag for JSON/SARIF/GitHub output327328---329330## Next Steps331332After questions are resolved:3333341. Update "Resolution" fields in Questions section3352. Finalize Goals section with concrete acceptance criteria3363. Proceed to RT-ICA assessment (verify information completeness)3374. Then proceed to architecture design phase3385. Create task decomposition for implementation339340---341342## Risk Assessment343344### High Risk Areas345346**Schema Drift** — If validator embeds schemas that diverge from Claude Code's actual schemas, validation becomes unreliable.347- **Mitigation**: Reference official schema files or parse from Claude CLI348349**Performance Regression** — Adding 3 new validators + JSON parsing could slow pre-commit hook.350- **Mitigation**: Benchmark current performance, set <5s budget, optimize file I/O351352**Breaking Changes** — Fixing SK005 bug might reveal hundreds of existing violations in codebase.353- **Mitigation**: Add gradual rollout strategy, warn first then error354355### Medium Risk Areas356357**Test Coverage Gap** — No existing tests for hook/MCP/LSP validation means new code could be buggy.358- **Mitigation**: Write tests before implementation (TDD)359360**Error Code Proliferation** — 30 new error codes means more documentation to maintain.361- **Mitigation**: Consolidate where possible, template error documentation362363### Low Risk Areas364365**Dead Code Removal** — Removing unreachable nested skill reference code is safe.366- **Evidence**: Code is after early return, never executed367368**UX Fix** — Changing report count from validators to files is cosmetic.369- **Evidence**: No behavior change, only string formatting370371---372373## Technical Complexity Assessment374375### Straightforward Components3763771. **FileType enum extension** — Add 3 enum values, update detect_file_type()3782. **Dead code removal** — Delete lines 904-911 after verification3793. **UX report fix** — Change lines 2928-2931 to count validated files3804. **Error code constants** — Add 30 new constants following existing pattern381382### Moderate Complexity Components3833845. **SK005 file-type awareness** — Pass FileType to DescriptionValidator.validate()3856. **Hook validator** — Parse JSON, validate against 15 event type schemas3867. **MCP validator** — Validate required fields (command), optional fields (args/env)3878. **LSP validator** — Validate required fields (command, extensionToLanguage)388389### High Complexity Components3903919. **Hook matcher regex validation** — Must validate user-provided regex without executing39210. **Performance optimization** — Requires profiling, multiprocessing coordination39311. **Multiple output formats** — SARIF/GitHub annotations have complex schemas39412. **Schema source integration** — Parsing schemas from Claude CLI is complex discovery395396---397398## Dependencies on External Systems399400- **Claude Code CLI** — May need to query for official schemas401- **Pre-commit framework** — Hook must follow pre-commit protocol402- **tiktoken library** — Already in use for token counting403- **pydantic** — Already in use for schema validation404- **pytest** — Test framework for new test suite405406---407408## Backward Compatibility Concerns409410**CLI Interface** — Current invocation: `uv run plugin_validator.py <path>`411- New flags must not break existing usage412- Existing error codes must remain stable413- Exit codes must remain 0 (pass) or non-zero (fail)414415**Pre-Commit Hook** — Currently configured in `.pre-commit-config.yaml`416- New validators must not slow hook below 5s threshold417- Must remain compatible with prek (pre-commit replacement)418419**Error Code Documentation** — ERROR_CODES.md references URLs420- New error codes must follow existing URL pattern421- Old error codes must not change meaning422423---424425## Related Work426427**Similar Tools in Python Ecosystem**:428- `ruff` — Fast Python linter (model: single binary, many rules)429- `mypy` — Type checker (model: plugin architecture)430- `pylint` — Comprehensive linter (model: checker classes with register/run)431432**Existing Validation in Codebase**:433- `validate-skill-structure.sh` — REMOVED (logic ported to plugin_validator.py)434- `count-skill-lines.sh` — REMOVED (superseded by token metrics in plugin_validator.py)435- `validate-task-file.sh` — Task file validation436- `claude plugin validate` — Built-in CLI command (black box)437438---439440## Success Criteria441442### Functional Requirements443444- [ ] Validates all 7 component types (skills, commands, agents, hooks, plugin.json, .mcp.json, .lsp.json)445- [ ] Detects file types correctly (no false positives/negatives)446- [ ] Reports errors with file:line:column precision447- [ ] Provides actionable error messages with suggestions448- [ ] Auto-fixes safe issues when --fix flag used449- [ ] Returns exit code 0 on pass, non-zero on fail450451### Performance Requirements452453- [ ] Pre-commit hook completes in <5s for typical changes454- [ ] Validates entire plugin in <30s455- [ ] Memory usage <500MB for large plugins456457### Quality Requirements458459- [ ] Test coverage >80% for all new validators460- [ ] No false positives on valid plugins461- [ ] No false negatives on invalid plugins462- [ ] Error messages cite official schema documentation463464### Usability Requirements465466- [ ] Reports count files validated, not validators run467- [ ] Groups errors by file, not by validator468- [ ] Provides suggestions for fixing errors469- [ ] Links to ERROR_CODES.md for detailed explanations470471---472473## Open Research Questions474475**Requires additional investigation**:4764771. What is the exact JSON schema for hooks.json? (Need to parse official docs or examples)4782. What regex flavor does matcher field use? (Python re, PCRE, JavaScript?)4793. How does Claude Code resolve ${CLAUDE_PLUGIN_ROOT} in MCP command field?4804. Are there undocumented LSP fields we should validate or warn about?4815. What is the performance impact of adding 3 new validators? (Need benchmarking)4826. How many existing plugins will fail validation after SK005 fix? (Need to audit)483484**Cannot be resolved during discovery phase** — requires experimentation or upstream documentation.