[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6997MBRKDMHWVCNS4MKRYR5":3,"skill-same:01M6997MBRKDMHWVCNS4MKRYR5":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6997MBRKDMHWVCNS4MKRYR5","java-ast-refactoring",null,"AST-aware Java refactoring using OpenRewrite. Use when asked to structurally refactor Java code, change class names, change method signatures\u002Foverloads, replace builder patterns, modify annotations, or perform cross-file structural replacements. Note: Renaming fields or local variables\u002Fparameters is not supported natively via simple YAML recipes in the standard openrewrite modules.","google\u002Fnomulus","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6997HT1T9C6ZTKYKPVJZZ2Q",1818,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"java","refactoring","ast","java ast refactoring","builder","replace","when","standard","Variables","via","structural","local","signatures","simple","modules","use","yaml","file","code","change","2026-11-10 10:12:30",false,"---\nname: java-ast-refactoring\ndescription: \"AST-aware Java refactoring using OpenRewrite. Use when asked to structurally refactor Java code, change class names, change method signatures\u002Foverloads, replace builder patterns, modify annotations, or perform cross-file structural replacements. Note: Renaming fields or local variables\u002Fparameters is not supported natively via simple YAML recipes in the standard openrewrite modules.\"\n---\n\n# AST-Aware Java Refactoring\n\nThis skill uses OpenRewrite to perform Abstract Syntax Tree (AST) based refactoring on Java codebases. This is highly preferred over text-based regex or python scripts because it understands Java semantics, correctly updates imports, and preserves formatting.\n\n## Parameter and Field Renaming (Last Resort)\n\nBecause OpenRewrite's YAML recipes do not natively support simple variable or field renaming, a custom script is provided:\n```bash\npython3 .gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Fsafe_rename.py \u003Cfilepath> \u003Cold_name> \u003Cnew_name>\n```\n**CRITICAL:** Running this python script is a LAST RESORT. It is a regex-based token replacement that ignores strings and comments, but it lacks true AST understanding. ALWAYS prefer using OpenRewrite recipes (`rewrite.yml`) for structural changes like renaming classes, methods, or moving targets, as OpenRewrite correctly handles imports, types, and cross-file references safely.\n\n## Usage\n\n1. Create a `rewrite.yml` recipe file in the workspace root. Refer to `.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Freferences\u002Frewrite_recipes.md` for syntax.\n2. Execute the script:\n```bash\n.\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Frun_rewrite.sh rewrite.yml\n```\n3. The script will safely apply the AST transformations and then automatically run `.\u002Fgradlew spotlessApply` and `.\u002Fgradlew javaIncrementalFormatApply` on the modified files to automatically fix any Checkstyle line-length and import ordering issues caused by longer\u002Fshorter identifiers. Verify the output using `git diff`.\n4. **MANDATORY:** Always run `.\u002Fgradlew build -x test` (or the equivalent compile task) after running OpenRewrite to ensure no compilation errors were introduced.\n\n## Known Limitations & Troubleshooting\n*   **Static Imports Dropped on Class Rename:** When using `ChangeType` to rename a class, OpenRewrite may sometimes drop static imports for fields\u002Fconstants belonging to the old class instead of updating them to the new class. If compilation fails due to \"cannot find symbol\" for a constant after a class rename, manually restore the static import (e.g., `import static com.new.ClassName.CONSTANT;`).\n*   **Continuous Improvement:** If any new issues or edge cases are found while running the refactoring (e.g., build failures, formatting issues, or missed transformations), you **MUST** proactively ask the user if you should permanently update this skill file (`SKILL.md`) and its accompanying scripts (`scripts\u002Frun_rewrite.sh`, `scripts\u002Fsafe_rename.py`) to fix the issue for future use. Do not wait for the user to prompt you to fix the infrastructure.\n","# AST-Aware Java Refactoring\n\nThis skill uses OpenRewrite to perform Abstract Syntax Tree (AST) based refactoring on Java codebases. This is highly preferred over text-based regex or python scripts because it understands Java semantics, correctly updates imports, and preserves formatting.\n\n## Parameter and Field Renaming (Last Resort)\n\nBecause OpenRewrite's YAML recipes do not natively support simple variable or field renaming, a custom script is provided:\n```bash\npython3 .gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Fsafe_rename.py \u003Cfilepath> \u003Cold_name> \u003Cnew_name>\n```\n**CRITICAL:** Running this python script is a LAST RESORT. It is a regex-based token replacement that ignores strings and comments, but it lacks true AST understanding. ALWAYS prefer using OpenRewrite recipes (`rewrite.yml`) for structural changes like renaming classes, methods, or moving targets, as OpenRewrite correctly handles imports, types, and cross-file references safely.\n\n## Usage\n\n1. Create a `rewrite.yml` recipe file in the workspace root. Refer to `.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Freferences\u002Frewrite_recipes.md` for syntax.\n2. Execute the script:\n```bash\n.\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Frun_rewrite.sh rewrite.yml\n```\n3. The script will safely apply the AST transformations and then automatically run `.\u002Fgradlew spotlessApply` and `.\u002Fgradlew javaIncrementalFormatApply` on the modified files to automatically fix any Checkstyle line-length and import ordering issues caused by longer\u002Fshorter identifiers. Verify the output using `git diff`.\n4. **MANDATORY:** Always run `.\u002Fgradlew build -x test` (or the equivalent compile task) after running OpenRewrite to ensure no compilation errors were introduced.\n\n## Known Limitations & Troubleshooting\n*   **Static Imports Dropped on Class Rename:** When using `ChangeType` to rename a class, OpenRewrite may sometimes drop static imports for fields\u002Fconstants belonging to the old class instead of updating them to the new class. If compilation fails due to \"cannot find symbol\" for a constant after a class rename, manually restore the static import (e.g., `import static com.new.ClassName.CONSTANT;`).\n*   **Continuous Improvement:** If any new issues or edge cases are found while running the refactoring (e.g., build failures, formatting issues, or missed transformations), you **MUST** proactively ask the user if you should permanently update this skill file (`SKILL.md`) and its accompanying scripts (`scripts\u002Frun_rewrite.sh`, `scripts\u002Fsafe_rename.py`) to fix the issue for future use. Do not wait for the user to prompt you to fix the infrastructure.\n",{"name":5,"description":7},"master","d324350f821b64225193ae70661c8f8e16dd818c",".gemini\u002Fskills\u002Fjava-ast-refactoring",306,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus","https:\u002F\u002Fregistry.google","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-11 05:11:28",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add google\u002Fnomulus --skill java-ast-refactoring",{"tool":60,"command":61},"bunx","bunx skills add google\u002Fnomulus --skill java-ast-refactoring",{"tool":63,"command":64},"pnpm","pnpm dlx skills add google\u002Fnomulus --skill java-ast-refactoring","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002FSKILL.md",true,[68,74,80],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Frewrite_recipes.md","REFERENCE","参考文档",2712,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Freferences\u002Frewrite_recipes.md",{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"scripts\u002Frun_rewrite.sh","SCRIPT","脚本",2302,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Frun_rewrite.sh",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fsafe_rename.py",1997,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fjava-ast-refactoring\u002Fscripts\u002Fsafe_rename.py",[85],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":39},"01M6997NVG50EQYBPF3ZJ63RP5","pr-polisher","Automated pre-flight checklist to polish PRs. Use this before declaring a task or PR complete to automatically verify license headers, commit hygiene, formatting, and codebase mandates.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fnomulus\u002Fblob\u002Fmaster\u002F.gemini\u002Fskills\u002Fpr-polisher\u002FSKILL.md",[],[92,93,94,95,96,97,98,99,100,101,102,103,34,104,105,106,107],"pr","polisher","pr polisher","task","prs","codebase","headers","commit hygiene","complete","hygiene","formatting","checklist","polish","verify","license","commit"]