Skip to content

feat: add context-audit skill (Vesely/skills)#80

Merged
izo merged 4 commits intomainfrom
claude/audit-context-usage-UJw2a
Apr 15, 2026
Merged

feat: add context-audit skill (Vesely/skills)#80
izo merged 4 commits intomainfrom
claude/audit-context-usage-UJw2a

Conversation

@izo
Copy link
Copy Markdown
Owner

@izo izo commented Apr 14, 2026

Ports Vesely/skills/context-audit into the ulk skill ecosystem.
Audits MCP servers, CLAUDE.md bloat, skills size, settings gaps,
and missing .claudeignore — returns a 0-100 health score with
prioritised fixes and optional auto-apply.

  • community-skills/context-audit/SKILL.md (5-step audit framework)
  • install.sh: _install_context_audit_skill() → ~/.claude/skills/context-audit/
  • CLAUDE.md: listed under Community Skills

Invoke with /context-audit after running /context.

https://claude.ai/code/session_01GEeL7L13c3xJMNxGPFm6up

Summary by CodeRabbit

  • New Features
    • Added context-audit agent and community skill for auditing Claude Code setup efficiency.
    • Performs comprehensive analysis of MCP servers, instructions, skills, settings, and housekeeping.
    • Generates a 0–100 health score with token-waste and context-bloat detection.
    • Provides auto-fix recommendations with user confirmation.
    • Automatically included in default installation.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ulk-site Ready Ready Preview, Comment Apr 14, 2026 9:07pm

Request Review

claude added 4 commits April 14, 2026 21:05
Ports Vesely/skills/context-audit into the ulk skill ecosystem.
Audits MCP servers, CLAUDE.md bloat, skills size, settings gaps,
and missing .claudeignore — returns a 0-100 health score with
prioritised fixes and optional auto-apply.

- community-skills/context-audit/SKILL.md  (5-step audit framework)
- install.sh: _install_context_audit_skill() → ~/.claude/skills/context-audit/
- CLAUDE.md: listed under Community Skills

Invoke with /context-audit after running /context.

https://claude.ai/code/session_01GEeL7L13c3xJMNxGPFm6up
Ajoute l'agent 53-context-audit dans agents/session/ :
7 phases (prérequis /context, MCP, CLAUDE.md, skills, settings,
housekeeping, score 0-100, auto-fix optionnel).

Complète la skill /context-audit (community-skills/) — l'agent
expose le même audit via /ulk:context-audit avec le protocole ulk
(phases, scoring, rapport formaté, auto-fix guidé).

- agents/session/53-context-audit.md
- agents/registry.json + registry.md régénérés (74 agents)
- CLAUDE.md : prochain numéro → 54

https://claude.ai/code/session_01GEeL7L13c3xJMNxGPFm6up
- README.md : ligne context-audit (1) dans la table Community Skills
- install.sh : help · wizard · résumé · options summary mis à jour
- site/install.astro : mention context-audit dans les skills bundlés

https://claude.ai/code/session_01GEeL7L13c3xJMNxGPFm6up
Les agents 53 (routine) et 54 (ci-guard) étaient déjà pris dans main.
- agents/session/53-context-audit.md → 55-context-audit.md
- Titre interne mis à jour (53→55)
- CLAUDE.md : Context Audit (55) + prochain → 56
- registry.json + registry.md régénérés (76 agents)

https://claude.ai/code/session_01GEeL7L13c3xJMNxGPFm6up
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new context-audit community skill that audits Claude Code session health, detecting token waste and context bloat by analyzing MCP server configurations, CLAUDE.md files, installed skills, settings, and housekeeping. The skill is registered in the agent registry, added to default installations, and documented across configuration files.

Changes

Cohort / File(s) Summary
Documentation & Metadata
CLAUDE.md, README.md, site/src/pages/install.astro
Added context-audit to community skills lists with invocation syntax and scope descriptions. Updated installation documentation to include the new skill in default setup.
Agent Registry
agents/registry.json, agents/registry.md
Incremented registry count from 75 to 76 and registered new context-audit agent in session workflow with invocation phrases (/ulk:context-audit, "context audit", French variants), model sonnet, phase review, and required tools (Read, Glob, Grep, Bash, AskUserQuestionTool).
Agent Definition
agents/session/55-context-audit.md
Introduced comprehensive agent implementation that orchestrates multi-phase audit: validates /context output, audits MCP servers for idle/redundant instances, scans CLAUDE.md files for bloat (default/contradictory/redundant instructions), evaluates skill quality, inspects settings for recommended values, checks housekeeping (memory directories, .claudeignore), computes 0–100 health score with labeled bands, and offers auto-fix flow with confirmation.
Community Skill
community-skills/context-audit/SKILL.md
Created skill documentation outlining audit workflow: enumerates MCP servers and token costs, filters CLAUDE.md files by five rule categories, evaluates installed skills against quality thresholds, inspects settings for safe defaults, performs housekeeping checks, calculates health score with structured deductions, and specifies safe vs. manual auto-fix phases.
Installation Script
install.sh
Added _install_context_audit_skill() function to copy skill from source to $SKILLS_DIR/context-audit with dry-run compatibility, updated wizard help/summary text to include context-audit, and ensured skill appears in final installation report.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Agent as Context-Audit<br/>Agent
    participant FS as File System
    participant Settings as Settings<br/>System
    participant Scorer as Score<br/>Calculator
    
    User->>Agent: /ulk:context-audit<br/>(trigger audit)
    Agent->>FS: Request /context output
    FS-->>Agent: Context data
    
    Agent->>Settings: Read ~/.claude/settings.json
    Settings-->>Agent: MCP server config
    Agent->>Agent: Classify servers<br/>(idle/redundant)
    
    Agent->>FS: Scan CLAUDE.md files
    FS-->>Agent: File contents & line counts
    Agent->>Agent: Filter by rules<br/>(5 categories)
    
    Agent->>FS: List ~/.claude/skills/
    FS-->>Agent: Installed skills
    Agent->>FS: Check SKILL.md sizes
    FS-->>Agent: Skill metadata
    
    Agent->>FS: Check housekeeping<br/>(.claudeignore, memory)
    FS-->>Agent: Housekeeping status
    
    Agent->>Scorer: Deductions & thresholds
    Scorer-->>Agent: Health score (0–100)
    
    Agent->>User: Structured report<br/>+ auto-fix options
    User->>Agent: Confirm auto-fix
    Agent->>FS: Apply safe changes
    FS-->>Agent: Changes applied
    Agent->>User: Results & diffs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hop! Auditing code with whiskers twitched tight,
MCP servers checked, instructions held right,
Health scores computed, token waste detected,
Context stays lean, no bloat—all protected!
From fifty-five hops, this skill brings the light.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a context-audit skill. It is concise, directly related to the primary changeset objective, and provides enough context (including source attribution 'Vesely/skills') for readers to understand the contribution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/audit-context-usage-UJw2a

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
community-skills/context-audit/SKILL.md (1)

55-59: Make fenced blocks markdownlint-compliant.

Add code fence languages and keep blank lines around the health-label table to avoid lint warnings.

