cody

A way to give Sourcegraph Cody, a coding assistant, shared instructions for refactoring projects. The instructions can be added in Cody's settings or stored in a project-specific .cody/instructions.md file.

In plain words
What is it for?
Use it to refactor functions, split oversized classes, and make changes across related files with project-specific instructions.
Why use it?
It keeps refactoring guidance consistent across Cody conversations and projects. Cody can also use its codebase-wide view when a change spans multiple files.

Agent

Install

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.

agentmods
npx agentmods add agents/muhiminosim/code-refactoring-skill/cody
Clone the repo
git clone --depth 1 https://github.com/MuhiminOsim/code-refactoring-skill
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 243 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00243
Opus 5 $0.00000 $0.00121
Sonnet 5 $0.00000 $0.00049
Haiku 4.5 $0.00000 $0.00024

Measured 2d ago against content hash 7c7ba29ca3ae, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cody scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -o .cody/instructions.md \
agents/cody.md · 42 lines

What it actually says

Setup: Sourcegraph Cody

Via Custom Instructions

VS Code:

  1. Open Cody panel → Settings → Custom Instructions
  2. Paste contents of PROMPT.md

JetBrains:

  1. Settings → Tools → Cody → Custom Instructions
  2. Paste contents of PROMPT.md

Via .cody/instructions.md (project-scoped)

mkdir -p .cody
curl -o .cody/instructions.md \
  https://raw.githubusercontent.com/MuhiminOsim/code-refactoring-skill/main/PROMPT.md

Cody loads .cody/instructions.md automatically for the project.

Usage

In the Cody chat panel:

Refactor the processOrder function

Extract the discount calculation into a separate function

This class is a god object — help me split it up

Note

Cody's strength is its codebase-wide context (code graph). Combine this skill with @codebase context for large refactorings that span many files.

@codebase Refactor: extract a UserRepository from UserService
Changes

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.

  1. 2d ago First seen · 42 lines · 0 tokens per session scan A 7c7ba29ca3ae

Subscribe to this mod's changes

cody is an agent published in the GitHub repository MuhiminOsim/code-refactoring-skill (5 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 243 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.