Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/dhevenddra/forensic-deepdive/codebase-refactoringnpx skills add Dhevenddra/forensic-deepdive --skill codebase-refactoringgit clone --depth 1 https://github.com/Dhevenddra/forensic-deepdiveWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00122 | $0.00596 |
| Opus 5 | $0.00061 | $0.00298 |
| Sonnet 5 | $0.00024 | $0.00119 |
| Haiku 4.5 | $0.00012 | $0.00060 |
Grade A, and why
codebase-refactoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 35 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Codebase refactoring
Coordinate multi-file structural changes against the codebase's coupling rules and co-change history. A refactor is not 'rename + reformat' — it's 'move responsibility while preserving every caller's contract.'
When to use
- User wants to extract / inline / split / consolidate code across files.
- Question shape: 'refactor X to do Y', 'extract method', 'split this class into A and B', 'consolidate this duplicated logic'.
When NOT to use
- Change is contained in one file → just do the edit.
- User is investigating a bug →
codebase-debugging. - User is reading to understand →
codebase-exploring.
How to answer
- Read
docs/codebase/AGENT_BRIEF.mdfirst. The 'if you touch X also touch Y' rules pre-encode the co-change neighborhood — refactors that ignore them break things in adjacent files. - Read
docs/codebase/HOTPATHS.md'Co-change clusters' section. Files that historically co-change with the target should be reviewed in the same PR. - If MCP server is running:
context(target_symbol)— full neighborhood (callers, callees, parent class, siblings, members, recent commits).impact(target_symbol, direction='upstream')— every caller that will need to compile after the change.
- Surface the dominant author from ARCHAEOLOGY.md if the target file has one — they own the historical context.
Pitfalls
- Don't refactor a symbol with AMBIGUOUS callers without listing them first — the human should resolve the ambiguity.
- Don't refactor a symbol whose co-change cluster includes files the user didn't mention — flag those files, ask if they should be in scope.
- Don't auto-rename across a polyglot graph (DEC-012's language-scoped rule) without checking that the symbol's other-language references are intentional.
Citation rule
Cite every coupling rule (docs/codebase/AGENT_BRIEF.md:23) and every co-change pair (docs/codebase/HOTPATHS.md:78). Never propose a multi-file refactor without first showing the impact list.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 35 lines · 122 tokens per session scan A e8531de83f21
codebase-refactoring is a skill published in the GitHub repository Dhevenddra/forensic-deepdive (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 122 tokens to every session and 596 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
mistakes
List past mistakes engram has learned in this project — failures, regressions, broken assumptions. Use before starting a non-trivial change to surface relevant prior failures, or when debugging to check if this issue has been seen before.
query
Query engram's local knowledge graph for structural context — function calls, imports, type relationships, mistake history, ADRs. Use when the user asks "how does X work in this project", "what calls Y", "where is Z used", or any structural question that doesn't need file content.
chatcrystal-task-writeback
Write reusable ChatCrystal task memories after substantive work completes. Use when implementation or debugging produced a durable fix, pitfall, pattern, or decision worth preserving, and when the environment can either persist it through writetaskmemory or emit a structured memory candidate for later save.
chatcrystal-debug-recall
Recall ChatCrystal memories for debugging tasks involving failing tests, compiler errors, runtime exceptions, dependency issues, environment breakage, or performance regressions. Use when historical root causes, fixes, or pitfalls may accelerate diagnosis before proposing a fix.
chatcrystal-task-recall
Recall project-first and global-supplement ChatCrystal memories before substantive implementation, refactoring, migration, configuration, investigation, or optimization work. Use when the task is non-trivial, has repository or project context, and prior fixes, decisions, pitfalls, or reusable patterns may change the…
slm-graph
Index and query a codebase as a structural graph — build the code graph, trace blast radius of a change, find callers/callees/inheritors, semantic code search by meaning, assemble PR review context, and detect what changed since last index. Use when the user asks how code connects, what breaks if X changes, what calls…