Refactor Context logo

Refactor Context

Community
aktsmm
refactor-context

指定スコープの instruction / agent / skill をコンテキスト最適化する。単一ファイルも複数ファイル群の MECE 横断レビューも扱う。構造レビューは review-workflow-structure の担当

Overview

Publisheraktsmm
RepositoryAgent-Skills
Skill namerefactor-context
Stars
27
Forks
5
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by aktsmm on GitHub. Read the source before you install it.

Installation

Install the Refactor Context AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/aktsmm/Agent-Skills/tree/master/refactor-context
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/aktsmm/Agent-Skills.git /tmp/Agent-Skills
mkdir -p .claude/skills
cp -r /tmp/Agent-Skills/refactor-context .claude/skills/refactor-context
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Refactor Context in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Refactor Context on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Refactor Context is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

refactor context

When to Use

  • 使う: 単一ファイル内のコンテキストを圧縮・整理
  • 使う: 複数ファイル群を横断して SSOT / DRY / SRP / MECE / スコープ適合を見る
  • 使わない: SKILL 本文の設計、新規 agent / workflow の scaffold

モードとスコープ

  • モード: 自動 / オート / auto 含む → オート(不可逆・影響大は提案止まり)。それ以外は確認モード
  • スコープ: 指定なし は対象のみ / ALL / Global (=~/.copilot/ の instructions・skills・agents) / ALL + Global
  • 対象外(明示指定なき限り): .github/skills/, .vscode/settings.json
  • スコープ境界: Global 対象は ~/.copilot 内で完結させる。明示許可なしに現在の workspace / repo へ移動・分割・SSOT 化を提案しない
  • 現在 workspace は参照情報としてだけ使う。配置先提案の既定にしない

判断ルール

目標: 対象ファイルを AI が判断できる最小情報に圧縮する。人間向け可読性は二次

  • 削除を先に判定し、必要な残りだけを圧縮する。記述なしでも正常・例外・停止時の判断が変わらない一般論 / 自明な説明 / 装飾 / metadataの言い換え / 重複 / 役割が消えた節 / 無効なルール・exampleは、短く言い換えて残さない
  • 残す: 判断に必要なユーザー固有事実 / ID / パス / 方針、参考 URL・判断に効く設計根拠、Example(最低 1 つ)、非自明な手順。具体的な失敗条件・引数・承認範囲・未検証要件・停止・復旧手順は自明扱いせず残す
  • 圧縮: 必要だが冗長な定義・前置き・エラー例。統合済みの重複を削るときは、許可スコープ内の参照先と実際の読み込み経路で同じ判断が成立することを確認する
  • 履歴: 古さだけで削除しない。現行判断に不要で原文の保存を確認できた履歴は削除候補にし、必要なら固定リビジョン等の再取得先だけ残す。未保存の追記は保存を確認するまで保持する
  • 削除禁止: 運用メタコメント(syncToGlobal / author / repository / license / copyright)

レビュー観点

  • SSOT / DRY / SRP / スコープ適合
  • applyTo / 常時ロード / 手動呼び出しの整合
  • agent は本文の tool reference が frontmatter tools と整合しているか(不一致は lint エラー)
  • 適用範囲・ルーティング(いつ使う / 使わない / どこへ逃がす)が、見出しだけに依存せず各ルールで明確か
  • 意味保持: 主語・対象・適用条件、必須/任意、優先/禁止、例外、停止・検証条件を変えていないか。統合で対象を意図せず広げない(例: script不在の実行停止を新規ファイル作成禁止へ広げない)。意図した挙動変更は圧縮と区別し、承認範囲を確認する
  • 判断の整合: 経路選択 → 実行 → 検証 → 停止がつながり、後続ルールが先に選んだ経路や制約を覆さないか
  • Global 対象の逃がし先は ~/.copilot の instruction / agent / skill に限る。workspace へ逃がす案は「明示許可が必要」と書く

複数ファイル時のみ追加:

  • MECE: 同じ概念の重複定義なし / 想定タスクに空白なし
  • 配置適合(always-on / scoped / 手動参照)
  • 逃がし先有効性: 対象スコープ内の applyTo 付き instruction / 明示呼び出し型 agent・skill / references のいずれか。不可: 別スコープへの移動・参照リンク(明示許可がある場合を除く)
  • ファイル提案順序: 削除(役割消失 / 重複) → 既存への統合 → 既存ファイル内の整理 → 分割 → 新規追加。新規ファイルは最後の手段
  • Global 対象のファイル提案順序: Global 内で削除 → Global 既存へ統合 → Global 既存内で整理 → Global 内で分割 → Global 新規追加。workspace 化は提案順序に含めない
  • ファイル削除は破壊的なのでオートモードでも提案止まり

手順

  1. 対象全件の全文で削除候補を先に判定し、必要な残りを圧縮する。直近の変更節だけで評価しない。Before→After を提示(文字数は改行を同じ条件で計測し、行数/見出し数も示す)
  2. 文字数・行数は補助指標とし、短くても曖昧さ・矛盾・重複をレビューする。明確な問題がなければ変更不要
  3. 適用は 1 ファイルずつ
  4. 適用後は原文と変更後で、対象に該当する正常時・例外時・停止時の代表入力に対する判断を比較する。意図しない差を修正し、キーワード残存だけで合格にしない。複数ファイル時は MECE(重複消失 / 空白未増)も確認

Frequently asked questions

What does the Refactor Context AI skill do?

指定スコープの instruction / agent / skill をコンテキスト最適化する。単一ファイルも複数ファイル群の MECE 横断レビューも扱う。構造レビューは review-workflow-structure の担当

Why use Refactor Context on TypingMind?

Because you install it once and use it with any model. Refactor Context is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Refactor Context in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/aktsmm/Agent-Skills/tree/master/refactor-context. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Refactor Context?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Refactor Context?

As many as you like. As long as a model supports skills, you can use Refactor Context with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Refactor Context AI skill free?

It is published on GitHub by aktsmm. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