@tinkcarlos/skillora 0.2.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/.claude/skills/.temp-skill-index.md +245 -0
- package/.claude/skills/SKILL.md +264 -0
- package/.claude/skills/api-scaffolding/SKILL.md +431 -0
- package/.claude/skills/api-scaffolding/agents/backend-architect.md +282 -0
- package/.claude/skills/api-scaffolding/agents/django-pro.md +144 -0
- package/.claude/skills/api-scaffolding/agents/fastapi-pro.md +156 -0
- package/.claude/skills/api-scaffolding/agents/graphql-architect.md +146 -0
- package/.claude/skills/api-scaffolding/skills/fastapi-templates/SKILL.md +171 -0
- package/.claude/skills/api-testing-observability/SKILL.md +583 -0
- package/.claude/skills/api-testing-observability/agents/api-documenter.md +146 -0
- package/.claude/skills/api-testing-observability/commands/api-mock.md +1320 -0
- package/.claude/skills/brainstorming/SKILL.md +283 -0
- package/.claude/skills/bug-fixing/SKILL.md +382 -0
- package/.claude/skills/bug-fixing/references/backend-guide.md +132 -0
- package/.claude/skills/bug-fixing/references/bug-guide.md +354 -0
- package/.claude/skills/bug-fixing/references/bug-record-template.md +134 -0
- package/.claude/skills/bug-fixing/references/bug-records.md +88 -0
- package/.claude/skills/bug-fixing/references/code-review-gate.md +81 -0
- package/.claude/skills/bug-fixing/references/common-bugs.md +140 -0
- package/.claude/skills/bug-fixing/references/complete-workflow.md +361 -0
- package/.claude/skills/bug-fixing/references/config-driven-fixes.md +136 -0
- package/.claude/skills/bug-fixing/references/context-isolation-protocol.md +268 -0
- package/.claude/skills/bug-fixing/references/cross-surface-regression.md +120 -0
- package/.claude/skills/bug-fixing/references/database-investigation.md +129 -0
- package/.claude/skills/bug-fixing/references/dependency-and-integrity-protocol.md +369 -0
- package/.claude/skills/bug-fixing/references/fix-completeness-checklist.md +239 -0
- package/.claude/skills/bug-fixing/references/frontend-guide.md +219 -0
- package/.claude/skills/bug-fixing/references/fullstack-joint-guide.md +123 -0
- package/.claude/skills/bug-fixing/references/functional-breakage.md +117 -0
- package/.claude/skills/bug-fixing/references/ide-lint-errors-guide.md +176 -0
- package/.claude/skills/bug-fixing/references/impact-analysis.md +511 -0
- package/.claude/skills/bug-fixing/references/investigation-checklist.md +263 -0
- package/.claude/skills/bug-fixing/references/knowledge-extraction-guide.md +531 -0
- package/.claude/skills/bug-fixing/references/knowledge-workflow.md +212 -0
- package/.claude/skills/bug-fixing/references/post-edit-quality-gate.md +30 -0
- package/.claude/skills/bug-fixing/references/python-env-and-testing.md +126 -0
- package/.claude/skills/bug-fixing/references/rca-guide.md +428 -0
- package/.claude/skills/bug-fixing/references/similar-bug-patterns.md +113 -0
- package/.claude/skills/bug-fixing/references/skill-delegation-guide.md +350 -0
- package/.claude/skills/bug-fixing/references/skill-orchestration.md +155 -0
- package/.claude/skills/bug-fixing/references/testing-strategy.md +350 -0
- package/.claude/skills/bug-fixing/references/tooling-build-scripts.md +162 -0
- package/.claude/skills/bug-fixing/references/user-input-validation.md +77 -0
- package/.claude/skills/bug-fixing/references/ux-patterns.md +158 -0
- package/.claude/skills/bug-fixing/references/windows-terminal-hygiene.md +106 -0
- package/.claude/skills/bug-fixing/references/zero-regression-matrix.md +239 -0
- package/.claude/skills/bug-fixing/references/zero-risk-protocol.md +102 -0
- package/.claude/skills/bug-fixing/scripts/format_code.py +611 -0
- package/.claude/skills/bug-fixing/scripts/generate_report_template.py +74 -0
- package/.claude/skills/bug-fixing/scripts/lint_check.py +816 -0
- package/.claude/skills/bug-fixing/scripts/requirements.txt +36 -0
- package/.claude/skills/cicd-pipeline/SKILL.md +300 -0
- package/.claude/skills/code-review/SKILL.md +535 -0
- package/.claude/skills/code-review/references/anti-pattern-scan.md +102 -0
- package/.claude/skills/code-review/references/automated-analysis.md +456 -0
- package/.claude/skills/code-review/references/backend-common-issues.md +589 -0
- package/.claude/skills/code-review/references/backend-expert-guide.md +415 -0
- package/.claude/skills/code-review/references/backend-review.md +868 -0
- package/.claude/skills/code-review/references/batch-processing-strategy.md +198 -0
- package/.claude/skills/code-review/references/call-chain-analysis-protocol.md +166 -0
- package/.claude/skills/code-review/references/common-patterns.md +321 -0
- package/.claude/skills/code-review/references/configuration-review.md +425 -0
- package/.claude/skills/code-review/references/control-flow-completeness.md +114 -0
- package/.claude/skills/code-review/references/database-review.md +298 -0
- package/.claude/skills/code-review/references/dependency-and-integrity-protocol.md +313 -0
- package/.claude/skills/code-review/references/external-standards.md +51 -0
- package/.claude/skills/code-review/references/feature-review.md +329 -0
- package/.claude/skills/code-review/references/file-review-template.md +326 -0
- package/.claude/skills/code-review/references/frontend-advanced.md +654 -0
- package/.claude/skills/code-review/references/frontend-common-issues.md +482 -0
- package/.claude/skills/code-review/references/frontend-expert-guide.md +342 -0
- package/.claude/skills/code-review/references/frontend-review.md +783 -0
- package/.claude/skills/code-review/references/fullstack-consistency.md +418 -0
- package/.claude/skills/code-review/references/fullstack-review.md +477 -0
- package/.claude/skills/code-review/references/functional-completeness.md +386 -0
- package/.claude/skills/code-review/references/hidden-bugs-detection.md +473 -0
- package/.claude/skills/code-review/references/ide-lint-errors-guide.md +173 -0
- package/.claude/skills/code-review/references/infrastructure-review.md +453 -0
- package/.claude/skills/code-review/references/iteration-review.md +264 -0
- package/.claude/skills/code-review/references/job-review.md +335 -0
- package/.claude/skills/code-review/references/layered-checklist-protocol.md +157 -0
- package/.claude/skills/code-review/references/logic-completeness.md +535 -0
- package/.claude/skills/code-review/references/mandatory-checklist.md +288 -0
- package/.claude/skills/code-review/references/multi-language-guide.md +800 -0
- package/.claude/skills/code-review/references/new-project-review.md +226 -0
- package/.claude/skills/code-review/references/non-code-files-review.md +451 -0
- package/.claude/skills/code-review/references/overlooked-issues.md +657 -0
- package/.claude/skills/code-review/references/platform-specific-review.md +195 -0
- package/.claude/skills/code-review/references/precision-analysis-protocol.md +260 -0
- package/.claude/skills/code-review/references/python-patterns.md +494 -0
- package/.claude/skills/code-review/references/rca-techniques.md +362 -0
- package/.claude/skills/code-review/references/report-template.md +430 -0
- package/.claude/skills/code-review/references/resource-limits-and-degradation.md +137 -0
- package/.claude/skills/code-review/references/review-dimensions.md +311 -0
- package/.claude/skills/code-review/references/review-guide.md +202 -0
- package/.claude/skills/code-review/references/review-knowledge-workflow.md +257 -0
- package/.claude/skills/code-review/references/review-progress-tracker-protocol.md +172 -0
- package/.claude/skills/code-review/references/review-record-template.md +195 -0
- package/.claude/skills/code-review/references/skill-orchestration.md +143 -0
- package/.claude/skills/code-review/references/ui-ux-review.md +470 -0
- package/.claude/skills/containerization/SKILL.md +313 -0
- package/.claude/skills/database-migrations/agents/database-admin.md +142 -0
- package/.claude/skills/database-migrations/agents/database-optimizer.md +144 -0
- package/.claude/skills/database-migrations/commands/migration-observability.md +408 -0
- package/.claude/skills/database-migrations/commands/sql-migrations.md +492 -0
- package/.claude/skills/finishing-a-development-branch/SKILL.md +319 -0
- package/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/.claude/skills/frontend-design/SKILL.md +587 -0
- package/.claude/skills/frontend-design/references/color-consistency.md +487 -0
- package/.claude/skills/frontend-design/references/color-palettes-full.md +657 -0
- package/.claude/skills/frontend-design/references/design-system-generator.md +285 -0
- package/.claude/skills/frontend-design/references/font-pairings-full.md +705 -0
- package/.claude/skills/frontend-design/references/industry-anti-patterns.md +281 -0
- package/.claude/skills/frontend-design/references/layout-anti-patterns.md +582 -0
- package/.claude/skills/frontend-design/references/motion-patterns.md +659 -0
- package/.claude/skills/frontend-design/references/pre-delivery-checklist.md +153 -0
- package/.claude/skills/frontend-design/references/responsive-design.md +555 -0
- package/.claude/skills/frontend-design/references/style-modification-rules.md +335 -0
- package/.claude/skills/frontend-design/references/ui-styles-full.md +383 -0
- package/.claude/skills/frontend-design/references/ui-styles-rating.md +191 -0
- package/.claude/skills/frontend-design/references/ux-guidelines.md +640 -0
- package/.claude/skills/fullstack-developer/SKILL.md +512 -0
- package/.claude/skills/fullstack-developer/references/api-contract-guide.md +312 -0
- package/.claude/skills/fullstack-developer/references/api-response-patterns.md +223 -0
- package/.claude/skills/fullstack-developer/references/async-patterns.md +220 -0
- package/.claude/skills/fullstack-developer/references/bug-prevention.md +914 -0
- package/.claude/skills/fullstack-developer/references/code-quality-checklist.md +271 -0
- package/.claude/skills/fullstack-developer/references/complete-development-workflow.md +278 -0
- package/.claude/skills/fullstack-developer/references/context-isolation-protocol.md +256 -0
- package/.claude/skills/fullstack-developer/references/database-migration.md +331 -0
- package/.claude/skills/fullstack-developer/references/dependency-and-integrity-protocol.md +390 -0
- package/.claude/skills/fullstack-developer/references/development-phases.md +333 -0
- package/.claude/skills/fullstack-developer/references/expert-guide.md +214 -0
- package/.claude/skills/fullstack-developer/references/file-import-patterns.md +114 -0
- package/.claude/skills/fullstack-developer/references/graceful-degradation-patterns.md +78 -0
- package/.claude/skills/fullstack-developer/references/ide-lint-errors-guide.md +183 -0
- package/.claude/skills/fullstack-developer/references/integration-testing.md +301 -0
- package/.claude/skills/fullstack-developer/references/mock-api-patterns.md +307 -0
- package/.claude/skills/fullstack-developer/references/phase-gate-template.md +249 -0
- package/.claude/skills/fullstack-developer/references/post-edit-quality-gate.md +30 -0
- package/.claude/skills/fullstack-developer/references/python-engineering.md +79 -0
- package/.claude/skills/fullstack-developer/references/skill-orchestration.md +214 -0
- package/.claude/skills/fullstack-developer/references/skill-router-table.md +304 -0
- package/.claude/skills/fullstack-developer/references/state-sync.md +217 -0
- package/.claude/skills/fullstack-developer/references/ui-testing-checklist.md +292 -0
- package/.claude/skills/fullstack-developer/scripts/format_code.py +611 -0
- package/.claude/skills/fullstack-developer/scripts/lint_check.py +816 -0
- package/.claude/skills/fullstack-developer/scripts/requirements.txt +36 -0
- package/.claude/skills/performance-optimization/SKILL.md +250 -0
- package/.claude/skills/product-requirements/SKILL.md +357 -0
- package/.claude/skills/product-requirements/references/acceptance-criteria.md +335 -0
- package/.claude/skills/product-requirements/references/answer-first-questioning-protocol.md +299 -0
- package/.claude/skills/product-requirements/references/competitive-analysis-guide.md +183 -0
- package/.claude/skills/product-requirements/references/document-accuracy-protocol.md +253 -0
- package/.claude/skills/product-requirements/references/document-management-protocol.md +278 -0
- package/.claude/skills/product-requirements/references/external-standards.md +62 -0
- package/.claude/skills/product-requirements/references/feature-spec-template.md +359 -0
- package/.claude/skills/product-requirements/references/knowledge-acquisition-protocol.md +251 -0
- package/.claude/skills/product-requirements/references/plan-execution-protocol.md +334 -0
- package/.claude/skills/product-requirements/references/plan-generation-protocol.md +264 -0
- package/.claude/skills/product-requirements/references/prioritization-frameworks.md +80 -0
- package/.claude/skills/product-requirements/references/requirement-decomposition-protocol.md +291 -0
- package/.claude/skills/product-requirements/references/user-story-examples.md +297 -0
- package/.claude/skills/product-requirements/references/workflow-templates.md +266 -0
- package/.claude/skills/react-best-practices/SKILL.md +198 -0
- package/.claude/skills/react-best-practices/references/advanced-patterns.md +94 -0
- package/.claude/skills/react-best-practices/references/bundle-optimization.md +182 -0
- package/.claude/skills/react-best-practices/references/client-data-fetching.md +112 -0
- package/.claude/skills/react-best-practices/references/complete-guide.md +2249 -0
- package/.claude/skills/react-best-practices/references/eliminating-waterfalls.md +169 -0
- package/.claude/skills/react-best-practices/references/javascript-performance.md +256 -0
- package/.claude/skills/react-best-practices/references/rendering-performance.md +230 -0
- package/.claude/skills/react-best-practices/references/rerender-optimization.md +214 -0
- package/.claude/skills/react-best-practices/references/server-performance.md +182 -0
- package/.claude/skills/security-audit/SKILL.md +226 -0
- package/.claude/skills/shared-references/advanced-debugging-techniques.md +186 -0
- package/.claude/skills/shared-references/code-quality-checklist.md +218 -0
- package/.claude/skills/shared-references/code-review-efficiency-guide.md +125 -0
- package/.claude/skills/shared-references/mcp-dependency-compatibility-protocol.md +276 -0
- package/.claude/skills/shared-references/skill-call-graph.md +230 -0
- package/.claude/skills/shared-references/skill-orchestration-protocol.md +281 -0
- package/.claude/skills/shared-references/subagent-dispatch-templates.md +199 -0
- package/.claude/skills/skill-expert-skills/LICENSE.txt +204 -0
- package/.claude/skills/skill-expert-skills/QUICK_NAVIGATION.md +374 -0
- package/.claude/skills/skill-expert-skills/SKILL.md +247 -0
- package/.claude/skills/skill-expert-skills/docs/_index.md +91 -0
- package/.claude/skills/skill-expert-skills/references/deep-research-methodology.md +389 -0
- package/.claude/skills/skill-expert-skills/references/docs-generation-workflow.md +398 -0
- package/.claude/skills/skill-expert-skills/references/domain-expertise-protocol.md +343 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/_index.md +54 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/backend-expertise.md +517 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/bug-fixing-expertise.md +363 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/code-review-expertise.md +392 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/frontend-expertise.md +410 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge-template.md +503 -0
- package/.claude/skills/skill-expert-skills/references/examples.md +782 -0
- package/.claude/skills/skill-expert-skills/references/integration-examples.md +655 -0
- package/.claude/skills/skill-expert-skills/references/knowledge-validation-checklist.md +246 -0
- package/.claude/skills/skill-expert-skills/references/latest-knowledge-acquisition.md +461 -0
- package/.claude/skills/skill-expert-skills/references/mcp-tools-guide.md +439 -0
- package/.claude/skills/skill-expert-skills/references/official-best-practices.md +616 -0
- package/.claude/skills/skill-expert-skills/references/patterns.md +218 -0
- package/.claude/skills/skill-expert-skills/references/plugin-skills-guide.md +432 -0
- package/.claude/skills/skill-expert-skills/references/requirement-elicitation-protocol.md +290 -0
- package/.claude/skills/skill-expert-skills/references/skill-creator-SKILL.md +353 -0
- package/.claude/skills/skill-expert-skills/references/skill-templates.md +583 -0
- package/.claude/skills/skill-expert-skills/references/skills-knowledge-base.md +561 -0
- package/.claude/skills/skill-expert-skills/references/tools-guide.md +379 -0
- package/.claude/skills/skill-expert-skills/references/troubleshooting.md +378 -0
- package/.claude/skills/skill-expert-skills/references/universality-guide.md +205 -0
- package/.claude/skills/skill-expert-skills/references/writing-style-guide.md +466 -0
- package/.claude/skills/skill-expert-skills/scripts/__pycache__/quick_validate.cpython-313.pyc +0 -0
- package/.claude/skills/skill-expert-skills/scripts/__pycache__/universal_validate.cpython-313.pyc +0 -0
- package/.claude/skills/skill-expert-skills/scripts/analyze_trigger.py +425 -0
- package/.claude/skills/skill-expert-skills/scripts/diff_with_official.py +188 -0
- package/.claude/skills/skill-expert-skills/scripts/init_skill.py +349 -0
- package/.claude/skills/skill-expert-skills/scripts/package_skill.py +156 -0
- package/.claude/skills/skill-expert-skills/scripts/quick_validate.py +493 -0
- package/.claude/skills/skill-expert-skills/scripts/requirements.txt +2 -0
- package/.claude/skills/skill-expert-skills/scripts/universal_validate.py +182 -0
- package/.claude/skills/skill-expert-skills/scripts/upgrade_skill.py +431 -0
- package/.claude/skills/subagent-driven-development/SKILL.md +268 -0
- package/.claude/skills/test-driven-development/SKILL.md +246 -0
- package/.claude/skills/test-driven-development/references/testing-anti-patterns.md +192 -0
- package/.claude/skills/using-git-worktrees/SKILL.md +266 -0
- package/.claude/skills/using-skillstack/SKILL.md +127 -0
- package/.claude/skills/vercel-deploy/SKILL.md +166 -0
- package/.claude/skills/vercel-deploy/scripts/deploy.sh +249 -0
- package/.claude/skills/verification-before-completion/SKILL.md +305 -0
- package/.claude/skills/writing-plans/SKILL.md +259 -0
- package/README.md +69 -0
- package/bin/cli.js +468 -0
- package/lib/init.js +333 -0
- package/package.json +29 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Frontend Bug-Fixing Guide – 2025 Edition
|
|
2
|
+
|
|
3
|
+
> Battle-tested guide for React, Vue, TypeScript, Next.js, Vite, and modern browsers.
|
|
4
|
+
|
|
5
|
+
20 years of hard-won experience distilled into one playbook.
|
|
6
|
+
|
|
7
|
+
## Core Philosophy
|
|
8
|
+
> “A frontend bug is never just CSS or React — it’s always state, timing, or contract.”
|
|
9
|
+
|
|
10
|
+
## The 5-Step Frontend Repair Phases
|
|
11
|
+
|
|
12
|
+
### 1. Reproduce & Isolate – Ghost Hunting
|
|
13
|
+
90% of “works on my machine” failures come from environment drift.
|
|
14
|
+
|
|
15
|
+
| Check | How to verify |
|
|
16
|
+
|-----------------------|--------------------------------------------------------|
|
|
17
|
+
| Browser + version | Chrome 128+, Safari 18+, Firefox 131+, Edge 128+ |
|
|
18
|
+
| Device / viewport | DevTools toggle device toolbar |
|
|
19
|
+
| Network | 3G / Offline throttling |
|
|
20
|
+
| Auth / cookies | Incognito vs logged-in session |
|
|
21
|
+
| Build mode | `vite build` (then serve the built output) vs `vite dev` (HMR can hide bugs) |
|
|
22
|
+
|
|
23
|
+
Tools: Chrome DevTools Recorder, Playwright trace, BrowserStack
|
|
24
|
+
|
|
25
|
+
### 2. Root Cause Analysis – Follow the Data Flow
|
|
26
|
+
Always trace backwards from the symptom:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
DOM/Console error
|
|
30
|
+
↓
|
|
31
|
+
Component that threw
|
|
32
|
+
↓
|
|
33
|
+
Props → State → Hook → API response → Network tab
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Common hidden culprits:
|
|
37
|
+
- React 18+ StrictMode double-mount (useEffect runs twice in dev)
|
|
38
|
+
- Next.js SSR vs CSR hydration mismatch
|
|
39
|
+
- Vite/React Fast Refresh keeping stale closures
|
|
40
|
+
- RTK Query / SWR stale cache
|
|
41
|
+
|
|
42
|
+
### 3. Minimal Viable Fix – Surgical Precision
|
|
43
|
+
Rules (non-negotiable):
|
|
44
|
+
- Never refactor while fixing a bug
|
|
45
|
+
- Change < 20 LOC if possible
|
|
46
|
+
- No new dependencies
|
|
47
|
+
- Keep old code path when under zero-risk protocol
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
// Bad – over-engineering
|
|
51
|
+
return user ? <Profile user={user} /> : <NotFound />
|
|
52
|
+
|
|
53
|
+
// Good – minimal + safe
|
|
54
|
+
if (!user) return <NotFoundPage />
|
|
55
|
+
return <Profile user={user} />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Multi-Layer Validation – Ironclad Proof
|
|
59
|
+
Must all be green before asking for review:
|
|
60
|
+
|
|
61
|
+
| Layer | Tool / Command | Required |
|
|
62
|
+
|---------------------|--------------------------------------------------|----------|
|
|
63
|
+
| Unit | Jest / Vitest | Yes |
|
|
64
|
+
| Component | React Testing Library / Vue Test Utils | Yes |
|
|
65
|
+
| Snapshot | `.toMatchSnapshot()` (only for stable UI) | Yes |
|
|
66
|
+
| Visual regression | Chromatic / Percy / Playwright screenshots | Yes |
|
|
67
|
+
| E2E | Playwright / Cypress (against staging) | Yes |
|
|
68
|
+
| Cross-browser | BrowserStack / Sauce Labs matrix | Yes |
|
|
69
|
+
| Accessibility | axe-core / eslint-plugin-jsx-a11y | Yes |
|
|
70
|
+
| Performance | Lighthouse CI (no regression >5%) | Yes |
|
|
71
|
+
|
|
72
|
+
### 5. Immunization & Documentation
|
|
73
|
+
After the fix ships:
|
|
74
|
+
|
|
75
|
+
- Add the pattern to common-bugs.md
|
|
76
|
+
- Add a failing test that would have caught it
|
|
77
|
+
- Create a custom ESLint rule or TypeScript utility type if recurring
|
|
78
|
+
- Write a short “How I fixed it” in PR description (template below)
|
|
79
|
+
|
|
80
|
+
## Most Common Frontend Pitfalls (2025)
|
|
81
|
+
|
|
82
|
+
| Category | Symptom | Root Cause | Instant Fix / Prevention |
|
|
83
|
+
|------------------------|--------------------------------------------|-----------------------------------------------|-------------------------------------------------------|
|
|
84
|
+
| React Keys | List items duplicate/wrong order | Using index as key | `key={item.id}` or `key={item.uniqueStableId}` |
|
|
85
|
+
| Stale Closures | Button click uses old state | Missing dependency or captured stale value | `setCount(c => c+1)` or `useCallback` + correct deps |
|
|
86
|
+
| Hydration Mismatch | Next.js warning in console | Server rendered different than client | Use `useEffect` for client-only code, suppress correctly |
|
|
87
|
+
| Memory Leak | "Can't perform state update on unmounted" | Async fetch without cleanup | `AbortController` + cleanup or `isMounted` ref |
|
|
88
|
+
| Double API Call | Data fetched twice in dev | React 18 StrictMode double mount | Ignore in dev or use `useEffectEvent` (React 19) |
|
|
89
|
+
| CSS z-index fails | Element stays behind | No stacking context | Add `position: relative/absolute/fixed` + z-index |
|
|
90
|
+
| Flex item won't shrink | Text overflows container | `min-width: 0` missing on flex child | `min-w-0` (Tailwind) or `min-width: 0` |
|
|
91
|
+
| Image/layout shift | CLS > 0.1 in Lighthouse | No width/height on `<img>` | `width` + `height` attributes + `aspect-ratio` CSS |
|
|
92
|
+
| Dark mode broken | Colors wrong in dark | Using wrong token or missing `prefers-color-scheme` | Use CSS variables + `color-scheme: light dark` |
|
|
93
|
+
| **Popup clipped/hidden** | Context menu/tooltip cut off at viewport edge | No boundary detection for positioned element | Use `useLayoutEffect` + viewport bounds check + flip logic |
|
|
94
|
+
| **Dropdown overflow** | Select/dropdown options hidden at bottom | Parent has `overflow: hidden` or no flip logic | Add boundary-aware positioning or use portal rendering |
|
|
95
|
+
|
|
96
|
+
## 🔴 UI Boundary Detection (Popup/Tooltip/ContextMenu)
|
|
97
|
+
|
|
98
|
+
**Common Symptom**: Right-click menu, tooltip, dropdown, or popover is clipped or hidden when triggered near viewport edges.
|
|
99
|
+
|
|
100
|
+
**Root Cause**: Fixed/absolute positioned elements use click coordinates directly without checking viewport boundaries.
|
|
101
|
+
|
|
102
|
+
**Detection Questions**:
|
|
103
|
+
1. "If user clicks near the bottom of the viewport, will the popup be fully visible?"
|
|
104
|
+
2. "If user clicks near the right edge, will the popup overflow outside the screen?"
|
|
105
|
+
3. "Does the popup/dropdown have flip logic for edge cases?"
|
|
106
|
+
|
|
107
|
+
### Standard Fix Pattern
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// 🔴 BUG: Direct positioning without boundary check
|
|
111
|
+
style={{ left: position.x, top: position.y }}
|
|
112
|
+
|
|
113
|
+
// ✅ FIX: Boundary-aware positioning with useLayoutEffect
|
|
114
|
+
const [adjustedPosition, setAdjustedPosition] = useState(position);
|
|
115
|
+
|
|
116
|
+
useLayoutEffect(() => {
|
|
117
|
+
if (isOpen && menuRef.current) {
|
|
118
|
+
const menu = menuRef.current;
|
|
119
|
+
const rect = menu.getBoundingClientRect();
|
|
120
|
+
const viewportHeight = window.innerHeight;
|
|
121
|
+
const viewportWidth = window.innerWidth;
|
|
122
|
+
|
|
123
|
+
let newX = position.x;
|
|
124
|
+
let newY = position.y;
|
|
125
|
+
|
|
126
|
+
// Bottom boundary: flip upward if overflow
|
|
127
|
+
if (position.y + rect.height > viewportHeight - 10) {
|
|
128
|
+
newY = position.y - rect.height;
|
|
129
|
+
if (newY < 10) newY = 10; // Ensure not above viewport
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Right boundary: flip leftward if overflow
|
|
133
|
+
if (position.x + rect.width > viewportWidth - 10) {
|
|
134
|
+
newX = position.x - rect.width;
|
|
135
|
+
if (newX < 10) newX = 10; // Ensure not outside left
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setAdjustedPosition({ x: newX, y: newY });
|
|
139
|
+
}
|
|
140
|
+
}, [isOpen, position]);
|
|
141
|
+
|
|
142
|
+
// Use adjustedPosition instead of position
|
|
143
|
+
style={{ left: adjustedPosition.x, top: adjustedPosition.y }}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Boundary Detection Checklist
|
|
147
|
+
|
|
148
|
+
| Element Type | Bottom Edge | Right Edge | Top Edge | Left Edge |
|
|
149
|
+
|-------------|-------------|------------|----------|-----------|
|
|
150
|
+
| Context Menu | Flip up | Flip left | Clamp to 0 | Clamp to 0 |
|
|
151
|
+
| Tooltip | Flip to top | Flip to left | Flip to bottom | Flip to right |
|
|
152
|
+
| Dropdown | Flip up (dropup) | Scroll or truncate | N/A | N/A |
|
|
153
|
+
| Modal | Center + scroll | Center + scroll | Center + scroll | Center + scroll |
|
|
154
|
+
| Popover | Flip direction | Flip direction | Flip direction | Flip direction |
|
|
155
|
+
|
|
156
|
+
### Search Pattern for Similar Issues
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Find all fixed/absolute positioned popup components
|
|
160
|
+
grep -rn "position: fixed\|position: absolute" --include="*.tsx" --include="*.css" | grep -i "menu\|popup\|tooltip\|dropdown\|popover"
|
|
161
|
+
|
|
162
|
+
# Find components using clientX/clientY without boundary check
|
|
163
|
+
grep -rn "clientX\|clientY\|pageX\|pageY" --include="*.tsx" -A 5 | grep -v "innerHeight\|innerWidth\|getBoundingClientRect"
|
|
164
|
+
|
|
165
|
+
# Find context menu implementations
|
|
166
|
+
grep -rn "ContextMenu\|onContextMenu\|rightClick" --include="*.tsx"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Libraries with Built-in Boundary Detection
|
|
170
|
+
|
|
171
|
+
- **Radix UI** (`@radix-ui/react-dropdown-menu`, `@radix-ui/react-popover`)
|
|
172
|
+
- **Floating UI** (`@floating-ui/react`) - Best for custom positioning
|
|
173
|
+
- **Headless UI** (`@headlessui/react`)
|
|
174
|
+
- **React Popper** (`react-popper`)
|
|
175
|
+
|
|
176
|
+
## Quick Copy-Paste Fixes
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
// 1. Safe optional chaining
|
|
180
|
+
user?.profile?.settings?.theme ?? 'light'
|
|
181
|
+
|
|
182
|
+
// 2. Correct useEffect dependencies
|
|
183
|
+
useEffect(() => { ... }, [dep1, dep2]) // never [obj] or [arr]
|
|
184
|
+
|
|
185
|
+
// 3. Abort fetch on unmount
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
const controller = new AbortController();
|
|
188
|
+
fetch(url, { signal: controller.signal });
|
|
189
|
+
return () => controller.abort();
|
|
190
|
+
}, []);
|
|
191
|
+
|
|
192
|
+
// 4. Stable list keys
|
|
193
|
+
items.map(item => <Item key={item.id} item={item} />)
|
|
194
|
+
|
|
195
|
+
// 5. Prevent layout shift<img src="…" width="400" height="300" alt="…" className="aspect-video object-cover" />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## PR Template for Frontend Fixes
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
## Bug Fix – Frontend
|
|
202
|
+
|
|
203
|
+
**Bug ID**: BUG-XXXX
|
|
204
|
+
**Severity**: High / Medium / Low
|
|
205
|
+
**Reproduction**: (link to recording or steps)
|
|
206
|
+
|
|
207
|
+
**Root Cause**: (one sentence)
|
|
208
|
+
|
|
209
|
+
**Fix Approach**: Minimal change + feature flag (if zero-risk)
|
|
210
|
+
|
|
211
|
+
**Validation**:
|
|
212
|
+
- [x] Unit tests added / updated
|
|
213
|
+
- [x] Component tests pass
|
|
214
|
+
- [x] Playwright E2E green on staging
|
|
215
|
+
- [x] No Lighthouse regressions
|
|
216
|
+
- [x] Accessibility score unchanged
|
|
217
|
+
- [x] Works on Chrome / Safari / Firefox mobile
|
|
218
|
+
|
|
219
|
+
**Prevention**: Added to common-bugs.md + new ESLint rule
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Fullstack (Joint) Bug-Fixing Guide – 2025 Edition
|
|
2
|
+
|
|
3
|
+
> Strategic guide for fixing bugs that span frontend-backend boundaries.
|
|
4
|
+
|
|
5
|
+
For bugs that cross the frontend-backend divide. "Dual-wielding" approach to eliminate systemic wounds.
|
|
6
|
+
|
|
7
|
+
## Core Philosophy
|
|
8
|
+
> "Joint bugs aren't fixed by one team—they're collaborative erasures. The entire chain must heal, or the wound reopens."
|
|
9
|
+
|
|
10
|
+
## The 5-Step Joint Repair Process
|
|
11
|
+
|
|
12
|
+
### 1. Reproduce & Isolate – Dual-End Visibility
|
|
13
|
+
**Why**: Mocked data hides the truth. Front/back environments rarely align.
|
|
14
|
+
|
|
15
|
+
**Steps**:
|
|
16
|
+
1. **Dual Reproduction**: Front: Record interaction (Cypress/Playwright); Back: Log request/response (Postman/JMeter).
|
|
17
|
+
2. **Interface Isolation**: Network tab inspection—200 OK with wrong shape? Front ignoring valid error?
|
|
18
|
+
3. **★ Sync Point**: Front + back engineers verify together (screen share required).
|
|
19
|
+
|
|
20
|
+
**Tools**: Storybook (front isolation), WireMock (back mock), Docker multi-service compose.
|
|
21
|
+
|
|
22
|
+
**Common Pitfall**: Cache Shadows—Redis expires on back, but browser cache holds stale data.
|
|
23
|
+
|
|
24
|
+
### 2. Root Cause Analysis – Cross-Link Excavation
|
|
25
|
+
**Why**: Bugs hide in team assumptions.
|
|
26
|
+
|
|
27
|
+
**Techniques**:
|
|
28
|
+
- **Cross-Domain 5 Whys**: Why empty list? → API empty. Why? → Back filter bug. Why? → Schema mismatch.
|
|
29
|
+
- **Full Trace**: React props → Network request → Back span → DB query.
|
|
30
|
+
- **Swimlanes**: Visualize data flow across boundaries (Miro/Excalidraw).
|
|
31
|
+
|
|
32
|
+
**Common Pitfall**: Version Hallucinations—Front uses old SDK for new API.
|
|
33
|
+
|
|
34
|
+
### 3. Design & Implement – Parallel Execution
|
|
35
|
+
**Why**: Solo fixes cause drift. Contracts must bind.
|
|
36
|
+
|
|
37
|
+
**Guidelines**:
|
|
38
|
+
- **Minimal Dual-Fix**: Back: Logic/schema. Front: Guard clauses + types.
|
|
39
|
+
- **Contract First**: OpenAPI/Swagger auto-generate clients.
|
|
40
|
+
- **Idempotency**: Retries safe—no duplicate effects.
|
|
41
|
+
- **★ Sync Point**: Feature flags for rollout. Mutual code review.
|
|
42
|
+
|
|
43
|
+
**Common Pitfall**: Serialization Mismatch—Back `camelCase`, front expects `snake_case`.
|
|
44
|
+
|
|
45
|
+
### 4. Full-Stack Validation – Unified Testing
|
|
46
|
+
**Why**: Green units on both sides ≠ working system.
|
|
47
|
+
|
|
48
|
+
**Checklist**:
|
|
49
|
+
- [ ] **Dual Unit**: Front components + back services.
|
|
50
|
+
- [ ] **E2E**: Cypress/Playwright vs real back (staging).
|
|
51
|
+
- [ ] **Contract Tests**: Pact/Spring Cloud Contract (schema verification).
|
|
52
|
+
- [ ] **★ Sync Point**: Joint blind regression testing.
|
|
53
|
+
|
|
54
|
+
**Common Pitfall**: Security Headers—CORS on back, but front fetch misses `credentials: 'include'`.
|
|
55
|
+
|
|
56
|
+
### 5. Immunize & Legacy – The Firewall
|
|
57
|
+
**Why**: Joint bugs spread fast.
|
|
58
|
+
|
|
59
|
+
**Actions**:
|
|
60
|
+
- **Pipeline**: CI/CD schema diff checks.
|
|
61
|
+
- **Gateway**: API gateway validation layers.
|
|
62
|
+
- **Documentation**: Joint post-mortem (shared Notion/Slack thread).
|
|
63
|
+
|
|
64
|
+
**Common Pitfall**: Documentation Lag—Swagger updated, but not pushed to front team.
|
|
65
|
+
|
|
66
|
+
## Common Joint Pitfalls Checklist (2025)
|
|
67
|
+
|
|
68
|
+
| Bug Type | Scenario & Root Cause | Fix Checklist & Prevention | Compatibility Traps |
|
|
69
|
+
|-----------------------|----------------------------------------|---------------------------------------------|--------------------------------------|
|
|
70
|
+
| **Interface Mismatch**| Field added/removed/type changed | Schema gen + type guards. Sync iterations | GraphQL null resolvers; OpenAPI enums|
|
|
71
|
+
| **State/Async Lost** | Front timeout vs back slow | WebSocket heartbeats / retry sync | Socket.io namespaces; Axios timeouts |
|
|
72
|
+
| **Performance Chain** | Slow query + front polling | Indexing + debounce. Peak load test | N+1 queries; React Query staleTime |
|
|
73
|
+
| **Security Gaps** | CORS/JWT expiry drift | Header checks + token refresh logic | OAuth2 PKCE; CSRF mismatch |
|
|
74
|
+
| **Data Offset** | Pagination (page vs offset) | Align logic. Keyed UI lists | Vue keys; DB offset bugs |
|
|
75
|
+
| **Compatibility** | Polyfills vs back output | Babel + version pinning | ESM imports; SSR hydration |
|
|
76
|
+
| **Cache Avalanche** | Redis/browser sync | Unified TTL / ETags | Cluster issues; RTK Query keys |
|
|
77
|
+
| **Error Handling** | 500 as generic error | Detailed codes + error boundaries | Missing handlers; React ErrorBoundary|
|
|
78
|
+
|
|
79
|
+
## Quick Copy-Paste Fixes
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
// Front: Safe API response guard
|
|
83
|
+
const { data, error } = useQuery(userId);
|
|
84
|
+
if (error || !data?.user) return <NotFound />;
|
|
85
|
+
|
|
86
|
+
// Back: Proper error response
|
|
87
|
+
if (!user) {
|
|
88
|
+
throw new HttpException('User not found', HttpStatus.NOT_FOUND);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Contract: OpenAPI snippet
|
|
92
|
+
responses:
|
|
93
|
+
404:
|
|
94
|
+
description: User not found
|
|
95
|
+
content:
|
|
96
|
+
application/json:
|
|
97
|
+
schema:
|
|
98
|
+
type: object
|
|
99
|
+
properties:
|
|
100
|
+
error: { type: string }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## PR Template for Joint Fixes
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
## Joint Bug Fix – Fullstack
|
|
107
|
+
|
|
108
|
+
**Bug ID**: BUG-XXXX
|
|
109
|
+
**Severity**: High / Medium / Low
|
|
110
|
+
**Reproduction**: (Cypress video + Postman collection)
|
|
111
|
+
|
|
112
|
+
**Root Cause**: (e.g., Schema version mismatch between front SDK and back API)
|
|
113
|
+
|
|
114
|
+
**Fix Approach**: Back schema update + front type guard + contract test
|
|
115
|
+
|
|
116
|
+
**Validation**:
|
|
117
|
+
- [x] Dual unit tests pass
|
|
118
|
+
- [x] Pact contract verification green
|
|
119
|
+
- [x] E2E on staging (real back)
|
|
120
|
+
- [x] Mutual code review (front + back)
|
|
121
|
+
- [x] No schema drift in CI
|
|
122
|
+
|
|
123
|
+
**Prevention**: Added schema diff to CI + updated Swagger docs
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Functional Breakage Detection
|
|
2
|
+
|
|
3
|
+
> Detect features that "look complete but are actually unimplemented".
|
|
4
|
+
|
|
5
|
+
## What is Functional Breakage?
|
|
6
|
+
|
|
7
|
+
| Type | Description | Example | Detection Method |
|
|
8
|
+
|------|-------------|---------|------------------|
|
|
9
|
+
| **Placeholder Bug** | UI exists but functionality missing | Login page only has `<h1>Login</h1>` | Check component implementation |
|
|
10
|
+
| **Integration Gap** | Backend exists but frontend doesn't call it | Auth API ready, frontend hardcoded | grep API calls |
|
|
11
|
+
| **Flow Breakage** | Individual parts work but overall flow broken | Login succeeds but token not stored | Trace complete data flow |
|
|
12
|
+
| **Contract Mismatch** | Frontend/backend field names differ | `{message}` vs `{content}` | Compare schemas |
|
|
13
|
+
| **Silent Failure** | No errors but feature doesn't work | Button click does nothing | Check empty handlers |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Detection Commands
|
|
18
|
+
|
|
19
|
+
### Placeholder & Stub Code Detection
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Find explicit placeholder markers
|
|
23
|
+
grep -rn "Coming Soon\|TODO\|FIXME\|Not Implemented\|Placeholder" --include="*.tsx" --include="*.ts" --include="*.py"
|
|
24
|
+
|
|
25
|
+
# 2. Find empty handlers (silent failures)
|
|
26
|
+
grep -rn "onClick={() => {}}\|onChange={() => {}}\|onSubmit={() => {}}" --include="*.tsx"
|
|
27
|
+
|
|
28
|
+
# 3. Find single-line placeholder pages (CRITICAL - catches fake pages)
|
|
29
|
+
grep -rn "const.*=.*().*=>.*<div>.*</div>" --include="*.tsx" | grep -v "test\|spec\|mock"
|
|
30
|
+
grep -rn "const.*=.*().*=>.*<h1>" --include="*.tsx" | grep -v "test\|spec"
|
|
31
|
+
|
|
32
|
+
# 4. Find stub functions
|
|
33
|
+
grep -rn "pass # TODO\|raise NotImplementedError\|throw new Error.*not implemented" --include="*.py" --include="*.ts"
|
|
34
|
+
|
|
35
|
+
# 5. Find commented-out code that should be active
|
|
36
|
+
grep -rn "// api\.\|# api\.\|// fetch\|# requests\." --include="*.ts" --include="*.py"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Authentication Flow Detection
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 6. Check login component implementation
|
|
43
|
+
echo "=== Login Component ==="
|
|
44
|
+
grep -rn "const.*Login\|function Login" --include="*.tsx" -A 15
|
|
45
|
+
|
|
46
|
+
# 7. Check if login API is called
|
|
47
|
+
echo "=== Login API Calls ==="
|
|
48
|
+
grep -rn "auth/login\|/login" --include="*.ts" --include="*.tsx" | grep -v "route\|path\|href"
|
|
49
|
+
|
|
50
|
+
# 8. Check token storage
|
|
51
|
+
echo "=== Token Storage (SET) ==="
|
|
52
|
+
grep -rn "localStorage.setItem.*token\|sessionStorage.setItem.*token\|setToken\|saveToken" --include="*.ts"
|
|
53
|
+
|
|
54
|
+
echo "=== Token Usage (GET) ==="
|
|
55
|
+
grep -rn "localStorage.getItem.*token\|sessionStorage.getItem.*token\|getToken" --include="*.ts"
|
|
56
|
+
|
|
57
|
+
# 9. Check route guards
|
|
58
|
+
echo "=== Route Guards ==="
|
|
59
|
+
grep -rn "ProtectedRoute\|PrivateRoute\|AuthGuard\|RequireAuth\|isAuthenticated" --include="*.tsx"
|
|
60
|
+
|
|
61
|
+
# 10. Check 401 error handling
|
|
62
|
+
echo "=== 401 Handling ==="
|
|
63
|
+
grep -rn "401\|Unauthorized\|not authenticated" --include="*.ts" --include="*.tsx"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Frontend-Backend Contract Detection
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 11. Backend request models
|
|
70
|
+
echo "=== Backend Request Models ==="
|
|
71
|
+
grep -rn "class.*Request.*BaseModel\|class.*Schema" --include="*.py" -A 8
|
|
72
|
+
|
|
73
|
+
# 12. Frontend request bodies
|
|
74
|
+
echo "=== Frontend Request Bodies ==="
|
|
75
|
+
grep -rn "JSON.stringify\|body:" --include="*.ts" --include="*.tsx" -B 2 -A 5
|
|
76
|
+
|
|
77
|
+
# 13. SSE event sending (backend)
|
|
78
|
+
echo "=== Backend SSE Events ==="
|
|
79
|
+
grep -rn "event:.*data:\|yield.*event" --include="*.py" -A 3
|
|
80
|
+
|
|
81
|
+
# 14. SSE event handling (frontend)
|
|
82
|
+
echo "=== Frontend SSE Handlers ==="
|
|
83
|
+
grep -rn "onmessage\|msg.event\|event ===" --include="*.ts" --include="*.tsx" -A 8
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Classification Decision Matrix
|
|
89
|
+
|
|
90
|
+
| Scenario | Evidence | Classification | Action |
|
|
91
|
+
|----------|----------|----------------|--------|
|
|
92
|
+
| Code exists, has defect | Logic/syntax error | **BUG** | Continue with fix workflow |
|
|
93
|
+
| Component is placeholder | Single-line `<h1>` or `<div>` | **Missing Feature** | Escalate to product owner |
|
|
94
|
+
| Code exists but not connected | No fetch/axios calls | **Integration Bug** | Add integration first |
|
|
95
|
+
| Field names don't match | `message` vs `content` | **Contract Bug** | Fix field names |
|
|
96
|
+
| API exists but not called | Backend works, frontend doesn't call | **Integration Bug** | Add API call |
|
|
97
|
+
| Upstream dependency missing | Depends on unimplemented feature | **Blocked** | Fix dependency first |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## If It's Not a Real Bug
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
🛑 INVESTIGATION STOPPED
|
|
105
|
+
|
|
106
|
+
Classification: [Missing Feature / Integration Bug / Contract Bug / Blocked]
|
|
107
|
+
|
|
108
|
+
Evidence:
|
|
109
|
+
- [Paste grep output or code screenshot]
|
|
110
|
+
|
|
111
|
+
This is NOT a code defect. Required actions:
|
|
112
|
+
- [ ] Route to development team for implementation
|
|
113
|
+
- [ ] Create feature request ticket
|
|
114
|
+
- [ ] Update documentation to reflect actual status
|
|
115
|
+
|
|
116
|
+
Do NOT proceed with bug-fixing workflow for non-bugs.
|
|
117
|
+
```
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# IDE Lint Errors Detection and Resolution Guide
|
|
2
|
+
|
|
3
|
+
IDE red squiggly lines (lint errors) indicate code quality issues that must be resolved before code can be considered complete. This guide provides a systematic approach to detecting, categorizing, and fixing these errors.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Red underlines in code editors represent diagnostics from language servers, linters, and type checkers. They indicate issues ranging from simple syntax errors to complex type mismatches. Treating these as blocking issues prevents bugs from reaching production.
|
|
8
|
+
|
|
9
|
+
## Error Categories
|
|
10
|
+
|
|
11
|
+
### 1. Syntax Errors (P0 - Must Fix Immediately)
|
|
12
|
+
|
|
13
|
+
**Symptoms**: Code won't compile/parse; immediate red underlines on basic code structure.
|
|
14
|
+
|
|
15
|
+
| Common Causes | Detection | Fix Approach |
|
|
16
|
+
|---------------|-----------|--------------|
|
|
17
|
+
| Missing semicolons, commas, colons | Parser error at specific line | Add missing punctuation |
|
|
18
|
+
| Unmatched brackets/braces/parentheses | Error often at end of block | Use editor bracket matching to find pair |
|
|
19
|
+
| Typos in keywords (`fucntion`, `retrun`) | "Unknown identifier" error | Correct spelling |
|
|
20
|
+
| Invalid syntax constructs | "Unexpected token" error | Check language syntax rules |
|
|
21
|
+
|
|
22
|
+
### 2. Type Errors (P0/P1 - Critical)
|
|
23
|
+
|
|
24
|
+
**Symptoms**: Type checker reports mismatches; often shows expected vs actual types.
|
|
25
|
+
|
|
26
|
+
| Common Causes | Detection | Fix Approach |
|
|
27
|
+
|---------------|-----------|--------------|
|
|
28
|
+
| Type mismatch in assignment | "Type X not assignable to Y" | Cast, convert, or fix source type |
|
|
29
|
+
| Undefined type reference | "Cannot find type X" | Import type or define it |
|
|
30
|
+
| Wrong generic parameters | "Expected N type arguments" | Check generic signature |
|
|
31
|
+
| Null/undefined not handled | "Object possibly undefined" | Add null checks or assertions |
|
|
32
|
+
| Incorrect function return type | "Return type mismatch" | Fix return statement or signature |
|
|
33
|
+
|
|
34
|
+
### 3. Import/Module Errors (P1 - Must Fix)
|
|
35
|
+
|
|
36
|
+
**Symptoms**: Imports highlighted red; "module not found" messages.
|
|
37
|
+
|
|
38
|
+
| Common Causes | Detection | Fix Approach |
|
|
39
|
+
|---------------|-----------|--------------|
|
|
40
|
+
| Missing import statement | "X is not defined" | Add import for the symbol |
|
|
41
|
+
| Wrong import path | "Cannot find module X" | Check relative/absolute path |
|
|
42
|
+
| Circular dependencies | Complex error, often runtime | Refactor to break cycle |
|
|
43
|
+
| Package not installed | "Cannot find module X" | Install package via package manager |
|
|
44
|
+
| Wrong export/import style | "X has no default export" | Match import style to export |
|
|
45
|
+
|
|
46
|
+
### 4. Linting Rule Violations (P2/P3 - Should Fix)
|
|
47
|
+
|
|
48
|
+
**Symptoms**: Warnings or errors from ESLint, Pylint, Ruff, etc.
|
|
49
|
+
|
|
50
|
+
| Common Causes | Detection | Fix Approach |
|
|
51
|
+
|---------------|-----------|--------------|
|
|
52
|
+
| Unused variables/imports | "X is defined but never used" | Remove or use the symbol |
|
|
53
|
+
| Code style violations | Various formatting warnings | Auto-fix or manual adjustment |
|
|
54
|
+
| Deprecated API usage | "X is deprecated" | Update to recommended API |
|
|
55
|
+
| Unsafe patterns | Security/safety warnings | Refactor to safe pattern |
|
|
56
|
+
| Complexity warnings | "Function too complex" | Refactor to simpler structure |
|
|
57
|
+
|
|
58
|
+
### 5. Declaration Errors (P1 - Must Fix)
|
|
59
|
+
|
|
60
|
+
**Symptoms**: Variables or functions highlighted as undefined.
|
|
61
|
+
|
|
62
|
+
| Common Causes | Detection | Fix Approach |
|
|
63
|
+
|---------------|-----------|--------------|
|
|
64
|
+
| Using before declaration | "X used before defined" | Move declaration before use |
|
|
65
|
+
| Missing variable declaration | "X is not defined" | Add let/const/var or import |
|
|
66
|
+
| Scope issues | "X is not accessible" | Check variable scope |
|
|
67
|
+
| Missing function definition | "X is not a function" | Define or import function |
|
|
68
|
+
|
|
69
|
+
### 6. Configuration Issues (P1 - Must Fix)
|
|
70
|
+
|
|
71
|
+
**Symptoms**: Errors not related to specific code lines; often project-wide.
|
|
72
|
+
|
|
73
|
+
| Common Causes | Detection | Fix Approach |
|
|
74
|
+
|---------------|-----------|--------------|
|
|
75
|
+
| Missing tsconfig.json | TypeScript errors everywhere | Create/fix tsconfig.json |
|
|
76
|
+
| Wrong compiler options | Unexpected type behavior | Check and fix compiler settings |
|
|
77
|
+
| Missing type definitions | "Cannot find type X" for packages | Install @types/X package |
|
|
78
|
+
| ESLint/Pylint misconfiguration | Inconsistent linting | Check linter config files |
|
|
79
|
+
| Python virtual env issues | Import errors for installed packages | Activate correct venv |
|
|
80
|
+
|
|
81
|
+
## Detection Workflow
|
|
82
|
+
|
|
83
|
+
### Step 1: Run `read_lints` Tool
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
read_lints(paths: ["path/to/modified/file.ts"])
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This returns all diagnostics (errors, warnings, hints) for the specified files.
|
|
90
|
+
|
|
91
|
+
### Step 2: Categorize Errors
|
|
92
|
+
|
|
93
|
+
Group errors by category using the table above:
|
|
94
|
+
- **P0 (Syntax, Critical Type)**: Fix immediately, blocks execution
|
|
95
|
+
- **P1 (Import, Declaration, Type, Config)**: Fix before commit
|
|
96
|
+
- **P2 (Linting warnings)**: Fix or document suppression
|
|
97
|
+
- **P3 (Style nits)**: Optional, follow team conventions
|
|
98
|
+
|
|
99
|
+
### Step 3: Fix in Priority Order
|
|
100
|
+
|
|
101
|
+
1. Fix all P0 errors first (code won't work otherwise)
|
|
102
|
+
2. Fix all P1 errors (code may have runtime issues)
|
|
103
|
+
3. Fix P2 errors or add justified suppressions
|
|
104
|
+
4. Optionally fix P3 style issues
|
|
105
|
+
|
|
106
|
+
### Step 4: Verify Resolution
|
|
107
|
+
|
|
108
|
+
Run `read_lints` again to confirm:
|
|
109
|
+
- No new errors introduced
|
|
110
|
+
- Original errors resolved
|
|
111
|
+
- No cascading issues from fixes
|
|
112
|
+
|
|
113
|
+
## Resolution Strategies by Language
|
|
114
|
+
|
|
115
|
+
### TypeScript/JavaScript
|
|
116
|
+
|
|
117
|
+
| Error Pattern | Quick Fix |
|
|
118
|
+
|---------------|-----------|
|
|
119
|
+
| "Cannot find name 'X'" | Add import: `import { X } from 'module'` |
|
|
120
|
+
| "Type 'X' is not assignable to 'Y'" | Check types, add cast if intentional |
|
|
121
|
+
| "Object is possibly 'undefined'" | Add optional chaining `?.` or null check |
|
|
122
|
+
| "Property 'X' does not exist" | Check spelling, add property to interface |
|
|
123
|
+
| "Module has no exported member 'X'" | Check export name, use correct import |
|
|
124
|
+
|
|
125
|
+
### Python
|
|
126
|
+
|
|
127
|
+
| Error Pattern | Quick Fix |
|
|
128
|
+
|---------------|-----------|
|
|
129
|
+
| "Undefined name 'X'" | Add import or define variable |
|
|
130
|
+
| "X is not defined" (Pylint) | Import missing module |
|
|
131
|
+
| "Missing type annotation" | Add type hint: `def f(x: int) -> str:` |
|
|
132
|
+
| "Incompatible types" (mypy) | Fix type mismatch or add cast |
|
|
133
|
+
| "Module 'X' has no attribute 'Y'" | Check module API, fix import |
|
|
134
|
+
|
|
135
|
+
### General Patterns
|
|
136
|
+
|
|
137
|
+
| Error Pattern | Quick Fix |
|
|
138
|
+
|---------------|-----------|
|
|
139
|
+
| Unmatched brackets | Use editor bracket matching |
|
|
140
|
+
| Trailing whitespace | Configure editor auto-trim |
|
|
141
|
+
| Unused imports | Remove or add usage |
|
|
142
|
+
| Undefined symbol | Add import or declaration |
|
|
143
|
+
| Type assertion needed | Add type annotation or cast |
|
|
144
|
+
|
|
145
|
+
## Verification Checklist
|
|
146
|
+
|
|
147
|
+
Before marking code as complete:
|
|
148
|
+
|
|
149
|
+
- [ ] Run `read_lints` on ALL modified files
|
|
150
|
+
- [ ] Zero P0 errors (syntax, critical type)
|
|
151
|
+
- [ ] Zero P1 errors (imports, declarations, config)
|
|
152
|
+
- [ ] P2 errors fixed or documented with justification
|
|
153
|
+
- [ ] No new errors introduced during fixes
|
|
154
|
+
- [ ] Related files also checked (imports may cascade)
|
|
155
|
+
|
|
156
|
+
## Common Pitfalls
|
|
157
|
+
|
|
158
|
+
| Pitfall | Why It Happens | Prevention |
|
|
159
|
+
|---------|----------------|------------|
|
|
160
|
+
| Fixing one error creates another | Type changes cascade | Check all usages before changing types |
|
|
161
|
+
| Ignoring warnings | "It still runs" mentality | Treat warnings as errors in CI |
|
|
162
|
+
| Suppressing without reason | Quick fix habit | Always document suppression reason |
|
|
163
|
+
| Not checking related files | Focus on single file | Run lints on entire changed set |
|
|
164
|
+
| Missing transitive dependencies | Import from imported module | Check full dependency chain |
|
|
165
|
+
|
|
166
|
+
## Integration with Bug-Fixing Workflow
|
|
167
|
+
|
|
168
|
+
This guide is part of the verification gate (Phase 5). After applying a fix:
|
|
169
|
+
|
|
170
|
+
1. Run `read_lints` on all modified files
|
|
171
|
+
2. Treat any red underlines as potential regressions
|
|
172
|
+
3. Verify fix didn't introduce new type/import issues
|
|
173
|
+
4. Document any intentional lint suppressions in PR
|
|
174
|
+
|
|
175
|
+
→ Return to main workflow: Phase 5 Verification Gate
|
|
176
|
+
|