🧹 Proposed markdown cleanup
-Find all CLAUDE.md files:
-```
+Find all CLAUDE.md files:
+```text
 ~/.claude/CLAUDE.md          (global)
 <project>/CLAUDE.md          (project)
 <project>/.claude/rules/*.md (path-specific rules)

@@
-Health labels:
-| Score | Label |
+Health labels:
+
+| Score | Label |
|-------|-------|
| 90–100 | ✅ CLEAN |
| 70–89 | ⚠️ NEEDS WORK |
| 50–69 | 🔴 BLOATED |
| 0–49 | 💀 CRITICAL |
@@
-Output a structured report:

- +Output a structured report: + +text
CONTEXT AUDIT —
══════════════════════════════════════════
@@
-## Reference — Standard .claudeignore

- +## Reference — Standard .claudeignore + +gitignore
node_modules/
dist/
build/

</details>


Also applies to: 141-143, 154-184, 211-227

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @community-skills/context-audit/SKILL.md around lines 55 - 59, The markdown
has unlanguaged fenced code blocks and missing blank lines around the
health-label table which triggers markdownlint warnings; update each unlanguaged
fence instances (e.g., the "Find all CLAUDE.md" block, the "Output a structured
report" block, and the "## Reference — Standard .claudeignore" block) to include
an appropriate language tag such as text or gitignore, and ensure there is
a blank line before and after the health labels table (the "| Score | Label |"
table) and any other tables mentioned (also apply the same fenced-language and
surrounding blank-line fixes to the other affected sections noted in the
comment).


</details>

</blockquote></details>
<details>
<summary>agents/session/55-context-audit.md (1)</summary><blockquote>

`1-17`: **Frontmatter and placement follow agent conventions.**

`model: sonnet`, `phase: review`, and the `agents/session/` location are consistent for this new agent.

As per coding guidelines: Agent `model` field should be set to 'opus' only for a fixed allowlist; all other agents should use 'sonnet', and agent frontmatter must include a `phase:` field.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against the current code and only fix it if needed.

In `@agents/session/55-context-audit.md` around lines 1 - 17, The frontmatter must
use the allowed model and include a phase: verify that the agent's frontmatter
contains model: sonnet (not opus) and includes a phase: field; for this agent
ensure name: context-audit and invocation remain unchanged and that model:
sonnet and phase: review are present in the frontmatter so it complies with the
agent allowlist rules and frontmatter requirements (update model or add phase
only if missing).
```

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Inline comments:
In @install.sh:

  • Around line 607-616: install_context_audit_skill currently copies the skill
    into "$SKILLS_DIR/context-audit" which doesn't match the prefixed glob patterns
    used by cmd_uninstall and cmd_check, leaving the skill orphaned; update the
    install to place the directory with the same prefix used by other community
    skills (e.g., copy to "$SKILLS_DIR/community-context-audit" and adjust the
    printf label), or alternatively update cmd_uninstall and cmd_check to include
    the non-prefixed "context-audit" in their globs — refer to
    install_context_audit_skill, cmd_uninstall, cmd_check, SKILL.md and the
    "$SKILLS_DIR/context-audit" target when making the change.

Nitpick comments:
In @agents/session/55-context-audit.md:

  • Around line 1-17: The frontmatter must use the allowed model and include a
    phase: verify that the agent's frontmatter contains model: sonnet (not opus) and
    includes a phase: field; for this agent ensure name: context-audit and
    invocation remain unchanged and that model: sonnet and phase: review are present
    in the frontmatter so it complies with the agent allowlist rules and frontmatter
    requirements (update model or add phase only if missing).

In @community-skills/context-audit/SKILL.md:

  • Around line 55-59: The markdown has unlanguaged fenced code blocks and missing
    blank lines around the health-label table which triggers markdownlint warnings;
    update each unlanguaged fence instances (e.g., the "Find all CLAUDE.md" block,
    the "Output a structured report" block, and the "## Reference — Standard
    .claudeignore" block) to include an appropriate language tag such as ```text or
labels table (the "| Score | Label |" table) and any other tables mentioned
(also apply the same fenced-language and surrounding blank-line fixes to the
other affected sections noted in the comment).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1105e755-4f40-42e1-90c7-aac74d06dd4e

📥 Commits

Reviewing files that changed from the base of the PR and between aa4a562 and 471b481.

📒 Files selected for processing (8)
  • CLAUDE.md
  • README.md
  • agents/registry.json
  • agents/registry.md
  • agents/session/55-context-audit.md
  • community-skills/context-audit/SKILL.md
  • install.sh
  • site/src/pages/install.astro

Comment thread install.sh
Comment on lines +607 to +616
_install_context_audit_skill() {
local src="$SCRIPT_DIR/community-skills/context-audit"
if [ ! -f "${src}/SKILL.md" ]; then
printf " ${WARN} %-14s ${D}community-skills/context-audit/SKILL.md not found${NC}\n" "context-audit"
return
fi
run rm -rf "$SKILLS_DIR/context-audit"
run cp -r "$src" "$SKILLS_DIR/context-audit"
printf " ${OK} %-14s ${D}/context-audit — token waste + health score${NC}\n" "context-audit"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

context-audit gets installed, but uninstall/check flows don’t track it.

This installs to ~/.claude/skills/context-audit, but cmd_uninstall and cmd_check only handle prefixed globs, so this default skill becomes orphaned after uninstall and invisible in diagnostics.

🔧 Proposed fix
@@
   # Flutter skills (community)
   local n_flutter=0
   for d in "$SKILLS_DIR"/flutter-*/; do
@@
   if [ $n_flutter -gt 0 ]; then
     printf "  ${OK}  Removed  ${D}%s Flutter skills${NC}\n" "$n_flutter"
     removed=$((removed + 1))
   fi
+
+  # context-audit skill (community, default)
+  if [ -d "$SKILLS_DIR/context-audit" ]; then
+    run rm -rf "$SKILLS_DIR/context-audit"
+    printf "  ${OK}  Removed  ${D}context-audit skill${NC}\n"
+    removed=$((removed + 1))
+  fi
@@
-  for d in "$SKILLS_DIR"/ulk-*/ "$SKILLS_DIR"/addy-*/ "$SKILLS_DIR"/a11y-*/ "$SKILLS_DIR"/figma-*/ "$SKILLS_DIR"/kepano-*/ "$SKILLS_DIR"/nothing-*/ "$SKILLS_DIR"/swift-*/ "$SKILLS_DIR"/flutter-*/; do
+  for d in "$SKILLS_DIR"/ulk-*/ "$SKILLS_DIR"/addy-*/ "$SKILLS_DIR"/a11y-*/ "$SKILLS_DIR"/figma-*/ "$SKILLS_DIR"/kepano-*/ "$SKILLS_DIR"/nothing-*/ "$SKILLS_DIR"/swift-*/ "$SKILLS_DIR"/flutter-*/ "$SKILLS_DIR"/context-audit/; do
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 607 - 616, install_context_audit_skill currently
copies the skill into "$SKILLS_DIR/context-audit" which doesn't match the
prefixed glob patterns used by cmd_uninstall and cmd_check, leaving the skill
orphaned; update the install to place the directory with the same prefix used by
other community skills (e.g., copy to "$SKILLS_DIR/community-context-audit" and
adjust the printf label), or alternatively update cmd_uninstall and cmd_check to
include the non-prefixed "context-audit" in their globs — refer to
install_context_audit_skill, cmd_uninstall, cmd_check, SKILL.md and the
"$SKILLS_DIR/context-audit" target when making the change.

@izo izo merged commit bd9eed7 into main Apr 15, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants