AgentSkillsCN

17th-code-analyzer

当用户询问代码质量、代码重复、死代码,或寻找优化机会时,可使用此技能。 借助GPT-5.2-Codex,对已暂存的变更以及周边代码进行分析。 自动触发的指令包括:“代码重复”、“无用代码”、“优化”、“代码质量”、“代码重复”、“死代码”。 此技能适用于代码卫生维护、PR前的质量检查,以及重构优化的机会。 不适用于:运行测试、编写代码、或进行代码正确性审查。

SKILL.md
--- frontmatter
name: 17th-code-analyzer
description: |
  Use this skill when user asks about code quality, duplications, dead code, or optimization opportunities.
  Analyzes staged changes AND surrounding code using GPT-5.2-Codex.
  Auto-triggers on: "중복 코드", "불필요한 코드", "최적화", "code quality", "duplications", "dead code"
  Appropriate for: code hygiene, pre-PR quality check, refactoring opportunities.
  Not appropriate for: running tests, writing code, code review for correctness.

Code Analyzer

Analyze staged code and surrounding context for duplications, dead code, and optimization opportunities using GPT-5.2-Codex.

Usage

code
/code-analyzer              → Codex high (default)
/code-analyzer deep         → Codex xhigh

Argument Parsing

Keywords (reserved):

  • deep → Use xhigh effort instead of high

Parsing Logic

code
args = split(input)
effort = "high"

for arg in args:
    if arg == "deep":
        effort = "xhigh"

Result Mapping

Inputeffort
(none)high
deepxhigh

Analysis Scope

ScopeDescription
Staged filesProduction + test code in git staged
Surrounding codeSame package/directory, related modules

Analysis Items

ItemDescription
DuplicationsSimilar code patterns, copy-paste code
Dead codeUnused functions, imports, variables
OptimizationsPerformance improvements, inefficient patterns
ConsistencyPattern alignment with existing codebase

Implementation

Invoke the 17th-code-analyzer subagent:

code
Task(
    description="Analyze code quality ({effort})",
    subagent_type="17th-code-analyzer",
    prompt="""
Analyze code quality for staged changes and surrounding code.

Configuration:
- Effort: {effort}  (high or xhigh)
- Project root: {project_root}
""",
    run_in_background=true
)

Auto-Trigger

When skill auto-triggers (no args), uses defaults:

  • Effort: high

Output

  • Report: .kkachi/{branch_name}/completed/code-analyzer-{epoch_timestamp}.md
  • Summary: duplications, dead code, optimizations found
  • Recommendations: prioritized action items

Examples

Inputeffort
(none)high
deepxhigh

Notes

  • Uses GPT-5.2-Codex for all analysis
  • Analyzes staged changes + surrounding code
  • Supports Go, Python, Dart, TypeScript, JavaScript
  • Results verified before reporting
  • Ensure .kkachi/ is in .gitignore