improve-claude-md

When the user provides a CLAUDE.md file (or asks you to improve one), rewrite it following the principles and structure below.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "improve-claude-md" with this command: npx skills add dexhorthy/slopfiles/dexhorthy-slopfiles-improve-claude-md

When the user provides a CLAUDE.md file (or asks you to improve one), rewrite it following the principles and structure below.

Core Problem

Claude Code injects a system reminder with every CLAUDE.md that says:

"this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task."

This means Claude will ignore parts of your CLAUDE.md it deems irrelevant. The more content that isn't applicable to the current task, the more likely Claude is to ignore everything — including the parts that matter.

Solution: <important if="condition"> Blocks

Wrap conditionally-relevant sections of the CLAUDE.md in <important if="condition"> XML tags. This exploits the same XML tag pattern used in Claude Code's own system prompt, giving the model an explicit relevance signal that cuts through the "may or may not be relevant" framing.

Principles

  1. Foundational context stays bare, domain guidance gets wrapped

Not everything should be in an <important if> block. Context that is relevant to virtually every task — project identity, project map, tech stack — should be left as plain markdown at the top of the file. This is onboarding context the agent always needs.

Domain-specific guidance that only matters for certain tasks — testing patterns, API conventions, state management, i18n — gets wrapped in <important if> blocks with targeted conditions.

The rule of thumb: if it's relevant to 90%+ of tasks, leave it bare. If it's relevant to a specific kind of work, wrap it.

  1. Conditions must be specific and targeted

Bad — overly broad conditions that match everything:

<important if="you are writing or modifying any code">

  • Use absolute imports
  • Use functional components
  • Use camelCase filenames </important>

Good — each rule has its own narrow trigger:

<important if="you are adding or modifying imports">

  • Use @/ absolute imports (see tsconfig.json for path aliases)
  • Avoid default exports except in route files </important>

<important if="you are creating new components">

  • Use functional components with explicit prop interfaces </important>

<important if="you are creating new files or directories">

  • Use camelCase for file and directory names </important>
  1. Keep it short, use progressive disclosure sparingly

Do not shard into separate files that require the agent to make tool calls to discover, unless the extra context is incredibly verbose or complex.

The whole point of <important if> blocks is that everything is inline but conditionally weighted — the agent sees it all but only attends to what matches.

Prefer to keep the file concise.

  1. Less is more
  • Frontier models can reliably follow a few hundred. Claude Code's system prompt and tools already use ~50 of those. Your CLAUDE.md should be as lean as possible.

  • Cut any instruction that a linter, formatter, or pre-commit hook can enforce

  • Cut any instruction the agent can discover from existing code patterns. LLMs are in-context learners — if your codebase consistently uses a pattern, the agent will follow it after a few searches.

  • Cut code snippets. They go stale and bloat the file. Use file path references instead (e.g., "see src/utils/example.ts for the pattern").

  1. Keep all commands

Do not drop commands from the original file. The commands table is foundational reference — the agent needs to know what's available even if some commands are used less frequently.

Output Structure

When rewriting a CLAUDE.md, produce this structure:

CLAUDE.md

