oh-my-agent-commandcode 0.0.0-stage → 20.38.3
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/README.md +35 -2
- package/filter-test-output.sh +52 -0
- package/mods/oma.ts +347 -0
- package/package.json +30 -4
- package/skills/_shared/conditional/experiment-ledger.md +28 -0
- package/skills/_shared/conditional/exploration-loop.md +22 -0
- package/skills/_shared/conditional/quality-score.md +33 -0
- package/skills/_shared/core/anti-ai-prose.md +191 -0
- package/skills/_shared/core/api-contracts/README.md +28 -0
- package/skills/_shared/core/api-contracts/template.md +90 -0
- package/skills/_shared/core/clarification-protocol.md +23 -0
- package/skills/_shared/core/code-intelligence.md +46 -0
- package/skills/_shared/core/collaboration-policy.md +28 -0
- package/skills/_shared/core/common-checklist.md +28 -0
- package/skills/_shared/core/context-budget.md +22 -0
- package/skills/_shared/core/context-loading.md +34 -0
- package/skills/_shared/core/difficulty-guide.md +26 -0
- package/skills/_shared/core/execution-policy.md +31 -0
- package/skills/_shared/core/lessons-learned.md +33 -0
- package/skills/_shared/core/prompt-structure.md +18 -0
- package/skills/_shared/core/quality-principles.md +11 -0
- package/skills/_shared/core/session-metrics.md +35 -0
- package/skills/_shared/core/skill-routing.md +39 -0
- package/skills/_shared/core/test-approach.md +54 -0
- package/skills/_shared/core/vendor-detection.md +52 -0
- package/skills/_shared/runtime/memory-protocol.md +118 -0
- package/skills/_shared/runtime/result-contract.md +64 -0
- package/skills/_shared/ui-interaction-quality.md +133 -0
- package/skills/oma-academic-writing/SKILL.md +181 -0
- package/skills/oma-academic-writing/resources/abstract-guide.md +51 -0
- package/skills/oma-academic-writing/resources/academic-verb-tiers.md +42 -0
- package/skills/oma-academic-writing/resources/anti-ai-checklist.md +52 -0
- package/skills/oma-academic-writing/resources/hedging-guide.md +132 -0
- package/skills/oma-academic-writing/resources/sentence-structure-reference.md +151 -0
- package/skills/oma-architecture/SKILL.md +203 -0
- package/skills/oma-architecture/resources/api-evolution.md +41 -0
- package/skills/oma-architecture/resources/checklist.md +42 -0
- package/skills/oma-architecture/resources/execution-protocol.md +115 -0
- package/skills/oma-architecture/resources/methodology-selection.md +92 -0
- package/skills/oma-architecture/resources/migration-patterns.md +28 -0
- package/skills/oma-architecture/resources/output-templates.md +111 -0
- package/skills/oma-architecture/resources/stakeholder-synthesis.md +80 -0
- package/skills/oma-backend/SKILL.md +202 -0
- package/skills/oma-backend/resources/checklist.md +45 -0
- package/skills/oma-backend/resources/error-playbook.md +97 -0
- package/skills/oma-backend/resources/execution-protocol.md +39 -0
- package/skills/oma-backend/resources/orm-reference.md +61 -0
- package/skills/oma-backend/variants/node/api-template.ts +315 -0
- package/skills/oma-backend/variants/node/snippets.md +475 -0
- package/skills/oma-backend/variants/node/stack.yaml +21 -0
- package/skills/oma-backend/variants/node/tech-stack.md +33 -0
- package/skills/oma-backend/variants/python/api-template.py +378 -0
- package/skills/oma-backend/variants/python/snippets.md +199 -0
- package/skills/oma-backend/variants/python/stack.yaml +18 -0
- package/skills/oma-backend/variants/python/tech-stack.md +45 -0
- package/skills/oma-backend/variants/rust/api-template.rs +635 -0
- package/skills/oma-backend/variants/rust/snippets.md +471 -0
- package/skills/oma-backend/variants/rust/stack.yaml +20 -0
- package/skills/oma-backend/variants/rust/tech-stack.md +36 -0
- package/skills/oma-backend/variants/stack.schema.json +73 -0
- package/skills/oma-brainstorm/SKILL.md +166 -0
- package/skills/oma-brainstorm/resources/triz-lite.md +117 -0
- package/skills/oma-coordination/SKILL.md +171 -0
- package/skills/oma-db/SKILL.md +201 -0
- package/skills/oma-db/resources/anti-patterns.md +177 -0
- package/skills/oma-db/resources/checklist.md +67 -0
- package/skills/oma-db/resources/document-templates.md +107 -0
- package/skills/oma-db/resources/error-playbook.md +50 -0
- package/skills/oma-db/resources/examples.md +170 -0
- package/skills/oma-db/resources/execution-protocol.md +127 -0
- package/skills/oma-db/resources/iso-controls.md +98 -0
- package/skills/oma-db/resources/migration-playbook.md +93 -0
- package/skills/oma-db/resources/query-tuning.md +57 -0
- package/skills/oma-db/resources/vector-db.md +159 -0
- package/skills/oma-debug/SKILL.md +146 -0
- package/skills/oma-debug/resources/bug-report-template.md +327 -0
- package/skills/oma-debug/resources/checklist.md +31 -0
- package/skills/oma-debug/resources/common-patterns.md +734 -0
- package/skills/oma-debug/resources/debugging-checklist.md +364 -0
- package/skills/oma-debug/resources/error-playbook.md +94 -0
- package/skills/oma-debug/resources/execution-protocol.md +40 -0
- package/skills/oma-design/SKILL.md +135 -0
- package/skills/oma-design/resources/asset-strategy.md +34 -0
- package/skills/oma-design/resources/checklist.md +63 -0
- package/skills/oma-design/resources/data-grid.md +48 -0
- package/skills/oma-design/resources/design-md-spec.md +107 -0
- package/skills/oma-design/resources/design-tokens.md +53 -0
- package/skills/oma-design/resources/error-playbook.md +18 -0
- package/skills/oma-design/resources/execution-protocol.md +95 -0
- package/skills/oma-design/resources/external-design-skills.md +130 -0
- package/skills/oma-design/resources/getdesign-fetcher.md +104 -0
- package/skills/oma-design/resources/product-interface-review.md +59 -0
- package/skills/oma-design/resources/redesign-protocol.md +52 -0
- package/skills/oma-design/resources/stitch-integration.md +244 -0
- package/skills/oma-dev-workflow/SKILL.md +375 -0
- package/skills/oma-dev-workflow/resources/affected-checks.py +58 -0
- package/skills/oma-dev-workflow/resources/api-workflows.md +58 -0
- package/skills/oma-dev-workflow/resources/database-patterns.md +107 -0
- package/skills/oma-dev-workflow/resources/i18n-patterns.md +63 -0
- package/skills/oma-dev-workflow/resources/release-coordination.md +240 -0
- package/skills/oma-dev-workflow/resources/tooling-profiles.md +217 -0
- package/skills/oma-dev-workflow/resources/troubleshooting.md +78 -0
- package/skills/oma-dev-workflow/resources/validation-pipeline.md +246 -0
- package/skills/oma-docs/SKILL.md +77 -0
- package/skills/oma-docs/resources/commands.md +76 -0
- package/skills/oma-explanation/SKILL.md +212 -0
- package/skills/oma-explanation/resources/document-structure.md +115 -0
- package/skills/oma-explanation/resources/draft-format.md +199 -0
- package/skills/oma-explanation/resources/html-contract.md +102 -0
- package/skills/oma-frontend/SKILL.md +227 -0
- package/skills/oma-frontend/resources/angular-rules.md +110 -0
- package/skills/oma-frontend/resources/checklist.md +76 -0
- package/skills/oma-frontend/resources/error-playbook.md +125 -0
- package/skills/oma-frontend/resources/execution-protocol.md +46 -0
- package/skills/oma-frontend/resources/snippets.md +354 -0
- package/skills/oma-frontend/resources/specialized-visual-implementation.md +193 -0
- package/skills/oma-frontend/resources/tailwind-rules.md +83 -0
- package/skills/oma-frontend/resources/tech-stack.md +156 -0
- package/skills/oma-hwp/SKILL.md +166 -0
- package/skills/oma-hwp/config/hwp-config.yaml +35 -0
- package/skills/oma-hwp/resources/balanced-tables.ts +39 -0
- package/skills/oma-hwp/resources/execution-protocol.md +145 -0
- package/skills/oma-hwp/resources/flatten-tables.ts +101 -0
- package/skills/oma-hwp/resources/package.json +13 -0
- package/skills/oma-hwp/resources/troubleshooting.md +70 -0
- package/skills/oma-hwp/resources/tsconfig.json +10 -0
- package/skills/oma-hwp/resources/turndown-plugin-gfm.d.ts +9 -0
- package/skills/oma-image/SKILL.md +142 -0
- package/skills/oma-image/config/image-config.yaml +70 -0
- package/skills/oma-image/resources/checklist.md +18 -0
- package/skills/oma-image/resources/execution-protocol.md +117 -0
- package/skills/oma-image/resources/invocation.md +105 -0
- package/skills/oma-image/resources/prompt-tips.md +71 -0
- package/skills/oma-image/resources/vendor-matrix.md +90 -0
- package/skills/oma-market/SKILL.md +142 -0
- package/skills/oma-market/resources/checklist.md +12 -0
- package/skills/oma-market/resources/error-playbook.md +12 -0
- package/skills/oma-market/resources/execution-protocol.md +60 -0
- package/skills/oma-market/resources/frameworks/pestel.md +101 -0
- package/skills/oma-market/resources/frameworks/porters-5f.md +90 -0
- package/skills/oma-market/resources/frameworks/swot.md +61 -0
- package/skills/oma-market/resources/intent-rules.md +35 -0
- package/skills/oma-market/resources/output-laws.md +53 -0
- package/skills/oma-mobile/SKILL.md +168 -0
- package/skills/oma-mobile/resources/checklist.md +77 -0
- package/skills/oma-mobile/resources/error-playbook.md +198 -0
- package/skills/oma-mobile/resources/execution-protocol.md +47 -0
- package/skills/oma-mobile/resources/screen-template.dart +331 -0
- package/skills/oma-mobile/resources/screen-template.swift +239 -0
- package/skills/oma-mobile/resources/screen-template.tsx +179 -0
- package/skills/oma-mobile/resources/tech-stack.md +69 -0
- package/skills/oma-mobile/variants/README.md +45 -0
- package/skills/oma-mobile/variants/flutter/api-template.dart +461 -0
- package/skills/oma-mobile/variants/flutter/snippets.md +1353 -0
- package/skills/oma-mobile/variants/flutter/stack.yaml +21 -0
- package/skills/oma-mobile/variants/flutter/tech-stack.md +201 -0
- package/skills/oma-mobile/variants/kotlin-android/api-template.kt +182 -0
- package/skills/oma-mobile/variants/kotlin-android/snippets.md +871 -0
- package/skills/oma-mobile/variants/kotlin-android/stack.yaml +32 -0
- package/skills/oma-mobile/variants/kotlin-android/tech-stack.md +159 -0
- package/skills/oma-mobile/variants/react-native/api-template.ts +531 -0
- package/skills/oma-mobile/variants/react-native/snippets.md +1014 -0
- package/skills/oma-mobile/variants/react-native/stack.yaml +22 -0
- package/skills/oma-mobile/variants/react-native/tech-stack.md +192 -0
- package/skills/oma-mobile/variants/stack.schema.json +68 -0
- package/skills/oma-mobile/variants/swift-ios/api-template.swift +165 -0
- package/skills/oma-mobile/variants/swift-ios/snippets.md +1028 -0
- package/skills/oma-mobile/variants/swift-ios/stack.yaml +25 -0
- package/skills/oma-mobile/variants/swift-ios/tech-stack.md +174 -0
- package/skills/oma-observability/SKILL.md +225 -0
- package/skills/oma-observability/resources/anti-patterns.md +555 -0
- package/skills/oma-observability/resources/boundaries/cross-application.md +348 -0
- package/skills/oma-observability/resources/boundaries/multi-tenant.md +290 -0
- package/skills/oma-observability/resources/boundaries/release.md +372 -0
- package/skills/oma-observability/resources/boundaries/slo.md +225 -0
- package/skills/oma-observability/resources/checklist.md +123 -0
- package/skills/oma-observability/resources/examples.md +448 -0
- package/skills/oma-observability/resources/execution-protocol.md +166 -0
- package/skills/oma-observability/resources/incident-forensics.md +348 -0
- package/skills/oma-observability/resources/intent-rules.md +307 -0
- package/skills/oma-observability/resources/layers/L3-network.md +281 -0
- package/skills/oma-observability/resources/layers/L4-transport.md +299 -0
- package/skills/oma-observability/resources/layers/L7-application/crash-analytics.md +359 -0
- package/skills/oma-observability/resources/layers/L7-application/mobile-rum.md +278 -0
- package/skills/oma-observability/resources/layers/L7-application/waf.md +246 -0
- package/skills/oma-observability/resources/layers/L7-application/web-rum.md +350 -0
- package/skills/oma-observability/resources/layers/mesh.md +368 -0
- package/skills/oma-observability/resources/matrix.md +177 -0
- package/skills/oma-observability/resources/meta-observability.md +605 -0
- package/skills/oma-observability/resources/observability-as-code.md +666 -0
- package/skills/oma-observability/resources/signals/audit.md +310 -0
- package/skills/oma-observability/resources/signals/cost.md +303 -0
- package/skills/oma-observability/resources/signals/logs.md +263 -0
- package/skills/oma-observability/resources/signals/metrics.md +478 -0
- package/skills/oma-observability/resources/signals/privacy.md +351 -0
- package/skills/oma-observability/resources/signals/profiles.md +245 -0
- package/skills/oma-observability/resources/signals/traces.md +360 -0
- package/skills/oma-observability/resources/standards.md +214 -0
- package/skills/oma-observability/resources/transport/collector-topology.md +308 -0
- package/skills/oma-observability/resources/transport/otlp-grpc-vs-http.md +256 -0
- package/skills/oma-observability/resources/transport/sampling-recipes.md +297 -0
- package/skills/oma-observability/resources/transport/udp-statsd-mtu.md +167 -0
- package/skills/oma-observability/resources/vendor-categories.md +352 -0
- package/skills/oma-orchestration/SKILL.md +302 -0
- package/skills/oma-orchestration/config/cli-config.yaml +92 -0
- package/skills/oma-orchestration/resources/memory-schema.md +232 -0
- package/skills/oma-orchestration/resources/subagent-prompt-template.md +30 -0
- package/skills/oma-orchestration/scripts/parallel-run.sh +6 -0
- package/skills/oma-orchestration/scripts/spawn-agent.sh +5 -0
- package/skills/oma-orchestration/scripts/verify.sh +20 -0
- package/skills/oma-orchestration/templates/backend-task.md +19 -0
- package/skills/oma-orchestration/templates/debug-task.md +16 -0
- package/skills/oma-orchestration/templates/frontend-task.md +18 -0
- package/skills/oma-orchestration/templates/mobile-task.md +18 -0
- package/skills/oma-orchestration/templates/qa-task.md +16 -0
- package/skills/oma-orchestration/templates/tasks-example.yaml +15 -0
- package/skills/oma-pdf/SKILL.md +162 -0
- package/skills/oma-pdf/config/pdf-config.yaml +27 -0
- package/skills/oma-pdf/resources/execution-protocol.md +127 -0
- package/skills/oma-pm/SKILL.md +157 -0
- package/skills/oma-pm/resources/error-playbook.md +75 -0
- package/skills/oma-pm/resources/examples.md +439 -0
- package/skills/oma-pm/resources/execution-protocol.md +62 -0
- package/skills/oma-pm/resources/iso-planning.md +110 -0
- package/skills/oma-pm/resources/plan-phase-protocol.md +66 -0
- package/skills/oma-pm/resources/task-template.json +86 -0
- package/skills/oma-qa/SKILL.md +141 -0
- package/skills/oma-qa/resources/checklist.md +339 -0
- package/skills/oma-qa/resources/error-playbook.md +98 -0
- package/skills/oma-qa/resources/execution-protocol.md +169 -0
- package/skills/oma-qa/resources/iso-quality.md +82 -0
- package/skills/oma-qa/resources/verify-ship-protocol.md +116 -0
- package/skills/oma-recap/SKILL.md +245 -0
- package/skills/oma-recap/resources/output-formats.md +83 -0
- package/skills/oma-refactor/SKILL.md +184 -0
- package/skills/oma-refactor/resources/definition.md +108 -0
- package/skills/oma-refactor/resources/governance.md +33 -0
- package/skills/oma-refactor/resources/hotspots.py +44 -0
- package/skills/oma-refactor/resources/measurement.md +93 -0
- package/skills/oma-scholar/SKILL.md +276 -0
- package/skills/oma-scholar/config/scholar-config.yaml +79 -0
- package/skills/oma-scholar/resources/api-endpoints.md +174 -0
- package/skills/oma-scholar/resources/checklist.md +92 -0
- package/skills/oma-scholar/resources/execution-protocol.md +224 -0
- package/skills/oma-scholar/resources/fallback-providers.md +143 -0
- package/skills/oma-scholar/resources/setup-openalex.md +85 -0
- package/skills/oma-scholar/resources/sidecar-spec.md +341 -0
- package/skills/oma-scholar/resources/upstream-spec-cache.md +972 -0
- package/skills/oma-scm/SKILL.md +103 -0
- package/skills/oma-scm/resources/cm-operations.md +56 -0
- package/skills/oma-scm/resources/codeowners-playbook.md +45 -0
- package/skills/oma-scm/resources/conventional-commits.md +108 -0
- package/skills/oma-scm/resources/merge-risk.md +76 -0
- package/skills/oma-scm/resources/onboarding-risk-signals.md +71 -0
- package/skills/oma-search/SKILL.md +125 -0
- package/skills/oma-search/resources/checklist.md +36 -0
- package/skills/oma-search/resources/error-playbook.md +66 -0
- package/skills/oma-search/resources/examples.md +80 -0
- package/skills/oma-search/resources/execution-protocol.md +86 -0
- package/skills/oma-search/resources/intent-rules.md +47 -0
- package/skills/oma-search/resources/trust-registry.md +53 -0
- package/skills/oma-security/SKILL.md +172 -0
- package/skills/oma-security/resources/artex.md +108 -0
- package/skills/oma-security/resources/ci.md +134 -0
- package/skills/oma-security/resources/cisco-source.md +108 -0
- package/skills/oma-security/resources/deepsec-config.md +45 -0
- package/skills/oma-security/resources/deepsec-matchers.md +35 -0
- package/skills/oma-security/resources/deepsec-scanning.md +45 -0
- package/skills/oma-security/resources/deepsec-setup.md +41 -0
- package/skills/oma-security/resources/findings-contract.md +408 -0
- package/skills/oma-security/resources/mcp-scanning.md +122 -0
- package/skills/oma-security/resources/skill-scanning.md +106 -0
- package/skills/oma-security/resources/validation.md +71 -0
- package/skills/oma-skill-creation/SKILL.md +84 -0
- package/skills/oma-skill-creation/resources/prompt-evaluation.md +36 -0
- package/skills/oma-skill-creation/resources/ssl-lite-template.md +108 -0
- package/skills/oma-skill-creation/resources/validation-checklist.md +101 -0
- package/skills/oma-slide/SKILL.md +277 -0
- package/skills/oma-slide/resources/animation-patterns.md +245 -0
- package/skills/oma-slide/resources/assets/deck-stage.js +514 -0
- package/skills/oma-slide/resources/assets/viewport-base.css +257 -0
- package/skills/oma-slide/resources/canva-integration.md +203 -0
- package/skills/oma-slide/resources/checklist.md +46 -0
- package/skills/oma-slide/resources/design-doctrine.md +260 -0
- package/skills/oma-slide/resources/fixed-stage.md +232 -0
- package/skills/oma-slide/resources/generation-protocol.md +393 -0
- package/skills/oma-slide/resources/native-pptx.md +84 -0
- package/skills/oma-slide/resources/selection-index.json +461 -0
- package/skills/oma-slide/resources/style-presets.LICENSE +10 -0
- package/skills/oma-slide/resources/style-presets.md +520 -0
- package/skills/oma-tf-infra/SKILL.md +201 -0
- package/skills/oma-tf-infra/resources/checklist.md +53 -0
- package/skills/oma-tf-infra/resources/cost-optimization.md +574 -0
- package/skills/oma-tf-infra/resources/error-playbook.md +68 -0
- package/skills/oma-tf-infra/resources/examples.md +38 -0
- package/skills/oma-tf-infra/resources/execution-protocol.md +129 -0
- package/skills/oma-tf-infra/resources/iso-42001-infra.md +229 -0
- package/skills/oma-tf-infra/resources/multi-cloud-examples.md +241 -0
- package/skills/oma-tf-infra/resources/policy-testing-examples.md +332 -0
- package/skills/oma-translation/SKILL.md +229 -0
- package/skills/oma-translation/resources/anti-ai-patterns.md +104 -0
- package/skills/oma-translation/resources/lang/_template.md +73 -0
- package/skills/oma-translation/resources/lang/en.md +123 -0
- package/skills/oma-translation/resources/lang/ja.md +274 -0
- package/skills/oma-translation/resources/lang/ko.md +228 -0
- package/skills/oma-translation/resources/lang/zh.md +285 -0
- package/skills/oma-translation/resources/style-skills.md +104 -0
- package/skills/oma-translation/resources/translation-rubric.md +126 -0
- package/skills/oma-video/SKILL.md +229 -0
- package/skills/oma-video/config/video-config.yaml +60 -0
- package/skills/oma-video/resources/checklist.md +26 -0
- package/skills/oma-video/resources/execution-protocol.md +122 -0
- package/skills/oma-video/resources/existing-media.md +185 -0
- package/skills/oma-video/resources/hyperframes-authoring/README.md +44 -0
- package/skills/oma-video/resources/hyperframes-authoring/demo.md +31 -0
- package/skills/oma-video/resources/hyperframes-authoring/explainer.md +10 -0
- package/skills/oma-video/resources/hyperframes-authoring/shorts.md +10 -0
- package/skills/oma-video/resources/motion-principles.md +81 -0
- package/skills/oma-video/resources/mpt/driver.py +301 -0
- package/skills/oma-video/resources/prompt-tips.md +75 -0
- package/skills/oma-video/resources/script-schema.md +81 -0
- package/skills/oma-video/resources/sound-design.md +127 -0
- package/skills/oma-video/resources/strudel/package.json +11 -0
- package/skills/oma-video/resources/strudel/page.html +87 -0
- package/skills/oma-video/resources/strudel/render.mjs +295 -0
- package/skills/oma-video/resources/vendor-matrix.md +124 -0
- package/skills/oma-voice/SKILL.md +249 -0
- package/skills/oma-voice/config/voice-config.yaml +30 -0
- package/skills/oma-voice/resources/audio-processing.md +119 -0
- package/skills/oma-voice/resources/checklist.md +47 -0
- package/skills/oma-voice/resources/execution-protocol.md +215 -0
- package/skills/oma-voice/resources/prompt-tips.md +43 -0
- package/skills/oma-voice/resources/voice-matrix.md +51 -0
- package/skills/oma-voice/resources/voicestudio.md +87 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Recap Output Format Templates
|
|
2
|
+
|
|
3
|
+
Markdown templates for the recap files written to `.agents/results/recap/`.
|
|
4
|
+
Response language follows the user's prompt language first, then the `language` setting in `.agents/oma-config.yaml`, then English.
|
|
5
|
+
|
|
6
|
+
## Daily format (1d or specific date)
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## {date} Recap
|
|
10
|
+
|
|
11
|
+
> **TL;DR**
|
|
12
|
+
> - {Completed outcome, only with completion evidence}
|
|
13
|
+
> - {In-progress or requested work, labelled with its status when completion is unproven}
|
|
14
|
+
> - {Another supported outcome or status}
|
|
15
|
+
|
|
16
|
+
### Overview
|
|
17
|
+
2-3 sentence summary of the day. Written from "I did X" perspective.
|
|
18
|
+
Distinguish requested, in-progress, and completed work. A prompt by itself is a request; an
|
|
19
|
+
explicit result, receipt, or artifact supports completion. Focus on outcomes and progress, not
|
|
20
|
+
tool ratios or technical details.
|
|
21
|
+
|
|
22
|
+
### {Theme 1} (AM 09:36~11:30)
|
|
23
|
+
- Core work performed
|
|
24
|
+
- Key decisions
|
|
25
|
+
- 2-4 bullets per theme
|
|
26
|
+
|
|
27
|
+
### {Theme 2} (PM 13:33~15:21)
|
|
28
|
+
- Core work performed
|
|
29
|
+
- Key decisions
|
|
30
|
+
|
|
31
|
+
### Miscellaneous
|
|
32
|
+
- Brief summary of sub-15-minute tasks
|
|
33
|
+
|
|
34
|
+
### Tool Usage Patterns
|
|
35
|
+
- Tool usage ratios and primary purposes
|
|
36
|
+
- Notable tool-switching patterns
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Multi-day format (3d, 7d, 2w, 30d)
|
|
40
|
+
|
|
41
|
+
For any multi-day window, use a **project-driven structure** like a sprint report.
|
|
42
|
+
Focus on what was accomplished per project, not day-by-day chronology.
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## {start} ~ {end} Recap
|
|
46
|
+
|
|
47
|
+
> **TL;DR**
|
|
48
|
+
> - {Completed outcome, only with completion evidence}
|
|
49
|
+
> - {In-progress or requested work, labelled with its status when completion is unproven}
|
|
50
|
+
> - {Another supported outcome or status}
|
|
51
|
+
|
|
52
|
+
### Overview
|
|
53
|
+
3-5 sentence narrative of the period. Major focus shifts across the window,
|
|
54
|
+
key milestones achieved, and overall direction. Written from "I did X" perspective.
|
|
55
|
+
|
|
56
|
+
### {Project A}
|
|
57
|
+
What this project is, with requested, in-progress, and completed work distinguished by evidence.
|
|
58
|
+
- Key milestone or deliverable 1
|
|
59
|
+
- Key milestone or deliverable 2
|
|
60
|
+
- Key decision made
|
|
61
|
+
- Current status (shipped / in progress / blocked)
|
|
62
|
+
|
|
63
|
+
### {Project B}
|
|
64
|
+
- ...
|
|
65
|
+
|
|
66
|
+
### Side Projects
|
|
67
|
+
Projects with <30 prompts, summarized briefly.
|
|
68
|
+
- {project}: one-line summary
|
|
69
|
+
- {project}: one-line summary
|
|
70
|
+
|
|
71
|
+
### Tool Usage Patterns
|
|
72
|
+
- Tool usage ratios and how they evolved over the period
|
|
73
|
+
- Notable shifts (e.g., "started using Codex midway through the period")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Multi-day grouping rules
|
|
77
|
+
|
|
78
|
+
- Group by **project**, not by date
|
|
79
|
+
- Order projects by activity volume (most active first)
|
|
80
|
+
- Each project section: what it is, supported outcomes, key decisions, and current status
|
|
81
|
+
- Do NOT include prompt counts or date ranges in project headers (those are internal metrics)
|
|
82
|
+
- Small projects (<30 prompts) go into "Side Projects" as one-liners
|
|
83
|
+
- Overview should read like a sprint report narrative, not a log
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oma-refactor
|
|
3
|
+
description: Restructure existing code while preserving observable behavior. Use
|
|
4
|
+
for targeted technical debt or hotspot work with characterization tests.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Refactor Agent - Behavior-Preserving Restructuring Specialist
|
|
8
|
+
|
|
9
|
+
## Scheduling
|
|
10
|
+
|
|
11
|
+
### Goal
|
|
12
|
+
Improve internal code structure - readability first - without changing observable behavior, through small verified transformations, each gated by a safety net (tests / tooling / types) and committed separately from any behavior change.
|
|
13
|
+
|
|
14
|
+
### Intent signature
|
|
15
|
+
- User asks to refactor, clean up, restructure, modernize, de-duplicate, or "make this code maintainable/readable".
|
|
16
|
+
- User mentions code smells, technical debt, legacy code, long methods/files, god classes, hotspots, characterization tests, or extract/move/rename transformations.
|
|
17
|
+
- User asks "where should we refactor first?" or wants a refactoring plan/priority for a codebase.
|
|
18
|
+
|
|
19
|
+
### When to use
|
|
20
|
+
- Executing a refactoring on specific files/modules (extract, move, rename, decompose, pattern/idiom alignment)
|
|
21
|
+
- Preparatory refactoring before a feature ("make the change easy, then make the easy change")
|
|
22
|
+
- Legacy (brownfield) rescue: seam discovery + characterization tests, then restructuring
|
|
23
|
+
- Refactoring target selection and prioritization (smells + SATD + hotspot = churn x complexity)
|
|
24
|
+
- Auditing whether code is safe to refactor now (coverage breadth x mutation strength x flakiness)
|
|
25
|
+
|
|
26
|
+
### When NOT to use
|
|
27
|
+
- Adding or completing behavior already requested by the user -> use the appropriate existing implementation skill; classify the scope under Entry first.
|
|
28
|
+
- Fixing a reported bug or failing behavior -> use `oma-debug` (refactoring must not change behavior)
|
|
29
|
+
- Security/performance/accessibility review or quality audit -> use `oma-qa`
|
|
30
|
+
- System design, module boundary decisions, ADRs, convention changes -> use `oma-architecture` (a convention/pattern change is an architecture decision, not a local refactoring)
|
|
31
|
+
- DB schema design or migration mechanics -> use `oma-db` (this skill only plans the expand-contract sequence)
|
|
32
|
+
- Commit splitting / staging mechanics -> use `oma-scm`
|
|
33
|
+
- Performance optimization as a goal -> out of scope by definition (tuning is a side effect, never the objective)
|
|
34
|
+
|
|
35
|
+
### Expected inputs
|
|
36
|
+
- `target`: file/module/path, smell report, SATD marker, or the feature request motivating preparatory refactoring
|
|
37
|
+
- `verification`: existing project test command(s); coverage/mutation tooling if already available
|
|
38
|
+
- `constraints`: coding guide / conventions, regulated-environment flags, merge-window concerns
|
|
39
|
+
- Optional: prior metric reports, hotspot data, ADRs touching the target area
|
|
40
|
+
|
|
41
|
+
### Expected outputs
|
|
42
|
+
- Refactored code as a sequence of atomic, refactor-only commits (no test changes mixed in)
|
|
43
|
+
- Safety-net additions when missing (characterization / golden-master tests) as separate commits
|
|
44
|
+
- Before/after report: metric delta (cyclomatic/cognitive complexity, size, coupling) + readability verdict
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
outputs:
|
|
48
|
+
- name: report
|
|
49
|
+
description: refactoring plan or before/after report
|
|
50
|
+
artifact: ".agents/results/refactor/*.md"
|
|
51
|
+
required: false
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Standalone runs write plan / before-after reports under `.agents/results/refactor/`; orchestrated runs (via the `refactor-engineer` agent) write `.agents/results/result-refactor[-{sessionId}].md` per the agent execution protocol.
|
|
55
|
+
|
|
56
|
+
### Dependencies
|
|
57
|
+
- `resources/definition.md` (invariant definition: 5 properties, boundaries, destination principle, naming roles, inline evidence)
|
|
58
|
+
- `resources/measurement.md` (4-layer measurement + git forensics commands)
|
|
59
|
+
- `resources/governance.md` (optional organization conventions and existing verification tools)
|
|
60
|
+
- Configured code-intelligence symbol/reference tools; existing project test runners for the target language
|
|
61
|
+
- Git history for churn/ownership/hotspot analysis
|
|
62
|
+
|
|
63
|
+
### Control-flow features
|
|
64
|
+
- Branches by safety-net state (greenfield vs brownfield), statefulness (code-only vs expand-contract), and verification outcome (pass vs Mikado revert)
|
|
65
|
+
- Reads code/history/metrics; writes code, tests (in separate commits), and reports
|
|
66
|
+
- Stops and routes to `oma-architecture` when the change requires a convention/boundary decision
|
|
67
|
+
|
|
68
|
+
## Structural Flow
|
|
69
|
+
|
|
70
|
+
### Entry
|
|
71
|
+
1. Classify the requested outcome against the actual target code, not the word "refactor" alone. Behavior-preserving restructuring stays here. Implementation or bug fixing already included in the request continues under the appropriate existing implementation skill or `oma-debug`, within existing authorization and without renewed approval. For mixed requests, separate behavior changes from restructuring and apply this skill only to the latter.
|
|
72
|
+
2. For the refactoring scope, establish its motivation and diagnose the safety net: coverage of changed lines, test determinism (flakiness), mutation strength if measurable.
|
|
73
|
+
3. Identify the destination form: the language idiom and codebase convention the result must match.
|
|
74
|
+
|
|
75
|
+
Missing or stub code does not itself authorize new behavior. A pure refactor with
|
|
76
|
+
no implementation to restructure reports the missing target rather than inventing
|
|
77
|
+
one. If a contract fact needed for correctness remains unknown after checking
|
|
78
|
+
available task and project evidence, ask for that specific fact under the shared
|
|
79
|
+
execution policy and clarification protocol. Distinguish missing
|
|
80
|
+
information from missing authorization: retain existing permission, pause only
|
|
81
|
+
dependent work, and continue independent authorized work.
|
|
82
|
+
|
|
83
|
+
### Scenes
|
|
84
|
+
1. **PREPARE**: Within the refactoring scope, classify greenfield (safety net exists) vs brownfield (build net first); check size gates and hotspot rank; confirm two-hats scope (no feature/bug work mixed in).
|
|
85
|
+
2. **ACQUIRE**: Read target code via symbol tools; collect metrics (complexity, size, coupling) and git signals (churn, ownership); read the coding guide for conventions.
|
|
86
|
+
3. **REASON**: Decompose the goal into a sequence of named atomic transformations; for stateful targets plan expand-contract; verify each step is independently verifiable and revertible.
|
|
87
|
+
4. **ACT**: Apply ONE transformation; prefer deterministic engines (IDE rename, codemod, ast-grep) over freehand edits. When one feature spans several files after a split, consider G-5's optional header map if it helps navigation.
|
|
88
|
+
5. **VERIFY**: Re-run existing tests unchanged. Pass -> commit (refactor-only) -> next transformation. Repeated failure -> Mikado: record the broken prerequisite, undo only this transformation's edits, recurse on the prerequisite first. Preserve pre-existing edits and other contributors' work.
|
|
89
|
+
6. **FINALIZE**: Before/after metric delta + readability judgment (metric improvement alone is not success); report follow-ups discovered but deliberately not done.
|
|
90
|
+
|
|
91
|
+
### Transitions
|
|
92
|
+
- If the safety net is missing or weak (low diff coverage, flaky, no assertions), write characterization / golden-master tests FIRST, committed separately, before touching production code.
|
|
93
|
+
- If verification fails repeatedly, switch to the Mikado method: never carry a half-broken tree forward.
|
|
94
|
+
- If the right fix is a convention or pattern change (new dialect), stop and route to `oma-architecture` for an ADR + ratchet plan.
|
|
95
|
+
- If the target involves persisted state or external consumers, plan expand-contract (parallel change) with feature flags; deployment, not commit, becomes the unit of incrementality.
|
|
96
|
+
- If a behavior bug is discovered mid-refactoring, record it and route to `oma-debug`; do not fix it in the refactor commit.
|
|
97
|
+
- If the work is large enough to collide with teammates' branches, recommend announcement + short merge window; register bulk mechanical commits in `.git-blame-ignore-revs`.
|
|
98
|
+
|
|
99
|
+
### Failure and recovery
|
|
100
|
+
| Failure | Recovery |
|
|
101
|
+
|---------|----------|
|
|
102
|
+
| Tests fail after a transformation | Mikado: record prerequisite, undo only this transformation's edits, preserve unrelated work, attack prerequisite first |
|
|
103
|
+
| No tests and code is untestable | Find a seam; apply only minimal mechanical changes to inject test access, then characterize |
|
|
104
|
+
| Tests are flaky | Fix or quarantine flaky tests before refactoring - an unreliable net is no net |
|
|
105
|
+
| Metric improves but readability worsens | Reject the transformation; readability is the success criterion, metrics are proxies |
|
|
106
|
+
| Scope keeps growing | Stop; report the boundary issue and split into a Mikado graph or route to architecture |
|
|
107
|
+
| Refactoring engine/codemod produces wrong output | Engines are not infallible - tests re-run is mandatory; fall back to manual atomic edits |
|
|
108
|
+
|
|
109
|
+
### Exit
|
|
110
|
+
- Success: behavior verified unchanged, structure measurably improved, readability confirmed, refactor-only commits, follow-ups reported.
|
|
111
|
+
- Partial success: safety net built but restructuring deferred; or prerequisites mapped (Mikado graph) with explicit blockers.
|
|
112
|
+
- Handoff: already-requested implementation or bug fixing continues under its owning skill's completion criteria; changing skills is not a task failure.
|
|
113
|
+
- Blocked or failed: report the exact missing contract, verification path, or required decision and the dependent work it prevents, plus independent work completed. A pure refactor with no target reports that limit without inventing behavior.
|
|
114
|
+
|
|
115
|
+
## Logical Operations
|
|
116
|
+
|
|
117
|
+
### Actions
|
|
118
|
+
| Action | SSL primitive | Evidence |
|
|
119
|
+
|--------|---------------|----------|
|
|
120
|
+
| Diagnose safety net | `VALIDATE` | Coverage/flakiness/mutation state of target scope |
|
|
121
|
+
| Collect signals | `READ` | Metrics, git churn/ownership, smells, SATD |
|
|
122
|
+
| Rank targets | `COMPARE` | Hotspot = complexity x churn |
|
|
123
|
+
| Plan atomic sequence | `INFER` | Named transformations, Mikado graph |
|
|
124
|
+
| Write characterization tests | `WRITE` | Golden-master/snapshot tests (separate commit) |
|
|
125
|
+
| Apply transformation | `WRITE` / `CALL_TOOL` | One atomic refactor, engine-first |
|
|
126
|
+
| Verify preservation | `VALIDATE` | Existing tests re-run unchanged |
|
|
127
|
+
| Commit separately | `UPDATE_STATE` | `refactor:`-typed commits only |
|
|
128
|
+
| Report delta | `NOTIFY` | Metric + readability before/after |
|
|
129
|
+
|
|
130
|
+
### Tools and instruments
|
|
131
|
+
- Configured code intelligence for symbol/reference/pattern impact analysis; an available semantic rename engine for renames. Native inspection remains valid, but do not replace a semantic rename with blind text replacement
|
|
132
|
+
- Deterministic transformers: IDE refactoring actions, codemods (jscodeshift / OpenRewrite / ast-grep / comby)
|
|
133
|
+
- Metrics: use already installed complexity tools such as lizard / radon and existing project lint limits; installing or downloading additional tools requires authorization
|
|
134
|
+
- Test stack: preserve the project runner and configuration; use mutation tooling only when available and appropriate (see `resources/governance.md`)
|
|
135
|
+
- Git forensics one-liners (see `resources/measurement.md`)
|
|
136
|
+
|
|
137
|
+
### Canonical workflow path
|
|
138
|
+
1. Apply Entry's scope routing first. For the remaining refactoring scope, run coverage and check test determinism; classify green/brownfield.
|
|
139
|
+
2. If brownfield: find a seam, write characterization (golden-master) tests for CURRENT behavior, commit.
|
|
140
|
+
3. Select targets by hotspot rank (complexity x churn), not by smell aesthetics alone.
|
|
141
|
+
4. Plan a sequence of named atomic transformations toward the language-idiomatic, convention-conforming form.
|
|
142
|
+
5. Loop per transformation: apply (engine-first) -> re-run tests UNCHANGED -> commit `refactor:` only.
|
|
143
|
+
On repeated failure: record prerequisite, undo only this transformation's edits,
|
|
144
|
+
preserve pre-existing and concurrent work, recurse (Mikado).
|
|
145
|
+
6. Finish: metric delta + readability verdict; list discovered-but-deferred work; never mix in behavior changes.
|
|
146
|
+
|
|
147
|
+
### Resource scope
|
|
148
|
+
| Scope | Resource target |
|
|
149
|
+
|-------|-----------------|
|
|
150
|
+
| `CODEBASE` | Target source, tests, coding guide, lint configs |
|
|
151
|
+
| `LOCAL_FS` | Reports under `.agents/results/refactor/`, `.git-blame-ignore-revs` |
|
|
152
|
+
| `PROCESS` | Test runners, coverage/mutation tools, codemod engines, git log analysis |
|
|
153
|
+
| `MEMORY` | Mikado prerequisite graph, deferred follow-ups, metric baselines |
|
|
154
|
+
|
|
155
|
+
### Preconditions
|
|
156
|
+
- A verification path exists or can be built (tests/types/tooling); otherwise the first deliverable is the safety net, not restructuring.
|
|
157
|
+
- The target's conventions are known (coding guide read) or explicitly absent.
|
|
158
|
+
|
|
159
|
+
### Effects and side effects
|
|
160
|
+
- Mutates production code (structure only) and adds tests in separate commits.
|
|
161
|
+
- Runs test/coverage/mutation commands; reads git history.
|
|
162
|
+
- May write reports under `.agents/results/refactor/` and entries to `.git-blame-ignore-revs`.
|
|
163
|
+
- Never alters observable behavior, public contracts, or persisted data without an expand-contract plan.
|
|
164
|
+
|
|
165
|
+
### Guardrails
|
|
166
|
+
1. **Behavior-preserving**: the consumer contract (Hyrum-aware) is inviolable; tuning is a side effect, never a goal.
|
|
167
|
+
2. **Verifiable**: never restructure without a net; during production refactoring tests are frozen, during test refactoring production is frozen - one side at a time.
|
|
168
|
+
3. **Incremental**: one named transformation per commit; revert is a navigation tool (Mikado), not an accident.
|
|
169
|
+
4. **Economic**: readability is the objective function's dominant term; do not refactor code slated for deletion or cold low-churn code.
|
|
170
|
+
5. **Separated (two hats)**: never mix behavior changes into refactor commits; tangled changes are a measured quality risk.
|
|
171
|
+
6. Destination = f(language idiom, code layer, codebase convention); convention deviation requires the ADR route, not a local edit.
|
|
172
|
+
7. Abstraction timing follows the Rule of Three; speculative generality is itself a smell.
|
|
173
|
+
8. All metrics are proxies (Goodhart): a 499-line mechanical split, assertion-free coverage, or pattern-count gains are failures, not wins.
|
|
174
|
+
|
|
175
|
+
## References
|
|
176
|
+
- Local code tools: `../_shared/core/code-intelligence.md` (code search/navigation)
|
|
177
|
+
- Authorization and contract ambiguity: `../_shared/core/execution-policy.md` and `../_shared/core/clarification-protocol.md` (when clarification or authorization is needed)
|
|
178
|
+
|
|
179
|
+
- Invariant definition (5 properties, boundaries, destination, naming roles, contexts, D&C, inline evidence): `resources/definition.md`
|
|
180
|
+
- Measurement: 4 layers + git forensics commands: `resources/measurement.md`
|
|
181
|
+
- Optional organization conventions and existing verification tools: `resources/governance.md`
|
|
182
|
+
- Context loading: `../_shared/core/context-loading.md`
|
|
183
|
+
- Quality principles: `../_shared/core/quality-principles.md`
|
|
184
|
+
- Adjacent skills: `oma-debug` (bugs), `oma-qa` (audits), `oma-architecture` (boundaries/ADR), `oma-db` (schema), `oma-scm` (commits)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Refactoring - Invariant Definition
|
|
2
|
+
|
|
3
|
+
Use `governance.md` for organization-specific parameters.
|
|
4
|
+
|
|
5
|
+
## Core definition
|
|
6
|
+
|
|
7
|
+
Refactoring is the act of improving a system's internal structure toward its codebase's conventional form - without changing externally observable behavior (the contract its consumers depend on) - through small, revertible, named transformations whose behavior preservation is mechanically verifiable, in order to lower the future cost of change, whose dominant term is human comprehension cost.
|
|
8
|
+
|
|
9
|
+
## The five mandatory properties
|
|
10
|
+
|
|
11
|
+
If any property is missing, the activity is not refactoring.
|
|
12
|
+
|
|
13
|
+
| # | Property | Meaning | Without it |
|
|
14
|
+
|---|----------|---------|------------|
|
|
15
|
+
| 1 | Behavior-preserving | Consumer contract unchanged | Feature change / redesign |
|
|
16
|
+
| 2 | Verifiable | Preservation guaranteed by tests/tools/types | Risky edit |
|
|
17
|
+
| 3 | Incremental | Composition of small named transformations | Rewrite |
|
|
18
|
+
| 4 | Economically motivated | Lowers future change cost (~= comprehension cost) | Vanity polishing |
|
|
19
|
+
| 5 | Separated | Never mixed with behavior changes in a commit | Unreviewable tangle |
|
|
20
|
+
|
|
21
|
+
### 1. Behavior preservation - the boundary is contractual, not technical
|
|
22
|
+
- Preserved: input/output equivalence, public interface semantics, the *meaning* of side effects (records written, events emitted).
|
|
23
|
+
- Not preserved: internal call order, private structure, stack-trace shape.
|
|
24
|
+
- Gray zone (performance, log format, serialization): judged by **Hyrum's Law** - if someone actually depends on it, it is part of the contract.
|
|
25
|
+
- Performance (tuning) is allowed only as a side effect, never as the goal. If performance is contractual (SLA, real-time), preserve it too.
|
|
26
|
+
- Preservation is necessary but not sufficient: behavior can be preserved while readability worsens - that is a failed refactoring. (Empirical: LLM refactorings preserved behavior ~84% yet worsened readability in ~71% of cases while static metrics improved.)
|
|
27
|
+
|
|
28
|
+
### 2. Verifiability - the precondition
|
|
29
|
+
Guarantee mechanisms: (a) test suite - tests are FROZEN during refactoring; a failing test means behavior changed; (b) deterministic tool transformations - engines have bugs too (refactoring-engine bug studies exist), so re-run tests anyway; (c) type system / compiler; (d) differential testing and semantic equivalence checking (e.g., execution-driven differential testers, equivalence checkers).
|
|
30
|
+
- Symmetry rule: refactor production with tests frozen; refactor tests with production frozen. One side at a time.
|
|
31
|
+
- "Test failed = behavior changed" holds only for deterministic tests. Flaky tests destroy the signal itself.
|
|
32
|
+
- When no net exists: write **characterization tests** (pin CURRENT behavior, bugs included - Hyrum). Practical form: golden-master / approval / snapshot tests.
|
|
33
|
+
|
|
34
|
+
### 3. Incrementality - an open catalog
|
|
35
|
+
Composition of named transformations (Extract Function, Move Method, Rename, ...). Small enough to verify instantly, revert instantly, and review confidently. The standard catalog names only a fraction of real-world behavior-preserving changes (detector studies explain ~20% of real changesets with the standard catalog alone) - the test is the five properties, not catalog membership. Compound refactorings are where automated agents fail most; decompose to atomic steps.
|
|
36
|
+
|
|
37
|
+
### 4. Economics - readability is the dominant term
|
|
38
|
+
`change cost = comprehension cost + ripple cost + verification cost`. Most developer time goes to comprehension, so readability (analysability) is the primary objective; coupling-driven ripple radius (modifiability) is the second, independent lever.
|
|
39
|
+
- Cognitive grounding: refactoring removes extraneous cognitive load; working-memory limits (chunking) justify small units; naming is the largest readability lever no metric measures.
|
|
40
|
+
- Debt vocabulary: Cunningham's debt metaphor is a communication device for non-engineers (interest = ongoing cost, principal = structural flaw). Fowler's quadrants (deliberate x prudent) split the prescription: prudent-deliberate debt is a repayment-planning problem; reckless-inadvertent debt is an education problem.
|
|
41
|
+
|
|
42
|
+
### 5. Separation - two hats
|
|
43
|
+
Never wear the feature hat and the refactoring hat simultaneously; mixed (tangled) commits make preservation unreviewable and are a measured quality risk (tangled refactorings in agent patches significantly reduce compilability). This is why `refactor` is a distinct commit type. Separation governs commits, not budgets - preparatory refactoring embedded in feature work is part of that feature's cost.
|
|
44
|
+
|
|
45
|
+
## What refactoring is NOT
|
|
46
|
+
Bug fixing (intentional behavior change) / performance optimization (different goal, often anti-readability) / feature addition / rewrite (wholesale replacement without stepwise verification) / API-breaking change (= redesign/migration). Lifecycle home: ISO/IEC/IEEE 14764 perfective/preventive maintenance. Edge case: cross-language migration can satisfy all five properties but is conventionally named "migration".
|
|
47
|
+
|
|
48
|
+
## When NOT to refactor
|
|
49
|
+
- Code about to be deleted or replaced (zero economics)
|
|
50
|
+
- Cold, low-churn stable code (touching it is pure risk)
|
|
51
|
+
- Right before a release (risk asymmetry: gains are future, risk is now)
|
|
52
|
+
- Without a safety net (build the net first)
|
|
53
|
+
- Know the risk: a fraction of refactorings induce defects and security regressions (both empirically documented); the five properties reduce risk, they do not zero it.
|
|
54
|
+
- Rewrite is right only when incremental-migration total cost exceeds rewrite + full re-verification cost (include feature-freeze cost and second-system risk in the comparison).
|
|
55
|
+
|
|
56
|
+
## Triggers
|
|
57
|
+
- Code smells (qualitative heuristics: duplication, Long Method - long *body*, god class, Feature Envy, Shotgun Surgery, Speculative Generality): signals that change cost is rising, not defects.
|
|
58
|
+
- SATD (self-admitted technical debt): TODO/HACK/FIXME in comments/issues - a third signal independent of structure and history. Do not let the *tone* of the admission drive priority (negativity measurably skews developer prioritization even though most consider it wrong).
|
|
59
|
+
|
|
60
|
+
## Destination - one principle, three axes
|
|
61
|
+
**Reusability = context independence.** Every pattern is a named technique for severing one kind of context dependency (Strategy: host vs algorithm; Facade: consumer vs subsystem internals; Adapter: new context vs existing interface; DI: unit vs dependency construction). Pure functions reduce implicit context dependencies.
|
|
62
|
+
|
|
63
|
+
**Pattern choice = f(language expressiveness, code layer, codebase convention):**
|
|
64
|
+
- Language axis: patterns compensate for what the language cannot express (Norvig: most GoF patterns evaporate into idioms). The destination is the language's idiom, not a GoF diagram.
|
|
65
|
+
- Layer axis: functional core vs imperative shell call for different forms and different test economics.
|
|
66
|
+
- Convention axis: in brownfield, the coding guide and framework conventions beat "theoretically better" patterns - consistency is a component of analysability. Changing a convention is an architecture decision (ADR + lint ratchet for new code + module-wise migration), never a boy-scout edit.
|
|
67
|
+
- Timing: Rule of Three - abstract after reuse evidence accumulates; speculative generality is a smell.
|
|
68
|
+
|
|
69
|
+
## Naming - operationalizing the unmeasured lever
|
|
70
|
+
|
|
71
|
+
Rename is the only core transformation with no metric gate; its gate is qualitative: does the new name reveal the entity's **role** and **domain meaning** to the next reader? For variables, Sajaniemi's role taxonomy makes that question checkable (11 roles cover ~99% of variables in procedural/OO code): first identify the role, then verify the name exposes it.
|
|
72
|
+
|
|
73
|
+
| Role | Behavior | Naming cue |
|
|
74
|
+
|------|----------|-----------|
|
|
75
|
+
| Fixed value | Set once, read thereafter | `maxRetries`, `basePath` |
|
|
76
|
+
| Stepper | Walks a predictable succession | `attempt`, `pageIndex` |
|
|
77
|
+
| Flag | Two-state signal controlling flow | `isStale`, `hasOverflow` |
|
|
78
|
+
| Walker | Traverses a data structure | `cursor`, `currentNode` |
|
|
79
|
+
| Most-recent holder | Latest value seen so far | `lastError`, `currentLine` |
|
|
80
|
+
| Most-wanted holder | Best value found so far | `closestMatch`, `maxSoFar` |
|
|
81
|
+
| Gatherer | Accumulates across values | `total`, `mergedDiff` |
|
|
82
|
+
| Container | Elements enter and leave | `pendingJobs`, `seenIds` |
|
|
83
|
+
| Follower | Previous value of another variable | `prevNode` |
|
|
84
|
+
| Organizer | Holds data being rearranged | `sortedCopy` |
|
|
85
|
+
| Temporary | Held briefly (swap/reuse) | `tmp` - acceptable ONLY in this role |
|
|
86
|
+
|
|
87
|
+
Rename discipline:
|
|
88
|
+
- Generic names (`data`, `result`, `temp`, `value`) outside the temporary role fail the role check; lying names (name promises X, body does Y) outrank them as targets.
|
|
89
|
+
- One variable, one role: a variable that switches roles mid-scope is a **Split Variable** trigger, not a rename target.
|
|
90
|
+
- Functions are named for intent (what), not mechanism (how); command = verb, query = noun/predicate.
|
|
91
|
+
- Renames are engine-executed (LSP/IDE rename or a configured provider’s semantic rename tool), never find-replace; tests re-run regardless.
|
|
92
|
+
- Goodhart applies here too: role vocabulary diagnoses; the terminal check is still "does the next reader understand this cheaper".
|
|
93
|
+
|
|
94
|
+
## Execution contexts
|
|
95
|
+
- **Greenfield**: refactoring is the third beat of TDD (Red -> Green -> Refactor) - minute-scale hygiene, net already exists.
|
|
96
|
+
- **Brownfield**: order inverts - find a seam (minimal mechanical change to enable testing) -> characterization tests -> restructure. Large scale: Strangler Fig, Branch by Abstraction, Sprout Method - the system stays working at every point. The classification is per code fragment (coverage map), not per project.
|
|
97
|
+
- **Stateful (data/API)**: git revert does not restore data. Mechanism: **Expand-Contract (parallel change)** - expand (old+new coexist) -> dual-write + backfill -> switch reads -> contract (remove old); feature flags are the standard switch. External consumers: semver + deprecation cycles as a staged contract-transfer protocol; the pattern vocabulary for that staging (Version Identifier, Two in Production, Aggressive Obsolescence, Limited Lifetime Guarantee - MAP evolution patterns, Zimmermann et al.) lives with `oma-architecture` (`resources/api-evolution.md`) - a published-contract change is an architecture decision, route there for the ADR.
|
|
98
|
+
- **Team concurrency**: big renames collide with every open branch - another reason for "small and frequent". Announce large refactorings + short merge windows; register bulk mechanical commits in `.git-blame-ignore-revs`; LSC (monorepo-wide atomic change + owner-split review) is incrementality at org scale.
|
|
99
|
+
- **Regulated environments**: even behavior-preserving changes trigger re-verification/re-certification - economics invert; batch-per-release refactoring is the one legitimate exception to "continuous flow".
|
|
100
|
+
|
|
101
|
+
## Architectural principle - refactoring enables divide and conquer
|
|
102
|
+
Functional core / imperative shell: pure-core unit tests cost ~0 and assert maximally -> "every step gets a unit test" is the rational default there; the shell gets few integration/contract tests. The test pyramid is D&C's verification form (unit = conquer, contract/integration = combine, E2E = divide). "All units pass therefore the system works" is the composition fallacy. Expensive, mock-heavy unit tests diagnose a failed decomposition - i.e., a refactoring target. Reusability and testability are the same coin: a test is the code's second consumption context.
|
|
103
|
+
|
|
104
|
+
## Goodhart - every metric is a proxy
|
|
105
|
+
Complexity targets -> mechanical splits; coverage KPIs -> assertion-free tests; size gates -> boundary-dodging splits; pattern counts -> speculative generality; git metrics -> commit-habit gaming; SATD tone -> priority distortion. Metrics diagnose; they do not replace qualitative judgment on what they cannot see (bad names, wrong abstraction level, missing domain concepts). The only terminal criterion: **can the next person understand and change this code more cheaply?**
|
|
106
|
+
|
|
107
|
+
## Standards anchors
|
|
108
|
+
ISO/IEC 25010 (maintainability - analysability is the standard vocabulary for the readability thesis) | ISO/IEC/IEEE 14764 (perfective/preventive) | ISO/IEC 25023, 5055 (automated measures) | ISO/IEC/IEEE 29119-4 (test design techniques, coverage criteria incl. MC/DC) | ISO 26262 / DO-178C (risk-tiered coverage; re-certification implications) | ISO/IEC 25051 (successor of withdrawn 12119). Standards are anchors for the doctrine, not its content.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Refactor Governance
|
|
2
|
+
|
|
3
|
+
Use the target project's documented conventions. These examples do not create
|
|
4
|
+
organization policy or change the authority of repository instructions.
|
|
5
|
+
|
|
6
|
+
## G-1. Budget
|
|
7
|
+
Use an agreed refactoring budget when the organization has one. A small scoped
|
|
8
|
+
refactor does not require introducing a capacity floor or measurement platform.
|
|
9
|
+
|
|
10
|
+
## G-2. Budget usage
|
|
11
|
+
Distinguish preparatory work required by a feature from separately planned debt
|
|
12
|
+
repayment when the project tracks those costs.
|
|
13
|
+
|
|
14
|
+
## G-3. Outcomes
|
|
15
|
+
Use measured delivery, reliability and maintenance outcomes to adjust an adopted
|
|
16
|
+
budget in either direction. Do not infer fixed cost percentages without evidence.
|
|
17
|
+
|
|
18
|
+
## G-4. Metrics
|
|
19
|
+
Select work by observed change difficulty and defects. Metrics support decisions;
|
|
20
|
+
they do not require splitting code or spending a fixed quota.
|
|
21
|
+
|
|
22
|
+
## G-5. File size
|
|
23
|
+
Follow an existing size gate if present. File length is a review signal; split by
|
|
24
|
+
responsibility when that improves navigation and coupling. Do not add a 500-line
|
|
25
|
+
CI gate or demand an ADR for an unrelated scoped edit. For a useful split map,
|
|
26
|
+
keep a short entry-file comment listing related paths and roles current.
|
|
27
|
+
|
|
28
|
+
## G-6. Test tools
|
|
29
|
+
Use the repository's existing test runner and coverage commands, including Jest,
|
|
30
|
+
Vitest, unittest, pytest, XCTest, Swift Testing, cargo test, or go test as applicable.
|
|
31
|
+
An unlisted language does not block refactoring or require an ADR. Add coverage or
|
|
32
|
+
mutation instrumentation only when relevant to the task and available in the
|
|
33
|
+
project; a runner migration is separate work.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Join Git churn and installed lizard output without interpreting file names."""
|
|
3
|
+
import argparse
|
|
4
|
+
from collections import Counter
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
|
|
9
|
+
def churn(repo, since="1 year ago"):
|
|
10
|
+
prefix = ["git", "-C", str(repo)]
|
|
11
|
+
commits = subprocess.run(prefix + ["log", "--format=%H", f"--since={since}"],
|
|
12
|
+
check=True, capture_output=True, text=True).stdout.splitlines()
|
|
13
|
+
counts = Counter()
|
|
14
|
+
for commit in commits:
|
|
15
|
+
result = subprocess.run(prefix + ["diff-tree", "--root", "--no-commit-id",
|
|
16
|
+
"--name-only", "--no-renames", "-r", "-z", commit],
|
|
17
|
+
check=True, capture_output=True)
|
|
18
|
+
counts.update(p.decode("utf-8", "surrogateescape")
|
|
19
|
+
for p in result.stdout.split(b"\0") if p)
|
|
20
|
+
return counts
|
|
21
|
+
|
|
22
|
+
def measure(repo, relative_path, tool):
|
|
23
|
+
path = (repo / relative_path).resolve()
|
|
24
|
+
if not path.is_relative_to(repo.resolve()) or not path.is_file():
|
|
25
|
+
return None
|
|
26
|
+
# An absolute path is one argv entry, including spaces/newlines/$()/leading '-'.
|
|
27
|
+
return subprocess.run([tool, "-C", "999", str(path)],
|
|
28
|
+
check=True, capture_output=True, text=True).stdout
|
|
29
|
+
|
|
30
|
+
def main():
|
|
31
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
32
|
+
parser.add_argument("--repo", type=Path, default=Path.cwd())
|
|
33
|
+
parser.add_argument("--limit", type=int, default=30)
|
|
34
|
+
args = parser.parse_args()
|
|
35
|
+
tool = shutil.which("lizard")
|
|
36
|
+
if not tool:
|
|
37
|
+
parser.error("lizard is not installed; report that measurement is unavailable")
|
|
38
|
+
for path, count in churn(args.repo).most_common(args.limit):
|
|
39
|
+
output = measure(args.repo, path, tool)
|
|
40
|
+
if output is not None:
|
|
41
|
+
print(f"changes={count} path={path!r}\n{output}")
|
|
42
|
+
|
|
43
|
+
if __name__ == "__main__":
|
|
44
|
+
main()
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Measurement - Four Layers + Commands
|
|
2
|
+
|
|
3
|
+
> Operationalizes target selection and effect verification. All values are diagnostic proxies (Goodhart) - never evaluation KPIs.
|
|
4
|
+
|
|
5
|
+
## Layer 1 - Static structure: "where change is hard"
|
|
6
|
+
|
|
7
|
+
| Metric | Reading | Thresholds |
|
|
8
|
+
|--------|---------|-----------|
|
|
9
|
+
| McCabe V(G) = E - N + 2P (~ branch points + 1) | Number of independent paths; not a branch-coverage minimum | <=10 ok / 11-20 caution / 21-50 high risk / 50+ investigate risk |
|
|
10
|
+
| Cognitive Complexity | Human reading difficulty (nesting-weighted) | Primary indicator for the readability objective |
|
|
11
|
+
| CK suite (CBO, LCOM, WMC) | Coupling/cohesion at class/module boundary | Triggers for Move/Extract Class |
|
|
12
|
+
| Duplication % | Token/AST clone ratio | Duplicate Code smell, quantified |
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Use installed project tools; uvx can download packages and is not install-free.
|
|
16
|
+
# Python
|
|
17
|
+
radon cc -s -a <path> # cyclomatic
|
|
18
|
+
lizard <path> # multi-language CC + NLOC + params
|
|
19
|
+
# Any language with lizard support
|
|
20
|
+
uvx lizard -l <lang> --CCN 10 <path>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Layer 2 - Git forensics: "where change actually happens"
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# High-churn files (exclude lock/generated noise)
|
|
27
|
+
git log --format=format: --name-only --since="1 year ago" \
|
|
28
|
+
| grep -vE '(^$|lock|generated|\.snap|\.min\.)' | sort | uniq -c | sort -nr | head -20
|
|
29
|
+
|
|
30
|
+
# Bug hotspots (message-quality dependent; approximate is still useful)
|
|
31
|
+
git log -i -E --grep="fix|bug|broken" --name-only --format='' \
|
|
32
|
+
| grep -v '^$' | sort | uniq -c | sort -nr | head -20
|
|
33
|
+
|
|
34
|
+
# Ownership / bus factor (squash merges distort this)
|
|
35
|
+
git shortlog -sn --no-merges
|
|
36
|
+
|
|
37
|
+
# Velocity trend (interpret as trend only, never absolute)
|
|
38
|
+
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c
|
|
39
|
+
|
|
40
|
+
# Firefighting signal (safety-net trust diagnosis)
|
|
41
|
+
git log --oneline --since="1 year ago" | grep -icE 'revert|hotfix|emergency|rollback'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Corrections: use `--follow` for single-file rename history; register bulk mechanical commits in `.git-blame-ignore-revs`; squash merges flatten authorship.
|
|
45
|
+
|
|
46
|
+
**+ SATD signal** (admitted debt, independent of structure and history):
|
|
47
|
+
|
|
48
|
+
Use the configured code provider's content search for `TODO|FIXME|HACK|XXX`
|
|
49
|
+
within source files. Count findings per file without bypassing the project's code
|
|
50
|
+
search policy. Treat self-admitted debt as a signal, not a required refactor.
|
|
51
|
+
|
|
52
|
+
## Layer 3 - Hotspot: "what to fix first"
|
|
53
|
+
|
|
54
|
+
`hotspot = complexity (L1) x change frequency (L2)` - the quantified form of the economic property and the budget's spending rank.
|
|
55
|
+
|
|
56
|
+
Use [hotspots.py](hotspots.py) from the repository root with an already-installed
|
|
57
|
+
`lizard`. The helper preserves Git paths using NUL delimiters and passes each path
|
|
58
|
+
as a subprocess argument. It never interpolates a filename into shell code or
|
|
59
|
+
installs a measurement tool.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python3 <skill-directory>/resources/hotspots.py --repo . --limit 30
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If lizard is unavailable, report that measurement gap rather than downloading it
|
|
66
|
+
as part of a scoped refactor.
|
|
67
|
+
|
|
68
|
+
## Layer 4 - Safety-net instrumentation: "where refactoring is safe NOW"
|
|
69
|
+
|
|
70
|
+
`net = breadth x strength x reliability` - if any factor is zero, there is no net.
|
|
71
|
+
|
|
72
|
+
| Dimension | Metric | Notes |
|
|
73
|
+
|-----------|--------|-------|
|
|
74
|
+
| Breadth | Coverage (statement < branch < condition < MC/DC) | Coverage measures *executed*, not *verified*. Prefer diff coverage gates over global targets |
|
|
75
|
+
| Strength | Mutation score (PIT / StrykerJS / mutmut) | The true measure of "will the net catch a behavior change" |
|
|
76
|
+
| Reliability | Flakiness rate | Non-deterministic tests destroy the "failure = behavior changed" signal; fix or quarantine first |
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Per-registry commands (see governance.md for the registry)
|
|
80
|
+
vitest run --coverage # TS/JS breadth
|
|
81
|
+
stryker run # TS/JS strength
|
|
82
|
+
pytest --cov=<pkg> --cov-report=term-missing
|
|
83
|
+
mutmut run # Python strength
|
|
84
|
+
flutter test --coverage # Dart breadth (strength gap: compensate with assertion review)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Tier by layer: dense unit tests on the pure core, few integration/contract tests on the shell, MC/DC only for safety-critical modules.
|
|
88
|
+
|
|
89
|
+
When the net is missing, LLM-assisted test generation is viable for seeding characterization suites - prefer approaches guided by coverage or mutation feedback, and review generated assertions manually (generation quality is bounded by the feedback signal).
|
|
90
|
+
|
|
91
|
+
## Outcome accounting (org level)
|
|
92
|
+
|
|
93
|
+
Budget effectiveness closes with DORA: deployment frequency, change lead time, change failure rate, MTTR. Investment hypothesis: structural improvement -> lead time down + change failure rate down. Review budget consumption alongside DORA trends quarterly; Layer-2 signals are proxies, DORA is the outcome.
|