원클릭으로
refactor-safely
Plan and execute safe refactoring using dependency analysis
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Plan and execute safe refactoring using dependency analysis
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Register repositories, maintain multi-repo graph freshness, and search across repos with dagayn.
Read a Markdown document with full dependency context — query the dagayn graph first, pre-read referenced docs and code by edge type, then read the body.
Author Markdown documents (READMEs, design docs, RFCs) so dagayn extracts correct dependency edges. Four-stage flow — outline & sort, draft & verify, polish, summary.
Evaluate architecture signals through the unified dagayn dispatcher
Systematically debug issues using graph-powered code navigation
Navigate and understand codebase structure using the knowledge graph
| name | refactor-safely |
| description | Plan and execute safe refactoring using dependency analysis |
Use the knowledge graph to plan and execute refactoring with confidence.
get_minimal_context_tool(task="<refactor goal>") to check graph freshness,
risk, and suggested next tools.refactor_tool with mode="suggest" for evidence-ranked remove, move,
split, and document candidates.refactor_tool with mode="dead_code" only when the suggested remove
candidates need a deeper dead-code drill-down.refactor_tool with mode="rename" to preview all affected locations.query_graph_tool for specific callers, callees, tests, docs, imports,
or children before considering a raw neighborhood traversal. Use
traverse_graph_tool only when the refactor candidate has a known start node
and the question is broader than one relationship pattern.apply_refactor_tool with dry_run=True first, then apply with the
refactor_id only after the diff is acceptable.query_graph_tool(pattern="docs_for", target="<path::symbol>", detail_level="minimal")
for specs/runbooks/issue notes attached to code, and
query_graph_tool(pattern="implementations_of", target="<doc.md>::<section-slug>", detail_level="minimal")
when the refactor starts from a Markdown contract section.review_tool(mode="changes") and inspect analysis_summary to verify
impact, recommended tests, affected flows, and architecture risks.review_tool(mode="changes").analysis_summary first; call
review_tool(mode="impact") or review_tool(mode="affected_flows") only
when a wider drill-down is needed.find_large_functions_tool to identify decomposition targets.dagayn: documentation directives. Update Markdown
implemented-by path::symbol targets after code renames, and update code
implements docs/spec.md#Section targets after doc heading/path changes.
Do not add duplicate inverse directives unless there are two distinct claims.top_n or follow-up graph queries.When a split suggestion contains evidence.concern_separation, treat it as a
role-aware refactoring profile, not a verdict that the function is bad.
role first. Boundary functions, CLI handlers, adapters, coordinators,
and test helpers may legitimately combine IO and orchestration.score against split_score_threshold. A score over the threshold means
concern pressure can justify reviewing a large function for extraction; it
does not prove that extraction is safe or required.reason_codes to identify the suspected pressure: callee community spread,
callee scope spread, branch pressure, side-effect pressure, implicit context,
or low context clarity.evidence.purity_likelihood only as side-effect evidence. It is not a
proof of functional purity.missingness before acting. Low source, call, community, or unresolved
call evidence lowers confidence and should trigger a source read or graph
follow-up before recommending an edit.action as the first investigation step. Prefer extracting one cohesive
decision, transformation, or context object before moving IO or changing public
signatures.Use MCP tools first. If the current MCP server profile does not expose a
refactor-only tool such as apply_refactor_tool or find_large_functions_tool,
run the same implementation through the CLI without restarting the agent:
dagayn tool refactor_tool --arg mode='"suggest"' --arg limit=10
dagayn tool refactor_tool --arg mode='"rename"' --arg old_name='"old_symbol"' --arg new_name='"new_symbol"'
dagayn tool apply_refactor_tool --arg refactor_id='"refactor_123"' --arg dry_run=true
dagayn tool query_graph_tool --arg pattern='"docs_for"' --arg target='"src/app.py::handler"'
dagayn tool query_graph_tool --arg pattern='"implementations_of"' --arg target='"docs/spec.md::contract-section"'
get_minimal_context_tool(task="<your task>") before any other graph tool.detail_level="minimal" on all calls. Only escalate to "standard" when minimal is insufficient.