基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/manji-0/dagayn --skill refactor-safely命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Make a git worktree usable for dagayn MCP — inherit the main checkout's graph and MCP config, then catch up the branch diff.
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. If graph_health.status is empty (or
ensure_graph_tool is the first next-tool hint), call ensure_graph_tool()
and re-orient before refactor planning.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,
the question is broader than one relationship pattern, and the advanced MCP
surface (or dagayn tool) exposes it.apply_refactor_tool (advanced surface / dagayn 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 (advanced surface / dagayn 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.Default MCP already exposes refactor_tool, review_tool, and
query_graph_tool. Use dagayn tool for advanced helpers such as
apply_refactor_tool and find_large_functions_tool, or when the server
allow-list omitted a default tool:
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 find_large_functions_tool --arg min_lines=80
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.ensure_graph_tool returns.detail_level="minimal" on all calls. Only escalate to "standard" when minimal is insufficient.