generic

A general guide for adding the same code-refactoring instructions to tools that accept system prompts, custom instructions or project rules. Refactoring means improving code structure while preserving its intended behaviour.

In plain words
What is it for?
Use it with tools such as Cursor, Copilot, Continue, Windsurf or Zed by placing the shared PROMPT.md content in the tool's supported rules location.
Why use it?
It shows how to make an agent follow a consistent read, diagnose, plan, execute and test process, even when the tool uses different configuration 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/generic
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 900 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.00900
Opus 5 $0.00000 $0.00450
Sonnet 5 $0.00000 $0.00180
Haiku 4.5 $0.00000 $0.00090

Measured yesterday against content hash f67958e28a8c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generic 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 yesterday.

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 PROMPT.md \
agents/generic.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Setup: Any Agent or CLI

If your tool accepts a system prompt, custom instructions, or a rules file — this skill works with it.

The Universal Pattern

Every agent has one of these mechanisms:

1. System prompt / instructions field

Paste the contents of PROMPT.md into whatever your tool calls its "system prompt", "instructions", "custom instructions", "rules", or "persona".

2. Rules / context file in the project

Many tools automatically load markdown files from your project:

Tool File to create
Cursor .cursor/rules/refactor.mdc
Copilot .github/copilot-instructions.md
Continue .continuerules
Windsurf .windsurfrules
Zed .rules
Aider CONVENTIONS.md
Any tool with auto-load Check your tool's docs for the filename

In all cases, the content is the same — paste or symlink PROMPT.md:

# Download once
curl -o PROMPT.md \
  https://raw.githubusercontent.com/MuhiminOsim/code-refactoring-skill/main/PROMPT.md

# Then copy to the right location for your tool
cp PROMPT.md .github/copilot-instructions.md   # Copilot
cp PROMPT.md .cursor/rules/refactor.mdc        # Cursor
cp PROMPT.md .windsurfrules                    # Windsurf
cp PROMPT.md .continuerules                    # Continue
cp PROMPT.md CONVENTIONS.md                    # Aider

3. CLI flag

Many CLI tools accept a system prompt as a flag:

# Generic pattern
your-ai-cli --system-prompt "$(cat PROMPT.md)" "refactor src/orders.py"

# llm (Simon Willison's llm)
llm -s "$(cat PROMPT.md)" "refactor this function"

# sgpt / shell_gpt
sgpt --role refactor "extract the discount logic"

# Gemini CLI
gemini --system-instruction "$(cat PROMPT.md)" "refactor src/orders.ts"

# Amazon Q CLI
q chat --context "$(cat PROMPT.md)"

4. API call

If you're calling an LLM API directly:

# Any OpenAI-compatible API
response = client.chat.completions.create(
    model="your-model",
    messages=[
        {"role": "system", "content": open("PROMPT.md").read()},
        {"role": "user", "content": "Refactor the processOrder function"}
    ]
)

Read the full file on GitHub · 121 lines

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. yesterday First seen · 121 lines · 0 tokens per session scan A f67958e28a8c

Subscribe to this mod's changes

generic 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 900 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.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens