This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the leetcode-skills repository, a collection of Claude Code Skills for creating interactive algorithm visualization websites for LeetCode problems. Each skill generates complete TypeScript/React projects with D3.js animations.
This repository is published as a Claude Code Plugin. Users install it via /plugin install leetcode-skills and invoke skills via /leetcode-skills:algorithm-visualization.
# Load plugin in development mode
claude --plugin-dir .
# In Claude Code, test the skill
/leetcode-skills:algorithm-visualization 帮我创建两数之和的可视化.claude-plugin/plugin.jsondefines the plugin identity (name:leetcode-skills)- Skills under
skills/are automatically discovered by Claude Code
- Skills Location:
skills/<skill-name>/ - Entry Point: Each skill must have a
SKILL.mdfile with YAML frontmatter (name, description) - Manifest:
skills-manifest.jsonregisters all skills with id, path, entry, description, tags - State Tracking: Installation state tracked in
.skills-repo-state.jsonin target projects
.claude-plugin/
└── plugin.json # Plugin manifest (name, version, metadata)
skills/
└── algorithm-visualization/ # Main skill for LeetCode visualization
├── SKILL.md # Skill definition and execution spec
├── assets/ # Static assets (leetcode-problems cache)
├── references/ # 7 detailed reference docs
├── scripts/ # Helper scripts (fetch-leetcode-problem.py, check-quality-gates.mjs)
└── templates/ # Project generation templates
├── App.tsx, main.tsx # React app templates
├── components/ # React component templates
├── features/ # Feature module templates
├── tests/ # Test setup templates
├── docs/ # Required documentation templates
├── scripts/ # Template project scripts
└── *.config.ts, *.json # Build configs
scripts/
├── create-skill.js # CLI to scaffold new skill
├── validate-skills.js # Validate manifest and structure
└── skill-repo.js # Core skill management functions
install.js / install.sh # Development install scripts
# Create a new skill
node scripts/create-skill.js <skill-id> -d "description"
# Validate skill repository structure
node scripts/validate-skills.js
# Development install to target project (legacy fallback)
node install.js [target-project-path]
./install.sh [target-project-path]
# Load plugin in development mode (preferred)
claude --plugin-dir .Generated projects use Vite + React + TypeScript + D3.js:
# Development (uses random port 30000-65535)
npm run dev
npm run dev:random-port
# Build and type checking
npm run build # Full build with type check
npm run type-check # tsc --noEmit only
# Testing
npm run test:unit # Vitest (required before submission)
npm run test:unit:watch # Vitest watch mode
npm run test:coverage # Vitest with coverage (thresholds: 60/60/50)
npm run test:e2e # Playwright (blocking suite)
npm run test:e2e:headed # Playwright with UI
# Linting
npm run lint # ESLint . --ext ts,tsx --max-warnings 0
# Quality Gates (enforced)
npm run qa:guard # Check required docs, no purple in CSS, vitest dependency
npm run qa:full # Full pipeline: guard + lint + type-check + build + test:unit + test:e2e# Fetch single problem (uses local cache first)
python3 skills/algorithm-visualization/scripts/fetch-leetcode-problem.py <slug-or-number>
# Rebuild full cache (4280 problems) - only needed for updates
python3 skills/algorithm-visualization/scripts/build-problem-cache.py- Only lowercase letters, numbers, and hyphens:
^[a-z0-9][a-z0-9-]*$ - Examples:
algorithm-visualization,react-component-generator
- Technology Stack: TypeScript + React + D3.js + Vite
- Single Screen: No scrolling, all content in viewport
- TDD Required: Unit tests before implementation (
tests/unit/) - Coverage Thresholds: lines >= 60%, functions >= 60%, branches >= 50%
- Required Docs (in
docs/): QUALITY_GATE.md, TEST_PLAN.md, ACCEPTANCE_CHECKLIST.md, ACCEPTANCE_REPORT_TEMPLATE.md, PROGRESSIVE_DELIVERY.md, PLAYWRIGHT_CASES.md - Deployment: GitHub Actions with lint, type-check, build, deploy-pages
- Color Constraint: No purple (enforced by check-quality-gates.mjs)
- Port Range: 30000-65535 for dev server
Projects are evaluated on B1-B7 criteria:
- B1: No veto items
- B2: lint/type-check/build/test:unit/test:e2e all pass (exit 0)
- B3: Playwright blocking suite 100%
- B4: AC-001 ~ AC-022 all pass
- B5: No P0/P1 defects
- B6: Rubric score >= 80
- B7: Evidence complete
Final state: PASS or FAIL only. Any B failure means FAIL.
- TS/TSX files should stay under 250 lines
- Must split if exceeding 350 lines
skills-manifest.json- Central registry of all skillsskills/algorithm-visualization/SKILL.md- Main execution spec with 23 blocking constraintsskills/algorithm-visualization/references/- 7 detailed specification documentsskills/algorithm-visualization/assets/leetcode-problems/- Cached LeetCode data (4280 problems + index.json)