devflow-kit 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +167 -29
- package/LICENSE +1 -1
- package/README.md +179 -310
- package/dist/cli.js +3 -1
- package/dist/commands/init.d.ts +21 -0
- package/dist/commands/init.js +311 -576
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.js +20 -0
- package/dist/commands/uninstall.d.ts +10 -0
- package/dist/commands/uninstall.js +351 -78
- package/dist/plugins.d.ts +46 -0
- package/dist/plugins.js +162 -0
- package/dist/utils/cli.d.ts +5 -0
- package/dist/utils/cli.js +14 -0
- package/dist/utils/installer.d.ts +41 -0
- package/dist/utils/installer.js +177 -0
- package/dist/utils/paths.d.ts +10 -0
- package/dist/utils/paths.js +23 -3
- package/dist/utils/post-install.d.ts +68 -0
- package/dist/utils/post-install.js +427 -0
- package/dist/utils/safe-delete-install.d.ts +22 -0
- package/dist/utils/safe-delete-install.js +156 -0
- package/dist/utils/safe-delete.d.ts +12 -0
- package/dist/utils/safe-delete.js +83 -0
- package/package.json +18 -8
- package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +7 -0
- package/plugins/devflow-audit-claude/README.md +46 -0
- package/plugins/devflow-audit-claude/agents/claude-md-auditor.md +134 -0
- package/plugins/devflow-audit-claude/commands/audit-claude.md +85 -0
- package/plugins/devflow-code-review/.claude-plugin/plugin.json +31 -0
- package/plugins/devflow-code-review/README.md +73 -0
- package/plugins/devflow-code-review/agents/git.md +272 -0
- package/plugins/devflow-code-review/agents/reviewer.md +119 -0
- package/plugins/devflow-code-review/agents/synthesizer.md +204 -0
- package/plugins/devflow-code-review/commands/code-review-teams.md +262 -0
- package/plugins/devflow-code-review/commands/code-review.md +141 -0
- package/plugins/devflow-code-review/skills/accessibility/SKILL.md +229 -0
- package/plugins/devflow-code-review/skills/accessibility/references/detection.md +171 -0
- package/plugins/devflow-code-review/skills/accessibility/references/patterns.md +670 -0
- package/plugins/devflow-code-review/skills/accessibility/references/violations.md +419 -0
- package/plugins/devflow-code-review/skills/agent-teams/SKILL.md +124 -0
- package/plugins/devflow-code-review/skills/agent-teams/references/cleanup.md +104 -0
- package/plugins/devflow-code-review/skills/agent-teams/references/communication.md +122 -0
- package/plugins/devflow-code-review/skills/agent-teams/references/team-patterns.md +217 -0
- package/plugins/devflow-code-review/skills/architecture-patterns/SKILL.md +153 -0
- package/plugins/devflow-code-review/skills/architecture-patterns/references/detection.md +337 -0
- package/plugins/devflow-code-review/skills/architecture-patterns/references/patterns.md +873 -0
- package/plugins/devflow-code-review/skills/architecture-patterns/references/violations.md +575 -0
- package/plugins/devflow-code-review/skills/complexity-patterns/SKILL.md +143 -0
- package/plugins/devflow-code-review/skills/complexity-patterns/references/detection.md +264 -0
- package/plugins/devflow-code-review/skills/complexity-patterns/references/patterns.md +487 -0
- package/plugins/devflow-code-review/skills/complexity-patterns/references/violations.md +361 -0
- package/plugins/devflow-code-review/skills/consistency-patterns/SKILL.md +140 -0
- package/plugins/devflow-code-review/skills/consistency-patterns/references/detection.md +207 -0
- package/plugins/devflow-code-review/skills/consistency-patterns/references/patterns.md +202 -0
- package/plugins/devflow-code-review/skills/consistency-patterns/references/violations.md +213 -0
- package/plugins/devflow-code-review/skills/database-patterns/SKILL.md +134 -0
- package/plugins/devflow-code-review/skills/database-patterns/references/detection.md +208 -0
- package/plugins/devflow-code-review/skills/database-patterns/references/patterns.md +394 -0
- package/plugins/devflow-code-review/skills/database-patterns/references/violations.md +332 -0
- package/plugins/devflow-code-review/skills/dependencies-patterns/SKILL.md +141 -0
- package/plugins/devflow-code-review/skills/dependencies-patterns/references/detection.md +181 -0
- package/plugins/devflow-code-review/skills/dependencies-patterns/references/patterns.md +225 -0
- package/plugins/devflow-code-review/skills/dependencies-patterns/references/violations.md +247 -0
- package/plugins/devflow-code-review/skills/documentation-patterns/SKILL.md +125 -0
- package/plugins/devflow-code-review/skills/documentation-patterns/references/detection.md +190 -0
- package/plugins/devflow-code-review/skills/documentation-patterns/references/patterns.md +189 -0
- package/plugins/devflow-code-review/skills/documentation-patterns/references/violations.md +163 -0
- package/plugins/devflow-code-review/skills/frontend-design/SKILL.md +254 -0
- package/plugins/devflow-code-review/skills/frontend-design/references/detection.md +184 -0
- package/plugins/devflow-code-review/skills/frontend-design/references/patterns.md +511 -0
- package/plugins/devflow-code-review/skills/frontend-design/references/violations.md +453 -0
- package/plugins/devflow-code-review/skills/performance-patterns/SKILL.md +154 -0
- package/plugins/devflow-code-review/skills/performance-patterns/references/detection.md +351 -0
- package/plugins/devflow-code-review/skills/performance-patterns/references/patterns.md +503 -0
- package/plugins/devflow-code-review/skills/performance-patterns/references/violations.md +354 -0
- package/plugins/devflow-code-review/skills/react/SKILL.md +276 -0
- package/plugins/devflow-code-review/skills/react/references/patterns.md +1331 -0
- package/plugins/devflow-code-review/skills/react/references/violations.md +565 -0
- package/plugins/devflow-code-review/skills/regression-patterns/SKILL.md +146 -0
- package/plugins/devflow-code-review/skills/regression-patterns/references/detection.md +237 -0
- package/plugins/devflow-code-review/skills/regression-patterns/references/patterns.md +226 -0
- package/plugins/devflow-code-review/skills/regression-patterns/references/violations.md +225 -0
- package/plugins/devflow-code-review/skills/review-methodology/SKILL.md +119 -0
- package/plugins/devflow-code-review/skills/review-methodology/references/patterns.md +186 -0
- package/plugins/devflow-code-review/skills/review-methodology/references/report-template.md +142 -0
- package/plugins/devflow-code-review/skills/review-methodology/references/violations.md +125 -0
- package/plugins/devflow-code-review/skills/security-patterns/SKILL.md +156 -0
- package/plugins/devflow-code-review/skills/security-patterns/references/detection.md +287 -0
- package/plugins/devflow-code-review/skills/security-patterns/references/patterns.md +507 -0
- package/plugins/devflow-code-review/skills/security-patterns/references/violations.md +237 -0
- package/plugins/devflow-code-review/skills/test-patterns/SKILL.md +183 -0
- package/plugins/devflow-code-review/skills/test-patterns/references/detection.md +149 -0
- package/plugins/devflow-code-review/skills/test-patterns/references/patterns.md +220 -0
- package/plugins/devflow-code-review/skills/test-patterns/references/report-template.md +108 -0
- package/plugins/devflow-code-review/skills/test-patterns/references/violations.md +221 -0
- package/plugins/devflow-core-skills/.claude-plugin/plugin.json +27 -0
- package/plugins/devflow-core-skills/README.md +50 -0
- package/plugins/devflow-core-skills/skills/accessibility/SKILL.md +229 -0
- package/plugins/devflow-core-skills/skills/accessibility/references/detection.md +171 -0
- package/plugins/devflow-core-skills/skills/accessibility/references/patterns.md +670 -0
- package/plugins/devflow-core-skills/skills/accessibility/references/violations.md +419 -0
- package/plugins/devflow-core-skills/skills/core-patterns/SKILL.md +162 -0
- package/plugins/devflow-core-skills/skills/core-patterns/references/checklist.md +276 -0
- package/plugins/devflow-core-skills/skills/core-patterns/references/code-smell-violations.md +144 -0
- package/plugins/devflow-core-skills/skills/core-patterns/references/detection.md +303 -0
- package/plugins/devflow-core-skills/skills/core-patterns/references/patterns.md +576 -0
- package/plugins/devflow-core-skills/skills/core-patterns/references/violations.md +369 -0
- package/plugins/devflow-core-skills/skills/docs-framework/SKILL.md +134 -0
- package/plugins/devflow-core-skills/skills/docs-framework/references/patterns.md +346 -0
- package/plugins/devflow-core-skills/skills/docs-framework/references/violations.md +221 -0
- package/plugins/devflow-core-skills/skills/frontend-design/SKILL.md +254 -0
- package/plugins/devflow-core-skills/skills/frontend-design/references/detection.md +184 -0
- package/plugins/devflow-core-skills/skills/frontend-design/references/patterns.md +511 -0
- package/plugins/devflow-core-skills/skills/frontend-design/references/violations.md +453 -0
- package/plugins/devflow-core-skills/skills/git-safety/SKILL.md +122 -0
- package/plugins/devflow-core-skills/skills/git-safety/references/detection.md +290 -0
- package/plugins/devflow-core-skills/skills/git-safety/references/patterns.md +289 -0
- package/plugins/devflow-core-skills/skills/git-safety/references/violations.md +18 -0
- package/plugins/devflow-core-skills/skills/git-workflow/SKILL.md +158 -0
- package/plugins/devflow-core-skills/skills/git-workflow/references/commit-patterns.md +115 -0
- package/plugins/devflow-core-skills/skills/git-workflow/references/commit-violations.md +77 -0
- package/plugins/devflow-core-skills/skills/git-workflow/references/pr-patterns.md +127 -0
- package/plugins/devflow-core-skills/skills/git-workflow/references/pr-violations.md +96 -0
- package/plugins/devflow-core-skills/skills/github-patterns/SKILL.md +153 -0
- package/plugins/devflow-core-skills/skills/github-patterns/references/patterns.md +572 -0
- package/plugins/devflow-core-skills/skills/github-patterns/references/violations.md +298 -0
- package/plugins/devflow-core-skills/skills/input-validation/SKILL.md +148 -0
- package/plugins/devflow-core-skills/skills/input-validation/references/detection.md +283 -0
- package/plugins/devflow-core-skills/skills/input-validation/references/patterns.md +361 -0
- package/plugins/devflow-core-skills/skills/input-validation/references/violations.md +224 -0
- package/plugins/devflow-core-skills/skills/react/SKILL.md +276 -0
- package/plugins/devflow-core-skills/skills/react/references/patterns.md +1331 -0
- package/plugins/devflow-core-skills/skills/react/references/violations.md +565 -0
- package/plugins/devflow-core-skills/skills/test-patterns/SKILL.md +183 -0
- package/plugins/devflow-core-skills/skills/test-patterns/references/detection.md +149 -0
- package/plugins/devflow-core-skills/skills/test-patterns/references/patterns.md +220 -0
- package/plugins/devflow-core-skills/skills/test-patterns/references/report-template.md +108 -0
- package/plugins/devflow-core-skills/skills/test-patterns/references/violations.md +221 -0
- package/plugins/devflow-core-skills/skills/typescript/SKILL.md +176 -0
- package/plugins/devflow-core-skills/skills/typescript/references/patterns.md +1105 -0
- package/plugins/devflow-core-skills/skills/typescript/references/violations.md +433 -0
- package/plugins/devflow-debug/.claude-plugin/plugin.json +18 -0
- package/plugins/devflow-debug/README.md +65 -0
- package/plugins/devflow-debug/agents/git.md +272 -0
- package/plugins/devflow-debug/commands/debug-teams.md +231 -0
- package/plugins/devflow-debug/commands/debug.md +160 -0
- package/plugins/devflow-debug/skills/agent-teams/SKILL.md +124 -0
- package/plugins/devflow-debug/skills/agent-teams/references/cleanup.md +104 -0
- package/plugins/devflow-debug/skills/agent-teams/references/communication.md +122 -0
- package/plugins/devflow-debug/skills/agent-teams/references/team-patterns.md +217 -0
- package/plugins/devflow-debug/skills/git-safety/SKILL.md +122 -0
- package/plugins/devflow-debug/skills/git-safety/references/detection.md +290 -0
- package/plugins/devflow-debug/skills/git-safety/references/patterns.md +289 -0
- package/plugins/devflow-debug/skills/git-safety/references/violations.md +18 -0
- package/plugins/devflow-implement/.claude-plugin/plugin.json +21 -0
- package/plugins/devflow-implement/README.md +71 -0
- package/plugins/devflow-implement/agents/coder.md +122 -0
- package/plugins/devflow-implement/agents/git.md +272 -0
- package/plugins/devflow-implement/agents/scrutinizer.md +80 -0
- package/plugins/devflow-implement/agents/shepherd.md +94 -0
- package/plugins/devflow-implement/agents/simplifier.md +62 -0
- package/plugins/devflow-implement/agents/skimmer.md +88 -0
- package/plugins/devflow-implement/agents/synthesizer.md +204 -0
- package/plugins/devflow-implement/agents/validator.md +86 -0
- package/plugins/devflow-implement/commands/implement-teams.md +608 -0
- package/plugins/devflow-implement/commands/implement.md +426 -0
- package/plugins/devflow-implement/skills/accessibility/SKILL.md +229 -0
- package/plugins/devflow-implement/skills/accessibility/references/detection.md +171 -0
- package/plugins/devflow-implement/skills/accessibility/references/patterns.md +670 -0
- package/plugins/devflow-implement/skills/accessibility/references/violations.md +419 -0
- package/plugins/devflow-implement/skills/agent-teams/SKILL.md +124 -0
- package/plugins/devflow-implement/skills/agent-teams/references/cleanup.md +104 -0
- package/plugins/devflow-implement/skills/agent-teams/references/communication.md +122 -0
- package/plugins/devflow-implement/skills/agent-teams/references/team-patterns.md +217 -0
- package/plugins/devflow-implement/skills/frontend-design/SKILL.md +254 -0
- package/plugins/devflow-implement/skills/frontend-design/references/detection.md +184 -0
- package/plugins/devflow-implement/skills/frontend-design/references/patterns.md +511 -0
- package/plugins/devflow-implement/skills/frontend-design/references/violations.md +453 -0
- package/plugins/devflow-implement/skills/implementation-patterns/SKILL.md +162 -0
- package/plugins/devflow-implement/skills/implementation-patterns/references/patterns.md +1063 -0
- package/plugins/devflow-implement/skills/implementation-patterns/references/violations.md +483 -0
- package/plugins/devflow-implement/skills/self-review/SKILL.md +149 -0
- package/plugins/devflow-implement/skills/self-review/references/patterns.md +405 -0
- package/plugins/devflow-implement/skills/self-review/references/report-template.md +253 -0
- package/plugins/devflow-implement/skills/self-review/references/violations.md +308 -0
- package/plugins/devflow-resolve/.claude-plugin/plugin.json +19 -0
- package/plugins/devflow-resolve/README.md +65 -0
- package/plugins/devflow-resolve/agents/git.md +272 -0
- package/plugins/devflow-resolve/agents/resolver.md +131 -0
- package/plugins/devflow-resolve/agents/simplifier.md +62 -0
- package/plugins/devflow-resolve/commands/resolve-teams.md +298 -0
- package/plugins/devflow-resolve/commands/resolve.md +237 -0
- package/plugins/devflow-resolve/skills/agent-teams/SKILL.md +124 -0
- package/plugins/devflow-resolve/skills/agent-teams/references/cleanup.md +104 -0
- package/plugins/devflow-resolve/skills/agent-teams/references/communication.md +122 -0
- package/plugins/devflow-resolve/skills/agent-teams/references/team-patterns.md +217 -0
- package/plugins/devflow-resolve/skills/implementation-patterns/SKILL.md +162 -0
- package/plugins/devflow-resolve/skills/implementation-patterns/references/patterns.md +1063 -0
- package/plugins/devflow-resolve/skills/implementation-patterns/references/violations.md +483 -0
- package/plugins/devflow-resolve/skills/security-patterns/SKILL.md +156 -0
- package/plugins/devflow-resolve/skills/security-patterns/references/detection.md +287 -0
- package/plugins/devflow-resolve/skills/security-patterns/references/patterns.md +507 -0
- package/plugins/devflow-resolve/skills/security-patterns/references/violations.md +237 -0
- package/plugins/devflow-self-review/.claude-plugin/plugin.json +7 -0
- package/plugins/devflow-self-review/README.md +38 -0
- package/plugins/devflow-self-review/agents/scrutinizer.md +80 -0
- package/plugins/devflow-self-review/agents/simplifier.md +62 -0
- package/plugins/devflow-self-review/agents/validator.md +86 -0
- package/plugins/devflow-self-review/commands/self-review.md +126 -0
- package/plugins/devflow-self-review/skills/core-patterns/SKILL.md +162 -0
- package/plugins/devflow-self-review/skills/core-patterns/references/checklist.md +276 -0
- package/plugins/devflow-self-review/skills/core-patterns/references/code-smell-violations.md +144 -0
- package/plugins/devflow-self-review/skills/core-patterns/references/detection.md +303 -0
- package/plugins/devflow-self-review/skills/core-patterns/references/patterns.md +576 -0
- package/plugins/devflow-self-review/skills/core-patterns/references/violations.md +369 -0
- package/plugins/devflow-self-review/skills/self-review/SKILL.md +149 -0
- package/plugins/devflow-self-review/skills/self-review/references/patterns.md +405 -0
- package/plugins/devflow-self-review/skills/self-review/references/report-template.md +253 -0
- package/plugins/devflow-self-review/skills/self-review/references/violations.md +308 -0
- package/plugins/devflow-specify/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-specify/README.md +46 -0
- package/plugins/devflow-specify/agents/skimmer.md +88 -0
- package/plugins/devflow-specify/agents/synthesizer.md +204 -0
- package/plugins/devflow-specify/commands/specify-teams.md +314 -0
- package/plugins/devflow-specify/commands/specify.md +179 -0
- package/plugins/devflow-specify/skills/agent-teams/SKILL.md +124 -0
- package/plugins/devflow-specify/skills/agent-teams/references/cleanup.md +104 -0
- package/plugins/devflow-specify/skills/agent-teams/references/communication.md +122 -0
- package/plugins/devflow-specify/skills/agent-teams/references/team-patterns.md +217 -0
- package/scripts/hooks/background-memory-update.sh +167 -0
- package/scripts/hooks/pre-compact-memory.sh +81 -0
- package/scripts/hooks/session-start-memory.sh +84 -0
- package/scripts/hooks/stop-update-memory.sh +81 -0
- package/shared/agents/coder.md +122 -0
- package/shared/agents/git.md +272 -0
- package/shared/agents/resolver.md +131 -0
- package/shared/agents/reviewer.md +119 -0
- package/shared/agents/scrutinizer.md +80 -0
- package/shared/agents/shepherd.md +94 -0
- package/shared/agents/simplifier.md +62 -0
- package/shared/agents/skimmer.md +88 -0
- package/shared/agents/synthesizer.md +204 -0
- package/shared/agents/validator.md +86 -0
- package/shared/skills/accessibility/SKILL.md +229 -0
- package/shared/skills/accessibility/references/detection.md +171 -0
- package/shared/skills/accessibility/references/patterns.md +670 -0
- package/shared/skills/accessibility/references/violations.md +419 -0
- package/shared/skills/agent-teams/SKILL.md +124 -0
- package/shared/skills/agent-teams/references/cleanup.md +104 -0
- package/shared/skills/agent-teams/references/communication.md +122 -0
- package/shared/skills/agent-teams/references/team-patterns.md +217 -0
- package/shared/skills/architecture-patterns/SKILL.md +153 -0
- package/shared/skills/architecture-patterns/references/detection.md +337 -0
- package/shared/skills/architecture-patterns/references/patterns.md +873 -0
- package/shared/skills/architecture-patterns/references/violations.md +575 -0
- package/shared/skills/complexity-patterns/SKILL.md +143 -0
- package/shared/skills/complexity-patterns/references/detection.md +264 -0
- package/shared/skills/complexity-patterns/references/patterns.md +487 -0
- package/shared/skills/complexity-patterns/references/violations.md +361 -0
- package/shared/skills/consistency-patterns/SKILL.md +140 -0
- package/shared/skills/consistency-patterns/references/detection.md +207 -0
- package/shared/skills/consistency-patterns/references/patterns.md +202 -0
- package/shared/skills/consistency-patterns/references/violations.md +213 -0
- package/shared/skills/core-patterns/SKILL.md +162 -0
- package/shared/skills/core-patterns/references/checklist.md +276 -0
- package/shared/skills/core-patterns/references/code-smell-violations.md +144 -0
- package/shared/skills/core-patterns/references/detection.md +303 -0
- package/shared/skills/core-patterns/references/patterns.md +576 -0
- package/shared/skills/core-patterns/references/violations.md +369 -0
- package/shared/skills/database-patterns/SKILL.md +134 -0
- package/shared/skills/database-patterns/references/detection.md +208 -0
- package/shared/skills/database-patterns/references/patterns.md +394 -0
- package/shared/skills/database-patterns/references/violations.md +332 -0
- package/shared/skills/dependencies-patterns/SKILL.md +141 -0
- package/shared/skills/dependencies-patterns/references/detection.md +181 -0
- package/shared/skills/dependencies-patterns/references/patterns.md +225 -0
- package/shared/skills/dependencies-patterns/references/violations.md +247 -0
- package/shared/skills/docs-framework/SKILL.md +134 -0
- package/shared/skills/docs-framework/references/patterns.md +346 -0
- package/shared/skills/docs-framework/references/violations.md +221 -0
- package/shared/skills/documentation-patterns/SKILL.md +125 -0
- package/shared/skills/documentation-patterns/references/detection.md +190 -0
- package/shared/skills/documentation-patterns/references/patterns.md +189 -0
- package/shared/skills/documentation-patterns/references/violations.md +163 -0
- package/shared/skills/frontend-design/SKILL.md +254 -0
- package/shared/skills/frontend-design/references/detection.md +184 -0
- package/shared/skills/frontend-design/references/patterns.md +511 -0
- package/shared/skills/frontend-design/references/violations.md +453 -0
- package/shared/skills/git-safety/SKILL.md +122 -0
- package/shared/skills/git-safety/references/detection.md +290 -0
- package/shared/skills/git-safety/references/patterns.md +289 -0
- package/shared/skills/git-safety/references/violations.md +18 -0
- package/shared/skills/git-workflow/SKILL.md +158 -0
- package/shared/skills/git-workflow/references/commit-patterns.md +115 -0
- package/shared/skills/git-workflow/references/commit-violations.md +77 -0
- package/shared/skills/git-workflow/references/pr-patterns.md +127 -0
- package/shared/skills/git-workflow/references/pr-violations.md +96 -0
- package/shared/skills/github-patterns/SKILL.md +153 -0
- package/shared/skills/github-patterns/references/patterns.md +572 -0
- package/shared/skills/github-patterns/references/violations.md +298 -0
- package/shared/skills/implementation-patterns/SKILL.md +162 -0
- package/shared/skills/implementation-patterns/references/patterns.md +1063 -0
- package/shared/skills/implementation-patterns/references/violations.md +483 -0
- package/shared/skills/input-validation/SKILL.md +148 -0
- package/shared/skills/input-validation/references/detection.md +283 -0
- package/shared/skills/input-validation/references/patterns.md +361 -0
- package/shared/skills/input-validation/references/violations.md +224 -0
- package/shared/skills/performance-patterns/SKILL.md +154 -0
- package/shared/skills/performance-patterns/references/detection.md +351 -0
- package/shared/skills/performance-patterns/references/patterns.md +503 -0
- package/shared/skills/performance-patterns/references/violations.md +354 -0
- package/shared/skills/react/SKILL.md +276 -0
- package/shared/skills/react/references/patterns.md +1331 -0
- package/shared/skills/react/references/violations.md +565 -0
- package/shared/skills/regression-patterns/SKILL.md +146 -0
- package/shared/skills/regression-patterns/references/detection.md +237 -0
- package/shared/skills/regression-patterns/references/patterns.md +226 -0
- package/shared/skills/regression-patterns/references/violations.md +225 -0
- package/shared/skills/review-methodology/SKILL.md +119 -0
- package/shared/skills/review-methodology/references/patterns.md +186 -0
- package/shared/skills/review-methodology/references/report-template.md +142 -0
- package/shared/skills/review-methodology/references/violations.md +125 -0
- package/shared/skills/security-patterns/SKILL.md +156 -0
- package/shared/skills/security-patterns/references/detection.md +287 -0
- package/shared/skills/security-patterns/references/patterns.md +507 -0
- package/shared/skills/security-patterns/references/violations.md +237 -0
- package/shared/skills/self-review/SKILL.md +149 -0
- package/shared/skills/self-review/references/patterns.md +405 -0
- package/shared/skills/self-review/references/report-template.md +253 -0
- package/shared/skills/self-review/references/violations.md +308 -0
- package/shared/skills/test-patterns/SKILL.md +183 -0
- package/shared/skills/test-patterns/references/detection.md +149 -0
- package/shared/skills/test-patterns/references/patterns.md +220 -0
- package/shared/skills/test-patterns/references/report-template.md +108 -0
- package/shared/skills/test-patterns/references/violations.md +221 -0
- package/shared/skills/typescript/SKILL.md +176 -0
- package/shared/skills/typescript/references/patterns.md +1105 -0
- package/shared/skills/typescript/references/violations.md +433 -0
- package/src/templates/claudeignore.template +188 -0
- package/src/templates/managed-settings.json +146 -0
- package/src/templates/settings.json +59 -0
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/uninstall.d.ts.map +0 -1
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/src/claude/CLAUDE.md +0 -400
- package/src/claude/agents/devflow/audit-architecture.md +0 -132
- package/src/claude/agents/devflow/audit-complexity.md +0 -132
- package/src/claude/agents/devflow/audit-database.md +0 -132
- package/src/claude/agents/devflow/audit-dependencies.md +0 -132
- package/src/claude/agents/devflow/audit-documentation.md +0 -132
- package/src/claude/agents/devflow/audit-performance.md +0 -256
- package/src/claude/agents/devflow/audit-security.md +0 -259
- package/src/claude/agents/devflow/audit-tests.md +0 -132
- package/src/claude/agents/devflow/audit-typescript.md +0 -132
- package/src/claude/agents/devflow/brainstorm.md +0 -279
- package/src/claude/agents/devflow/catch-up.md +0 -345
- package/src/claude/agents/devflow/code-review.md +0 -307
- package/src/claude/agents/devflow/commit.md +0 -380
- package/src/claude/agents/devflow/debug.md +0 -476
- package/src/claude/agents/devflow/design.md +0 -491
- package/src/claude/agents/devflow/get-issue.md +0 -286
- package/src/claude/agents/devflow/pr-comments.md +0 -285
- package/src/claude/agents/devflow/project-state.md +0 -419
- package/src/claude/agents/devflow/pull-request.md +0 -493
- package/src/claude/agents/devflow/release.md +0 -1137
- package/src/claude/agents/devflow/tech-debt.md +0 -338
- package/src/claude/commands/devflow/brainstorm.md +0 -68
- package/src/claude/commands/devflow/breakdown.md +0 -125
- package/src/claude/commands/devflow/catch-up.md +0 -29
- package/src/claude/commands/devflow/code-review.md +0 -237
- package/src/claude/commands/devflow/commit.md +0 -17
- package/src/claude/commands/devflow/debug.md +0 -56
- package/src/claude/commands/devflow/design.md +0 -82
- package/src/claude/commands/devflow/devlog.md +0 -408
- package/src/claude/commands/devflow/get-issue.md +0 -16
- package/src/claude/commands/devflow/implement.md +0 -100
- package/src/claude/commands/devflow/plan.md +0 -223
- package/src/claude/commands/devflow/pull-request.md +0 -20
- package/src/claude/commands/devflow/release.md +0 -251
- package/src/claude/commands/devflow/resolve-comments.md +0 -583
- package/src/claude/scripts/statusline.sh +0 -47
- package/src/claude/settings.json +0 -6
- package/src/claude/skills/devflow/code-smell/SKILL.md +0 -428
- package/src/claude/skills/devflow/debug/SKILL.md +0 -119
- package/src/claude/skills/devflow/error-handling/SKILL.md +0 -597
- package/src/claude/skills/devflow/input-validation/SKILL.md +0 -514
- package/src/claude/skills/devflow/pattern-check/SKILL.md +0 -238
- package/src/claude/skills/devflow/research/SKILL.md +0 -138
- package/src/claude/skills/devflow/test-design/SKILL.md +0 -384
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Input Validation Violations
|
|
2
|
+
|
|
3
|
+
Extended examples of validation violations to detect and fix.
|
|
4
|
+
|
|
5
|
+
## Manual Validation Anti-Pattern
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// VIOLATION: Manual validation scatters checks
|
|
9
|
+
function createUser(data: any): User {
|
|
10
|
+
if (!data.email || typeof data.email !== 'string') {
|
|
11
|
+
throw new Error('Invalid email');
|
|
12
|
+
}
|
|
13
|
+
if (!data.age || typeof data.age !== 'number' || data.age < 0) {
|
|
14
|
+
throw new Error('Invalid age');
|
|
15
|
+
}
|
|
16
|
+
if (!data.name || data.name.length > 100) {
|
|
17
|
+
throw new Error('Invalid name');
|
|
18
|
+
}
|
|
19
|
+
// ... more manual checks
|
|
20
|
+
|
|
21
|
+
return { email: data.email, age: data.age, name: data.name };
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Problems**:
|
|
26
|
+
- Scattered validation logic
|
|
27
|
+
- Easy to miss edge cases
|
|
28
|
+
- No type inference
|
|
29
|
+
- Inconsistent error handling
|
|
30
|
+
- Hard to maintain
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Missing API Boundary Validation
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// VIOLATION: No validation at API boundary
|
|
38
|
+
app.post('/api/users', async (req, res) => {
|
|
39
|
+
const user = await createUser(req.body); // Trusting external data!
|
|
40
|
+
res.json(user);
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Security Risk**: HIGH - Injection attacks, data corruption possible
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Trusting External API Responses
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// VIOLATION: Trusting external API response
|
|
52
|
+
async function fetchUserData(userId: string): Promise<UserData> {
|
|
53
|
+
const response = await fetch(`https://api.example.com/users/${userId}`);
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
return data; // No validation!
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Risk**: Application crash if API changes structure, type safety lost
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Unvalidated Environment Variables
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// VIOLATION: Trusting environment variables
|
|
67
|
+
const config = {
|
|
68
|
+
port: process.env.PORT, // Could be undefined or invalid
|
|
69
|
+
dbUrl: process.env.DATABASE_URL, // No validation
|
|
70
|
+
apiKey: process.env.API_KEY // Could be empty or malformed
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Risk**: Runtime crashes, security issues from malformed config
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## SQL Injection Vulnerabilities
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// VIOLATION: Direct string interpolation (SQL injection risk)
|
|
82
|
+
async function getUserByEmail(email: string): Promise<User> {
|
|
83
|
+
const query = `SELECT * FROM users WHERE email = '${email}'`;
|
|
84
|
+
return db.query(query);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// VIOLATION: No input validation before query
|
|
88
|
+
async function searchUsers(searchTerm: string): Promise<User[]> {
|
|
89
|
+
return db.query('SELECT * FROM users WHERE name LIKE $1', [`%${searchTerm}%`]);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Security Risk**: CRITICAL - SQL injection allows data theft, modification, deletion
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## File Upload Without Validation
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// VIOLATION: Accepting any file upload
|
|
101
|
+
app.post('/upload', async (req, res) => {
|
|
102
|
+
const file = req.files.document;
|
|
103
|
+
await file.mv(`./uploads/${file.name}`); // No validation!
|
|
104
|
+
res.send('Uploaded');
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Risks**:
|
|
109
|
+
- Arbitrary file execution
|
|
110
|
+
- Path traversal attacks
|
|
111
|
+
- Storage exhaustion
|
|
112
|
+
- Malware upload
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## URL Parameter Injection
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// VIOLATION: Unvalidated path parameters
|
|
120
|
+
app.get('/users/:id', async (req, res) => {
|
|
121
|
+
const user = await db.users.findById(req.params.id); // No validation!
|
|
122
|
+
res.json(user);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// VIOLATION: Unvalidated query parameters
|
|
126
|
+
app.get('/search', async (req, res) => {
|
|
127
|
+
const results = await db.search(req.query.q); // No validation!
|
|
128
|
+
res.json(results);
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Risks**: NoSQL injection, type coercion attacks, DoS via crafted input
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Header-Based Logic Without Validation
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// VIOLATION: Trusting request headers
|
|
140
|
+
app.use((req, res, next) => {
|
|
141
|
+
const userId = req.headers['x-user-id'];
|
|
142
|
+
req.userId = userId; // No validation!
|
|
143
|
+
next();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// VIOLATION: Trusting JWT without proper validation
|
|
147
|
+
app.use((req, res, next) => {
|
|
148
|
+
const token = req.headers.authorization?.split(' ')[1];
|
|
149
|
+
const decoded = jwt.decode(token); // decode != verify!
|
|
150
|
+
req.user = decoded;
|
|
151
|
+
next();
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Risks**: Authentication bypass, privilege escalation
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Webhook Payload Vulnerabilities
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// VIOLATION: Trusting webhook payloads
|
|
163
|
+
app.post('/webhook', async (req, res) => {
|
|
164
|
+
const event = req.body;
|
|
165
|
+
await processPaymentEvent(event); // No signature verification!
|
|
166
|
+
res.sendStatus(200);
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Risks**: Spoofed events, unauthorized actions, data manipulation
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## GraphQL Input Vulnerabilities
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// VIOLATION: No depth/complexity limits
|
|
178
|
+
const schema = buildSchema(`
|
|
179
|
+
type Query {
|
|
180
|
+
users(filter: UserFilter): [User]
|
|
181
|
+
}
|
|
182
|
+
`);
|
|
183
|
+
|
|
184
|
+
// No validation on nested input
|
|
185
|
+
resolvers.Query.users = (_, { filter }) => {
|
|
186
|
+
return db.users.find(filter); // filter passed directly to DB!
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Risks**: Query complexity attacks, injection through nested objects
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Form Data Without Sanitization
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// VIOLATION: Rendering user input without sanitization
|
|
198
|
+
app.post('/profile', async (req, res) => {
|
|
199
|
+
const bio = req.body.bio;
|
|
200
|
+
await db.users.update({ bio }); // Stored XSS!
|
|
201
|
+
res.send(`Profile updated: ${bio}`); // Reflected XSS!
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Risks**: Cross-site scripting (XSS), stored attacks
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Detection Patterns
|
|
210
|
+
|
|
211
|
+
When reviewing code, look for these red flags:
|
|
212
|
+
|
|
213
|
+
| Pattern | Risk Level |
|
|
214
|
+
|---------|------------|
|
|
215
|
+
| `req.body` without schema validation | HIGH |
|
|
216
|
+
| `req.params` used directly | MEDIUM |
|
|
217
|
+
| `req.query` used directly | MEDIUM |
|
|
218
|
+
| `process.env` without validation | MEDIUM |
|
|
219
|
+
| String interpolation in SQL | CRITICAL |
|
|
220
|
+
| `JSON.parse` without schema | HIGH |
|
|
221
|
+
| `eval()` or `Function()` with user input | CRITICAL |
|
|
222
|
+
| File operations with user-provided paths | CRITICAL |
|
|
223
|
+
| `jwt.decode` instead of `jwt.verify` | CRITICAL |
|
|
224
|
+
| Missing webhook signature verification | HIGH |
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react
|
|
3
|
+
description: This skill should be used when the user works with React components (.tsx/.jsx), asks about "hooks", "state management", "context providers", "memo optimization", "useEffect", or discusses component composition and rendering performance. Provides patterns for hooks, state, effects, memoization, and React-specific architecture.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
allowed-tools: Read, Grep, Glob
|
|
6
|
+
activation:
|
|
7
|
+
file-patterns:
|
|
8
|
+
- "**/*.tsx"
|
|
9
|
+
- "**/*.jsx"
|
|
10
|
+
exclude:
|
|
11
|
+
- "node_modules/**"
|
|
12
|
+
- "**/*.test.*"
|
|
13
|
+
- "**/*.spec.*"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# React Patterns
|
|
17
|
+
|
|
18
|
+
Reference for React-specific patterns, component design, hooks, and performance optimization.
|
|
19
|
+
|
|
20
|
+
## Iron Law
|
|
21
|
+
|
|
22
|
+
> **COMPOSITION OVER PROPS**
|
|
23
|
+
>
|
|
24
|
+
> Use children and compound components, not prop drilling. If a component has >5 props,
|
|
25
|
+
> it's doing too much. Split it. If you're passing data through 3+ levels, use context
|
|
26
|
+
> or composition. Props are for configuration, not data plumbing.
|
|
27
|
+
|
|
28
|
+
## When This Skill Activates
|
|
29
|
+
|
|
30
|
+
- Working with React codebases
|
|
31
|
+
- Creating components and hooks
|
|
32
|
+
- Managing state and side effects
|
|
33
|
+
- Optimizing render performance
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Component Patterns
|
|
38
|
+
|
|
39
|
+
### Functional Component Structure
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
export function UserCard({ user, className }: UserCardProps) {
|
|
43
|
+
const [isExpanded, setIsExpanded] = useState(false); // 1. Hooks first
|
|
44
|
+
const displayName = user.firstName + ' ' + user.lastName; // 2. Derived state
|
|
45
|
+
const handleToggle = () => setIsExpanded((prev) => !prev); // 3. Handlers
|
|
46
|
+
return ( // 4. Render
|
|
47
|
+
<div className={cn('user-card', className)}>
|
|
48
|
+
<h3>{displayName}</h3>
|
|
49
|
+
{isExpanded && <UserDetails user={user} />}
|
|
50
|
+
<button onClick={handleToggle}>{isExpanded ? 'Collapse' : 'Expand'}</button>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Composition Over Props
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
function Card({ children }: { children: React.ReactNode }) {
|
|
60
|
+
return <div className="card">{children}</div>;
|
|
61
|
+
}
|
|
62
|
+
Card.Header = ({ children }) => <div className="card-header">{children}</div>;
|
|
63
|
+
Card.Body = ({ children }) => <div className="card-body">{children}</div>;
|
|
64
|
+
|
|
65
|
+
// Usage - flexible, not rigid props
|
|
66
|
+
<Card>
|
|
67
|
+
<Card.Header><h2>Title</h2></Card.Header>
|
|
68
|
+
<Card.Body><p>Content</p></Card.Body>
|
|
69
|
+
</Card>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Hook Patterns
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
function useLocalStorage<T>(key: string, initialValue: T) {
|
|
78
|
+
const [value, setValue] = useState<T>(() => {
|
|
79
|
+
const stored = localStorage.getItem(key);
|
|
80
|
+
return stored ? JSON.parse(stored) : initialValue;
|
|
81
|
+
});
|
|
82
|
+
useEffect(() => localStorage.setItem(key, JSON.stringify(value)), [key, value]);
|
|
83
|
+
return [value, setValue] as const;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## State Management
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
const AuthContext = createContext<AuthContextValue | null>(null);
|
|
93
|
+
|
|
94
|
+
export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|
95
|
+
const [user, setUser] = useState<User | null>(null);
|
|
96
|
+
const login = async (creds: Credentials) => setUser(await authApi.login(creds));
|
|
97
|
+
const logout = () => { authApi.logout(); setUser(null); };
|
|
98
|
+
return <AuthContext.Provider value={{ user, login, logout }}>{children}</AuthContext.Provider>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function useAuth() {
|
|
102
|
+
const ctx = useContext(AuthContext);
|
|
103
|
+
if (!ctx) throw new Error('useAuth must be used within AuthProvider');
|
|
104
|
+
return ctx;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Performance
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
function UserList({ users, filter }: { users: User[]; filter: string }) {
|
|
114
|
+
const filtered = useMemo(() => users.filter((u) => u.name.includes(filter)), [users, filter]);
|
|
115
|
+
const onClick = useCallback(() => console.log('Clicked'), []);
|
|
116
|
+
return <ul>{filtered.map((u) => <MemoItem key={u.id} user={u} onClick={onClick} />)}</ul>;
|
|
117
|
+
}
|
|
118
|
+
const MemoItem = memo(({ user }: { user: User }) => <li>{user.name}</li>);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Async Parallelization
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
// CORRECT: Independent fetches run in parallel
|
|
127
|
+
async function loadDashboard(userId: string) {
|
|
128
|
+
const [user, orders, preferences] = await Promise.all([
|
|
129
|
+
fetchUser(userId),
|
|
130
|
+
fetchOrders(userId),
|
|
131
|
+
fetchPreferences(userId),
|
|
132
|
+
]);
|
|
133
|
+
return { user, orders, preferences };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// VIOLATION: Sequential fetches (3x slower)
|
|
137
|
+
async function loadDashboardSlow(userId: string) {
|
|
138
|
+
const user = await fetchUser(userId);
|
|
139
|
+
const orders = await fetchOrders(userId);
|
|
140
|
+
const preferences = await fetchPreferences(userId);
|
|
141
|
+
return { user, orders, preferences };
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Bundle Size
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
// CORRECT: Direct imports (tree-shakable)
|
|
151
|
+
import { Button } from '@/components/Button';
|
|
152
|
+
import { Card } from '@/components/Card';
|
|
153
|
+
|
|
154
|
+
// VIOLATION: Barrel imports (imports entire library)
|
|
155
|
+
import { Button, Card } from '@/components';
|
|
156
|
+
|
|
157
|
+
// CORRECT: Dynamic import for heavy components
|
|
158
|
+
const Chart = lazy(() => import('./Chart'));
|
|
159
|
+
const Editor = lazy(() => import('./Editor'));
|
|
160
|
+
|
|
161
|
+
function Dashboard() {
|
|
162
|
+
return (
|
|
163
|
+
<Suspense fallback={<Skeleton />}>
|
|
164
|
+
{showChart && <Chart data={data} />}
|
|
165
|
+
</Suspense>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Re-render Optimization
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
// CORRECT: Primitive deps (stable references)
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
fetchData(userId, isActive);
|
|
178
|
+
}, [userId, isActive]); // primitives don't cause unnecessary runs
|
|
179
|
+
|
|
180
|
+
// VIOLATION: Object/array deps (new reference every render)
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
fetchData(options);
|
|
183
|
+
}, [options]); // { page: 1 } !== { page: 1 }
|
|
184
|
+
|
|
185
|
+
// CORRECT: Stable callback with useCallback
|
|
186
|
+
const handleClick = useCallback((id: string) => {
|
|
187
|
+
setSelected(id);
|
|
188
|
+
}, []); // no deps = stable reference
|
|
189
|
+
|
|
190
|
+
// VIOLATION: Inline function (new reference every render)
|
|
191
|
+
<List onItemClick={(id) => setSelected(id)} />
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Image Optimization
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
// CORRECT: Optimized image with all attributes
|
|
200
|
+
<img
|
|
201
|
+
src={url}
|
|
202
|
+
alt={description}
|
|
203
|
+
width={400}
|
|
204
|
+
height={300}
|
|
205
|
+
loading="lazy"
|
|
206
|
+
decoding="async"
|
|
207
|
+
style={{ aspectRatio: '4/3' }}
|
|
208
|
+
/>
|
|
209
|
+
|
|
210
|
+
// VIOLATION: Unoptimized image
|
|
211
|
+
<img src={url} /> // No dimensions, no lazy loading, layout shift
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Data Structure Performance
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
// CORRECT: Set for O(1) membership checks
|
|
220
|
+
const selectedIds = new Set(selected);
|
|
221
|
+
const isSelected = (id: string) => selectedIds.has(id);
|
|
222
|
+
|
|
223
|
+
// VIOLATION: Array.includes is O(n)
|
|
224
|
+
const isSelected = (id: string) => selected.includes(id);
|
|
225
|
+
|
|
226
|
+
// CORRECT: Map for key-value lookups
|
|
227
|
+
const usersById = new Map(users.map(u => [u.id, u]));
|
|
228
|
+
const getUser = (id: string) => usersById.get(id);
|
|
229
|
+
|
|
230
|
+
// VIOLATION: Array.find is O(n)
|
|
231
|
+
const getUser = (id: string) => users.find(u => u.id === id);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Anti-Patterns
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
// BAD: Derived state in useState | GOOD: useMemo
|
|
240
|
+
const filtered = useMemo(() => items.filter(i => i.active), [items]);
|
|
241
|
+
|
|
242
|
+
// BAD: Missing dependency | GOOD: Include all deps
|
|
243
|
+
useEffect(() => { fetchData(userId); }, [userId]);
|
|
244
|
+
|
|
245
|
+
// BAD: State update in render | GOOD: Use effect
|
|
246
|
+
useEffect(() => { setState(value); }, [value]);
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Extended References
|
|
252
|
+
|
|
253
|
+
- `references/patterns.md` - Render props, reducers, virtualization, lazy loading
|
|
254
|
+
- `references/hooks.md` - useQuery, useDebouncedValue, usePrevious, useClickOutside
|
|
255
|
+
- `references/forms.md` - Controlled forms, validation hooks, multi-step forms
|
|
256
|
+
- `references/error-handling.md` - Error boundaries, async error handling
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Checklist
|
|
261
|
+
|
|
262
|
+
- [ ] Hooks at top level only
|
|
263
|
+
- [ ] All useEffect deps included
|
|
264
|
+
- [ ] useCallback for handlers passed to children
|
|
265
|
+
- [ ] useMemo for expensive computations
|
|
266
|
+
- [ ] Context at appropriate level
|
|
267
|
+
- [ ] Error boundaries around risky components
|
|
268
|
+
- [ ] Keys on list items (not index)
|
|
269
|
+
- [ ] Loading/error states handled
|
|
270
|
+
- [ ] Accessibility (aria-*, role)
|
|
271
|
+
- [ ] Independent fetches parallelized with Promise.all
|
|
272
|
+
- [ ] No barrel imports (direct imports for tree-shaking)
|
|
273
|
+
- [ ] Large components lazy-loaded
|
|
274
|
+
- [ ] Object/array deps avoided in useEffect (use primitives)
|
|
275
|
+
- [ ] Set/Map used for lookups instead of Array.includes/find
|
|
276
|
+
- [ ] Images have dimensions, lazy loading, and aspect-ratio
|