[one-line project identity — what it is, what it's built with]

Project map

[directory listing with brief descriptions]

<important if="you need to run commands to build, test, lint, or generate code"> [commands table — all commands from the original] </important>

<important if="<specific trigger for rule 1>"> [rule 1] </important>

<important if="<specific trigger for rule 2>"> [rule 2] </important>

... more rules, each with their own block ...

<important if="<specific trigger for domain area 1>">

[guidance]

</important>

... more domain sections ...

How to Apply

When given an existing CLAUDE.md to improve:

  • Identify the project identity — extract a single sentence describing what this is. Leave it bare at the top.

  • Extract the directory map — keep it bare (no <important if> wrapper). This is foundational context.

  • Extract the tech stack — if present, keep it bare near the top. Condense to one or two lines.

  • Extract commands — keep ALL commands from the original. Wrap in a single <important if> block.

  • Break apart rules — split any list of rules into individual <important if> blocks with specific conditions. You can group rules, but never group unrelated rules under one broad condition.

  • Wrap domain sections — testing, API patterns, state management, i18n, etc. each get their own block with a condition describing when that knowledge matters.

  • Delete linter territory — remove style guidelines, formatting rules, and anything enforceable by tooling. Suggest replacing with pre-push or pre-commit hooks.

  • Delete code snippets — replace with file path references.

  • Delete vague instructions — remove anything like "leverage the X agent" or "follow best practices" that isn't concrete and actionable.

Example

Input:

CLAUDE.md

This is an Express API with a React frontend in a Turborepo monorepo.

Commands

CommandDescription
turbo buildBuild all packages
turbo testRun all tests
turbo lintLint all packages
turbo devStart dev server
turbo storybookStart Storybook
turbo db:generateGenerate Prisma client
turbo db:migrateRun database migrations
turbo analyzeBundle analyzer

Project Structure

  • apps/api/ - Express REST API
  • apps/web/ - React SPA
  • packages/db/ - Prisma schema and client
  • packages/ui/ - Shared component library
  • packages/config/ - Shared configuration

Coding Standards

  • Use named exports
  • Use functional components with TypeScript interfaces for props
  • Use camelCase for variables, PascalCase for components
  • Prefer const over let
  • Always use strict equality (===)
  • Use template literals instead of string concatenation
  • Write JSDoc comments for all public functions
  • Use barrel exports in index.ts files

API Development

  • All routes go in apps/api/src/routes/
  • Use Zod for request validation
  • Use Prisma for database access
  • Error responses follow RFC 7807 format
  • Authentication via JWT middleware

Testing

  • Jest + Supertest for API tests
  • Vitest + Testing Library for frontend
  • Test fixtures in __fixtures__/ directories
  • Use createTestClient() helper for API integration tests
  • Mock database with prismaMock from packages/db/test

State Management

  • Zustand for global client state
  • React Query for server state
  • URL state via nuqs

Output:

CLAUDE.md

Express API + React frontend in a Turborepo monorepo.

Project map

  • apps/api/ - Express REST API
  • apps/web/ - React SPA
  • packages/db/ - Prisma schema and client
  • packages/ui/ - Shared component library
  • packages/config/ - Shared configuration

<important if="you need to run commands to build, test, lint, or generate code">

Run with turbo from the repo root.

CommandWhat it does
turbo buildBuild all packages
turbo testRun all tests
turbo lintLint all packages
turbo devStart dev server
turbo storybookStart Storybook
turbo db:generateRegenerate Prisma client after schema changes
turbo db:migrateRun database migrations
turbo analyzeBundle analyzer
</important>

<important if="you are adding or modifying imports or exports">

  • Use named exports (no default exports) </important>

<important if="you are creating new components">

  • Use functional components with TypeScript interfaces for props </important>

<important if="you are adding or modifying API routes">

  • All routes go in apps/api/src/routes/
  • Use Zod for request validation
  • Use Prisma for database access
  • Error responses follow RFC 7807 format
  • Authentication via JWT middleware </important>

<important if="you are writing or modifying tests">

  • API: Jest + Supertest
  • Frontend: Vitest + Testing Library
  • Test fixtures in __fixtures__/ directories
  • Use createTestClient() helper for API integration tests
  • Mock database with prismaMock from packages/db/test </important>

<important if="you are working with state management, stores, or URL parameters">

  • Zustand for global client state
  • React Query for server state
  • URL state via nuqs </important>

What was removed and why:

  • camelCase/PascalCase, const vs let, strict equality, template literals, JSDoc, barrel exports — linter and formatter territory, or discoverable from existing code patterns

  • Coding Standards as a grouped section — split into targeted blocks by trigger condition

What was NOT removed:

  • All commands kept (including dev, storybook, analyze)

  • Project map left bare (foundational context, relevant to every task)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

axure-prototype-generator

Axure 原型代码生成器 - 输出 JavaScript 格式 HTML 代码,支持内联框架直接加载可交互原型。

Archived SourceRecently Updated
General

错敏信息检测

# 错敏检测 Skill

Archived SourceRecently Updated
General

TikTok B2B 引流台词生成器

# TikTok B2B 引流台词生成器 ## 技能描述 本 Skill 可根据您提供的产品信息和公司背景,自动生成适合 TikTok 平台的 B2B 引流视频脚本(20-50 秒),`skill.json` 文件中包含了输入参数的结构、输出格式以及用于生成台词的提示模板。脚本遵循已验证的外贸引流规律: - **真人出镜**:以第一人称(如 Anna)拉近距离 - **产品细节**:材质、颜色、MOQ、定制服务等 - **公司实力**:经验年限、自有工厂、认证等 - **客户背书**:提及已有市场国家(如巴基斯坦、埃及) - **互动引导**:清晰号召观众联系,引导至指定服务网址 支持三种风格:普通、幽默、惊喜,让您的视频内容更加多样化。 ## 输入参数 | 参数名 | 类型 | 必填 | 描述 | 示例 | |---------------------|----------|------|--------------------------------|--------------------------| | product_type | string | 是 | 产品类型 | 男士休闲鞋 | | material | string | 是 | 主要材质 | 优质 PU 皮革 | | colors | array | 是 | 颜色列表 | ["黑色","白色","棕色"] | | moq | string | 是 | 最小起订量 | 120 双(可混 2-3 色) | | customization | string | 否 | 可定制内容 | 可定制 logo | | target_markets | array | 是 | 主要市场国家 | ["巴基斯坦","埃及"] | | company_experience | string | 否 | 公司经验年数 | 15 年 | | factory_own | boolean | 否 | 是否自有工厂 | true | | extra_features | string | 否 | 其他亮点 | 免费样品 | | contact_url | string | 否 | 服务联系网址 | http://www.doumaotong.com | | style | string | 否 | 风格(普通/幽默/惊喜) | 普通 | ## 输出示例 Hi guys, this is Anna! Welcome to my showroom. Today I'm excited to show you our latest men's casual shoes – made of high-quality PU leather, very durable and comfortable. We have three colors available: black, white, and brown. MOQ is 120 pairs, and you can mix 2-3 colors. Plus, we can customize your logo on the shoes. Our shoes are already loved by customers in Pakistan, Egypt, and South Africa. With 15 years of experience and our own factory, we guarantee quality and timely delivery. We even offer free samples! If you're interested, please visit http://www.doumaotong.com to contact us. Thank you! ## 使用说明 1. 在 OpenClaw 平台安装此 Skill。 2. 调用时填写产品参数,包括 `contact_url`(默认为 http://www.doumaotong.com),即可获得定制化的 TikTok 脚本。 3. 生成的台词会在结尾处自然引导观众访问指定的服务网站。 4. 可根据实际需要调整 `style` 参数,生成不同语气的台词。 ## 文件说明 - `skill.json`:技能的机器可读定义,包含输入输出 schema 和生成提示模板。 - `SKILL.md`:技能的人类可读文档,提供详细说明和使用示例。

Archived SourceRecently Updated
General

instructional-design-cn

培训课程大纲设计、效果评估、内部分享材料生成

Archived SourceRecently Updated