shmakk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/package.json +6 -3
- package/scripts/import-skills.js +536 -0
- package/scripts/install-skills.js +64 -0
- package/skills/ai-elements.md +482 -0
- package/skills/architecture.md +151 -0
- package/skills/backend-adapter-aws-lambda.md +204 -0
- package/skills/backend-adapter-express.md +177 -0
- package/skills/backend-adapter-fastify.md +222 -0
- package/skills/backend-adapter-fetch.md +200 -0
- package/skills/backend-api-docs.md +22 -0
- package/skills/backend-aspire.md +232 -0
- package/skills/backend-aspnet-core.md +62 -0
- package/skills/backend-build-chatgpt-app.md +321 -0
- package/skills/backend-build-mcp-app.md +393 -0
- package/skills/backend-build-mcp-server.md +222 -0
- package/skills/backend-build-mcpb.md +200 -0
- package/skills/backend-building-ai-agent-on-cloudflare.md +401 -0
- package/skills/backend-caching.md +206 -0
- package/skills/backend-chatgpt-app-submission.md +157 -0
- package/skills/backend-chatgpt-apps.md +321 -0
- package/skills/backend-client-setup.md +318 -0
- package/skills/backend-containerize-aspnet-framework.md +455 -0
- package/skills/backend-create-spring-boot-java-project.md +164 -0
- package/skills/backend-create-spring-boot-kotlin-project.md +148 -0
- package/skills/backend-csharp-async.md +50 -0
- package/skills/backend-csharp-docs.md +63 -0
- package/skills/backend-csharp-mcp-server-generator.md +60 -0
- package/skills/backend-dotenv.md +201 -0
- package/skills/backend-dotenvx.md +119 -0
- package/skills/backend-env-vars.md +259 -0
- package/skills/backend-error-handling.md +254 -0
- package/skills/backend-fastapi.md +437 -0
- package/skills/backend-go-mcp-server-generator.md +335 -0
- package/skills/backend-java-mcp-server-generator.md +757 -0
- package/skills/backend-kotlin-mcp-server-generator.md +450 -0
- package/skills/backend-middlewares.md +243 -0
- package/skills/backend-multi-stage-dockerfile.md +47 -0
- package/skills/backend-nestjs.md +192 -0
- package/skills/backend-next-forge.md +375 -0
- package/skills/backend-nextjs.md +746 -0
- package/skills/backend-openapi-to-application-code.md +113 -0
- package/skills/backend-php-mcp-server-generator.md +523 -0
- package/skills/backend-python-mcp-server-generator.md +106 -0
- package/skills/backend-routing-middleware.md +251 -0
- package/skills/backend-ruby-mcp-server-generator.md +661 -0
- package/skills/backend-rust-mcp-server-generator.md +578 -0
- package/skills/backend-semantic-kernel.md +57 -0
- package/skills/backend-server-setup.md +379 -0
- package/skills/backend-server-side-calls.md +250 -0
- package/skills/backend-subscriptions.md +407 -0
- package/skills/backend-swift-mcp-server-generator.md +670 -0
- package/skills/backend-trpc-router.md +152 -0
- package/skills/backend-typescript-mcp-server-generator.md +91 -0
- package/skills/backend-validators.md +229 -0
- package/skills/backend.md +76 -0
- package/skills/backup.md +165 -0
- package/skills/budget.md +140 -0
- package/skills/business-gtm-0-to-1-launch.md +322 -0
- package/skills/business-gtm-operating-cadence.md +421 -0
- package/skills/business-gtm-positioning-strategy.md +439 -0
- package/skills/business-gtm-product-led-growth.md +340 -0
- package/skills/calendar.md +95 -0
- package/skills/code-review.md +130 -0
- package/skills/compliance.md +168 -0
- package/skills/contracts.md +130 -0
- package/skills/daily-job-run.md +46 -0
- package/skills/daily-webdesign.md +187 -0
- package/skills/database-bigquery-pipeline-audit.md +130 -0
- package/skills/database-cosmosdb-datamodeling.md +1046 -0
- package/skills/database-durable-objects.md +187 -0
- package/skills/database-ef-core.md +76 -0
- package/skills/database-fabric-lakehouse.md +107 -0
- package/skills/database-neon-postgres-egress-optimizer.md +213 -0
- package/skills/database-neon-postgres.md +218 -0
- package/skills/database-postgresql-code-review.md +213 -0
- package/skills/database-postgresql-optimization.md +405 -0
- package/skills/database-sql-code-review.md +302 -0
- package/skills/database-sql-optimization.md +297 -0
- package/skills/dependency-audit.md +165 -0
- package/skills/design-kami-landing.md +234 -0
- package/skills/design.md +221 -0
- package/skills/dev-acquire-codebase-knowledge.md +175 -0
- package/skills/dev-add-educational-comments.md +129 -0
- package/skills/dev-add-model-descriptions.md +74 -0
- package/skills/dev-adr-review.md +56 -0
- package/skills/dev-boost-prompt.md +26 -0
- package/skills/dev-build-run-debug.md +130 -0
- package/skills/dev-chunk.md +49 -0
- package/skills/dev-claude-md-improver.md +180 -0
- package/skills/dev-code-exemplars-blueprint-generator.md +127 -0
- package/skills/dev-code-tour.md +434 -0
- package/skills/dev-comment-code-generate-a-tutorial.md +27 -0
- package/skills/dev-commit.md +81 -0
- package/skills/dev-context-map.md +53 -0
- package/skills/dev-conventional-commit.md +73 -0
- package/skills/dev-create-architectural-decision-record.md +98 -0
- package/skills/dev-create-draft-pr.md +17 -0
- package/skills/dev-create-pr.md +17 -0
- package/skills/dev-create-readme.md +22 -0
- package/skills/dev-csharp-mstest.md +479 -0
- package/skills/dev-csharp-nunit.md +72 -0
- package/skills/dev-csharp-tunit.md +101 -0
- package/skills/dev-csharp-xunit.md +69 -0
- package/skills/dev-debug-failing-test.md +90 -0
- package/skills/dev-diff-analyze.md +32 -0
- package/skills/dev-diffs.md +24 -0
- package/skills/dev-dotnet-best-practices.md +86 -0
- package/skills/dev-dotnet-design-pattern-review.md +43 -0
- package/skills/dev-dotnet-timezone.md +110 -0
- package/skills/dev-dotnet-upgrade.md +117 -0
- package/skills/dev-doublecheck.md +278 -0
- package/skills/dev-explain-error.md +15 -0
- package/skills/dev-finding-discovery.md +164 -0
- package/skills/dev-fix-finding.md +111 -0
- package/skills/dev-full-file-edit.md +25 -0
- package/skills/dev-git-commit.md +125 -0
- package/skills/dev-git-flow-branch-creator.md +293 -0
- package/skills/dev-git-workflow.md +46 -0
- package/skills/dev-github-automation.md +64 -0
- package/skills/dev-github-code-review.md +1140 -0
- package/skills/dev-github-issues.md +202 -0
- package/skills/dev-gpt-5-4-prompting.md +55 -0
- package/skills/dev-investigation-mode.md +277 -0
- package/skills/dev-java-add-graalvm-native-image-support.md +450 -0
- package/skills/dev-java-docs.md +24 -0
- package/skills/dev-java-refactoring-extract-method.md +105 -0
- package/skills/dev-java-refactoring-remove-parameter.md +85 -0
- package/skills/dev-merge.md +73 -0
- package/skills/dev-migrate-create.md +36 -0
- package/skills/dev-migrate-validate.md +36 -0
- package/skills/dev-my-issues.md +9 -0
- package/skills/dev-my-pull-requests.md +15 -0
- package/skills/dev-planning-oracle-to-postgres-migration-integration-testing.md +45 -0
- package/skills/dev-playwright-generate-test.md +18 -0
- package/skills/dev-playwright.md +148 -0
- package/skills/dev-prompt-builder.md +142 -0
- package/skills/dev-pytest-coverage.md +29 -0
- package/skills/dev-python-manager-discovery.md +330 -0
- package/skills/dev-python-pypi-package-builder.md +445 -0
- package/skills/dev-readme-blueprint-generator.md +79 -0
- package/skills/dev-refactor-method-complexity-reduce.md +99 -0
- package/skills/dev-refactor-plan.md +66 -0
- package/skills/dev-refactor.md +646 -0
- package/skills/dev-review-and-refactor.md +16 -0
- package/skills/dev-reviewing-oracle-to-postgres-migration.md +68 -0
- package/skills/dev-ruff-recursive-fix.md +201 -0
- package/skills/dev-run-e2e-tests.md +126 -0
- package/skills/dev-run-pre-commit-checks.md +133 -0
- package/skills/dev-run-smoke-tests.md +127 -0
- package/skills/dev-scaffolding-oracle-to-postgres-migration-test-project.md +55 -0
- package/skills/dev-spring-boot-testing.md +190 -0
- package/skills/dev-sync-upstream.md +32 -0
- package/skills/dev-sync.md +74 -0
- package/skills/dev-tdd-workflow.md +23 -0
- package/skills/dev-terraform-azurerm-set-diff-analyzer.md +49 -0
- package/skills/dev-test-driven-development.md +372 -0
- package/skills/dev-test-gaps.md +18 -0
- package/skills/dev-test-triage.md +55 -0
- package/skills/dev-typer.md +267 -0
- package/skills/dev-typescript-setup.md +25 -0
- package/skills/dev-unified-diff-edit.md +16 -0
- package/skills/dev-unit-test-vue-pinia.md +198 -0
- package/skills/dev-using-git-worktrees.md +216 -0
- package/skills/dev-validation.md +99 -0
- package/skills/dev-verification.md +168 -0
- package/skills/dev-webapp-testing.md +134 -0
- package/skills/dev-write-coding-standards-from-file.md +317 -0
- package/skills/dev-write-tests.md +16 -0
- package/skills/devops-appinsights-instrumentation.md +49 -0
- package/skills/devops-az-cost-optimize.md +306 -0
- package/skills/devops-chronicle.md +154 -0
- package/skills/devops-deployments-cicd.md +331 -0
- package/skills/devops-devops-rollout-plan.md +118 -0
- package/skills/devops-geistdocs.md +276 -0
- package/skills/devops-observability.md +774 -0
- package/skills/devops-observe-metrics.md +35 -0
- package/skills/devops-observe-trace.md +30 -0
- package/skills/devops-phoenix-cli.md +163 -0
- package/skills/devops-phoenix-tracing.md +140 -0
- package/skills/devops-publish-to-pages.md +108 -0
- package/skills/devops-telemetry.md +87 -0
- package/skills/devops-update-avm-modules-in-bicep.md +61 -0
- package/skills/devops.md +81 -0
- package/skills/diagrams-canvas.md +204 -0
- package/skills/diagrams-draw-io-diagram-generator.md +463 -0
- package/skills/diagrams-excalidraw-diagram-generator.md +614 -0
- package/skills/diagrams-graphify.md +1277 -0
- package/skills/docs-bear-notes.md +108 -0
- package/skills/docs-create-llms.md +211 -0
- package/skills/docs-doc-gen.md +20 -0
- package/skills/docs-documentation-writer.md +46 -0
- package/skills/docs-llm-config.md +33 -0
- package/skills/docs-mkdocs-translations.md +109 -0
- package/skills/docs-obsidian-vault-maintainer.md +14 -0
- package/skills/docs-obsidian.md +82 -0
- package/skills/docs-prose.md +324 -0
- package/skills/docs-update-llms.md +217 -0
- package/skills/docs-update-markdown-file-index.md +77 -0
- package/skills/docs-wiki-maintainer.md +20 -0
- package/skills/documents.md +120 -0
- package/skills/email.md +113 -0
- package/skills/expenses.md +140 -0
- package/skills/file-ops.md +149 -0
- package/skills/files-convert-plaintext-to-md.md +363 -0
- package/skills/files-doc.md +81 -0
- package/skills/files-docx.md +594 -0
- package/skills/files-markdown-to-html.md +917 -0
- package/skills/files-nano-pdf.md +39 -0
- package/skills/files-pdf.md +315 -0
- package/skills/files-pdftk-server.md +163 -0
- package/skills/files-pptx-html-fidelity-audit.md +255 -0
- package/skills/files-pptx.md +231 -0
- package/skills/files-xlsx.md +301 -0
- package/skills/find-jobs.md +78 -0
- package/skills/format-conversion.md +157 -0
- package/skills/frontend-ai-elements.md +483 -0
- package/skills/frontend-ai-gateway.md +563 -0
- package/skills/frontend-ai-generation-persistence.md +242 -0
- package/skills/frontend-ai-sdk.md +799 -0
- package/skills/frontend-ai-visibility.md +127 -0
- package/skills/frontend-angular-developer.md +130 -0
- package/skills/frontend-aspnet-minimal-api-openapi.md +42 -0
- package/skills/frontend-bencium-innovative-ux-designer.md +719 -0
- package/skills/frontend-chat-sdk.md +666 -0
- package/skills/frontend-chrome-devtools.md +98 -0
- package/skills/frontend-frontend-app-builder.md +186 -0
- package/skills/frontend-frontend-design.md +43 -0
- package/skills/frontend-frontend-testing-debugging.md +143 -0
- package/skills/frontend-gsap-framer-scroll-animation.md +152 -0
- package/skills/frontend-internal-linking.md +109 -0
- package/skills/frontend-json-render.md +335 -0
- package/skills/frontend-keyword-clustering.md +118 -0
- package/skills/frontend-next-intl-add-language.md +20 -0
- package/skills/frontend-on-page-seo.md +112 -0
- package/skills/frontend-premium-frontend-ui.md +114 -0
- package/skills/frontend-react-best-practices.md +143 -0
- package/skills/frontend-schema-markup.md +160 -0
- package/skills/frontend-seo-audit.md +110 -0
- package/skills/frontend-swr.md +215 -0
- package/skills/frontend-technical-seo.md +162 -0
- package/skills/frontend-use-dom.md +418 -0
- package/skills/frontend-web-coder.md +564 -0
- package/skills/frontend-web-design-reviewer.md +369 -0
- package/skills/frontend-web-perf.md +202 -0
- package/skills/frontend.md +125 -0
- package/skills/general-adapter-standalone.md +199 -0
- package/skills/general-auth.md +356 -0
- package/skills/general-containerize-aspnetcore.md +393 -0
- package/skills/general-create-technical-spike.md +231 -0
- package/skills/general-cron-jobs.md +72 -0
- package/skills/general-ddd-aggregate.md +52 -0
- package/skills/general-ddd-context.md +46 -0
- package/skills/general-ddd-validate.md +51 -0
- package/skills/general-dependency-check.md +26 -0
- package/skills/general-email-marketing.md +86 -0
- package/skills/general-healthcheck.md +246 -0
- package/skills/general-import-infrastructure-as-code.md +368 -0
- package/skills/general-init.md +49 -0
- package/skills/general-java-junit.md +64 -0
- package/skills/general-java-springboot.md +66 -0
- package/skills/general-javascript-typescript-jest.md +45 -0
- package/skills/general-kotlin-springboot.md +71 -0
- package/skills/general-make-repo-contribution.md +91 -0
- package/skills/general-market-research.md +78 -0
- package/skills/general-marketplace.md +468 -0
- package/skills/general-model-recommendation.md +673 -0
- package/skills/general-payments.md +352 -0
- package/skills/general-quality-playbook.md +480 -0
- package/skills/general-run-integration-tests.md +113 -0
- package/skills/general-superjson.md +274 -0
- package/skills/general-swiftpm-macos.md +51 -0
- package/skills/general-threat-model.md +61 -0
- package/skills/invoices.md +167 -0
- package/skills/licenses.md +159 -0
- package/skills/logs.md +156 -0
- package/skills/marketing.md +139 -0
- package/skills/media-image-manipulation-image-magick.md +253 -0
- package/skills/media-imagegen.md +357 -0
- package/skills/media-openai-whisper-api.md +63 -0
- package/skills/media-openai-whisper.md +39 -0
- package/skills/media-peekaboo.md +191 -0
- package/skills/media-screenshot.md +268 -0
- package/skills/media-speech.md +145 -0
- package/skills/media-transcribe.md +82 -0
- package/skills/media-video-frames.md +47 -0
- package/skills/mobile-android-emulator-qa.md +81 -0
- package/skills/mobile-android-performance.md +280 -0
- package/skills/mobile-building-mcp-server-on-cloudflare.md +267 -0
- package/skills/mobile-building-native-ui.md +322 -0
- package/skills/mobile-expo-api-routes.md +369 -0
- package/skills/mobile-expo-cicd-workflows.md +92 -0
- package/skills/mobile-expo-deployment.md +191 -0
- package/skills/mobile-expo-dev-client.md +165 -0
- package/skills/mobile-expo-module.md +177 -0
- package/skills/mobile-expo-tailwind-setup.md +481 -0
- package/skills/mobile-expo-ui-jetpack-compose.md +41 -0
- package/skills/mobile-expo-ui-swift-ui.md +40 -0
- package/skills/mobile-ios-app-intents.md +78 -0
- package/skills/mobile-ios-debugger-agent.md +52 -0
- package/skills/mobile-ios-ettrace-performance.md +198 -0
- package/skills/mobile-ios-memgraph-leaks.md +77 -0
- package/skills/mobile-native-data-fetching.md +508 -0
- package/skills/mobile-packaging-notarization.md +48 -0
- package/skills/mobile-react-native-architecture.md +672 -0
- package/skills/mobile-react-native-mobile-design.md +438 -0
- package/skills/mobile-signing-entitlements.md +59 -0
- package/skills/mobile-swiftui-liquid-glass.md +91 -0
- package/skills/mobile-swiftui-patterns.md +210 -0
- package/skills/mobile-swiftui-performance-audit.md +108 -0
- package/skills/mobile-swiftui-ui-patterns.md +97 -0
- package/skills/mobile-swiftui-view-refactor.md +204 -0
- package/skills/mobile-upgrading-expo.md +134 -0
- package/skills/mobile.md +183 -0
- package/skills/notes.md +106 -0
- package/skills/planning-adr-create.md +62 -0
- package/skills/planning-adr-index.md +67 -0
- package/skills/planning-architecture-blueprint-generator.md +323 -0
- package/skills/planning-brainstorming.md +165 -0
- package/skills/planning-breakdown-epic-arch.md +67 -0
- package/skills/planning-breakdown-epic-pm.md +59 -0
- package/skills/planning-breakdown-feature-implementation.md +129 -0
- package/skills/planning-breakdown-feature-prd.md +62 -0
- package/skills/planning-breakdown-plan.md +510 -0
- package/skills/planning-breakdown-test.md +366 -0
- package/skills/planning-cloud-design-patterns.md +63 -0
- package/skills/planning-content-brief.md +128 -0
- package/skills/planning-content-strategy.md +138 -0
- package/skills/planning-content-translation.md +143 -0
- package/skills/planning-create-github-action-workflow-specification.md +277 -0
- package/skills/planning-create-github-issues-feature-from-implementation-plan.md +29 -0
- package/skills/planning-create-github-issues-for-unmet-specification-requirements.md +36 -0
- package/skills/planning-create-github-pull-request-from-specification.md +25 -0
- package/skills/planning-create-implementation-plan.md +158 -0
- package/skills/planning-create-specification.md +128 -0
- package/skills/planning-first-ask.md +31 -0
- package/skills/planning-folder-structure-blueprint-generator.md +406 -0
- package/skills/planning-gen-specs-as-issues.md +166 -0
- package/skills/planning-generate-snapshot.md +144 -0
- package/skills/planning-generate-status-report.md +336 -0
- package/skills/planning-metric-pack-designer.md +27 -0
- package/skills/planning-pm-spec.md +53 -0
- package/skills/planning-prd.md +144 -0
- package/skills/planning-project-assessment.md +182 -0
- package/skills/planning-project-setup-info-local.md +128 -0
- package/skills/planning-project-workflow-analysis-blueprint-generator.md +294 -0
- package/skills/planning-service-oriented-architecture.md +248 -0
- package/skills/planning-spec-to-backlog.md +544 -0
- package/skills/planning-technology-stack-blueprint-generator.md +243 -0
- package/skills/planning-update-implementation-plan.md +158 -0
- package/skills/planning-update-specification.md +128 -0
- package/skills/planning-what-context-needed.md +40 -0
- package/skills/planning-writing-plans.md +153 -0
- package/skills/prepare-application.md +81 -0
- package/skills/productivity-apple-notes.md +78 -0
- package/skills/productivity-apple-reminders.md +119 -0
- package/skills/productivity-capture-tasks-from-meeting-notes.md +680 -0
- package/skills/productivity-daily-prep.md +156 -0
- package/skills/productivity-email-drafter.md +101 -0
- package/skills/productivity-hr-onboarding.md +53 -0
- package/skills/productivity-things-mac.md +87 -0
- package/skills/productivity-update.md +169 -0
- package/skills/reminders.md +109 -0
- package/skills/research-dossier-collect.md +71 -0
- package/skills/research-kg-extract.md +37 -0
- package/skills/research-openai-docs.md +89 -0
- package/skills/research-research-add-items.md +31 -0
- package/skills/research-research-report.md +94 -0
- package/skills/research-research-synthesize.md +63 -0
- package/skills/research-summarize.md +88 -0
- package/skills/research-transformers-js.md +635 -0
- package/skills/research.md +119 -0
- package/skills/security-ai-prompt-engineering-safety-review.md +231 -0
- package/skills/security-attack-path-analysis.md +182 -0
- package/skills/security-gdpr-compliant.md +284 -0
- package/skills/security-mcp-security-audit.md +279 -0
- package/skills/security-pii-detect.md +31 -0
- package/skills/security-secret-scanning.md +243 -0
- package/skills/security-security-best-practices.md +87 -0
- package/skills/security-security-ownership-map.md +207 -0
- package/skills/security-security-review.md +169 -0
- package/skills/security-security-scan.md +138 -0
- package/skills/security-security-threat-model.md +82 -0
- package/skills/security-threat-model-analyst.md +76 -0
- package/skills/sysmon.md +181 -0
- package/skills/system-arch-linux-triage.md +32 -0
- package/skills/system-centos-linux-triage.md +32 -0
- package/skills/system-debian-linux-triage.md +32 -0
- package/skills/system-fedora-linux-triage.md +32 -0
- package/skills/system-geofeed-tuner.md +865 -0
- package/skills/system-iot-anomalies.md +15 -0
- package/skills/system-iot-firmware.md +16 -0
- package/skills/system-iot-fleet.md +14 -0
- package/skills/system-iot-register.md +19 -0
- package/skills/system-iot-witness-verify.md +15 -0
- package/skills/system-tmux.md +171 -0
- package/skills/system-window-management.md +228 -0
- package/skills/task-management.md +90 -0
- package/skills/tasks.md +102 -0
- package/skills/test-coverage.md +188 -0
- package/skills/ux-ui.md +128 -0
- package/skills/web.md +186 -0
- package/skills/workflow-act-on-feedback.md +15 -0
- package/skills/workflow-automate-this.md +245 -0
- package/skills/workflow-autoresearch.md +276 -0
- package/skills/workflow-coding-agent.md +317 -0
- package/skills/workflow-deep-research.md +44 -0
- package/skills/workflow-dispatching-parallel-agents.md +183 -0
- package/skills/workflow-eval-driven-dev.md +148 -0
- package/skills/workflow-executing-plans.md +71 -0
- package/skills/workflow-mentoring-juniors.md +311 -0
- package/skills/workflow-receiving-code-review.md +214 -0
- package/skills/workflow-repo-story-time.md +155 -0
- package/skills/workflow-requesting-code-review.md +104 -0
- package/skills/workflow-session-report.md +43 -0
- package/skills/workflow-structured-autonomy-generate.md +126 -0
- package/skills/workflow-subagent-driven-development.md +280 -0
- package/skills/writing.md +106 -0
- package/src/agent.js +0 -0
- package/src/browser.js +297 -0
- package/src/cli.js +25 -4
- package/src/code-reviewer.js +119 -0
- package/src/completions.js +1 -1
- package/src/control.js +222 -30
- package/src/coordinator.js +303 -0
- package/src/correction.js +29 -8
- package/src/edit-tracker.js +21 -0
- package/src/edit-viewer.js +414 -0
- package/src/endpoints.js +64 -15
- package/src/index.js +45 -11
- package/src/llm.js +86 -2
- package/src/mcp-client.js +416 -0
- package/src/memory.js +182 -0
- package/src/planner.js +216 -0
- package/src/rules.js +90 -0
- package/src/self-commands.js +757 -0
- package/src/services/voice.js +10 -7
- package/src/session-search.js +427 -0
- package/src/session.js +487 -99
- package/src/shmakk-server.js +91 -0
- package/src/skills.js +410 -3
- package/src/subagent.js +4 -1
- package/src/system-prompt.js +13 -5
- package/src/task-file.js +114 -0
- package/src/taskClassifier.js +246 -0
- package/src/team.js +752 -0
- package/src/tools.js +142 -21
- package/src/web.js +35 -5
- package/src/workflows.js +261 -0
- package/src/workspace-index.js +25 -6
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java-add-graalvm-native-image-support
|
|
3
|
+
description: 'GraalVM Native Image expert that adds native image support to Java applications, builds the project, analyzes build errors, applies fixes, and iterates until successful compilation using Oracle best practices.'
|
|
4
|
+
category: dev
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GraalVM Native Image Agent
|
|
8
|
+
|
|
9
|
+
You are an expert in adding GraalVM native image support to Java applications. Your goal is to:
|
|
10
|
+
|
|
11
|
+
1. Analyze the project structure and identify the build tool (Maven or Gradle)
|
|
12
|
+
2. Detect the framework (Spring Boot, Quarkus, Micronaut, or generic Java)
|
|
13
|
+
3. Add appropriate GraalVM native image configuration
|
|
14
|
+
4. Build the native image
|
|
15
|
+
5. Analyze any build errors or warnings
|
|
16
|
+
6. Apply fixes iteratively until the build succeeds
|
|
17
|
+
|
|
18
|
+
## Your Approach
|
|
19
|
+
|
|
20
|
+
Follow Oracle's best practices for GraalVM native images and use an iterative approach to resolve issues.
|
|
21
|
+
|
|
22
|
+
### Step 1: Analyze the Project
|
|
23
|
+
|
|
24
|
+
- Check if `pom.xml` exists (Maven) or `build.gradle`/`build.gradle.kts` exists (Gradle)
|
|
25
|
+
- Identify the framework by checking dependencies:
|
|
26
|
+
- Spring Boot: `spring-boot-starter` dependencies
|
|
27
|
+
- Quarkus: `quarkus-` dependencies
|
|
28
|
+
- Micronaut: `micronaut-` dependencies
|
|
29
|
+
- Check for existing GraalVM configuration
|
|
30
|
+
|
|
31
|
+
### Step 2: Add Native Image Support
|
|
32
|
+
|
|
33
|
+
#### For Maven Projects
|
|
34
|
+
|
|
35
|
+
Add the GraalVM Native Build Tools plugin within a `native` profile in `pom.xml`:
|
|
36
|
+
|
|
37
|
+
```xml
|
|
38
|
+
<profiles>
|
|
39
|
+
<profile>
|
|
40
|
+
<id>native</id>
|
|
41
|
+
<build>
|
|
42
|
+
<plugins>
|
|
43
|
+
<plugin>
|
|
44
|
+
<groupId>org.graalvm.buildtools</groupId>
|
|
45
|
+
<artifactId>native-maven-plugin</artifactId>
|
|
46
|
+
<version>[latest-version]</version>
|
|
47
|
+
<extensions>true</extensions>
|
|
48
|
+
<executions>
|
|
49
|
+
<execution>
|
|
50
|
+
<id>build-native</id>
|
|
51
|
+
<goals>
|
|
52
|
+
<goal>compile-no-fork</goal>
|
|
53
|
+
</goals>
|
|
54
|
+
<phase>package</phase>
|
|
55
|
+
</execution>
|
|
56
|
+
</executions>
|
|
57
|
+
<configuration>
|
|
58
|
+
<imageName>${project.artifactId}</imageName>
|
|
59
|
+
<mainClass>${main.class}</mainClass>
|
|
60
|
+
<buildArgs>
|
|
61
|
+
<buildArg>--no-fallback</buildArg>
|
|
62
|
+
</buildArgs>
|
|
63
|
+
</configuration>
|
|
64
|
+
</plugin>
|
|
65
|
+
</plugins>
|
|
66
|
+
</build>
|
|
67
|
+
</profile>
|
|
68
|
+
</profiles>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For Spring Boot projects, ensure the Spring Boot Maven plugin is in the main build section:
|
|
72
|
+
|
|
73
|
+
```xml
|
|
74
|
+
<build>
|
|
75
|
+
<plugins>
|
|
76
|
+
<plugin>
|
|
77
|
+
<groupId>org.springframework.boot</groupId>
|
|
78
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
79
|
+
</plugin>
|
|
80
|
+
</plugins>
|
|
81
|
+
</build>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### For Gradle Projects
|
|
85
|
+
|
|
86
|
+
Add the GraalVM Native Build Tools plugin to `build.gradle`:
|
|
87
|
+
|
|
88
|
+
```groovy
|
|
89
|
+
plugins {
|
|
90
|
+
id 'org.graalvm.buildtools.native' version '[latest-version]'
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
graalvmNative {
|
|
94
|
+
binaries {
|
|
95
|
+
main {
|
|
96
|
+
imageName = project.name
|
|
97
|
+
mainClass = application.mainClass.get()
|
|
98
|
+
buildArgs.add('--no-fallback')
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or for Kotlin DSL (`build.gradle.kts`):
|
|
105
|
+
|
|
106
|
+
```kotlin
|
|
107
|
+
plugins {
|
|
108
|
+
id("org.graalvm.buildtools.native") version "[latest-version]"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
graalvmNative {
|
|
112
|
+
binaries {
|
|
113
|
+
named("main") {
|
|
114
|
+
imageName.set(project.name)
|
|
115
|
+
mainClass.set(application.mainClass.get())
|
|
116
|
+
buildArgs.add("--no-fallback")
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Step 3: Build the Native Image
|
|
123
|
+
|
|
124
|
+
Run the appropriate build command:
|
|
125
|
+
|
|
126
|
+
**Maven:**
|
|
127
|
+
```sh
|
|
128
|
+
mvn -Pnative native:compile
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Gradle:**
|
|
132
|
+
```sh
|
|
133
|
+
./gradlew nativeCompile
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Spring Boot (Maven):**
|
|
137
|
+
```sh
|
|
138
|
+
mvn -Pnative spring-boot:build-image
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Quarkus (Maven):**
|
|
142
|
+
```sh
|
|
143
|
+
./mvnw package -Pnative
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Micronaut (Maven):**
|
|
147
|
+
```sh
|
|
148
|
+
./mvnw package -Dpackaging=native-image
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Step 4: Analyze Build Errors
|
|
152
|
+
|
|
153
|
+
Common issues and solutions:
|
|
154
|
+
|
|
155
|
+
#### Reflection Issues
|
|
156
|
+
If you see errors about missing reflection configuration, create or update `src/main/resources/META-INF/native-image/reflect-config.json`:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
"name": "com.example.YourClass",
|
|
162
|
+
"allDeclaredConstructors": true,
|
|
163
|
+
"allDeclaredMethods": true,
|
|
164
|
+
"allDeclaredFields": true
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Resource Access Issues
|
|
170
|
+
For missing resources, create `src/main/resources/META-INF/native-image/resource-config.json`:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"resources": {
|
|
175
|
+
"includes": [
|
|
176
|
+
{"pattern": "application.properties"},
|
|
177
|
+
{"pattern": ".*\\.yml"},
|
|
178
|
+
{"pattern": ".*\\.yaml"}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### JNI Issues
|
|
185
|
+
For JNI-related errors, create `src/main/resources/META-INF/native-image/jni-config.json`:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
[
|
|
189
|
+
{
|
|
190
|
+
"name": "com.example.NativeClass",
|
|
191
|
+
"methods": [
|
|
192
|
+
{"name": "nativeMethod", "parameterTypes": ["java.lang.String"]}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### Dynamic Proxy Issues
|
|
199
|
+
For dynamic proxy errors, create `src/main/resources/META-INF/native-image/proxy-config.json`:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
[
|
|
203
|
+
["com.example.Interface1", "com.example.Interface2"]
|
|
204
|
+
]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Step 5: Iterate Until Success
|
|
208
|
+
|
|
209
|
+
- After each fix, rebuild the native image
|
|
210
|
+
- Analyze new errors and apply appropriate fixes
|
|
211
|
+
- Use the GraalVM tracing agent to automatically generate configuration:
|
|
212
|
+
```sh
|
|
213
|
+
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/app.jar
|
|
214
|
+
```
|
|
215
|
+
- Continue until the build succeeds without errors
|
|
216
|
+
|
|
217
|
+
### Step 6: Verify the Native Image
|
|
218
|
+
|
|
219
|
+
Once built successfully:
|
|
220
|
+
- Test the native executable to ensure it runs correctly
|
|
221
|
+
- Verify startup time improvements
|
|
222
|
+
- Check memory footprint
|
|
223
|
+
- Test all critical application paths
|
|
224
|
+
|
|
225
|
+
## Framework-Specific Considerations
|
|
226
|
+
|
|
227
|
+
### Spring Boot
|
|
228
|
+
- Spring Boot 3.0+ has excellent native image support
|
|
229
|
+
- Ensure you're using compatible Spring Boot version (3.0+)
|
|
230
|
+
- Most Spring libraries provide GraalVM hints automatically
|
|
231
|
+
- Test with Spring AOT processing enabled
|
|
232
|
+
|
|
233
|
+
**When to Add Custom RuntimeHints:**
|
|
234
|
+
|
|
235
|
+
Create a `RuntimeHintsRegistrar` implementation only if you need to register custom hints:
|
|
236
|
+
|
|
237
|
+
```java
|
|
238
|
+
import org.springframework.aot.hint.RuntimeHints;
|
|
239
|
+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|
240
|
+
|
|
241
|
+
public class MyRuntimeHints implements RuntimeHintsRegistrar {
|
|
242
|
+
@Override
|
|
243
|
+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
244
|
+
// Register reflection hints
|
|
245
|
+
hints.reflection().registerType(
|
|
246
|
+
MyClass.class,
|
|
247
|
+
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
|
|
248
|
+
MemberCategory.INVOKE_DECLARED_METHODS)
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
// Register resource hints
|
|
252
|
+
hints.resources().registerPattern("custom-config/*.properties");
|
|
253
|
+
|
|
254
|
+
// Register serialization hints
|
|
255
|
+
hints.serialization().registerType(MySerializableClass.class);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Register it in your main application class:
|
|
261
|
+
|
|
262
|
+
```java
|
|
263
|
+
@SpringBootApplication
|
|
264
|
+
@ImportRuntimeHints(MyRuntimeHints.class)
|
|
265
|
+
public class Application {
|
|
266
|
+
public static void main(String[] args) {
|
|
267
|
+
SpringApplication.run(Application.class, args);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Common Spring Boot Native Image Issues:**
|
|
273
|
+
|
|
274
|
+
1. **Logback Configuration**: Add to `application.properties`:
|
|
275
|
+
```properties
|
|
276
|
+
# Disable Logback's shutdown hook in native images
|
|
277
|
+
logging.register-shutdown-hook=false
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
If using custom Logback configuration, ensure `logback-spring.xml` is in resources and add to `RuntimeHints`:
|
|
281
|
+
```java
|
|
282
|
+
hints.resources().registerPattern("logback-spring.xml");
|
|
283
|
+
hints.resources().registerPattern("org/springframework/boot/logging/logback/*.xml");
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
2. **Jackson Serialization**: For custom Jackson modules or types, register them:
|
|
287
|
+
```java
|
|
288
|
+
hints.serialization().registerType(MyDto.class);
|
|
289
|
+
hints.reflection().registerType(
|
|
290
|
+
MyDto.class,
|
|
291
|
+
hint -> hint.withMembers(
|
|
292
|
+
MemberCategory.DECLARED_FIELDS,
|
|
293
|
+
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Add Jackson mix-ins to reflection hints if used:
|
|
299
|
+
```java
|
|
300
|
+
hints.reflection().registerType(MyMixIn.class);
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
3. **Jackson Modules**: Ensure Jackson modules are on the classpath:
|
|
304
|
+
```xml
|
|
305
|
+
<dependency>
|
|
306
|
+
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
307
|
+
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
308
|
+
</dependency>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Quarkus
|
|
312
|
+
- Quarkus is designed for native images with zero configuration in most cases
|
|
313
|
+
- Use `@RegisterForReflection` annotation for reflection needs
|
|
314
|
+
- Quarkus extensions handle GraalVM configuration automatically
|
|
315
|
+
|
|
316
|
+
**Common Quarkus Native Image Tips:**
|
|
317
|
+
|
|
318
|
+
1. **Reflection Registration**: Use annotations instead of manual configuration:
|
|
319
|
+
```java
|
|
320
|
+
@RegisterForReflection(targets = {MyClass.class, MyDto.class})
|
|
321
|
+
public class ReflectionConfiguration {
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Or register entire packages:
|
|
326
|
+
```java
|
|
327
|
+
@RegisterForReflection(classNames = {"com.example.package.*"})
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
2. **Resource Inclusion**: Add to `application.properties`:
|
|
331
|
+
```properties
|
|
332
|
+
quarkus.native.resources.includes=config/*.json,templates/**
|
|
333
|
+
quarkus.native.additional-build-args=--initialize-at-run-time=com.example.RuntimeClass
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
3. **Database Drivers**: Ensure you're using Quarkus-supported JDBC extensions:
|
|
337
|
+
```xml
|
|
338
|
+
<dependency>
|
|
339
|
+
<groupId>io.quarkus</groupId>
|
|
340
|
+
<artifactId>quarkus-jdbc-postgresql</artifactId>
|
|
341
|
+
</dependency>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
4. **Build-Time vs Runtime Initialization**: Control initialization with:
|
|
345
|
+
```properties
|
|
346
|
+
quarkus.native.additional-build-args=--initialize-at-build-time=com.example.BuildTimeClass
|
|
347
|
+
quarkus.native.additional-build-args=--initialize-at-run-time=com.example.RuntimeClass
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
5. **Container Image Build**: Use Quarkus container-image extensions:
|
|
351
|
+
```properties
|
|
352
|
+
quarkus.native.container-build=true
|
|
353
|
+
quarkus.native.builder-image=mandrel
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Micronaut
|
|
357
|
+
- Micronaut has built-in GraalVM support with minimal configuration
|
|
358
|
+
- Use `@ReflectionConfig` and `@Introspected` annotations as needed
|
|
359
|
+
- Micronaut's ahead-of-time compilation reduces reflection requirements
|
|
360
|
+
|
|
361
|
+
**Common Micronaut Native Image Tips:**
|
|
362
|
+
|
|
363
|
+
1. **Bean Introspection**: Use `@Introspected` for POJOs to avoid reflection:
|
|
364
|
+
```java
|
|
365
|
+
@Introspected
|
|
366
|
+
public class MyDto {
|
|
367
|
+
private String name;
|
|
368
|
+
private int value;
|
|
369
|
+
// getters and setters
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Or enable package-wide introspection in `application.yml`:
|
|
374
|
+
```yaml
|
|
375
|
+
micronaut:
|
|
376
|
+
introspection:
|
|
377
|
+
packages:
|
|
378
|
+
- com.example.dto
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
2. **Reflection Configuration**: Use declarative annotations:
|
|
382
|
+
```java
|
|
383
|
+
@ReflectionConfig(
|
|
384
|
+
type = MyClass.class,
|
|
385
|
+
accessType = ReflectionConfig.AccessType.ALL_DECLARED_CONSTRUCTORS
|
|
386
|
+
)
|
|
387
|
+
public class MyConfiguration {
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
3. **Resource Configuration**: Add resources to native image:
|
|
392
|
+
```java
|
|
393
|
+
@ResourceConfig(
|
|
394
|
+
includes = {"application.yml", "logback.xml"}
|
|
395
|
+
)
|
|
396
|
+
public class ResourceConfiguration {
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
4. **Native Image Configuration**: In `build.gradle`:
|
|
401
|
+
```groovy
|
|
402
|
+
graalvmNative {
|
|
403
|
+
binaries {
|
|
404
|
+
main {
|
|
405
|
+
buildArgs.add("--initialize-at-build-time=io.micronaut")
|
|
406
|
+
buildArgs.add("--initialize-at-run-time=io.netty")
|
|
407
|
+
buildArgs.add("--report-unsupported-elements-at-runtime")
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
5. **HTTP Client Configuration**: For Micronaut HTTP clients, ensure netty is properly configured:
|
|
414
|
+
```yaml
|
|
415
|
+
micronaut:
|
|
416
|
+
http:
|
|
417
|
+
client:
|
|
418
|
+
read-timeout: 30s
|
|
419
|
+
netty:
|
|
420
|
+
default:
|
|
421
|
+
allocator:
|
|
422
|
+
max-order: 3
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Best Practices
|
|
426
|
+
|
|
427
|
+
- **Start Simple**: Build with `--no-fallback` to catch all native image issues
|
|
428
|
+
- **Use Tracing Agent**: Run your application with the GraalVM tracing agent to automatically discover reflection, resources, and JNI requirements
|
|
429
|
+
- **Test Thoroughly**: Native images behave differently than JVM applications
|
|
430
|
+
- **Minimize Reflection**: Prefer compile-time code generation over runtime reflection
|
|
431
|
+
- **Profile Memory**: Native images have different memory characteristics
|
|
432
|
+
- **CI/CD Integration**: Add native image builds to your CI/CD pipeline
|
|
433
|
+
- **Keep Dependencies Updated**: Use latest versions for better GraalVM compatibility
|
|
434
|
+
|
|
435
|
+
## Troubleshooting Tips
|
|
436
|
+
|
|
437
|
+
1. **Build Fails with Reflection Errors**: Use the tracing agent or add manual reflection configuration
|
|
438
|
+
2. **Missing Resources**: Ensure resource patterns are correctly specified in `resource-config.json`
|
|
439
|
+
3. **ClassNotFoundException at Runtime**: Add the class to reflection configuration
|
|
440
|
+
4. **Slow Build Times**: Consider using build caching and incremental builds
|
|
441
|
+
5. **Large Image Size**: Use `--gc=serial` (default) or `--gc=epsilon` (no-op GC for testing) and analyze dependencies
|
|
442
|
+
|
|
443
|
+
## References
|
|
444
|
+
|
|
445
|
+
- [GraalVM Native Image Documentation](https://www.graalvm.org/latest/reference-manual/native-image/)
|
|
446
|
+
- [Spring Boot Native Image Guide](https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html)
|
|
447
|
+
- [Quarkus Building Native Images](https://quarkus.io/guides/building-native-image)
|
|
448
|
+
- [Micronaut GraalVM Support](https://docs.micronaut.io/latest/guide/index.html#graal)
|
|
449
|
+
- [GraalVM Reachability Metadata](https://github.com/oracle/graalvm-reachability-metadata)
|
|
450
|
+
- [Native Build Tools](https://graalvm.github.io/native-build-tools/latest/index.html)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java-docs
|
|
3
|
+
description: 'Ensure that Java types are documented with Javadoc comments and follow best practices for documentation.'
|
|
4
|
+
category: dev
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Java Documentation (Javadoc) Best Practices
|
|
8
|
+
|
|
9
|
+
- Public and protected members should be documented with Javadoc comments.
|
|
10
|
+
- It is encouraged to document package-private and private members as well, especially if they are complex or not self-explanatory.
|
|
11
|
+
- The first sentence of the Javadoc comment is the summary description. It should be a concise overview of what the method does and end with a period.
|
|
12
|
+
- Use `@param` for method parameters. The description starts with a lowercase letter and does not end with a period.
|
|
13
|
+
- Use `@return` for method return values.
|
|
14
|
+
- Use `@throws` or `@exception` to document exceptions thrown by methods.
|
|
15
|
+
- Use `@see` for references to other types or members.
|
|
16
|
+
- Use `{@inheritDoc}` to inherit documentation from base classes or interfaces.
|
|
17
|
+
- Unless there is major behavior change, in which case you should document the differences.
|
|
18
|
+
- Use `@param <T>` for type parameters in generic types or methods.
|
|
19
|
+
- Use `{@code}` for inline code snippets.
|
|
20
|
+
- Use `<pre>{@code ... }</pre>` for code blocks.
|
|
21
|
+
- Use `@since` to indicate when the feature was introduced (e.g., version number).
|
|
22
|
+
- Use `@version` to specify the version of the member.
|
|
23
|
+
- Use `@author` to specify the author of the code.
|
|
24
|
+
- Use `@deprecated` to mark a member as deprecated and provide an alternative.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java-refactoring-extract-method
|
|
3
|
+
description: 'Refactoring using Extract Methods in Java Language'
|
|
4
|
+
category: dev
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Refactoring Java Methods with Extract Method
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
|
|
11
|
+
You are an expert in refactoring Java methods.
|
|
12
|
+
|
|
13
|
+
Below are **2 examples** (with titles code before and code after refactoring) that represents **Extract Method**.
|
|
14
|
+
|
|
15
|
+
## Code Before Refactoring 1:
|
|
16
|
+
```java
|
|
17
|
+
public FactLineBuilder setC_BPartner_ID_IfValid(final int bpartnerId) {
|
|
18
|
+
assertNotBuild();
|
|
19
|
+
if (bpartnerId > 0) {
|
|
20
|
+
setC_BPartner_ID(bpartnerId);
|
|
21
|
+
}
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Code After Refactoring 1:
|
|
27
|
+
```java
|
|
28
|
+
public FactLineBuilder bpartnerIdIfNotNull(final BPartnerId bpartnerId) {
|
|
29
|
+
if (bpartnerId != null) {
|
|
30
|
+
return bpartnerId(bpartnerId);
|
|
31
|
+
} else {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
public FactLineBuilder setC_BPartner_ID_IfValid(final int bpartnerRepoId) {
|
|
36
|
+
return bpartnerIdIfNotNull(BPartnerId.ofRepoIdOrNull(bpartnerRepoId));
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Code Before Refactoring 2:
|
|
41
|
+
```java
|
|
42
|
+
public DefaultExpander add(RelationshipType type, Direction direction) {
|
|
43
|
+
Direction existingDirection = directions.get(type.name());
|
|
44
|
+
final RelationshipType[] newTypes;
|
|
45
|
+
if (existingDirection != null) {
|
|
46
|
+
if (existingDirection == direction) {
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
newTypes = types;
|
|
50
|
+
} else {
|
|
51
|
+
newTypes = new RelationshipType[types.length + 1];
|
|
52
|
+
System.arraycopy(types, 0, newTypes, 0, types.length);
|
|
53
|
+
newTypes[types.length] = type;
|
|
54
|
+
}
|
|
55
|
+
Map<String, Direction> newDirections = new HashMap<String, Direction>(directions);
|
|
56
|
+
newDirections.put(type.name(), direction);
|
|
57
|
+
return new DefaultExpander(newTypes, newDirections);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Code After Refactoring 2:
|
|
62
|
+
```java
|
|
63
|
+
public DefaultExpander add(RelationshipType type, Direction direction) {
|
|
64
|
+
Direction existingDirection = directions.get(type.name());
|
|
65
|
+
final RelationshipType[] newTypes;
|
|
66
|
+
if (existingDirection != null) {
|
|
67
|
+
if (existingDirection == direction) {
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
newTypes = types;
|
|
71
|
+
} else {
|
|
72
|
+
newTypes = new RelationshipType[types.length + 1];
|
|
73
|
+
System.arraycopy(types, 0, newTypes, 0, types.length);
|
|
74
|
+
newTypes[types.length] = type;
|
|
75
|
+
}
|
|
76
|
+
Map<String, Direction> newDirections = new HashMap<String, Direction>(directions);
|
|
77
|
+
newDirections.put(type.name(), direction);
|
|
78
|
+
return (DefaultExpander) newExpander(newTypes, newDirections);
|
|
79
|
+
}
|
|
80
|
+
protected RelationshipExpander newExpander(RelationshipType[] types,
|
|
81
|
+
Map<String, Direction> directions) {
|
|
82
|
+
return new DefaultExpander(types, directions);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Task
|
|
87
|
+
|
|
88
|
+
Apply **Extract Method** to improve readability, testability, maintainability, reusability, modularity, cohesion, low coupling, and consistency.
|
|
89
|
+
|
|
90
|
+
Always return a complete and compilable method (Java 17).
|
|
91
|
+
|
|
92
|
+
Perform intermediate steps internally:
|
|
93
|
+
- First, analyze each method and identify those exceeding thresholds:
|
|
94
|
+
* LOC (Lines of Code) > 15
|
|
95
|
+
* NOM (Number of Statements) > 10
|
|
96
|
+
* CC (Cyclomatic Complexity) > 10
|
|
97
|
+
- For each qualifying method, identify code blocks that can be extracted into separate methods.
|
|
98
|
+
- Extract at least one new method with a descriptive name.
|
|
99
|
+
- Output only the refactored code inside a single ```java``` block.
|
|
100
|
+
- Do not remove any functionality from the original method.
|
|
101
|
+
- Include a one-line comment above each new method describing its purpose.
|
|
102
|
+
|
|
103
|
+
## Code to be Refactored:
|
|
104
|
+
|
|
105
|
+
Now, assess all methods with high complexity and refactor them using **Extract Method**
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java-refactoring-remove-parameter
|
|
3
|
+
description: 'Refactoring using Remove Parameter in Java Language'
|
|
4
|
+
category: dev
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Refactoring Java Methods with Remove Parameter
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
|
|
11
|
+
You are an expert in refactoring Java methods.
|
|
12
|
+
|
|
13
|
+
Below are **2 examples** (with titles code before and code after refactoring) that represents **Remove Parameter**.
|
|
14
|
+
|
|
15
|
+
## Code Before Refactoring 1:
|
|
16
|
+
```java
|
|
17
|
+
public Backend selectBackendForGroupCommit(long tableId, ConnectContext context, boolean isCloud)
|
|
18
|
+
throws LoadException, DdlException {
|
|
19
|
+
if (!Env.getCurrentEnv().isMaster()) {
|
|
20
|
+
try {
|
|
21
|
+
long backendId = new MasterOpExecutor(context)
|
|
22
|
+
.getGroupCommitLoadBeId(tableId, context.getCloudCluster(), isCloud);
|
|
23
|
+
return Env.getCurrentSystemInfo().getBackend(backendId);
|
|
24
|
+
} catch (Exception e) {
|
|
25
|
+
throw new LoadException(e.getMessage());
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
return Env.getCurrentSystemInfo()
|
|
29
|
+
.getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster(), isCloud));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Code After Refactoring 1:
|
|
35
|
+
```java
|
|
36
|
+
public Backend selectBackendForGroupCommit(long tableId, ConnectContext context)
|
|
37
|
+
throws LoadException, DdlException {
|
|
38
|
+
if (!Env.getCurrentEnv().isMaster()) {
|
|
39
|
+
try {
|
|
40
|
+
long backendId = new MasterOpExecutor(context)
|
|
41
|
+
.getGroupCommitLoadBeId(tableId, context.getCloudCluster());
|
|
42
|
+
return Env.getCurrentSystemInfo().getBackend(backendId);
|
|
43
|
+
} catch (Exception e) {
|
|
44
|
+
throw new LoadException(e.getMessage());
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
return Env.getCurrentSystemInfo()
|
|
48
|
+
.getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster()));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Code Before Refactoring 2:
|
|
54
|
+
```java
|
|
55
|
+
NodeImpl( long id, long firstRel, long firstProp )
|
|
56
|
+
{
|
|
57
|
+
this( id, false );
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Code After Refactoring 2:
|
|
62
|
+
```java
|
|
63
|
+
NodeImpl( long id)
|
|
64
|
+
{
|
|
65
|
+
this( id, false );
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Task
|
|
70
|
+
|
|
71
|
+
Apply **Remove Parameter** to improve readability, testability, maintainability, reusability, modularity, cohesion, low coupling, and consistency.
|
|
72
|
+
|
|
73
|
+
Always return a complete and compilable method (Java 17).
|
|
74
|
+
|
|
75
|
+
Perform intermediate steps internally:
|
|
76
|
+
- First, analyze each method and identify parameters that are unused or redundant (i.e., values that can be obtained from class fields, constants, or other method calls).
|
|
77
|
+
- For each qualifying method, remove the unnecessary parameters from its definition and from all its internal calls.
|
|
78
|
+
- Ensure that the method continues to function correctly after parameter removal.
|
|
79
|
+
- Output only the refactored code inside a single ```java``` block.
|
|
80
|
+
- Do not remove any functionality from the original method.
|
|
81
|
+
- Include a one-line comment above each modified method indicating which parameter was removed and why.
|
|
82
|
+
|
|
83
|
+
## Code to be Refactored:
|
|
84
|
+
|
|
85
|
+
Now, assess all methods with unused parameters and refactor them using **Remove Parameter**
|