ac-framework 1.2.0 → 1.3.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/LICENSE +8 -4
- package/bin/postinstall.js +23 -0
- package/framework/.agent/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.agent/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.agent/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.agent/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.agent/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.agent/skills/brainstorming/SKILL.md +54 -0
- package/framework/.agent/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.agent/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.agent/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.agent/skills/interface-design/SKILL.md +310 -0
- package/framework/.agent/skills/interface-design/references/example.md +86 -0
- package/framework/.agent/skills/interface-design/references/principles.md +235 -0
- package/framework/.agent/skills/interface-design/references/validation.md +48 -0
- package/framework/.agent/skills/project-index/SKILL.md +234 -0
- package/framework/.agent/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.agent/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.agent/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.agent/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.agent/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.agent/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.agent/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.agent/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.agent/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.amazonq/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.amazonq/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.amazonq/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.amazonq/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.amazonq/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.amazonq/skills/brainstorming/SKILL.md +54 -0
- package/framework/.amazonq/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.amazonq/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.amazonq/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.amazonq/skills/interface-design/SKILL.md +310 -0
- package/framework/.amazonq/skills/interface-design/references/example.md +86 -0
- package/framework/.amazonq/skills/interface-design/references/principles.md +235 -0
- package/framework/.amazonq/skills/interface-design/references/validation.md +48 -0
- package/framework/.amazonq/skills/project-index/SKILL.md +234 -0
- package/framework/.amazonq/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.amazonq/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.amazonq/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.amazonq/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.amazonq/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.amazonq/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.amazonq/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.amazonq/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.amazonq/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.augment/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.augment/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.augment/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.augment/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.augment/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.augment/skills/brainstorming/SKILL.md +54 -0
- package/framework/.augment/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.augment/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.augment/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.augment/skills/interface-design/SKILL.md +310 -0
- package/framework/.augment/skills/interface-design/references/example.md +86 -0
- package/framework/.augment/skills/interface-design/references/principles.md +235 -0
- package/framework/.augment/skills/interface-design/references/validation.md +48 -0
- package/framework/.augment/skills/project-index/SKILL.md +234 -0
- package/framework/.augment/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.augment/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.augment/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.augment/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.augment/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.augment/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.augment/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.augment/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.augment/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.claude/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.claude/skills/brainstorming/SKILL.md +54 -0
- package/framework/.claude/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.claude/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.claude/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.claude/skills/interface-design/SKILL.md +310 -0
- package/framework/.claude/skills/interface-design/references/example.md +86 -0
- package/framework/.claude/skills/interface-design/references/principles.md +235 -0
- package/framework/.claude/skills/interface-design/references/validation.md +48 -0
- package/framework/.claude/skills/project-index/SKILL.md +234 -0
- package/framework/.claude/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.claude/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.claude/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.claude/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.claude/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.claude/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.claude/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.claude/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.claude/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.cline/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.cline/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.cline/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.cline/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.cline/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.cline/skills/brainstorming/SKILL.md +54 -0
- package/framework/.cline/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.cline/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.cline/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.cline/skills/interface-design/SKILL.md +310 -0
- package/framework/.cline/skills/interface-design/references/example.md +86 -0
- package/framework/.cline/skills/interface-design/references/principles.md +235 -0
- package/framework/.cline/skills/interface-design/references/validation.md +48 -0
- package/framework/.cline/skills/project-index/SKILL.md +234 -0
- package/framework/.cline/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.cline/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.cline/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.cline/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.cline/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.cline/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.cline/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.cline/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.cline/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.codebuddy/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.codebuddy/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.codebuddy/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.codebuddy/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.codebuddy/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.codebuddy/skills/brainstorming/SKILL.md +54 -0
- package/framework/.codebuddy/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.codebuddy/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.codebuddy/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.codebuddy/skills/interface-design/SKILL.md +310 -0
- package/framework/.codebuddy/skills/interface-design/references/example.md +86 -0
- package/framework/.codebuddy/skills/interface-design/references/principles.md +235 -0
- package/framework/.codebuddy/skills/interface-design/references/validation.md +48 -0
- package/framework/.codebuddy/skills/project-index/SKILL.md +234 -0
- package/framework/.codebuddy/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.codebuddy/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.codebuddy/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.codebuddy/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.codebuddy/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.codebuddy/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.codebuddy/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.codebuddy/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.codebuddy/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.codex/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.codex/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.codex/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.codex/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.codex/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.codex/skills/brainstorming/SKILL.md +54 -0
- package/framework/.codex/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.codex/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.codex/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.codex/skills/interface-design/SKILL.md +310 -0
- package/framework/.codex/skills/interface-design/references/example.md +86 -0
- package/framework/.codex/skills/interface-design/references/principles.md +235 -0
- package/framework/.codex/skills/interface-design/references/validation.md +48 -0
- package/framework/.codex/skills/project-index/SKILL.md +234 -0
- package/framework/.codex/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.codex/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.codex/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.codex/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.codex/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.codex/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.codex/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.codex/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.codex/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.continue/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.continue/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.continue/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.continue/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.continue/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.continue/skills/brainstorming/SKILL.md +54 -0
- package/framework/.continue/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.continue/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.continue/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.continue/skills/interface-design/SKILL.md +310 -0
- package/framework/.continue/skills/interface-design/references/example.md +86 -0
- package/framework/.continue/skills/interface-design/references/principles.md +235 -0
- package/framework/.continue/skills/interface-design/references/validation.md +48 -0
- package/framework/.continue/skills/project-index/SKILL.md +234 -0
- package/framework/.continue/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.continue/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.continue/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.continue/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.continue/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.continue/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.continue/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.continue/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.continue/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.cospec/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.cospec/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.cospec/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.cospec/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.cospec/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.cospec/skills/brainstorming/SKILL.md +54 -0
- package/framework/.cospec/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.cospec/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.cospec/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.cospec/skills/interface-design/SKILL.md +310 -0
- package/framework/.cospec/skills/interface-design/references/example.md +86 -0
- package/framework/.cospec/skills/interface-design/references/principles.md +235 -0
- package/framework/.cospec/skills/interface-design/references/validation.md +48 -0
- package/framework/.cospec/skills/project-index/SKILL.md +234 -0
- package/framework/.cospec/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.cospec/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.cospec/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.cospec/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.cospec/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.cospec/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.cospec/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.cospec/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.cospec/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.crush/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.crush/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.crush/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.crush/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.crush/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.crush/skills/brainstorming/SKILL.md +54 -0
- package/framework/.crush/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.crush/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.crush/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.crush/skills/interface-design/SKILL.md +310 -0
- package/framework/.crush/skills/interface-design/references/example.md +86 -0
- package/framework/.crush/skills/interface-design/references/principles.md +235 -0
- package/framework/.crush/skills/interface-design/references/validation.md +48 -0
- package/framework/.crush/skills/project-index/SKILL.md +234 -0
- package/framework/.crush/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.crush/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.crush/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.crush/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.crush/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.crush/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.crush/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.crush/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.crush/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.cursor/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.cursor/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.cursor/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.cursor/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.cursor/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.cursor/skills/brainstorming/SKILL.md +54 -0
- package/framework/.cursor/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.cursor/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.cursor/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.cursor/skills/interface-design/SKILL.md +310 -0
- package/framework/.cursor/skills/interface-design/references/example.md +86 -0
- package/framework/.cursor/skills/interface-design/references/principles.md +235 -0
- package/framework/.cursor/skills/interface-design/references/validation.md +48 -0
- package/framework/.cursor/skills/project-index/SKILL.md +234 -0
- package/framework/.cursor/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.cursor/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.cursor/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.cursor/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.cursor/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.cursor/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.cursor/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.cursor/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.cursor/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.factory/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.factory/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.factory/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.factory/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.factory/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.factory/skills/brainstorming/SKILL.md +54 -0
- package/framework/.factory/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.factory/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.factory/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.factory/skills/interface-design/SKILL.md +310 -0
- package/framework/.factory/skills/interface-design/references/example.md +86 -0
- package/framework/.factory/skills/interface-design/references/principles.md +235 -0
- package/framework/.factory/skills/interface-design/references/validation.md +48 -0
- package/framework/.factory/skills/project-index/SKILL.md +234 -0
- package/framework/.factory/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.factory/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.factory/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.factory/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.factory/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.factory/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.factory/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.factory/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.factory/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.gemini/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.gemini/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.gemini/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.gemini/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.gemini/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.gemini/skills/brainstorming/SKILL.md +54 -0
- package/framework/.gemini/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.gemini/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.gemini/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.gemini/skills/interface-design/SKILL.md +310 -0
- package/framework/.gemini/skills/interface-design/references/example.md +86 -0
- package/framework/.gemini/skills/interface-design/references/principles.md +235 -0
- package/framework/.gemini/skills/interface-design/references/validation.md +48 -0
- package/framework/.gemini/skills/project-index/SKILL.md +234 -0
- package/framework/.gemini/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.gemini/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.gemini/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.gemini/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.gemini/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.gemini/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.gemini/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.gemini/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.gemini/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.github/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.github/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.github/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.github/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.github/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.github/skills/brainstorming/SKILL.md +54 -0
- package/framework/.github/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.github/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.github/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.github/skills/interface-design/SKILL.md +310 -0
- package/framework/.github/skills/interface-design/references/example.md +86 -0
- package/framework/.github/skills/interface-design/references/principles.md +235 -0
- package/framework/.github/skills/interface-design/references/validation.md +48 -0
- package/framework/.github/skills/project-index/SKILL.md +234 -0
- package/framework/.github/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.github/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.github/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.github/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.github/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.github/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.github/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.github/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.github/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.iflow/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.iflow/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.iflow/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.iflow/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.iflow/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.iflow/skills/brainstorming/SKILL.md +54 -0
- package/framework/.iflow/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.iflow/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.iflow/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.iflow/skills/interface-design/SKILL.md +310 -0
- package/framework/.iflow/skills/interface-design/references/example.md +86 -0
- package/framework/.iflow/skills/interface-design/references/principles.md +235 -0
- package/framework/.iflow/skills/interface-design/references/validation.md +48 -0
- package/framework/.iflow/skills/project-index/SKILL.md +234 -0
- package/framework/.iflow/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.iflow/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.iflow/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.iflow/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.iflow/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.iflow/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.iflow/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.iflow/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.iflow/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.kilocode/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.kilocode/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.kilocode/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.kilocode/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.kilocode/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.kilocode/skills/brainstorming/SKILL.md +54 -0
- package/framework/.kilocode/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.kilocode/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.kilocode/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.kilocode/skills/interface-design/SKILL.md +310 -0
- package/framework/.kilocode/skills/interface-design/references/example.md +86 -0
- package/framework/.kilocode/skills/interface-design/references/principles.md +235 -0
- package/framework/.kilocode/skills/interface-design/references/validation.md +48 -0
- package/framework/.kilocode/skills/project-index/SKILL.md +234 -0
- package/framework/.kilocode/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.kilocode/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.kilocode/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.kilocode/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.kilocode/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.kilocode/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.kilocode/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.kilocode/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.kilocode/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.opencode/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.opencode/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.opencode/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.opencode/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.opencode/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.opencode/skills/brainstorming/SKILL.md +54 -0
- package/framework/.opencode/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.opencode/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.opencode/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.opencode/skills/interface-design/SKILL.md +310 -0
- package/framework/.opencode/skills/interface-design/references/example.md +86 -0
- package/framework/.opencode/skills/interface-design/references/principles.md +235 -0
- package/framework/.opencode/skills/interface-design/references/validation.md +48 -0
- package/framework/.opencode/skills/project-index/SKILL.md +234 -0
- package/framework/.opencode/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.opencode/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.opencode/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.opencode/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.opencode/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.opencode/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.opencode/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.opencode/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.opencode/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.qoder/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.qoder/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.qoder/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.qoder/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.qoder/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.qoder/skills/brainstorming/SKILL.md +54 -0
- package/framework/.qoder/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.qoder/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.qoder/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.qoder/skills/interface-design/SKILL.md +310 -0
- package/framework/.qoder/skills/interface-design/references/example.md +86 -0
- package/framework/.qoder/skills/interface-design/references/principles.md +235 -0
- package/framework/.qoder/skills/interface-design/references/validation.md +48 -0
- package/framework/.qoder/skills/project-index/SKILL.md +234 -0
- package/framework/.qoder/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.qoder/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.qoder/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.qoder/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.qoder/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.qoder/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.qoder/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.qoder/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.qoder/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.qwen/commands/{opsx-apply.toml → opsx-apply.md} +4 -3
- package/framework/.qwen/commands/{opsx-archive.toml → opsx-archive.md} +4 -3
- package/framework/.qwen/commands/{opsx-bulk-archive.toml → opsx-bulk-archive.md} +4 -3
- package/framework/.qwen/commands/{opsx-continue.toml → opsx-continue.md} +4 -3
- package/framework/.qwen/commands/{opsx-explore.toml → opsx-explore.md} +4 -3
- package/framework/.qwen/commands/{opsx-ff.toml → opsx-ff.md} +4 -3
- package/framework/.qwen/commands/{opsx-new.toml → opsx-new.md} +4 -3
- package/framework/.qwen/commands/{opsx-onboard.toml → opsx-onboard.md} +4 -3
- package/framework/.qwen/commands/{opsx-sync.toml → opsx-sync.md} +4 -3
- package/framework/.qwen/commands/{opsx-verify.toml → opsx-verify.md} +4 -3
- package/framework/.qwen/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.qwen/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.qwen/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.qwen/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.qwen/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.qwen/skills/brainstorming/SKILL.md +54 -0
- package/framework/.qwen/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.qwen/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.qwen/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.qwen/skills/interface-design/SKILL.md +310 -0
- package/framework/.qwen/skills/interface-design/references/example.md +86 -0
- package/framework/.qwen/skills/interface-design/references/principles.md +235 -0
- package/framework/.qwen/skills/interface-design/references/validation.md +48 -0
- package/framework/.qwen/skills/project-index/SKILL.md +234 -0
- package/framework/.qwen/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.qwen/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.qwen/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.qwen/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.qwen/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.qwen/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.qwen/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.qwen/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.qwen/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.roo/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.roo/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.roo/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.roo/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.roo/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.roo/skills/brainstorming/SKILL.md +54 -0
- package/framework/.roo/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.roo/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.roo/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.roo/skills/interface-design/SKILL.md +310 -0
- package/framework/.roo/skills/interface-design/references/example.md +86 -0
- package/framework/.roo/skills/interface-design/references/principles.md +235 -0
- package/framework/.roo/skills/interface-design/references/validation.md +48 -0
- package/framework/.roo/skills/project-index/SKILL.md +234 -0
- package/framework/.roo/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.roo/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.roo/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.roo/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.roo/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.roo/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.roo/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.roo/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.roo/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.trae/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.trae/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.trae/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.trae/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.trae/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.trae/skills/brainstorming/SKILL.md +54 -0
- package/framework/.trae/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.trae/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.trae/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.trae/skills/interface-design/SKILL.md +310 -0
- package/framework/.trae/skills/interface-design/references/example.md +86 -0
- package/framework/.trae/skills/interface-design/references/principles.md +235 -0
- package/framework/.trae/skills/interface-design/references/validation.md +48 -0
- package/framework/.trae/skills/project-index/SKILL.md +234 -0
- package/framework/.trae/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.trae/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.trae/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.trae/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.trae/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.trae/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.trae/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.trae/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.trae/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/.windsurf/skills/api-design-principles/SKILL.md +528 -0
- package/framework/.windsurf/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.windsurf/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.windsurf/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.windsurf/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.windsurf/skills/brainstorming/SKILL.md +54 -0
- package/framework/.windsurf/skills/changelog-generator/SKILL.md +104 -0
- package/framework/.windsurf/skills/code-maintainability/SKILL.md +1108 -0
- package/framework/.windsurf/skills/error-handling-patterns/SKILL.md +641 -0
- package/framework/.windsurf/skills/interface-design/SKILL.md +310 -0
- package/framework/.windsurf/skills/interface-design/references/example.md +86 -0
- package/framework/.windsurf/skills/interface-design/references/principles.md +235 -0
- package/framework/.windsurf/skills/interface-design/references/validation.md +48 -0
- package/framework/.windsurf/skills/project-index/SKILL.md +234 -0
- package/framework/.windsurf/skills/project-index/scripts/scan_codebase.py +47 -0
- package/framework/.windsurf/skills/project-index/templates/agent-template.md +18 -0
- package/framework/.windsurf/skills/project-index/templates/skill-template.md +20 -0
- package/framework/.windsurf/skills/secure-coding-cybersecurity/SKILL.md +793 -0
- package/framework/.windsurf/skills/secure-coding-cybersecurity/references/ai_coding_pitfalls.md +44 -0
- package/framework/.windsurf/skills/secure-coding-cybersecurity/references/owasp_top_10_2025.md +28 -0
- package/framework/.windsurf/skills/secure-coding-cybersecurity/references/secure_coding_examples.md +102 -0
- package/framework/.windsurf/skills/secure-coding-cybersecurity/scripts/security_audit.py +46 -0
- package/framework/.windsurf/skills/systematic-debugging/SKILL.md +296 -0
- package/framework/AGENTS.md +464 -0
- package/framework/CLAUDE.md +464 -0
- package/framework/GEMINI.md +464 -0
- package/framework/QWEN.md +464 -0
- package/framework/copilot-instructions.md +464 -0
- package/package.json +3 -2
- package/src/commands/init.js +2 -1
- package/src/ui/animations.js +36 -11
- package/src/ui/banner.js +6 -6
|
@@ -0,0 +1,1108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-maintainability
|
|
3
|
+
description: "Comprehensive guide to prevent unmaintainable code, especially from AI generation. Covers code duplication, documentation, error handling, naming conventions, architecture, performance, dependencies, modularity, testing, and technical debt prevention. Essential for code reviews and ensuring long-term code health."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Maintainability & Quality Skill
|
|
7
|
+
|
|
8
|
+
## Vision and Purpose
|
|
9
|
+
|
|
10
|
+
This skill establishes maintainability as a critical quality attribute in code generation and review. It recognizes that AI-generated code often prioritizes immediate functionality over long-term maintainability, creating technical debt that compounds over time. This skill provides comprehensive guidelines, checklists, and best practices to ensure all code—especially AI-generated—is clean, readable, testable, and maintainable.
|
|
11
|
+
|
|
12
|
+
## Critical Understanding: Why AI Code is Often Unmaintainable
|
|
13
|
+
|
|
14
|
+
AI models optimize for "working code" and "completing the task" before "maintainable architecture." This creates patterns that are functional today but become liabilities tomorrow.
|
|
15
|
+
|
|
16
|
+
### Root Causes of AI Maintainability Failures
|
|
17
|
+
|
|
18
|
+
1. **Functionality over Structure**: AI generates code that passes immediate tests but lacks proper architecture, creating monolithic functions and tight coupling.
|
|
19
|
+
|
|
20
|
+
2. **Pattern Repetition from Training Data**: AI learns from codebases with varying quality standards, inheriting bad practices like magic numbers, poor naming, and spaghetti code.
|
|
21
|
+
|
|
22
|
+
3. **Lack of Context Awareness**: AI doesn't understand your team's conventions, existing architecture, or long-term maintenance needs.
|
|
23
|
+
|
|
24
|
+
4. **Boilerplate Bloat**: Studies show AI generates code with 8x more duplication than human developers, creating maintenance nightmares.
|
|
25
|
+
|
|
26
|
+
5. **Happy Path Bias**: AI focuses on successful scenarios, neglecting error handling, edge cases, and failure modes.
|
|
27
|
+
|
|
28
|
+
## The Maintainability Non-Negotiables
|
|
29
|
+
|
|
30
|
+
These rules must NEVER be violated, regardless of time pressure or "temporary" solutions:
|
|
31
|
+
|
|
32
|
+
1. **No Code Duplication**: Don't repeat logic—extract to reusable functions, utilities, or shared components.
|
|
33
|
+
|
|
34
|
+
2. **Document the "Why", Not the "What"**: Comments should explain business decisions and rationale, not restate the code.
|
|
35
|
+
|
|
36
|
+
3. **Handle All Edge Cases**: Every function must consider null values, empty inputs, boundary conditions, and failures.
|
|
37
|
+
|
|
38
|
+
4. **Consistent Naming**: Use clear, descriptive names that reveal intent. Avoid abbreviations and single-letter variables.
|
|
39
|
+
|
|
40
|
+
5. **Single Responsibility**: Each function, class, and module should have one reason to change.
|
|
41
|
+
|
|
42
|
+
6. **Test Everything**: All code paths—including error conditions—must have automated tests.
|
|
43
|
+
|
|
44
|
+
7. **No Hardcoded Values**: Use constants, configuration, or environment variables for values that might change.
|
|
45
|
+
|
|
46
|
+
## Comprehensive Maintainability Checklist
|
|
47
|
+
|
|
48
|
+
### 1. Code Duplication and Bloat
|
|
49
|
+
|
|
50
|
+
**The Problem**: AI generates duplicated code blocks at 8x the rate of human developers. This creates maintenance overhead, increases bug propagation, and violates the DRY (Don't Repeat Yourself) principle.
|
|
51
|
+
|
|
52
|
+
#### Checklist
|
|
53
|
+
|
|
54
|
+
- [ ] **Detect duplicate blocks**: Search for functions with 90%+ identical logic
|
|
55
|
+
- Look for similar conditional structures repeated across files
|
|
56
|
+
- Identify loops with nearly identical processing logic
|
|
57
|
+
- Find validation patterns copied multiple times
|
|
58
|
+
|
|
59
|
+
- [ ] **Identify unnecessary layers**: Review wrapper functions that add no value
|
|
60
|
+
- `processData()` that only calls `coreProcessData()` with same arguments
|
|
61
|
+
- Adapter layers that don't transform anything
|
|
62
|
+
- Redundant abstraction hierarchies
|
|
63
|
+
|
|
64
|
+
- [ ] **Remove dead code**: Eliminate unused artifacts
|
|
65
|
+
- Variables declared but never referenced
|
|
66
|
+
- Import statements for unused dependencies
|
|
67
|
+
- Functions that are never called
|
|
68
|
+
- Commented-out code blocks
|
|
69
|
+
- Unreachable code paths
|
|
70
|
+
|
|
71
|
+
- [ ] **Measure code volume**: Compare against human-written equivalents
|
|
72
|
+
- If AI code is 2x+ longer, investigate bloat
|
|
73
|
+
- Look for verbose patterns that could be simplified
|
|
74
|
+
- Check for unnecessary intermediate variables
|
|
75
|
+
|
|
76
|
+
#### Verification Steps
|
|
77
|
+
|
|
78
|
+
1. **Duplication Scan**: Use tools like SonarQube, jscpd, or PMD CPD to find duplicates
|
|
79
|
+
2. **Dead Code Analysis**: Use IDE inspections or tools like vulture (Python), unimport
|
|
80
|
+
3. **Complexity Metrics**: Calculate lines of code per function and cyclomatic complexity
|
|
81
|
+
|
|
82
|
+
#### Common AI Mistakes to Avoid
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
# ❌ NEVER DO THIS - Duplicated logic
|
|
86
|
+
def process_user_data(data):
|
|
87
|
+
if data is None:
|
|
88
|
+
return None
|
|
89
|
+
cleaned = data.strip().lower()
|
|
90
|
+
validated = validate_length(cleaned, 100)
|
|
91
|
+
return validated
|
|
92
|
+
|
|
93
|
+
def process_product_data(data):
|
|
94
|
+
if data is None:
|
|
95
|
+
return None
|
|
96
|
+
cleaned = data.strip().lower()
|
|
97
|
+
validated = validate_length(cleaned, 100)
|
|
98
|
+
return validated
|
|
99
|
+
|
|
100
|
+
# ✅ DO THIS INSTEAD - Reusable function
|
|
101
|
+
def normalize_text(data, max_length=100):
|
|
102
|
+
"""
|
|
103
|
+
Normalize text input by cleaning and validating.
|
|
104
|
+
|
|
105
|
+
Business Rule: All text inputs must be normalized before storage
|
|
106
|
+
to ensure consistency in search and display.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
data: Raw text input
|
|
110
|
+
max_length: Maximum allowed length (default: 100)
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Normalized string or None if input is None
|
|
114
|
+
"""
|
|
115
|
+
if data is None:
|
|
116
|
+
return None
|
|
117
|
+
cleaned = data.strip().lower()
|
|
118
|
+
return validate_length(cleaned, max_length)
|
|
119
|
+
|
|
120
|
+
# Usage
|
|
121
|
+
user_name = normalize_text(raw_user_name)
|
|
122
|
+
product_name = normalize_text(raw_product_name)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
// ❌ NEVER DO THIS - Unnecessary wrapper
|
|
127
|
+
function processData(data) {
|
|
128
|
+
return coreProcessData(data); // No transformation, no value added
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ✅ DO THIS INSTEAD - Use core function directly
|
|
132
|
+
// Or add meaningful transformation:
|
|
133
|
+
function processAndValidateData(data) {
|
|
134
|
+
const processed = coreProcessData(data);
|
|
135
|
+
return validateBusinessRules(processed);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### 2. Documentation and Comments
|
|
142
|
+
|
|
143
|
+
**The Problem**: AI generates comments that merely restate what the code does, providing zero value. Missing context about business decisions, edge cases, and integration points makes maintenance difficult.
|
|
144
|
+
|
|
145
|
+
#### Checklist
|
|
146
|
+
|
|
147
|
+
- [ ] **Explain the "Why"**: Every non-obvious decision needs explanation
|
|
148
|
+
- Why was this algorithm chosen?
|
|
149
|
+
- Why this specific limit/boundary?
|
|
150
|
+
- What business rule does this enforce?
|
|
151
|
+
|
|
152
|
+
- [ ] **Document business context**: Include domain knowledge
|
|
153
|
+
- Reference to requirements or tickets
|
|
154
|
+
- Explanation of business constraints
|
|
155
|
+
- Links to related documentation
|
|
156
|
+
|
|
157
|
+
- [ ] **Document integration points**: Explain external dependencies
|
|
158
|
+
- How this code interacts with other modules
|
|
159
|
+
- Expected contract of external APIs
|
|
160
|
+
- Side effects and state changes
|
|
161
|
+
|
|
162
|
+
- [ ] **Document edge cases**: Explicitly call out special handling
|
|
163
|
+
- Null/undefined behavior
|
|
164
|
+
- Empty collection handling
|
|
165
|
+
- Boundary conditions
|
|
166
|
+
- Concurrency considerations
|
|
167
|
+
|
|
168
|
+
- [ ] **Useful vs. useless comments**: Ensure comments add value
|
|
169
|
+
- ❌ Bad: `// increment counter` (restates code)
|
|
170
|
+
- ✅ Good: `// API retry limit: max 3 attempts with exponential backoff starting at 100ms`
|
|
171
|
+
|
|
172
|
+
#### Verification Steps
|
|
173
|
+
|
|
174
|
+
1. **Comment Review**: Check that comments explain rationale, not mechanics
|
|
175
|
+
2. **Documentation Coverage**: Ensure all public APIs have docstrings/JSDoc
|
|
176
|
+
3. **Edge Case Documentation**: Verify all special cases are documented
|
|
177
|
+
|
|
178
|
+
#### Common AI Mistakes to Avoid
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
# ❌ NEVER DO THIS - Useless comment
|
|
182
|
+
# increment counter
|
|
183
|
+
counter += 1
|
|
184
|
+
|
|
185
|
+
# ❌ NEVER DO THIS - Restating the obvious
|
|
186
|
+
def calculate_total(price, quantity):
|
|
187
|
+
# multiply price by quantity
|
|
188
|
+
return price * quantity
|
|
189
|
+
|
|
190
|
+
# ✅ DO THIS INSTEAD - Explain business context
|
|
191
|
+
def calculate_total(price, quantity):
|
|
192
|
+
"""
|
|
193
|
+
Calculate order total with volume discount rules.
|
|
194
|
+
|
|
195
|
+
Business Rules:
|
|
196
|
+
- Base price * quantity for orders < 10 items
|
|
197
|
+
- 5% discount for orders 10-49 items
|
|
198
|
+
- 10% discount for orders 50+ items
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
price: Unit price in cents (integer to avoid floating point errors)
|
|
202
|
+
quantity: Number of items ordered
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
Total amount in cents
|
|
206
|
+
|
|
207
|
+
Edge Cases:
|
|
208
|
+
- Returns 0 if quantity is 0
|
|
209
|
+
- Raises ValueError if price or quantity is negative
|
|
210
|
+
"""
|
|
211
|
+
if quantity == 0:
|
|
212
|
+
return 0
|
|
213
|
+
|
|
214
|
+
base_total = price * quantity
|
|
215
|
+
|
|
216
|
+
if quantity >= 50:
|
|
217
|
+
return int(base_total * 0.90) # 10% discount
|
|
218
|
+
elif quantity >= 10:
|
|
219
|
+
return int(base_total * 0.95) # 5% discount
|
|
220
|
+
|
|
221
|
+
return base_total
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
// ✅ DO THIS INSTEAD - Document integration context
|
|
226
|
+
/**
|
|
227
|
+
* Process payment through Stripe integration.
|
|
228
|
+
*
|
|
229
|
+
* Integration Notes:
|
|
230
|
+
* - Requires STRIPE_SECRET_KEY environment variable
|
|
231
|
+
* - Webhook endpoint must be configured at /webhooks/stripe
|
|
232
|
+
* - Idempotency key prevents duplicate charges on retries
|
|
233
|
+
*
|
|
234
|
+
* Error Handling:
|
|
235
|
+
* - Card errors: Returns 402 with user-friendly message
|
|
236
|
+
* - API errors: Returns 500, logs to Sentry
|
|
237
|
+
* - Network errors: Retries up to 3 times with exponential backoff
|
|
238
|
+
*
|
|
239
|
+
* @param {Object} paymentData - Payment details
|
|
240
|
+
* @param {string} paymentData.amount - Amount in cents
|
|
241
|
+
* @param {string} paymentData.currency - ISO 4217 currency code
|
|
242
|
+
* @returns {Promise<PaymentResult>} Payment confirmation or error
|
|
243
|
+
*/
|
|
244
|
+
async function processStripePayment(paymentData) {
|
|
245
|
+
// Implementation with proper error handling...
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### 3. Error Handling and Edge Cases
|
|
252
|
+
|
|
253
|
+
**The Problem**: AI focuses on "happy path" scenarios, neglecting null checks, exceptions, and failure modes. This creates fragile code that fails unpredictably in production.
|
|
254
|
+
|
|
255
|
+
#### Checklist
|
|
256
|
+
|
|
257
|
+
- [ ] **Null safety**: Protect against null/undefined values
|
|
258
|
+
- Validate all input parameters at function entry
|
|
259
|
+
- Use optional chaining where appropriate
|
|
260
|
+
- Fail fast with clear error messages
|
|
261
|
+
|
|
262
|
+
- [ ] **Exception handling**: Catch errors at risk points
|
|
263
|
+
- Database operations
|
|
264
|
+
- External API calls
|
|
265
|
+
- File system operations
|
|
266
|
+
- Parsing operations (JSON, XML, dates)
|
|
267
|
+
- Network requests
|
|
268
|
+
|
|
269
|
+
- [ ] **Graceful degradation**: Provide fallbacks when possible
|
|
270
|
+
- Default values for missing configuration
|
|
271
|
+
- Cached responses when APIs fail
|
|
272
|
+
- Circuit breakers for external dependencies
|
|
273
|
+
|
|
274
|
+
- [ ] **Error logging**: Log appropriately for debugging
|
|
275
|
+
- Include context (function name, input parameters, stack trace)
|
|
276
|
+
- Use appropriate log levels (error, warn, info)
|
|
277
|
+
- Never log sensitive data (passwords, tokens, PII)
|
|
278
|
+
|
|
279
|
+
- [ ] **Edge case testing**: Handle boundary conditions
|
|
280
|
+
- Empty strings and arrays
|
|
281
|
+
- Zero and negative numbers
|
|
282
|
+
- Maximum integer values
|
|
283
|
+
- Special characters and Unicode
|
|
284
|
+
- Maximum file sizes
|
|
285
|
+
- Timeout scenarios
|
|
286
|
+
|
|
287
|
+
#### Verification Steps
|
|
288
|
+
|
|
289
|
+
1. **Null Injection**: Pass null/undefined to all parameters
|
|
290
|
+
2. **Exception Testing**: Force errors in external dependencies
|
|
291
|
+
3. **Boundary Testing**: Test minimum, maximum, and boundary values
|
|
292
|
+
4. **Fuzz Testing**: Randomize inputs to find unexpected failures
|
|
293
|
+
|
|
294
|
+
#### Common AI Mistakes to Avoid
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
# ❌ NEVER DO THIS - No null checks or error handling
|
|
298
|
+
def process_user(user):
|
|
299
|
+
email = user['email'] # KeyError if key missing
|
|
300
|
+
send_email(email) # Fails if email is None
|
|
301
|
+
|
|
302
|
+
# ✅ DO THIS INSTEAD - Comprehensive error handling
|
|
303
|
+
def process_user(user):
|
|
304
|
+
"""
|
|
305
|
+
Process user data with validation and error handling.
|
|
306
|
+
|
|
307
|
+
Args:
|
|
308
|
+
user: Dictionary containing user data
|
|
309
|
+
|
|
310
|
+
Raises:
|
|
311
|
+
ValueError: If user data is invalid
|
|
312
|
+
EmailError: If email sending fails
|
|
313
|
+
"""
|
|
314
|
+
if not user:
|
|
315
|
+
raise ValueError("User data is required")
|
|
316
|
+
|
|
317
|
+
email = user.get('email')
|
|
318
|
+
if not email:
|
|
319
|
+
raise ValueError("User email is required")
|
|
320
|
+
|
|
321
|
+
if not is_valid_email(email):
|
|
322
|
+
raise ValueError(f"Invalid email format: {email}")
|
|
323
|
+
|
|
324
|
+
try:
|
|
325
|
+
send_email(email)
|
|
326
|
+
except EmailException as e:
|
|
327
|
+
logger.error(f"Failed to send email to {email}: {e}")
|
|
328
|
+
raise EmailError(f"Could not send welcome email") from e
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
```javascript
|
|
332
|
+
// ❌ NEVER DO THIS - Missing error handling
|
|
333
|
+
async function fetchUserData(userId) {
|
|
334
|
+
const response = await fetch(`/api/users/${userId}`);
|
|
335
|
+
const data = await response.json(); // Crashes if not valid JSON
|
|
336
|
+
return data;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// ✅ DO THIS INSTEAD - Robust error handling
|
|
340
|
+
async function fetchUserData(userId) {
|
|
341
|
+
if (!userId) {
|
|
342
|
+
throw new ValidationError('User ID is required');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
try {
|
|
346
|
+
const response = await fetch(`/api/users/${userId}`);
|
|
347
|
+
|
|
348
|
+
if (!response.ok) {
|
|
349
|
+
if (response.status === 404) {
|
|
350
|
+
throw new NotFoundError(`User ${userId} not found`);
|
|
351
|
+
}
|
|
352
|
+
throw new ApiError(`API error: ${response.status}`);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const data = await response.json();
|
|
356
|
+
|
|
357
|
+
if (!data || typeof data !== 'object') {
|
|
358
|
+
throw new DataError('Invalid response format');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return data;
|
|
362
|
+
|
|
363
|
+
} catch (error) {
|
|
364
|
+
if (error instanceof ValidationError || error instanceof NotFoundError) {
|
|
365
|
+
throw error; // Re-throw known errors
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
logger.error('Failed to fetch user data', {
|
|
369
|
+
userId,
|
|
370
|
+
error: error.message,
|
|
371
|
+
stack: error.stack
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
throw new ServiceError('Unable to retrieve user data');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### 4. Naming Conventions
|
|
382
|
+
|
|
383
|
+
**The Problem**: AI generates ambiguous, inconsistent, or abbreviated names that obscure intent. Poor naming is one of the biggest barriers to code understanding.
|
|
384
|
+
|
|
385
|
+
#### Checklist
|
|
386
|
+
|
|
387
|
+
- [ ] **Descriptive variable names**: Reveal purpose and content
|
|
388
|
+
- ❌ Avoid: `data`, `temp`, `result`, `value`, `x`, `y`
|
|
389
|
+
- ✅ Use: `userEmailList`, `calculatedTaxAmount`, `pendingOrderCount`
|
|
390
|
+
|
|
391
|
+
- [ ] **Consistent naming patterns**: Follow conventions throughout
|
|
392
|
+
- camelCase for JavaScript/TypeScript variables and functions
|
|
393
|
+
- PascalCase for classes and constructors
|
|
394
|
+
- snake_case for Python variables and functions
|
|
395
|
+
- SCREAMING_SNAKE_CASE for constants
|
|
396
|
+
- Boolean prefix: `is`, `has`, `can`, `should`
|
|
397
|
+
|
|
398
|
+
- [ ] **Accurate naming**: Names should match actual purpose
|
|
399
|
+
- `isValid` should not mean `isUserEmailVerified`
|
|
400
|
+
- Function names should describe what they do, not how
|
|
401
|
+
|
|
402
|
+
- [ ] **Avoid abbreviations**: Unless universally understood
|
|
403
|
+
- ❌ Avoid: `usrNm`, `dta`, `proc`, `calc`, `fn`
|
|
404
|
+
- ✅ Acceptable: `id`, `url`, `api`, `html` (domain standards)
|
|
405
|
+
|
|
406
|
+
- [ ] **Function naming**: Use action verbs
|
|
407
|
+
- `fetch`, `get`, `create`, `update`, `delete`, `process`, `validate`, `calculate`, `transform`
|
|
408
|
+
|
|
409
|
+
#### Verification Steps
|
|
410
|
+
|
|
411
|
+
1. **Name Review**: Read names without context—do they make sense?
|
|
412
|
+
2. **Abbreviation Check**: Ensure all abbreviations are domain-appropriate
|
|
413
|
+
3. **Consistency Audit**: Verify naming conventions are applied consistently
|
|
414
|
+
|
|
415
|
+
#### Common AI Mistakes to Avoid
|
|
416
|
+
|
|
417
|
+
```python
|
|
418
|
+
# ❌ NEVER DO THIS - Ambiguous names
|
|
419
|
+
def calc(a, b):
|
|
420
|
+
return a * b
|
|
421
|
+
|
|
422
|
+
data = get_data()
|
|
423
|
+
for x in data:
|
|
424
|
+
process(x)
|
|
425
|
+
|
|
426
|
+
# ✅ DO THIS INSTEAD - Clear, descriptive names
|
|
427
|
+
def calculate_order_total(item_price, quantity):
|
|
428
|
+
"""Calculate total price for order line item."""
|
|
429
|
+
return item_price * quantity
|
|
430
|
+
|
|
431
|
+
user_orders = fetch_pending_orders()
|
|
432
|
+
for order in user_orders:
|
|
433
|
+
process_order_payment(order)
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```javascript
|
|
437
|
+
// ❌ NEVER DO THIS - Inconsistent naming and abbreviations
|
|
438
|
+
let usrNm = getUserName();
|
|
439
|
+
let is_valid = validateEmail(email);
|
|
440
|
+
function procData(d) { /* ... */ }
|
|
441
|
+
|
|
442
|
+
// ✅ DO THIS INSTEAD - Consistent, clear naming
|
|
443
|
+
const userName = getUserName();
|
|
444
|
+
const isEmailValid = validateEmail(email);
|
|
445
|
+
function processUserData(userData) { /* ... */ }
|
|
446
|
+
|
|
447
|
+
// Boolean naming convention
|
|
448
|
+
const isAuthenticated = checkAuthStatus();
|
|
449
|
+
const hasPermission = verifyUserPermission('admin');
|
|
450
|
+
const canEdit = determineEditAccess(document);
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### 5. Architecture and Coupling
|
|
456
|
+
|
|
457
|
+
**The Problem**: AI generates code with excessive coupling, mixing concerns, and inconsistent patterns. This makes changes ripple through the codebase and violates SOLID principles.
|
|
458
|
+
|
|
459
|
+
#### Checklist
|
|
460
|
+
|
|
461
|
+
- [ ] **Respect abstractions**: Don't bypass interfaces
|
|
462
|
+
- Reference interfaces/abstract types, not concrete implementations
|
|
463
|
+
- Use dependency injection instead of hardcoded dependencies
|
|
464
|
+
- Follow the Dependency Inversion Principle
|
|
465
|
+
|
|
466
|
+
- [ ] **Loose coupling**: Minimize inter-module dependencies
|
|
467
|
+
- Changes in one module shouldn't break unrelated modules
|
|
468
|
+
- Use events or message passing for loose communication
|
|
469
|
+
- Apply the Law of Demeter
|
|
470
|
+
|
|
471
|
+
- [ ] **Consistent patterns**: Use same approach for similar problems
|
|
472
|
+
- Don't mix Singleton, Factory, and direct instantiation arbitrarily
|
|
473
|
+
- Establish and follow architectural patterns
|
|
474
|
+
- Use established design patterns appropriately
|
|
475
|
+
|
|
476
|
+
- [ ] **Single Responsibility**: One reason to change per component
|
|
477
|
+
- Functions: One task
|
|
478
|
+
- Classes: One responsibility
|
|
479
|
+
- Modules: One domain concern
|
|
480
|
+
|
|
481
|
+
- [ ] **Separation of concerns**: Keep layers distinct
|
|
482
|
+
- Presentation/UI logic separate from business logic
|
|
483
|
+
- Business logic separate from data access
|
|
484
|
+
- Validation centralized, not scattered
|
|
485
|
+
|
|
486
|
+
#### Verification Steps
|
|
487
|
+
|
|
488
|
+
1. **Dependency Analysis**: Use tools like madge, dependency-cruiser
|
|
489
|
+
2. **Change Impact Analysis**: Change one module, see what breaks
|
|
490
|
+
3. **Architecture Review**: Verify adherence to established patterns
|
|
491
|
+
|
|
492
|
+
#### Common AI Mistakes to Avoid
|
|
493
|
+
|
|
494
|
+
```python
|
|
495
|
+
# ❌ NEVER DO THIS - High coupling, mixed concerns
|
|
496
|
+
class UserService:
|
|
497
|
+
def create_user(self, data):
|
|
498
|
+
# Validation mixed with business logic
|
|
499
|
+
if not data.get('email'):
|
|
500
|
+
raise ValueError("Email required")
|
|
501
|
+
|
|
502
|
+
# Direct database access mixed in
|
|
503
|
+
db = Database.connect("localhost", "user", "pass123")
|
|
504
|
+
cursor = db.cursor()
|
|
505
|
+
cursor.execute("INSERT INTO users ...")
|
|
506
|
+
|
|
507
|
+
# Email sending mixed in
|
|
508
|
+
smtp = SMTP("smtp.gmail.com")
|
|
509
|
+
smtp.sendmail("welcome@example.com", data['email'], "Welcome!")
|
|
510
|
+
|
|
511
|
+
# Logging mixed in
|
|
512
|
+
with open("/var/log/users.log", "a") as f:
|
|
513
|
+
f.write(f"User created: {data['email']}\n")
|
|
514
|
+
|
|
515
|
+
# ✅ DO THIS INSTEAD - Separated concerns
|
|
516
|
+
class UserValidator:
|
|
517
|
+
"""Validates user input data."""
|
|
518
|
+
|
|
519
|
+
def validate_create_data(self, data):
|
|
520
|
+
if not data.get('email'):
|
|
521
|
+
raise ValidationError("Email is required")
|
|
522
|
+
if not is_valid_email(data['email']):
|
|
523
|
+
raise ValidationError("Invalid email format")
|
|
524
|
+
return data
|
|
525
|
+
|
|
526
|
+
class UserRepository:
|
|
527
|
+
"""Handles user data persistence."""
|
|
528
|
+
|
|
529
|
+
def __init__(self, db_connection):
|
|
530
|
+
self._db = db_connection
|
|
531
|
+
|
|
532
|
+
def create(self, user_data):
|
|
533
|
+
# Database operations only
|
|
534
|
+
return self._db.insert('users', user_data)
|
|
535
|
+
|
|
536
|
+
class NotificationService:
|
|
537
|
+
"""Handles user notifications."""
|
|
538
|
+
|
|
539
|
+
def __init__(self, email_client, logger):
|
|
540
|
+
self._email = email_client
|
|
541
|
+
self._logger = logger
|
|
542
|
+
|
|
543
|
+
def send_welcome_email(self, user_email):
|
|
544
|
+
self._email.send(user_email, "Welcome!", template="welcome")
|
|
545
|
+
self._logger.info(f"Welcome email sent to {user_email}")
|
|
546
|
+
|
|
547
|
+
class UserService:
|
|
548
|
+
"""Orchestrates user creation with proper separation."""
|
|
549
|
+
|
|
550
|
+
def __init__(self, validator, repository, notifications):
|
|
551
|
+
self._validator = validator
|
|
552
|
+
self._repository = repository
|
|
553
|
+
self._notifications = notifications
|
|
554
|
+
|
|
555
|
+
def create_user(self, user_data):
|
|
556
|
+
validated_data = self._validator.validate_create_data(user_data)
|
|
557
|
+
user = self._repository.create(validated_data)
|
|
558
|
+
self._notifications.send_welcome_email(user.email)
|
|
559
|
+
return user
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
### 6. Performance and Efficiency
|
|
565
|
+
|
|
566
|
+
**The Problem**: AI prioritizes clarity over efficiency, often generating code with N+1 queries, excessive I/O, and memory waste that becomes problematic at scale.
|
|
567
|
+
|
|
568
|
+
#### Checklist
|
|
569
|
+
|
|
570
|
+
- [ ] **Database optimization**: Efficient queries
|
|
571
|
+
- Eliminate N+1 queries (queries inside loops)
|
|
572
|
+
- Use eager loading/joins where appropriate
|
|
573
|
+
- Implement pagination for large result sets
|
|
574
|
+
- Add necessary database indexes
|
|
575
|
+
- Only select needed columns
|
|
576
|
+
|
|
577
|
+
- [ ] **Minimize I/O operations**: Batch operations when possible
|
|
578
|
+
- Batch database inserts/updates
|
|
579
|
+
- Bulk API requests instead of individual calls
|
|
580
|
+
- Efficient file operations (streaming, buffering)
|
|
581
|
+
|
|
582
|
+
- [ ] **Memory efficiency**: Avoid unnecessary allocations
|
|
583
|
+
- Don't create copies when references suffice
|
|
584
|
+
- Use generators for large datasets
|
|
585
|
+
- Release resources promptly
|
|
586
|
+
|
|
587
|
+
- [ ] **Async/concurrency**: Don't block on I/O
|
|
588
|
+
- Use async/await for network calls
|
|
589
|
+
- Don't perform synchronous operations in event loops
|
|
590
|
+
- Implement proper concurrency controls
|
|
591
|
+
|
|
592
|
+
- [ ] **Algorithm efficiency**: Choose appropriate algorithms
|
|
593
|
+
- Avoid O(n²) when O(n log n) or O(n) is possible
|
|
594
|
+
- Consider time vs. space tradeoffs
|
|
595
|
+
- Profile performance-critical code
|
|
596
|
+
|
|
597
|
+
#### Verification Steps
|
|
598
|
+
|
|
599
|
+
1. **Query Analysis**: Use EXPLAIN plans and query log analysis
|
|
600
|
+
2. **Load Testing**: Test with realistic data volumes
|
|
601
|
+
3. **Profiling**: Use profilers to identify bottlenecks
|
|
602
|
+
4. **Memory Profiling**: Check for leaks and excessive allocation
|
|
603
|
+
|
|
604
|
+
#### Common AI Mistakes to Avoid
|
|
605
|
+
|
|
606
|
+
```python
|
|
607
|
+
# ❌ NEVER DO THIS - N+1 query problem
|
|
608
|
+
users = User.query.all()
|
|
609
|
+
for user in users:
|
|
610
|
+
# This executes a query for EACH user!
|
|
611
|
+
orders = Order.query.filter_by(user_id=user.id).all()
|
|
612
|
+
process_orders(orders)
|
|
613
|
+
|
|
614
|
+
# ✅ DO THIS INSTEAD - Eager loading
|
|
615
|
+
# Single query with join
|
|
616
|
+
users_with_orders = db.session.query(User).options(
|
|
617
|
+
joinedload(User.orders)
|
|
618
|
+
).all()
|
|
619
|
+
|
|
620
|
+
for user in users_with_orders:
|
|
621
|
+
process_orders(user.orders) # No additional queries
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
```javascript
|
|
625
|
+
// ❌ NEVER DO THIS - Sequential async operations
|
|
626
|
+
async function processUsers(userIds) {
|
|
627
|
+
const results = [];
|
|
628
|
+
for (const userId of userIds) {
|
|
629
|
+
// Each iteration waits for the previous to complete!
|
|
630
|
+
const user = await fetchUser(userId);
|
|
631
|
+
results.push(user);
|
|
632
|
+
}
|
|
633
|
+
return results;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// ✅ DO THIS INSTEAD - Parallel async operations
|
|
637
|
+
async function processUsers(userIds) {
|
|
638
|
+
// All requests fire in parallel
|
|
639
|
+
const promises = userIds.map(userId => fetchUser(userId));
|
|
640
|
+
return await Promise.all(promises);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// ✅ Or with concurrency limiting for large batches
|
|
644
|
+
async function processUsersBatched(userIds, batchSize = 10) {
|
|
645
|
+
const results = [];
|
|
646
|
+
for (let i = 0; i < userIds.length; i += batchSize) {
|
|
647
|
+
const batch = userIds.slice(i, i + batchSize);
|
|
648
|
+
const batchResults = await Promise.all(
|
|
649
|
+
batch.map(id => fetchUser(id))
|
|
650
|
+
);
|
|
651
|
+
results.push(...batchResults);
|
|
652
|
+
}
|
|
653
|
+
return results;
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
### 7. Dependencies and Versioning
|
|
660
|
+
|
|
661
|
+
**The Problem**: AI may suggest packages that don't exist, use loose version constraints, or create dependency bloat with deep transitive dependency trees.
|
|
662
|
+
|
|
663
|
+
#### Checklist
|
|
664
|
+
|
|
665
|
+
- [ ] **Verify dependencies**: Ensure packages exist and are legitimate
|
|
666
|
+
- Check for typosquatting (slight misspellings of popular packages)
|
|
667
|
+
- Verify package is actively maintained
|
|
668
|
+
- Review package quality and security
|
|
669
|
+
|
|
670
|
+
- [ ] **Lock dependencies**: Use lockfiles for reproducible builds
|
|
671
|
+
- `package-lock.json` (npm)
|
|
672
|
+
- `yarn.lock` (yarn)
|
|
673
|
+
- `poetry.lock` (Poetry)
|
|
674
|
+
- `Cargo.lock` (Rust)
|
|
675
|
+
- `go.sum` (Go)
|
|
676
|
+
|
|
677
|
+
- [ ] **Version constraints**: Use appropriate versioning
|
|
678
|
+
- Pin exact versions for critical dependencies
|
|
679
|
+
- Use caret (^) or tilde (~) ranges thoughtfully
|
|
680
|
+
- Avoid wildcards (*) in production
|
|
681
|
+
|
|
682
|
+
- [ ] **Minimize dependencies**: Reduce attack surface
|
|
683
|
+
- Question every new dependency
|
|
684
|
+
- Prefer standard library solutions
|
|
685
|
+
- Remove unused dependencies
|
|
686
|
+
|
|
687
|
+
- [ ] **Audit regularly**: Check for vulnerabilities
|
|
688
|
+
- Run `npm audit`, `pip-audit`, `snyk test`
|
|
689
|
+
- Automate with Dependabot or similar
|
|
690
|
+
- Keep dependencies updated
|
|
691
|
+
|
|
692
|
+
#### Verification Steps
|
|
693
|
+
|
|
694
|
+
1. **Dependency Audit**: Use `npm audit`, `safety check`, `snyk test`
|
|
695
|
+
2. **License Check**: Verify license compatibility
|
|
696
|
+
3. **Update Check**: Identify outdated dependencies
|
|
697
|
+
4. **Bloat Analysis**: Check bundle size and dependency depth
|
|
698
|
+
|
|
699
|
+
#### Common AI Mistakes to Avoid
|
|
700
|
+
|
|
701
|
+
```json
|
|
702
|
+
// ❌ NEVER DO THIS - Loose versions and unchecked packages
|
|
703
|
+
{
|
|
704
|
+
"dependencies": {
|
|
705
|
+
"express": "*",
|
|
706
|
+
"unknown-package": "^1.0.0", // Might not exist!
|
|
707
|
+
"left-pad": "1.0.0" // Check if really needed
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// ✅ DO THIS INSTEAD - Specific versions with lockfile
|
|
712
|
+
{
|
|
713
|
+
"dependencies": {
|
|
714
|
+
"express": "^4.18.2",
|
|
715
|
+
"lodash": "^4.17.21"
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
// Always include package-lock.json in version control
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
### 8. Modularity and Encapsulation
|
|
724
|
+
|
|
725
|
+
**The Problem**: AI generates code with unclear module boundaries, exposing internal details and creating fragile dependencies between modules.
|
|
726
|
+
|
|
727
|
+
#### Checklist
|
|
728
|
+
|
|
729
|
+
- [ ] **Clear module boundaries**: Changes in one module don't affect others unexpectedly
|
|
730
|
+
- Define public APIs explicitly
|
|
731
|
+
- Keep implementation details private
|
|
732
|
+
- Use exports/imports thoughtfully
|
|
733
|
+
|
|
734
|
+
- [ ] **Encapsulation**: Hide internal state
|
|
735
|
+
- Private fields/methods for internal use only
|
|
736
|
+
- Getter/setter methods for controlled access
|
|
737
|
+
- Immutable data where possible
|
|
738
|
+
|
|
739
|
+
- [ ] **Single responsibility**: One reason to change
|
|
740
|
+
- Module focused on one domain concern
|
|
741
|
+
- Cohesive functionality
|
|
742
|
+
- Clear purpose and scope
|
|
743
|
+
|
|
744
|
+
- [ ] **Consistent interfaces**: Similar modules have similar interfaces
|
|
745
|
+
- Standardize input/output patterns
|
|
746
|
+
- Consistent error handling
|
|
747
|
+
- Predictable behavior
|
|
748
|
+
|
|
749
|
+
#### Verification Steps
|
|
750
|
+
|
|
751
|
+
1. **API Review**: Verify public interfaces are clean and minimal
|
|
752
|
+
2. **Encapsulation Test**: Try to access internal state—should be difficult
|
|
753
|
+
3. **Cohesion Check**: Ensure module functions relate to single purpose
|
|
754
|
+
|
|
755
|
+
#### Common AI Mistakes to Avoid
|
|
756
|
+
|
|
757
|
+
```python
|
|
758
|
+
# ❌ NEVER DO THIS - Poor encapsulation
|
|
759
|
+
class BankAccount:
|
|
760
|
+
def __init__(self):
|
|
761
|
+
self.balance = 0 # Public field, can be modified directly
|
|
762
|
+
self.transactions = [] # Internal state exposed
|
|
763
|
+
|
|
764
|
+
account = BankAccount()
|
|
765
|
+
account.balance = 1000000 # Anyone can modify!
|
|
766
|
+
|
|
767
|
+
# ✅ DO THIS INSTEAD - Proper encapsulation
|
|
768
|
+
class BankAccount:
|
|
769
|
+
def __init__(self):
|
|
770
|
+
self._balance = 0 # Private field
|
|
771
|
+
self._transactions = [] # Private
|
|
772
|
+
|
|
773
|
+
@property
|
|
774
|
+
def balance(self):
|
|
775
|
+
"""Read-only access to balance."""
|
|
776
|
+
return self._balance
|
|
777
|
+
|
|
778
|
+
def deposit(self, amount):
|
|
779
|
+
"""Deposit funds with validation."""
|
|
780
|
+
if amount <= 0:
|
|
781
|
+
raise ValueError("Deposit amount must be positive")
|
|
782
|
+
self._balance += amount
|
|
783
|
+
self._transactions.append(Transaction('deposit', amount))
|
|
784
|
+
|
|
785
|
+
def get_transaction_history(self):
|
|
786
|
+
"""Return copy of transaction history."""
|
|
787
|
+
return self._transactions.copy()
|
|
788
|
+
|
|
789
|
+
account = BankAccount()
|
|
790
|
+
account.deposit(100)
|
|
791
|
+
print(account.balance) # 100
|
|
792
|
+
# account.balance = 1000 # AttributeError: can't set attribute
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
### 9. Testing and Quality Assurance
|
|
798
|
+
|
|
799
|
+
**The Problem**: AI generates tests that only cover happy paths with weak assertions, providing false confidence while missing edge cases and error conditions.
|
|
800
|
+
|
|
801
|
+
#### Checklist
|
|
802
|
+
|
|
803
|
+
- [ ] **Comprehensive test coverage**: More than happy paths
|
|
804
|
+
- Success cases
|
|
805
|
+
- Error cases
|
|
806
|
+
- Edge cases (null, empty, boundaries)
|
|
807
|
+
- Invalid inputs
|
|
808
|
+
|
|
809
|
+
- [ ] **Strong assertions**: Verify specific outcomes
|
|
810
|
+
- ❌ Weak: `expect(result).toBeDefined()`
|
|
811
|
+
- ✅ Strong: `expect(result).toEqual(expectedValue)`
|
|
812
|
+
- Verify exact values, not just existence
|
|
813
|
+
|
|
814
|
+
- [ ] **Test maintainability**: Tests should be clear and maintainable
|
|
815
|
+
- Descriptive test names explaining scenario
|
|
816
|
+
- Arrange-Act-Assert structure
|
|
817
|
+
- Shared setup using beforeEach/afterEach
|
|
818
|
+
- No test interdependencies
|
|
819
|
+
|
|
820
|
+
- [ ] **Test coverage goals**: Aim for high coverage with quality
|
|
821
|
+
- Minimum 70% coverage (preferably 80%+)
|
|
822
|
+
- Focus on critical paths
|
|
823
|
+
- Don't test implementation details
|
|
824
|
+
|
|
825
|
+
- [ ] **Integration testing**: Test component interactions
|
|
826
|
+
- API endpoint tests
|
|
827
|
+
- Database integration tests
|
|
828
|
+
- Third-party service mocks
|
|
829
|
+
|
|
830
|
+
#### Verification Steps
|
|
831
|
+
|
|
832
|
+
1. **Coverage Analysis**: Use coverage tools (nyc, coverage.py, cargo tarpaulin)
|
|
833
|
+
2. **Mutation Testing**: Verify test quality with mutation testing
|
|
834
|
+
3. **Test Review**: Ensure tests are meaningful, not just coverage padding
|
|
835
|
+
|
|
836
|
+
#### Common AI Mistakes to Avoid
|
|
837
|
+
|
|
838
|
+
```python
|
|
839
|
+
# ❌ NEVER DO THIS - Weak tests with poor coverage
|
|
840
|
+
def test_calculate():
|
|
841
|
+
result = calculate(5, 10)
|
|
842
|
+
assert result is not None # Too weak!
|
|
843
|
+
|
|
844
|
+
def test_process_data():
|
|
845
|
+
data = {"name": "test"}
|
|
846
|
+
result = process_data(data)
|
|
847
|
+
assert result # Just checks truthiness
|
|
848
|
+
|
|
849
|
+
# ✅ DO THIS INSTEAD - Comprehensive tests
|
|
850
|
+
import pytest
|
|
851
|
+
|
|
852
|
+
class TestOrderCalculator:
|
|
853
|
+
"""Test suite for order total calculation."""
|
|
854
|
+
|
|
855
|
+
def test_calculate_simple_order(self):
|
|
856
|
+
"""Should correctly calculate order without discounts."""
|
|
857
|
+
result = calculate_order_total(price=1000, quantity=5)
|
|
858
|
+
assert result == 5000
|
|
859
|
+
|
|
860
|
+
def test_calculate_with_small_discount(self):
|
|
861
|
+
"""Should apply 5% discount for orders 10-49 items."""
|
|
862
|
+
result = calculate_order_total(price=100, quantity=10)
|
|
863
|
+
assert result == 950 # 1000 - 5%
|
|
864
|
+
|
|
865
|
+
def test_calculate_with_large_discount(self):
|
|
866
|
+
"""Should apply 10% discount for orders 50+ items."""
|
|
867
|
+
result = calculate_order_total(price=100, quantity=50)
|
|
868
|
+
assert result == 4500 # 5000 - 10%
|
|
869
|
+
|
|
870
|
+
def test_calculate_zero_quantity(self):
|
|
871
|
+
"""Should return 0 for empty orders."""
|
|
872
|
+
result = calculate_order_total(price=100, quantity=0)
|
|
873
|
+
assert result == 0
|
|
874
|
+
|
|
875
|
+
def test_calculate_negative_price_raises_error(self):
|
|
876
|
+
"""Should reject negative prices."""
|
|
877
|
+
with pytest.raises(ValueError, match="Price cannot be negative"):
|
|
878
|
+
calculate_order_total(price=-100, quantity=5)
|
|
879
|
+
|
|
880
|
+
def test_calculate_large_numbers(self):
|
|
881
|
+
"""Should handle maximum integer values."""
|
|
882
|
+
result = calculate_order_total(price=1000000, quantity=1000)
|
|
883
|
+
assert result == 900000000 # With 10% discount
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
```javascript
|
|
887
|
+
// ✅ DO THIS INSTEAD - Well-structured JavaScript tests
|
|
888
|
+
describe('UserService', () => {
|
|
889
|
+
describe('createUser', () => {
|
|
890
|
+
it('should create user with valid data', async () => {
|
|
891
|
+
const userData = {
|
|
892
|
+
email: 'test@example.com',
|
|
893
|
+
name: 'Test User'
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
const result = await userService.createUser(userData);
|
|
897
|
+
|
|
898
|
+
expect(result).toMatchObject({
|
|
899
|
+
id: expect.any(String),
|
|
900
|
+
email: 'test@example.com',
|
|
901
|
+
name: 'Test User',
|
|
902
|
+
createdAt: expect.any(Date)
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
it('should throw ValidationError for missing email', async () => {
|
|
907
|
+
const userData = { name: 'Test User' };
|
|
908
|
+
|
|
909
|
+
await expect(userService.createUser(userData))
|
|
910
|
+
.rejects
|
|
911
|
+
.toThrow(ValidationError);
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
it('should throw DuplicateError for existing email', async () => {
|
|
915
|
+
const userData = { email: 'existing@example.com', name: 'Test' };
|
|
916
|
+
|
|
917
|
+
await expect(userService.createUser(userData))
|
|
918
|
+
.rejects
|
|
919
|
+
.toThrow(DuplicateError);
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
});
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
---
|
|
926
|
+
|
|
927
|
+
### 10. Technical Debt Prevention
|
|
928
|
+
|
|
929
|
+
**The Problem**: AI generates "temporary" solutions that become permanent, accumulating technical debt through shortcuts, hacks, and quick fixes.
|
|
930
|
+
|
|
931
|
+
#### Checklist
|
|
932
|
+
|
|
933
|
+
- [ ] **No TODO without tickets**: Every TODO needs tracking
|
|
934
|
+
- Create issue/ticket for each TODO
|
|
935
|
+
- Include TODO with ticket reference in code
|
|
936
|
+
- Schedule technical debt sprints
|
|
937
|
+
|
|
938
|
+
- [ ] **Avoid temporary hacks**: Shortcuts become permanent
|
|
939
|
+
- Don't commit "quick fixes" that bypass architecture
|
|
940
|
+
- Refactor instead of layering hacks
|
|
941
|
+
- Document workarounds and plan proper solutions
|
|
942
|
+
|
|
943
|
+
- [ ] **Configuration over code**: Make behavior configurable
|
|
944
|
+
- Magic numbers as named constants
|
|
945
|
+
- Feature flags for toggling behavior
|
|
946
|
+
- Environment-specific configuration
|
|
947
|
+
|
|
948
|
+
- [ ] **Version control discipline**: Clean commit history
|
|
949
|
+
- Descriptive commit messages
|
|
950
|
+
- Logical, atomic commits
|
|
951
|
+
- No debugging code or secrets in commits
|
|
952
|
+
|
|
953
|
+
#### Verification Steps
|
|
954
|
+
|
|
955
|
+
1. **TODO Audit**: Find all TODOs and verify they have tickets
|
|
956
|
+
2. **Code Smell Detection**: Use linters to find anti-patterns
|
|
957
|
+
3. **Architecture Review**: Ensure shortcuts haven't compromised design
|
|
958
|
+
|
|
959
|
+
#### Common AI Mistakes to Avoid
|
|
960
|
+
|
|
961
|
+
```python
|
|
962
|
+
# ❌ NEVER DO THIS - Hardcoded magic numbers
|
|
963
|
+
def calculate_shipping(weight):
|
|
964
|
+
if weight < 10:
|
|
965
|
+
return 5.99 # Magic number!
|
|
966
|
+
elif weight < 50:
|
|
967
|
+
return 10.99 # Magic number!
|
|
968
|
+
return 25.99 # Magic number!
|
|
969
|
+
|
|
970
|
+
# ✅ DO THIS INSTEAD - Named constants
|
|
971
|
+
SHIPPING_TIERS = [
|
|
972
|
+
(10, 5.99), # (max_weight_kg, cost_usd)
|
|
973
|
+
(50, 10.99),
|
|
974
|
+
(float('inf'), 25.99)
|
|
975
|
+
]
|
|
976
|
+
|
|
977
|
+
def calculate_shipping(weight_kg):
|
|
978
|
+
"""Calculate shipping cost based on weight tiers."""
|
|
979
|
+
for max_weight, cost in SHIPPING_TIERS:
|
|
980
|
+
if weight_kg < max_weight:
|
|
981
|
+
return cost
|
|
982
|
+
return SHIPPING_TIERS[-1][1]
|
|
983
|
+
|
|
984
|
+
# ❌ NEVER DO THIS - TODO without context
|
|
985
|
+
# TODO: Fix this later
|
|
986
|
+
def process_payment(data):
|
|
987
|
+
pass # Not implemented
|
|
988
|
+
|
|
989
|
+
# ✅ DO THIS INSTEAD - TODO with ticket reference
|
|
990
|
+
# TODO(PROJ-1234): Implement Stripe payment processing
|
|
991
|
+
# Currently returns mock success for development
|
|
992
|
+
# See: https://jira.company.com/browse/PROJ-1234
|
|
993
|
+
def process_payment(data):
|
|
994
|
+
logger.warning("Using mock payment processor")
|
|
995
|
+
return PaymentResult(success=True, transaction_id="mock-123")
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
## Implementation Workflow
|
|
1001
|
+
|
|
1002
|
+
### Phase 1: Code Generation
|
|
1003
|
+
1. Review AI-generated code against this checklist
|
|
1004
|
+
2. Refactor duplicated logic immediately
|
|
1005
|
+
3. Add documentation for business context
|
|
1006
|
+
4. Implement proper error handling
|
|
1007
|
+
|
|
1008
|
+
### Phase 2: Code Review
|
|
1009
|
+
1. Verify naming conventions are followed
|
|
1010
|
+
2. Check architecture and coupling
|
|
1011
|
+
3. Ensure comprehensive test coverage
|
|
1012
|
+
4. Validate performance considerations
|
|
1013
|
+
|
|
1014
|
+
### Phase 3: Refactoring
|
|
1015
|
+
1. Address code smells and duplication
|
|
1016
|
+
2. Improve documentation where lacking
|
|
1017
|
+
3. Add missing error handling
|
|
1018
|
+
4. Optimize performance bottlenecks
|
|
1019
|
+
|
|
1020
|
+
### Phase 4: Maintenance
|
|
1021
|
+
1. Regular dependency audits
|
|
1022
|
+
2. Technical debt tracking
|
|
1023
|
+
3. Architecture evolution planning
|
|
1024
|
+
4. Team knowledge sharing
|
|
1025
|
+
|
|
1026
|
+
## Tools and Automation
|
|
1027
|
+
|
|
1028
|
+
### Static Analysis
|
|
1029
|
+
- **ESLint/Prettier** (JavaScript/TypeScript) - Style and quality
|
|
1030
|
+
- **Flake8/Black/Pylint** (Python) - Style and complexity
|
|
1031
|
+
- **SonarQube** - Comprehensive code quality analysis
|
|
1032
|
+
- **CodeClimate** - Automated code review
|
|
1033
|
+
|
|
1034
|
+
### Complexity Analysis
|
|
1035
|
+
- **ESLint complexity rules** - Cyclomatic complexity
|
|
1036
|
+
- **Xenon** (Python) - Code complexity monitoring
|
|
1037
|
+
- **CodeMetrics** (VS Code) - Complexity visualization
|
|
1038
|
+
|
|
1039
|
+
### Duplication Detection
|
|
1040
|
+
- **jscpd** - Copy-paste detector for multiple languages
|
|
1041
|
+
- **PMD CPD** - Copy-paste detector
|
|
1042
|
+
- **SonarQube duplication detection**
|
|
1043
|
+
|
|
1044
|
+
### Architecture Analysis
|
|
1045
|
+
- **madge** (JavaScript) - Dependency graph visualization
|
|
1046
|
+
- **dependency-cruiser** - Dependency validation
|
|
1047
|
+
- **pyreverse** (Python) - UML diagram generation
|
|
1048
|
+
|
|
1049
|
+
### Testing
|
|
1050
|
+
- **Jest/Mocha** (JavaScript) - Testing frameworks
|
|
1051
|
+
- **pytest** (Python) - Testing framework
|
|
1052
|
+
- **Istanbul/nyc** - Code coverage
|
|
1053
|
+
- **Stryker** - Mutation testing
|
|
1054
|
+
|
|
1055
|
+
## Priority Matrix for Code Review
|
|
1056
|
+
|
|
1057
|
+
When reviewing AI-generated code, prioritize in this order:
|
|
1058
|
+
|
|
1059
|
+
### Critical (Fix Immediately)
|
|
1060
|
+
1. **Error handling gaps** - Cause production bugs
|
|
1061
|
+
2. **Code duplication** - Technical debt multiplier
|
|
1062
|
+
3. **Security vulnerabilities** - Already covered by security skill
|
|
1063
|
+
|
|
1064
|
+
### High Priority (Fix Before Merge)
|
|
1065
|
+
4. **Insufficient documentation** - Blocks future maintenance
|
|
1066
|
+
5. **Architecture violations** - Slows future changes
|
|
1067
|
+
6. **Performance issues** - Scalability problems
|
|
1068
|
+
|
|
1069
|
+
### Medium Priority (Fix in Sprint)
|
|
1070
|
+
7. **Naming inconsistencies** - Reduces readability
|
|
1071
|
+
8. **Test coverage gaps** - Refactoring risk
|
|
1072
|
+
9. **Dependency bloat** - Increases attack surface
|
|
1073
|
+
|
|
1074
|
+
### Low Priority (Address in Refactoring)
|
|
1075
|
+
10. **Style inconsistencies** - Automated by linters
|
|
1076
|
+
11. **Minor optimizations** - Profile first
|
|
1077
|
+
|
|
1078
|
+
## Red Flags Reference
|
|
1079
|
+
|
|
1080
|
+
| Problem | Red Flag |
|
|
1081
|
+
|---------|----------|
|
|
1082
|
+
| Duplication | Same 5+ lines in 2+ places |
|
|
1083
|
+
| Documentation | No comments explaining "why" |
|
|
1084
|
+
| Error Handling | Missing try/catch in risky operations |
|
|
1085
|
+
| Edge Cases | Tests only with "happy path" values |
|
|
1086
|
+
| Naming | Variables named `data`, `temp`, `result` |
|
|
1087
|
+
| Coupling | Changing X breaks unrelated Y |
|
|
1088
|
+
| Performance | Queries in loops, no pagination |
|
|
1089
|
+
| Modularity | Module handles 5+ responsibilities |
|
|
1090
|
+
| Testing | <70% code coverage |
|
|
1091
|
+
| Dependencies | 3+ levels of transitive imports |
|
|
1092
|
+
|
|
1093
|
+
## Conclusion
|
|
1094
|
+
|
|
1095
|
+
AI is excellent for generating functional boilerplate quickly, but requires expert review for maintainability. Treat AI-generated code as junior developer code: fast and functional, but needs architect review.
|
|
1096
|
+
|
|
1097
|
+
**Key Principles:**
|
|
1098
|
+
- Review for duplication, documentation, and error handling first
|
|
1099
|
+
- Maintain consistent architecture and naming
|
|
1100
|
+
- Test thoroughly including edge cases
|
|
1101
|
+
- Minimize dependencies and technical debt
|
|
1102
|
+
- Document business context and decisions
|
|
1103
|
+
|
|
1104
|
+
**Remember:** Code is read 10x more than it's written. Optimize for readability and maintainability over cleverness or brevity.
|
|
1105
|
+
|
|
1106
|
+
---
|
|
1107
|
+
|
|
1108
|
+
*This skill should be consulted for every code generation task, every code review, and every refactoring effort. Maintainability is a competitive advantage.*
|