agileflow 4.0.0-alpha.2 → 4.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/content/plugins/accessibility/plugin.yaml +14 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/SKILL.md +392 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/aria-patterns.md +528 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/testing-checklist.md +457 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/wcag-guide.md +683 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/audit-page.md +310 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/implement-accessible-component.md +479 -0
- package/content/plugins/ads/agents/ads-audit-budget.md +185 -0
- package/content/plugins/ads/agents/ads-audit-compliance.md +171 -0
- package/content/plugins/ads/agents/ads-audit-creative.md +168 -0
- package/content/plugins/ads/agents/ads-audit-google.md +227 -0
- package/content/plugins/ads/agents/ads-audit-meta.md +184 -0
- package/content/plugins/ads/agents/ads-audit-tracking.md +205 -0
- package/content/plugins/ads/agents/ads-consensus.md +410 -0
- package/content/plugins/ads/agents/ads-generate.md +152 -0
- package/content/plugins/ads/agents/ads-performance-tracker.md +212 -0
- package/content/plugins/ads/plugin.yaml +23 -4
- package/content/plugins/ads/skills/agileflow-ads/SKILL.md +218 -0
- package/content/plugins/ads/skills/agileflow-ads/references/ad-copy-formula-guide.md +131 -0
- package/content/plugins/ads/skills/agileflow-ads/references/audience-targeting-guide.md +137 -0
- package/content/plugins/ads/skills/agileflow-ads/references/bid-strategy-guide.md +115 -0
- package/content/plugins/ads/skills/agileflow-ads/references/platform-benchmarks.md +100 -0
- package/content/plugins/ads/skills/agileflow-ads/workflows/audit.md +118 -0
- package/content/plugins/ads/skills/agileflow-ads/workflows/generate.md +84 -0
- package/content/plugins/audit/agents/a11y-analyzer-aria.md +173 -0
- package/content/plugins/audit/agents/a11y-analyzer-forms.md +173 -0
- package/content/plugins/audit/agents/a11y-analyzer-keyboard.md +183 -0
- package/content/plugins/audit/agents/a11y-analyzer-semantic.md +169 -0
- package/content/plugins/audit/agents/a11y-analyzer-visual.md +172 -0
- package/content/plugins/audit/agents/a11y-consensus.md +249 -0
- package/content/plugins/audit/agents/accessibility.md +558 -0
- package/content/plugins/audit/agents/api-quality-analyzer-conventions.md +156 -0
- package/content/plugins/audit/agents/api-quality-analyzer-docs.md +184 -0
- package/content/plugins/audit/agents/api-quality-analyzer-errors.md +191 -0
- package/content/plugins/audit/agents/api-quality-analyzer-pagination.md +179 -0
- package/content/plugins/audit/agents/api-quality-analyzer-versioning.md +150 -0
- package/content/plugins/audit/agents/api-quality-consensus.md +217 -0
- package/content/plugins/audit/agents/api-validator.md +191 -0
- package/content/plugins/audit/agents/arch-analyzer-circular.md +156 -0
- package/content/plugins/audit/agents/arch-analyzer-complexity.md +193 -0
- package/content/plugins/audit/agents/arch-analyzer-coupling.md +152 -0
- package/content/plugins/audit/agents/arch-analyzer-layering.md +160 -0
- package/content/plugins/audit/agents/arch-analyzer-patterns.md +210 -0
- package/content/plugins/audit/agents/arch-consensus.md +228 -0
- package/content/plugins/audit/agents/browser-qa.md +342 -0
- package/content/plugins/audit/agents/code-reviewer.md +298 -0
- package/content/plugins/audit/agents/completeness-analyzer-api.md +199 -0
- package/content/plugins/audit/agents/completeness-analyzer-conditional.md +211 -0
- package/content/plugins/audit/agents/completeness-analyzer-handlers.md +166 -0
- package/content/plugins/audit/agents/completeness-analyzer-imports.md +165 -0
- package/content/plugins/audit/agents/completeness-analyzer-routes.md +190 -0
- package/content/plugins/audit/agents/completeness-analyzer-state.md +196 -0
- package/content/plugins/audit/agents/completeness-analyzer-stubs.md +206 -0
- package/content/plugins/audit/agents/completeness-consensus.md +295 -0
- package/content/plugins/audit/agents/error-analyzer.md +213 -0
- package/content/plugins/audit/agents/flow-analyzer-authorization.md +182 -0
- package/content/plugins/audit/agents/flow-analyzer-discovery.md +174 -0
- package/content/plugins/audit/agents/flow-analyzer-errors.md +186 -0
- package/content/plugins/audit/agents/flow-analyzer-feedback.md +185 -0
- package/content/plugins/audit/agents/flow-analyzer-navigation.md +177 -0
- package/content/plugins/audit/agents/flow-analyzer-persistence.md +193 -0
- package/content/plugins/audit/agents/flow-analyzer-wiring.md +169 -0
- package/content/plugins/audit/agents/flow-consensus.md +237 -0
- package/content/plugins/audit/agents/legal-analyzer-a11y.md +114 -0
- package/content/plugins/audit/agents/legal-analyzer-ai.md +121 -0
- package/content/plugins/audit/agents/legal-analyzer-consumer.md +114 -0
- package/content/plugins/audit/agents/legal-analyzer-content.md +117 -0
- package/content/plugins/audit/agents/legal-analyzer-international.md +119 -0
- package/content/plugins/audit/agents/legal-analyzer-licensing.md +119 -0
- package/content/plugins/audit/agents/legal-analyzer-privacy.md +112 -0
- package/content/plugins/audit/agents/legal-analyzer-security.md +116 -0
- package/content/plugins/audit/agents/legal-analyzer-terms.md +115 -0
- package/content/plugins/audit/agents/legal-consensus.md +250 -0
- package/content/plugins/audit/agents/logic-analyzer-edge.md +179 -0
- package/content/plugins/audit/agents/logic-analyzer-flow.md +264 -0
- package/content/plugins/audit/agents/logic-analyzer-invariant.md +215 -0
- package/content/plugins/audit/agents/logic-analyzer-race.md +280 -0
- package/content/plugins/audit/agents/logic-analyzer-type.md +227 -0
- package/content/plugins/audit/agents/logic-consensus.md +259 -0
- package/content/plugins/audit/agents/perf-analyzer-assets.md +182 -0
- package/content/plugins/audit/agents/perf-analyzer-bundle.md +173 -0
- package/content/plugins/audit/agents/perf-analyzer-caching.md +170 -0
- package/content/plugins/audit/agents/perf-analyzer-compute.md +173 -0
- package/content/plugins/audit/agents/perf-analyzer-memory.md +193 -0
- package/content/plugins/audit/agents/perf-analyzer-network.md +165 -0
- package/content/plugins/audit/agents/perf-analyzer-queries.md +162 -0
- package/content/plugins/audit/agents/perf-analyzer-rendering.md +168 -0
- package/content/plugins/audit/agents/perf-consensus.md +287 -0
- package/content/plugins/audit/agents/qa.md +820 -0
- package/content/plugins/audit/agents/quality-analyzer-comments.md +159 -0
- package/content/plugins/audit/agents/quality-analyzer-duplication.md +184 -0
- package/content/plugins/audit/agents/quality-analyzer-naming.md +160 -0
- package/content/plugins/audit/agents/quality-consensus.md +241 -0
- package/content/plugins/audit/agents/schema-validator.md +473 -0
- package/content/plugins/audit/agents/security-analyzer-api.md +210 -0
- package/content/plugins/audit/agents/security-analyzer-auth.md +169 -0
- package/content/plugins/audit/agents/security-analyzer-authz.md +180 -0
- package/content/plugins/audit/agents/security-analyzer-deps.md +153 -0
- package/content/plugins/audit/agents/security-analyzer-infra.md +184 -0
- package/content/plugins/audit/agents/security-analyzer-injection.md +155 -0
- package/content/plugins/audit/agents/security-analyzer-input.md +201 -0
- package/content/plugins/audit/agents/security-analyzer-secrets.md +183 -0
- package/content/plugins/audit/agents/security-consensus.md +283 -0
- package/content/plugins/audit/agents/test-analyzer-assertions.md +188 -0
- package/content/plugins/audit/agents/test-analyzer-coverage.md +189 -0
- package/content/plugins/audit/agents/test-analyzer-fragility.md +193 -0
- package/content/plugins/audit/agents/test-analyzer-integration.md +161 -0
- package/content/plugins/audit/agents/test-analyzer-maintenance.md +180 -0
- package/content/plugins/audit/agents/test-analyzer-mocking.md +188 -0
- package/content/plugins/audit/agents/test-analyzer-patterns.md +196 -0
- package/content/plugins/audit/agents/test-analyzer-structure.md +184 -0
- package/content/plugins/audit/agents/test-consensus.md +301 -0
- package/content/plugins/audit/agents/testing.md +561 -0
- package/content/plugins/audit/agents/ui-validator.md +344 -0
- package/content/plugins/audit/plugin.yaml +186 -5
- package/content/plugins/audit/skills/agileflow-audit/SKILL.md +113 -0
- package/content/plugins/audit/skills/agileflow-audit/references/audit-depth-guide.md +151 -0
- package/content/plugins/audit/skills/agileflow-audit/references/dependency-risk-guide.md +139 -0
- package/content/plugins/audit/skills/agileflow-audit/references/owasp-top10.md +120 -0
- package/content/plugins/audit/skills/agileflow-audit/references/performance-budget-guide.md +143 -0
- package/content/plugins/audit/skills/agileflow-audit/references/wcag-criteria.md +117 -0
- package/content/plugins/audit/skills/agileflow-audit/workflows/run-audit.md +52 -0
- package/content/plugins/audit/skills/agileflow-audit/workflows/tdd.md +66 -0
- package/content/plugins/core/agents/adr-writer.md +521 -0
- package/content/plugins/core/agents/epic-planner.md +520 -0
- package/content/plugins/core/agents/mentor.md +709 -0
- package/content/plugins/core/agents/orchestrator.md +776 -0
- package/content/plugins/core/agents/team-coordinator.md +334 -0
- package/content/plugins/core/agents/team-lead.md +181 -0
- package/content/plugins/core/agents/workspace-orchestrator.md +146 -0
- package/content/plugins/core/hooks/context-loader.js +31 -4
- package/content/plugins/core/hooks/damage-control-bash.js +10 -2
- package/content/plugins/core/hooks/damage-control-edit.js +4 -1
- package/content/plugins/core/hooks/damage-control-patterns.yaml +1 -1
- package/content/plugins/core/hooks/damage-control-write.js +4 -1
- package/content/plugins/core/hooks/{pre-compact-state.js → post-compact-state.js} +25 -8
- package/content/plugins/core/hooks/preferences-injector.js +352 -0
- package/content/plugins/core/plugin.yaml +24 -28
- package/content/plugins/core/skills/agileflow-adr/SKILL.md +34 -8
- package/content/plugins/core/skills/agileflow-adr/references/madr-format-guide.md +86 -0
- package/content/plugins/core/skills/agileflow-adr/workflows/write-adr.md +57 -0
- package/content/plugins/core/skills/agileflow-babysit-mentor/SKILL.md +94 -27
- package/content/plugins/core/skills/agileflow-babysit-mentor/references/mentor-decision-guide.md +81 -0
- package/content/plugins/core/skills/agileflow-babysit-mentor/workflows/mentor-session.md +79 -0
- package/content/plugins/core/skills/agileflow-epic-planner/SKILL.md +37 -7
- package/content/plugins/core/skills/agileflow-epic-planner/references/epic-sizing-guide.md +81 -0
- package/content/plugins/core/skills/agileflow-epic-planner/workflows/plan-epic.md +55 -0
- package/content/plugins/core/skills/agileflow-status-updater/SKILL.md +36 -20
- package/content/plugins/core/skills/agileflow-status-updater/references/status-transitions.md +89 -0
- package/content/plugins/core/skills/agileflow-status-updater/workflows/update-status.md +56 -0
- package/content/plugins/core/skills/agileflow-story-writer/SKILL.md +39 -114
- package/content/plugins/core/skills/agileflow-story-writer/references/estimation-reference.md +36 -0
- package/content/plugins/core/skills/agileflow-story-writer/references/story-template.md +92 -0
- package/content/plugins/core/skills/agileflow-story-writer/workflows/write-story.md +138 -0
- package/content/plugins/council/agents/council-advocate.md +223 -0
- package/content/plugins/council/agents/council-analyst.md +278 -0
- package/content/plugins/council/agents/council-compounder.md +204 -0
- package/content/plugins/council/agents/council-contrarian.md +217 -0
- package/content/plugins/council/agents/council-moonshot.md +217 -0
- package/content/plugins/council/agents/council-optimist.md +185 -0
- package/content/plugins/council/agents/council-revenue.md +200 -0
- package/content/plugins/council/agents/council-technical.md +218 -0
- package/content/plugins/council/agents/multi-expert.md +334 -0
- package/content/plugins/council/plugin.yaml +23 -4
- package/content/plugins/council/skills/agileflow-council/SKILL.md +102 -0
- package/content/plugins/council/skills/agileflow-council/references/decision-log-template.md +109 -0
- package/content/plugins/council/skills/agileflow-council/references/perspective-guide.md +104 -0
- package/content/plugins/council/skills/agileflow-council/references/when-to-convene-guide.md +112 -0
- package/content/plugins/council/skills/agileflow-council/workflows/convene.md +73 -0
- package/content/plugins/council/skills/agileflow-council/workflows/multi-expert.md +75 -0
- package/content/plugins/database/plugin.yaml +14 -0
- package/content/plugins/database/skills/agileflow-database/SKILL.md +284 -0
- package/content/plugins/database/skills/agileflow-database/references/indexing-guide.md +313 -0
- package/content/plugins/database/skills/agileflow-database/references/migration-guide.md +328 -0
- package/content/plugins/database/skills/agileflow-database/references/schema-design-guide.md +467 -0
- package/content/plugins/database/skills/agileflow-database/workflows/design-schema.md +213 -0
- package/content/plugins/database/skills/agileflow-database/workflows/optimize-query.md +253 -0
- package/content/plugins/debugging/plugin.yaml +14 -0
- package/content/plugins/debugging/skills/agileflow-debug/SKILL.md +236 -0
- package/content/plugins/debugging/skills/agileflow-debug/references/common-patterns.md +350 -0
- package/content/plugins/debugging/skills/agileflow-debug/references/debugging-strategies.md +328 -0
- package/content/plugins/debugging/skills/agileflow-debug/workflows/debug-issue.md +187 -0
- package/content/plugins/debugging/skills/agileflow-debug/workflows/reproduce-bug.md +194 -0
- package/content/plugins/delivery/agents/ci.md +547 -0
- package/content/plugins/delivery/agents/devops.md +789 -0
- package/content/plugins/delivery/plugin.yaml +19 -0
- package/content/plugins/delivery/skills/agileflow-delivery/SKILL.md +111 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/changelog-format-guide.md +133 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/ci-pipeline-guide.md +158 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/pr-checklist-guide.md +133 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/release-checklist.md +142 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/changelog.md +72 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/deploy.md +74 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/pr.md +75 -0
- package/content/plugins/docs/agents/documentation.md +544 -0
- package/content/plugins/docs/agents/readme-updater.md +640 -0
- package/content/plugins/docs/plugin.yaml +19 -0
- package/content/plugins/docs/skills/agileflow-docs/SKILL.md +106 -0
- package/content/plugins/docs/skills/agileflow-docs/references/api-doc-template.md +167 -0
- package/content/plugins/docs/skills/agileflow-docs/references/doc-types-guide.md +141 -0
- package/content/plugins/docs/skills/agileflow-docs/references/readme-template.md +156 -0
- package/content/plugins/docs/skills/agileflow-docs/workflows/readme-sync.md +57 -0
- package/content/plugins/docs/skills/agileflow-docs/workflows/sync.md +64 -0
- package/content/plugins/engineering/agents/api.md +718 -0
- package/content/plugins/engineering/agents/codebase-query.md +285 -0
- package/content/plugins/engineering/agents/compliance.md +559 -0
- package/content/plugins/engineering/agents/database.md +644 -0
- package/content/plugins/engineering/agents/integrations.md +644 -0
- package/content/plugins/engineering/agents/mobile.md +552 -0
- package/content/plugins/engineering/agents/monitoring.md +585 -0
- package/content/plugins/engineering/agents/performance.md +529 -0
- package/content/plugins/engineering/agents/refactor.md +592 -0
- package/content/plugins/engineering/agents/security.md +524 -0
- package/content/plugins/engineering/agents/ui.md +1336 -0
- package/content/plugins/engineering/plugin.yaml +37 -0
- package/content/plugins/engineering/skills/agileflow-engineering/SKILL.md +127 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/code-review-guide.md +126 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/domain-routing-guide.md +89 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/refactoring-guide.md +136 -0
- package/content/plugins/engineering/skills/agileflow-engineering/workflows/diagnose.md +63 -0
- package/content/plugins/engineering/skills/agileflow-engineering/workflows/impact.md +60 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-features.md +179 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-growth.md +169 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-integration.md +181 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-market.md +150 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-ux.md +180 -0
- package/content/plugins/ideation/agents/brainstorm-consensus.md +245 -0
- package/content/plugins/ideation/agents/design.md +568 -0
- package/content/plugins/ideation/agents/product.md +582 -0
- package/content/plugins/ideation/plugin.yaml +31 -0
- package/content/plugins/ideation/skills/agileflow-ideation/SKILL.md +109 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/brainstorm-techniques.md +138 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/competitive-analysis-template.md +148 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/feature-prioritization-guide.md +147 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/user-story-patterns.md +152 -0
- package/content/plugins/ideation/skills/agileflow-ideation/workflows/features.md +65 -0
- package/content/plugins/ideation/skills/agileflow-ideation/workflows/ideate.md +54 -0
- package/content/plugins/migration/agents/datamigration.md +757 -0
- package/content/plugins/migration/plugin.yaml +17 -0
- package/content/plugins/migration/skills/agileflow-migration/SKILL.md +106 -0
- package/content/plugins/migration/skills/agileflow-migration/references/data-validation-checklist.md +154 -0
- package/content/plugins/migration/skills/agileflow-migration/references/migration-patterns.md +209 -0
- package/content/plugins/migration/skills/agileflow-migration/references/rollback-playbook.md +171 -0
- package/content/plugins/migration/skills/agileflow-migration/references/version-compatibility-matrix.md +155 -0
- package/content/plugins/migration/skills/agileflow-migration/workflows/plan.md +73 -0
- package/content/plugins/migration/skills/agileflow-migration/workflows/validate.md +71 -0
- package/content/plugins/performance/plugin.yaml +14 -0
- package/content/plugins/performance/skills/agileflow-performance/SKILL.md +224 -0
- package/content/plugins/performance/skills/agileflow-performance/references/optimization-patterns.md +554 -0
- package/content/plugins/performance/skills/agileflow-performance/references/profiling-guide.md +383 -0
- package/content/plugins/performance/skills/agileflow-performance/references/web-vitals-guide.md +360 -0
- package/content/plugins/performance/skills/agileflow-performance/workflows/improve-web-vitals.md +344 -0
- package/content/plugins/performance/skills/agileflow-performance/workflows/profile-and-fix.md +254 -0
- package/content/plugins/planning/agents/analytics.md +670 -0
- package/content/plugins/planning/agents/rlm-subcore.md +215 -0
- package/content/plugins/planning/plugin.yaml +19 -0
- package/content/plugins/planning/skills/agileflow-planning/SKILL.md +111 -0
- package/content/plugins/planning/skills/agileflow-planning/references/estimation-guide.md +114 -0
- package/content/plugins/planning/skills/agileflow-planning/references/rpi-workflow.md +119 -0
- package/content/plugins/planning/skills/agileflow-planning/references/sprint-planning-guide.md +145 -0
- package/content/plugins/planning/skills/agileflow-planning/workflows/impact.md +63 -0
- package/content/plugins/planning/skills/agileflow-planning/workflows/rpi.md +104 -0
- package/content/plugins/psychology/plugin.yaml +14 -0
- package/content/plugins/psychology/skills/agileflow-retention/SKILL.md +252 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/competitor-analysis.md +240 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/psychology-models.md +349 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/retention-patterns.md +279 -0
- package/content/plugins/psychology/skills/agileflow-retention/workflows/design-retention-feature.md +287 -0
- package/content/plugins/psychology/skills/agileflow-retention/workflows/retention-audit.md +259 -0
- package/content/plugins/refactoring/plugin.yaml +14 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/SKILL.md +235 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/references/refactoring-patterns.md +405 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/references/safety-checks.md +177 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/workflows/extract-module.md +226 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/workflows/safe-refactor.md +169 -0
- package/content/plugins/research/agents/research.md +503 -0
- package/content/plugins/research/plugin.yaml +17 -0
- package/content/plugins/research/skills/agileflow-research/SKILL.md +110 -0
- package/content/plugins/research/skills/agileflow-research/references/knowledge-decay-guide.md +121 -0
- package/content/plugins/research/skills/agileflow-research/references/research-prompt-guide.md +141 -0
- package/content/plugins/research/skills/agileflow-research/references/synthesis-template.md +154 -0
- package/content/plugins/research/skills/agileflow-research/workflows/analyze.md +60 -0
- package/content/plugins/research/skills/agileflow-research/workflows/ask.md +64 -0
- package/content/plugins/research/skills/agileflow-research/workflows/import.md +66 -0
- package/content/plugins/research/skills/agileflow-research/workflows/synthesize.md +66 -0
- package/content/plugins/reviews/plugin.yaml +14 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/SKILL.md +241 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/review-checklist.md +200 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/security-patterns.md +328 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/review-pr.md +153 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/security-review.md +177 -0
- package/content/plugins/seo/agents/seo-analyzer-content.md +169 -0
- package/content/plugins/seo/agents/seo-analyzer-images.md +198 -0
- package/content/plugins/seo/agents/seo-analyzer-performance.md +217 -0
- package/content/plugins/seo/agents/seo-analyzer-schema.md +184 -0
- package/content/plugins/seo/agents/seo-analyzer-sitemap.md +177 -0
- package/content/plugins/seo/agents/seo-analyzer-technical.md +151 -0
- package/content/plugins/seo/agents/seo-consensus.md +304 -0
- package/content/plugins/seo/plugin.yaml +19 -4
- package/content/plugins/seo/skills/agileflow-seo/SKILL.md +188 -0
- package/content/plugins/seo/skills/agileflow-seo/references/cwv-thresholds.md +110 -0
- package/content/plugins/seo/skills/agileflow-seo/references/eeat-framework.md +144 -0
- package/content/plugins/seo/skills/agileflow-seo/references/keyword-research-guide.md +125 -0
- package/content/plugins/seo/skills/agileflow-seo/references/schema-types.md +139 -0
- package/content/plugins/seo/skills/agileflow-seo/references/technical-seo-checklist.md +139 -0
- package/content/plugins/seo/skills/agileflow-seo/workflows/audit.md +98 -0
- package/content/plugins/seo/skills/agileflow-seo/workflows/page.md +118 -0
- package/content/plugins/testing/plugin.yaml +16 -0
- package/content/plugins/testing/skills/agileflow-test-writer/SKILL.md +260 -0
- package/content/plugins/testing/skills/agileflow-test-writer/references/coverage-targets.md +239 -0
- package/content/plugins/testing/skills/agileflow-test-writer/references/test-patterns.md +420 -0
- package/content/plugins/testing/skills/agileflow-test-writer/workflows/add-coverage.md +154 -0
- package/content/plugins/testing/skills/agileflow-test-writer/workflows/write-tests-from-ac.md +225 -0
- package/package.json +2 -2
- package/src/cli/commands/doctor.js +818 -30
- package/src/cli/commands/hook.js +17 -14
- package/src/cli/commands/launch.js +1454 -0
- package/src/cli/commands/learn.js +149 -0
- package/src/cli/commands/plugins.js +113 -0
- package/src/cli/commands/setup.js +455 -110
- package/src/cli/commands/skills.js +324 -0
- package/src/cli/commands/status.js +8 -10
- package/src/cli/commands/update.js +76 -15
- package/src/cli/index.js +90 -26
- package/src/cli/wizard/babysit-mode-picker.js +192 -0
- package/src/cli/wizard/behaviors-picker.js +208 -54
- package/src/cli/wizard/ide-picker.js +40 -28
- package/src/cli/wizard/install-scope-picker.js +57 -0
- package/src/cli/wizard/launch-alias-picker.js +50 -0
- package/src/cli/wizard/launch-cli-picker.js +129 -0
- package/src/cli/wizard/launch-tmux-picker.js +133 -0
- package/src/cli/wizard/learnings-picker.js +40 -0
- package/src/cli/wizard/plugin-picker.js +47 -16
- package/src/lib/brand.js +116 -0
- package/src/lib/errors.js +120 -0
- package/src/lib/path-check.js +39 -0
- package/src/runtime/config/defaults.js +22 -17
- package/src/runtime/config/loader.js +77 -8
- package/src/runtime/config/schema.json +43 -16
- package/src/runtime/config/writer.js +3 -1
- package/src/runtime/ide/babysit-skill.js +202 -0
- package/src/runtime/ide/capabilities.js +84 -29
- package/src/runtime/ide/claude-code-content.js +177 -0
- package/src/runtime/ide/claude-code-settings.js +67 -29
- package/src/runtime/ide/claude-code-skills.js +47 -32
- package/src/runtime/ide/codex-config.js +295 -0
- package/src/runtime/installer/install.js +252 -24
- package/src/runtime/launch/alias-installer.js +191 -0
- package/src/runtime/launch/cli-resume.js +244 -0
- package/src/runtime/launch/closed-windows.js +338 -0
- package/src/runtime/launch/defaults.js +66 -0
- package/src/runtime/launch/detect-clis.js +69 -0
- package/src/runtime/launch/doctor.js +464 -0
- package/src/runtime/launch/exec-wrapper.js +114 -0
- package/src/runtime/launch/parallel-session.js +247 -0
- package/src/runtime/launch/prefs.js +211 -0
- package/src/runtime/launch/project-prefs.js +234 -0
- package/src/runtime/launch/resolve-cli.js +56 -0
- package/src/runtime/launch/restore.js +152 -0
- package/src/runtime/launch/schema.json +75 -0
- package/src/runtime/launch/session-lifecycle.js +313 -0
- package/src/runtime/launch/session-registry.js +401 -0
- package/src/runtime/launch/spawn.js +103 -0
- package/src/runtime/launch/tabs.js +350 -0
- package/src/runtime/launch/tmux.js +764 -0
- package/src/runtime/launch/worktree.js +260 -0
- package/src/runtime/plugins/registry.js +16 -11
- package/src/runtime/plugins/validator.js +57 -43
- package/src/runtime/skills/learnings.js +308 -0
- package/content/plugins/core/hooks/babysit-mentor-injector.js +0 -55
- package/src/cli/wizard/personalization.js +0 -64
package/content/plugins/refactoring/skills/agileflow-refactor/references/refactoring-patterns.md
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Refactoring Patterns Reference
|
|
2
|
+
|
|
3
|
+
**Load this when:** choosing a refactoring pattern for a specific smell, or implementing a specific pattern with correct before/after structure.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Pattern 1: Extract Function
|
|
8
|
+
|
|
9
|
+
**When:** A section of a function has a clear single purpose, or a function is > 20–30 lines.
|
|
10
|
+
|
|
11
|
+
**Signal:** You can describe a block of code with a phrase ("calculate tax", "validate email format", "format the response").
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// Before — 40-line function doing multiple things
|
|
15
|
+
async function processOrder(orderId, userId) {
|
|
16
|
+
const order = await Order.findById(orderId);
|
|
17
|
+
if (!order) throw new Error("Order not found");
|
|
18
|
+
if (order.userId !== userId) throw new Error("Forbidden");
|
|
19
|
+
|
|
20
|
+
// calculate total with discounts
|
|
21
|
+
let total = order.lineItems.reduce(
|
|
22
|
+
(sum, item) => sum + item.price * item.qty,
|
|
23
|
+
0,
|
|
24
|
+
);
|
|
25
|
+
const coupon = await Coupon.findByCode(order.couponCode);
|
|
26
|
+
if (coupon && coupon.isValid) {
|
|
27
|
+
total = total * (1 - coupon.discountPct / 100);
|
|
28
|
+
}
|
|
29
|
+
total = total * 1.1; // tax
|
|
30
|
+
|
|
31
|
+
// send confirmation
|
|
32
|
+
await Email.send({
|
|
33
|
+
to: order.customerEmail,
|
|
34
|
+
subject: `Order ${orderId} confirmed`,
|
|
35
|
+
body: `Your total is $${total.toFixed(2)}`,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return { orderId, total };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// After — extracted functions, each with one responsibility
|
|
42
|
+
async function processOrder(orderId, userId) {
|
|
43
|
+
const order = await fetchAndAuthoriseOrder(orderId, userId);
|
|
44
|
+
const total = await calculateOrderTotal(order);
|
|
45
|
+
await sendOrderConfirmation(order, total);
|
|
46
|
+
return { orderId, total };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function fetchAndAuthoriseOrder(orderId, userId) {
|
|
50
|
+
const order = await Order.findById(orderId);
|
|
51
|
+
if (!order) throw new OrderNotFoundError(orderId);
|
|
52
|
+
if (order.userId !== userId) throw new ForbiddenError();
|
|
53
|
+
return order;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function calculateOrderTotal(order) {
|
|
57
|
+
const subtotal = order.lineItems.reduce(
|
|
58
|
+
(sum, item) => sum + item.price * item.qty,
|
|
59
|
+
0,
|
|
60
|
+
);
|
|
61
|
+
const discounted = await applyDiscount(subtotal, order.couponCode);
|
|
62
|
+
return discounted * 1.1; // apply tax
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Pattern 2: Replace Nested Conditionals with Guard Clauses
|
|
69
|
+
|
|
70
|
+
**When:** The happy path is deeply nested inside multiple if/else blocks; early exit conditions are buried.
|
|
71
|
+
|
|
72
|
+
**Signal:** Code looks like an arrow pointing right, with the main logic at the deepest indentation level.
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
// Before — arrow anti-pattern
|
|
76
|
+
function getShippingCost(order) {
|
|
77
|
+
if (order !== null) {
|
|
78
|
+
if (order.isEligible) {
|
|
79
|
+
if (order.total > 100) {
|
|
80
|
+
return 0; // free shipping
|
|
81
|
+
} else {
|
|
82
|
+
return 5.99;
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
return null; // not eligible
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// After — guard clauses; happy path last, exceptions first
|
|
93
|
+
function getShippingCost(order) {
|
|
94
|
+
if (!order) return null;
|
|
95
|
+
if (!order.isEligible) return null;
|
|
96
|
+
if (order.total > 100) return 0;
|
|
97
|
+
return 5.99;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Pattern 3: Extract Class (Single Responsibility)
|
|
104
|
+
|
|
105
|
+
**When:** A class has grown to handle multiple concerns; it is hard to describe what it does without using "and".
|
|
106
|
+
|
|
107
|
+
**Signal:** "This class manages users **and** sends emails **and** generates reports."
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
// Before — UserService doing too much
|
|
111
|
+
class UserService {
|
|
112
|
+
async createUser(data) {
|
|
113
|
+
/* create in DB */
|
|
114
|
+
}
|
|
115
|
+
async deleteUser(id) {
|
|
116
|
+
/* delete from DB */
|
|
117
|
+
}
|
|
118
|
+
async sendWelcomeEmail(user) {
|
|
119
|
+
/* call email provider */
|
|
120
|
+
}
|
|
121
|
+
async sendPasswordResetEmail(user) {
|
|
122
|
+
/* call email provider */
|
|
123
|
+
}
|
|
124
|
+
async generateMonthlyReport() {
|
|
125
|
+
/* query + format report */
|
|
126
|
+
}
|
|
127
|
+
async exportUsersCsv() {
|
|
128
|
+
/* query + format CSV */
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// After — separated by responsibility
|
|
133
|
+
class UserService {
|
|
134
|
+
async createUser(data) {
|
|
135
|
+
/* create in DB */
|
|
136
|
+
}
|
|
137
|
+
async deleteUser(id) {
|
|
138
|
+
/* delete from DB */
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
class UserEmailService {
|
|
143
|
+
async sendWelcomeEmail(user) {
|
|
144
|
+
/* call email provider */
|
|
145
|
+
}
|
|
146
|
+
async sendPasswordResetEmail(user) {
|
|
147
|
+
/* call email provider */
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
class UserReportService {
|
|
152
|
+
async generateMonthlyReport() {
|
|
153
|
+
/* query + format report */
|
|
154
|
+
}
|
|
155
|
+
async exportUsersCsv() {
|
|
156
|
+
/* query + format CSV */
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Pattern 4: Replace Magic Number/String with Named Constant
|
|
164
|
+
|
|
165
|
+
**When:** A numeric or string literal is used without explanation.
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
// Before
|
|
169
|
+
if (user.subscriptionTier === 3) {
|
|
170
|
+
applyDiscount(0.15);
|
|
171
|
+
}
|
|
172
|
+
setTimeout(retryRequest, 5000);
|
|
173
|
+
|
|
174
|
+
// After
|
|
175
|
+
const ENTERPRISE_TIER = 3;
|
|
176
|
+
const ENTERPRISE_DISCOUNT = 0.15;
|
|
177
|
+
const RETRY_DELAY_MS = 5_000;
|
|
178
|
+
|
|
179
|
+
if (user.subscriptionTier === ENTERPRISE_TIER) {
|
|
180
|
+
applyDiscount(ENTERPRISE_DISCOUNT);
|
|
181
|
+
}
|
|
182
|
+
setTimeout(retryRequest, RETRY_DELAY_MS);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Pattern 5: Introduce Parameter Object
|
|
188
|
+
|
|
189
|
+
**When:** A function takes more than 4 parameters, especially if several are related.
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
// Before
|
|
193
|
+
function createBooking(userId, roomId, checkIn, checkOut, guestCount, notes) {}
|
|
194
|
+
|
|
195
|
+
// After
|
|
196
|
+
function createBooking({
|
|
197
|
+
userId,
|
|
198
|
+
roomId,
|
|
199
|
+
checkIn,
|
|
200
|
+
checkOut,
|
|
201
|
+
guestCount,
|
|
202
|
+
notes,
|
|
203
|
+
}) {}
|
|
204
|
+
|
|
205
|
+
// Caller — reads like documentation
|
|
206
|
+
await createBooking({
|
|
207
|
+
userId: currentUser.id,
|
|
208
|
+
roomId: selectedRoom.id,
|
|
209
|
+
checkIn: dates.start,
|
|
210
|
+
checkOut: dates.end,
|
|
211
|
+
guestCount: form.guests,
|
|
212
|
+
notes: form.specialRequests,
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Pattern 6: Extract Variable
|
|
219
|
+
|
|
220
|
+
**When:** A complex expression is used inline; it's hard to understand what it computes.
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
// Before
|
|
224
|
+
if (
|
|
225
|
+
user.plan === "premium" &&
|
|
226
|
+
Date.now() - user.lastLoginMs < 86400000 &&
|
|
227
|
+
user.emailVerified
|
|
228
|
+
) {
|
|
229
|
+
showPremiumContent();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// After
|
|
233
|
+
const isPremium = user.plan === "premium";
|
|
234
|
+
const isActiveToday = Date.now() - user.lastLoginMs < ONE_DAY_MS;
|
|
235
|
+
const isVerified = user.emailVerified;
|
|
236
|
+
|
|
237
|
+
if (isPremium && isActiveToday && isVerified) {
|
|
238
|
+
showPremiumContent();
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Pattern 7: Consolidate Duplicate Code
|
|
245
|
+
|
|
246
|
+
**When:** The same logic appears in 2+ places (copy-paste code). Bugs get fixed in one place but not the other.
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
// Before — same validation in two places
|
|
250
|
+
// In user-controller.js:
|
|
251
|
+
if (!email || !email.includes("@")) throw new ValidationError("Invalid email");
|
|
252
|
+
|
|
253
|
+
// In admin-controller.js:
|
|
254
|
+
if (!email || !email.includes("@")) throw new ValidationError("Invalid email");
|
|
255
|
+
|
|
256
|
+
// After — extracted to a shared utility
|
|
257
|
+
// In utils/validation.js:
|
|
258
|
+
export function validateEmail(email) {
|
|
259
|
+
if (!email || !email.includes("@"))
|
|
260
|
+
throw new ValidationError("Invalid email");
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Both controllers import and use it
|
|
264
|
+
import { validateEmail } from "../utils/validation.js";
|
|
265
|
+
validateEmail(req.body.email);
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Pattern 8: Replace Inheritance with Composition
|
|
271
|
+
|
|
272
|
+
**When:** A subclass uses only a small fraction of the parent's interface, or "is-a" doesn't semantically make sense.
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
// Before — awkward inheritance
|
|
276
|
+
class Animal {
|
|
277
|
+
eat() {}
|
|
278
|
+
sleep() {}
|
|
279
|
+
fly() {} // not all animals fly
|
|
280
|
+
swim() {} // not all animals swim
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
class Dog extends Animal {
|
|
284
|
+
fly() {
|
|
285
|
+
throw new Error("Dogs can't fly");
|
|
286
|
+
} // Violates Liskov
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// After — composition with mixins or interfaces
|
|
290
|
+
class Dog {
|
|
291
|
+
constructor() {
|
|
292
|
+
this.locomotion = new GroundLocomotion(); // can run
|
|
293
|
+
this.feeding = new CarnivoreDiet();
|
|
294
|
+
}
|
|
295
|
+
move() {
|
|
296
|
+
return this.locomotion.move();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Pattern 9: Strangler Fig (incremental large-scale refactoring)
|
|
304
|
+
|
|
305
|
+
**When:** A large module or system needs a full redesign but can't be replaced all at once.
|
|
306
|
+
|
|
307
|
+
**Concept:** Build the new implementation alongside the old one; gradually route traffic to the new version until the old one can be deleted.
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
// Phase 1: new implementation exists but old one still runs
|
|
311
|
+
class LegacyPaymentProcessor {
|
|
312
|
+
/* old implementation */
|
|
313
|
+
}
|
|
314
|
+
class NewPaymentProcessor {
|
|
315
|
+
/* new implementation */
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Phase 2: add a feature flag / router
|
|
319
|
+
class PaymentProcessorAdapter {
|
|
320
|
+
constructor() {
|
|
321
|
+
this.legacy = new LegacyPaymentProcessor();
|
|
322
|
+
this.modern = new NewPaymentProcessor();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
async charge(amount, card) {
|
|
326
|
+
if (featureFlags.useNewPaymentProcessor) {
|
|
327
|
+
return this.modern.charge(amount, card);
|
|
328
|
+
}
|
|
329
|
+
return this.legacy.charge(amount, card);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Phase 3: once confidence is high, remove the legacy processor
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Pattern 10: Parallel Change (expand, migrate, contract)
|
|
339
|
+
|
|
340
|
+
**When:** Changing a function signature or data structure that has many callers — you need to migrate safely without breaking everything at once.
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
Step 1 — Expand: Add the new parameter alongside the old one
|
|
344
|
+
function getUser(id, options = {}) { ... }
|
|
345
|
+
|
|
346
|
+
Step 2 — Migrate: Update all callers to use the new signature
|
|
347
|
+
getUser(id, { includeProfile: true })
|
|
348
|
+
|
|
349
|
+
Step 3 — Contract: Remove the old parameter once all callers are updated
|
|
350
|
+
function getUser(id, options) { ... }
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Pattern 11: Dead Code Removal
|
|
356
|
+
|
|
357
|
+
**When:** Functions, variables, or branches are never reached.
|
|
358
|
+
|
|
359
|
+
**Detection:**
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Find unused exports (TypeScript)
|
|
363
|
+
npx ts-prune
|
|
364
|
+
|
|
365
|
+
# Find unused variables
|
|
366
|
+
eslint --rule 'no-unused-vars: error'
|
|
367
|
+
|
|
368
|
+
# Find unreachable code after return
|
|
369
|
+
# Most linters catch this; look for ESLint 'no-unreachable'
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Before removing:**
|
|
373
|
+
|
|
374
|
+
1. Confirm with a search: is this truly never called? (Dynamic calls, reflection, string interpolation can fool static analysis)
|
|
375
|
+
2. Check git history: was this disabled recently for a reason?
|
|
376
|
+
3. Check if it's used in tests only — that's still "used" but warrants a discussion
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Pattern 12: Replace if/else chain with lookup table
|
|
381
|
+
|
|
382
|
+
**When:** A long if/else or switch that maps values to actions or results.
|
|
383
|
+
|
|
384
|
+
```js
|
|
385
|
+
// Before — hard to extend, easy to miss a case
|
|
386
|
+
function getStatusLabel(status) {
|
|
387
|
+
if (status === "pending") return "Awaiting approval";
|
|
388
|
+
else if (status === "approved") return "Approved";
|
|
389
|
+
else if (status === "rejected") return "Rejected";
|
|
390
|
+
else if (status === "cancelled") return "Cancelled";
|
|
391
|
+
else return "Unknown";
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// After — lookup table; adding a new status is one line
|
|
395
|
+
const STATUS_LABELS = {
|
|
396
|
+
pending: "Awaiting approval",
|
|
397
|
+
approved: "Approved",
|
|
398
|
+
rejected: "Rejected",
|
|
399
|
+
cancelled: "Cancelled",
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
function getStatusLabel(status) {
|
|
403
|
+
return STATUS_LABELS[status] ?? "Unknown";
|
|
404
|
+
}
|
|
405
|
+
```
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Refactoring Safety Checks
|
|
2
|
+
|
|
3
|
+
**Load this when:** assessing the risk of a refactoring before starting, or verifying a refactoring is complete and safe to commit.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why safety matters
|
|
8
|
+
|
|
9
|
+
Refactoring without adequate safety measures creates two common failure modes:
|
|
10
|
+
|
|
11
|
+
1. **Behaviour changes silently** — the refactoring introduced a subtle difference (different error type, changed evaluation order, missing case) that wasn't caught
|
|
12
|
+
2. **Tests weren't sufficient** — tests passed, but they weren't testing the right thing; the regression only shows up in production
|
|
13
|
+
|
|
14
|
+
The checklists here mitigate both.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Pre-refactoring checklist
|
|
19
|
+
|
|
20
|
+
Work through this before touching any code.
|
|
21
|
+
|
|
22
|
+
### 1. Tests exist and pass
|
|
23
|
+
|
|
24
|
+
- [ ] There are tests for the code being refactored
|
|
25
|
+
- [ ] The tests are passing right now (before any change)
|
|
26
|
+
- [ ] The tests are in the correct layer (unit, integration) for the code being changed
|
|
27
|
+
- [ ] If tests don't exist: STOP — write characterisation tests first
|
|
28
|
+
|
|
29
|
+
**Minimum test coverage required before refactoring:**
|
|
30
|
+
|
|
31
|
+
- All public method happy paths
|
|
32
|
+
- At least one error/exception path
|
|
33
|
+
- Any code paths that will be structurally affected by the refactoring
|
|
34
|
+
|
|
35
|
+
### 2. Impact analysis
|
|
36
|
+
|
|
37
|
+
- [ ] I know which callers/consumers use the code being changed
|
|
38
|
+
- [ ] For functions: searched for all call sites with `grep -r "functionName"`
|
|
39
|
+
- [ ] For modules: searched for all imports with `grep -r "from './module'"`
|
|
40
|
+
- [ ] For types/interfaces: TypeScript compiler will catch violations; ESLint for JS
|
|
41
|
+
- [ ] For exported symbols: not used by external packages/consumers
|
|
42
|
+
|
|
43
|
+
### 3. Public API check
|
|
44
|
+
|
|
45
|
+
Is the code being changed part of a public API (consumed externally)?
|
|
46
|
+
|
|
47
|
+
| API type | Risk | Required action |
|
|
48
|
+
| -------------------- | --------- | ------------------------------------------- |
|
|
49
|
+
| Internal function | Low | Proceed with care |
|
|
50
|
+
| Public module export | Medium | Ensure same external interface is preserved |
|
|
51
|
+
| HTTP endpoint | High | Ensure same request/response schema |
|
|
52
|
+
| SDK / library API | Very high | Requires deprecation + major version bump |
|
|
53
|
+
| Database schema | High | Requires migration + backward compatibility |
|
|
54
|
+
|
|
55
|
+
If changing a public API: use **Parallel Change** pattern (expand → migrate → contract) rather than a direct replacement.
|
|
56
|
+
|
|
57
|
+
### 4. Scope check
|
|
58
|
+
|
|
59
|
+
- [ ] This refactoring does only ONE type of change (extract, rename, restructure — not all three)
|
|
60
|
+
- [ ] The change can be committed independently (doesn't depend on other uncommitted work)
|
|
61
|
+
- [ ] The change is not bundled with a feature addition or bug fix
|
|
62
|
+
|
|
63
|
+
If you find yourself doing more than one type of refactoring: split into separate commits.
|
|
64
|
+
|
|
65
|
+
### 5. Risk assessment
|
|
66
|
+
|
|
67
|
+
| Factor | Low risk | High risk |
|
|
68
|
+
| ------------------ | ---------------------------- | ------------------------------------------------------- |
|
|
69
|
+
| Code coverage | > 80% | < 40% |
|
|
70
|
+
| Callers | Few (< 5) | Many (> 20) |
|
|
71
|
+
| Code age | Recently written | Legacy, rarely touched |
|
|
72
|
+
| Code clarity | Easy to understand | Hard to understand (which is why you're refactoring it) |
|
|
73
|
+
| Team familiarity | Author or recent contributor | Nobody remembers writing it |
|
|
74
|
+
| Production traffic | Low | High (hot path) |
|
|
75
|
+
|
|
76
|
+
For high-risk refactoring: do it in a feature branch, get a review before merging.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Post-refactoring checklist
|
|
81
|
+
|
|
82
|
+
After every refactoring, confirm these before committing.
|
|
83
|
+
|
|
84
|
+
### 1. Behaviour preservation
|
|
85
|
+
|
|
86
|
+
- [ ] All existing tests pass with zero modifications to test expectations
|
|
87
|
+
- [ ] Any test that needed to change: verify it's because the test was wrong, not because behaviour changed
|
|
88
|
+
- [ ] No new linting errors introduced
|
|
89
|
+
|
|
90
|
+
**Red flags — investigate before proceeding:**
|
|
91
|
+
|
|
92
|
+
- A test now passes that was previously failing
|
|
93
|
+
- A test needed to be deleted (not just reorganised)
|
|
94
|
+
- A test expectation changed (not just the structure of the test)
|
|
95
|
+
|
|
96
|
+
### 2. Performance (for hot paths)
|
|
97
|
+
|
|
98
|
+
For code in a frequently-called code path:
|
|
99
|
+
|
|
100
|
+
- [ ] No new synchronous I/O introduced
|
|
101
|
+
- [ ] No N+1 query introduced (loop calling DB in each iteration)
|
|
102
|
+
- [ ] No algorithm complexity regression (O(n) → O(n²))
|
|
103
|
+
|
|
104
|
+
### 3. Error handling preserved
|
|
105
|
+
|
|
106
|
+
- [ ] Error types thrown are the same (callers may catch specific error types)
|
|
107
|
+
- [ ] Error messages still contain the same diagnostic information
|
|
108
|
+
- [ ] No errors are now silently swallowed that were previously propagated
|
|
109
|
+
|
|
110
|
+
### 4. Type correctness (TypeScript)
|
|
111
|
+
|
|
112
|
+
- [ ] `tsc --noEmit` runs clean (no new type errors)
|
|
113
|
+
- [ ] No `any` casts introduced to work around type issues
|
|
114
|
+
|
|
115
|
+
### 5. API contract preserved
|
|
116
|
+
|
|
117
|
+
If the refactoring touched an API handler:
|
|
118
|
+
|
|
119
|
+
- [ ] Request schema unchanged
|
|
120
|
+
- [ ] Response schema unchanged
|
|
121
|
+
- [ ] HTTP status codes unchanged
|
|
122
|
+
- [ ] Header behaviour unchanged
|
|
123
|
+
|
|
124
|
+
### 6. Commit quality
|
|
125
|
+
|
|
126
|
+
- [ ] Commit message describes the refactoring pattern: "refactor: extract calculateOrderTotal function"
|
|
127
|
+
- [ ] Commit contains only the refactoring (no feature changes mixed in)
|
|
128
|
+
- [ ] PR description explains what was refactored and why (technical debt? readability? preparation for a feature?)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Characterisation tests (when tests don't exist)
|
|
133
|
+
|
|
134
|
+
Before refactoring code with no tests, write **characterisation tests** — tests that document the current behaviour (even if that behaviour is wrong or ugly).
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
// Characterisation test — tests what the code DOES NOW,
|
|
138
|
+
// not necessarily what it SHOULD do
|
|
139
|
+
describe("LegacyPricingEngine.compute — characterisation", () => {
|
|
140
|
+
it("returns the price with tax for a standard product", () => {
|
|
141
|
+
const result = engine.compute({ sku: "PROD-1", qty: 2 });
|
|
142
|
+
// The exact value — not ideal, but documents current behaviour
|
|
143
|
+
expect(result.total).toBe(24.2);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("returns 0 for qty of 0", () => {
|
|
147
|
+
const result = engine.compute({ sku: "PROD-1", qty: 0 });
|
|
148
|
+
expect(result.total).toBe(0);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("throws for negative qty (current behaviour)", () => {
|
|
152
|
+
// This might be wrong behaviour, but we document it before changing
|
|
153
|
+
expect(() => engine.compute({ sku: "PROD-1", qty: -1 })).toThrow();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
These tests protect you from accidentally changing observable behaviour during the refactoring. After the refactoring, you can improve the tests to reflect what the code should do.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Rollback plan
|
|
163
|
+
|
|
164
|
+
For high-risk refactoring:
|
|
165
|
+
|
|
166
|
+
1. **Work in a branch** — you can discard without affecting main
|
|
167
|
+
2. **Small commits** — each step can be reverted independently
|
|
168
|
+
3. **Feature flag** — if refactoring a hot path, wrap with a flag to revert at runtime without a deploy
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
// Feature flag for refactoring rollback
|
|
172
|
+
const result = featureFlags.useRefactoredPricingEngine
|
|
173
|
+
? newPricingEngine.compute(params)
|
|
174
|
+
: legacyPricingEngine.compute(params);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Remove the flag once confidence is established (after a few days in production with monitoring).
|