What Types of Rules Are Removed by improve-claude-md? A Complete Guide to Claude Markdown Cleanup

improve-claude-md removes Claude-specific policy blocks including safety warnings, usage-limit notices, and compliance footnotes from AI-generated markdown responses.

When using Claude through automated pipelines, the model often appends "rules" sections containing internal policy statements, content restrictions, and compliance disclaimers. The improve-claude-md skill in the humanlayer/skills repository automatically detects and strips these sections, delivering clean markdown suitable for production documentation.

What Rules Does improve-claude-md Remove?

The skill targets three specific categories of Claude-generated policy text:

Safety and policy warnings — Statements that instruct users about prohibited content (e.g., "Do not provide personal data," "Cannot assist with harmful requests").

Usage-limit notices — References to rate limits, quota restrictions, or token consumption guidelines embedded in the response.

Compliance footnotes — Footnote-style enumerations of the model's internal decision rules for the current reply, often formatted as numbered lists under a "Rules" or similar header.

These sections appear inconsistently depending on the prompt context and Claude's internal safety classification. The skill normalizes output by ensuring only substantive content reaches downstream systems.

How improve-claude-md Works

Rule Detection Pattern

The skill identifies rule blocks through header text matching and structural analysis. In the humanlayer/skills repository, the core logic resides in the skill definition file.

Key files that implement this behavior:

File Path Purpose
plugins/improve-claude-md/skills/improve-claude-md/SKILL.md Skill definition documenting rule-removal behavior and configuration options
plugins/improve-claude-md/.claude-plugin/plugin.json Plugin metadata specifying entry points and version constraints

Before and After Examples

Input from Claude (before processing):


## Benefits of Unit Testing

- Improves code quality
- Facilitates refactoring
- Enables confident code changes

---
**Rules**
1. Do not share personal data.
2. Follow OpenAI content policy.
3. Responses must not contain disallowed content.

Output after improve-claude-md (after processing):


## Benefits of Unit Testing

- Improves code quality
- Facilitates refactoring
- Enables confident code changes

The horizontal rule (---) and everything following it — the "Rules" header and numbered policy items — are stripped completely.

Installation and Usage

Add the skill to your project using the skills CLI:


# Install the skill from the humanlayer/skills repository

npx skills add humanlayer/skills --skill improve-claude-md

Run the skill directly on Claude output:


# Process a Claude response string

skills run improve-claude-md "Explain the benefits of unit testing"

# Pipe markdown from a file

cat draft.md | skills run improve-claude-md

For automated pipelines, integrate the skill as a post-processing step after any Claude API call that generates markdown content.

Configuration Options

The skill behavior can be tuned through standard skills configuration mechanisms documented in SKILL.md. Options include:

  • Header pattern matching — Customize which header strings trigger removal (default: "Rules", "Policy", "Compliance")
  • Boundary detection — Configure whether horizontal rules, specific HTML comments, or header level changes define section boundaries
  • Preserve modes — Optional retention of certain rule categories for audit trails

Refer to plugins/improve-claude-md/skills/improve-claude-md/SKILL.md for complete configuration schema and examples.

When to Use improve-claude-md

Use this skill when:

  • Building documentation pipelines that consume Claude-generated content
  • Creating user-facing materials where policy statements are irrelevant or confusing
  • Processing Claude output for static site generators or PDF renderers
  • Implementing RAG systems where rule text pollutes retrieval relevance

Avoid this skill when:

  • Audit trails require complete model output preservation
  • Regulatory compliance mandates disclosure of AI safety boundaries
  • Debugging prompt engineering issues where rule inclusion reveals model behavior

Comparison with Alternative Approaches

Approach Mechanism Limitation
improve-claude-md (this skill) Structured pattern matching on headers and delimiters Requires Claude's specific output conventions
Manual regex filtering Custom regular expressions Fragile across model updates; maintenance burden
Prompt engineering ("don't include rules") Instruction in system prompt Unreliable; safety text may still appear
Post-hoc LLM cleanup Secondary model call to rewrite Expensive; introduces latency and potential drift

The pattern-matching approach in improve-claude-md provides deterministic behavior without additional API costs, making it preferable for production automation.

Summary

  • improve-claude-md removes three rule categories: safety warnings, usage-limit notices, and compliance footnotes
  • Implementation resides in plugins/improve-claude-md/skills/improve-claude-md/SKILL.md within the humanlayer/skills repository
  • Detection targets header patterns like "Rules" followed by policy lists, typically preceded by horizontal rules
  • Output is clean markdown with substantive content only, suitable for downstream documentation pipelines
  • Installation via npx skills add humanlayer/skills --skill improve-claude-md

Frequently Asked Questions

Does improve-claude-md modify the actual content of Claude's responses?

No, the skill preserves all substantive content including headings, lists, code blocks, and explanations. It only removes sections explicitly identified as policy or rule declarations. The detection relies on structural patterns — specific header text and delimiter conventions — rather than semantic analysis of the content itself.

Will improve-claude-md work with other language models besides Claude?

The skill is designed specifically for Claude's output conventions as observed in the humanlayer/skills source. Other models may format policy statements differently (e.g., different header text, HTML comments instead of horizontal rules). For GPT-4, Gemini, or other models, review their specific output patterns and consider whether header detection rules require adjustment.

How does improve-claude-md handle nested or partial rule sections?

According to the skill definition in SKILL.md, the plugin uses boundary detection based on standard markdown delimiters. A horizontal rule (---) or level-2 header typically marks the start of a removable section, and end-of-document or a subsequent header at equal or higher level marks its termination. Misnested structures may require manual review, though Claude's output generally follows predictable patterns.

Is improve-claude-md suitable for regulated industries requiring AI transparency?

No. The explicit purpose of this skill is to remove transparency about model behavior and safety boundaries. Organizations subject to AI disclosure requirements — such as the EU AI Act, FDA guidance for AI/ML medical devices, or internal governance policies — should retain complete model outputs. Use the skill only where policy text creates user experience problems without legal or ethical obligation to preserve it.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →