lp-enhance
Skill8 starsChanged 5 months agoMITView on GitHub
AI-improve your CLAUDE.md based on codebase analysis. Fills in architecture, conventions, guardrails, and suggests hooks and MCP servers. TRIGGER when: user runs /lp-enhance, asks to "improve CLAUDE.md", "fill in architecture", or after major refactors. DO NOT TRIGGER when: user is editing CLAUDE.md manually, doing normal coding, or running doctor/eval.
- Reads credentials
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/conventions.mdcCursor rule
- .cursor/rules/doctor.mdcCursor rule
- .cursor/rules/hooks.mdcCursor rule
- .cursor/rules/memory.mdcCursor rule
- .cursor/rules/verification.mdcCursor rule
- .cursor/rules/workflow.mdcCursor rule
- lp-migrate-memorySkill
- lp-enhanceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
40 rules. About 0 are common, 22 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Read CLAUDE.md and the project's codebase, then update CLAUDE.md to fill in missing or incomplete sections.
- Distinctive: line 19
Read CLAUDE.md (if it exists)
- Very specific: line 20
Read .claude/CLAUDE.md (local config, if it exists)
- Very specific: line 21
Read .claude/settings.json (hooks, permissions, MCP)
- Very specific: line 22
Read .claude/settings.local.json (local settings, if it exists)
- Very specific: line 23
Read .claude/rules/*.md (existing rules)
- Distinctive: line 24
Read .claudeignore (if it exists)
- Very specific: line 26
Read package.json / go.mod / pyproject.toml for stack detection
- Very specific: line 27
Check for monorepo indicators (workspaces, nx.json, lerna.json)
- Distinctive: line 28
Check scenarios/ directory for existing eval scenarios
- Very specific: line 40
## Memory (agentic-memory): - ONLY if agentic-memory is configured in settings.json.
- Distinctive: line 41
## Key Decisions: - only decisions that affect how Claude works in this codebase
- Very specific: line 43
Skill Authoring: - if .claude/rules/conventions.md lacks a Skill Authoring section, plan to add one
- Very specific: line 45
If any section would exceed 8 bullets, plan a .claude/rules/ file for the overflow.
- Very specific: line 53
Create or update .claude/rules/ files for overflow content
- Distinctive: line 57
Verify line count is under 200
- Distinctive: line 60
Don't remove existing content, only add or improve
- Distinctive: line 62
Use bullet points, not paragraphs
- Very specific: line 66
Run claude-launchpad doctor to check the score improved
- Very specific: line 69
If eval scenarios were generated, print: "Run this in your terminal (not inside Claude Code): claude-launchpad eval --scenarios scenarios/ …
- Very specific: line 79
Check for monorepo indicators: workspaces in package.json, pnpm-workspace.yaml, nx.json, lerna.json.
- Distinctive: line 80
Check for docs/, tests/, scripts/ as separate scopes.
- Distinctive: line 90
Keep route handlers under 30 lines
- Distinctive: line 103
If path-scoped rules already exist, don't overwrite them
- Very specific: line 111
If .claude/rules/conventions.md exists but has no Skill Authoring section, add this:
- Very specific: line 115
When creating Claude Code skills (.claude/skills/*/SKILL.md):
- Very specific: line 117
Keep SKILL.md under 500 lines — move reference material to supporting files in the same directory
- Distinctive: line 119
Add allowed-tools in frontmatter to restrict tool access (e.g.
- Distinctive: line 120
Add argument-hint in frontmatter showing the expected input format (use $ARGUMENTS or $0, $1 for dynamic input)
- Distinctive: line 128
If you see project-specific patterns that deserve hooks, suggest them
- Distinctive: line 129
If the SessionStart matcher misses compact/clear, suggest widening it to startup|resume|compact|clear (there is NO PostCompact event — it …
- Distinctive: line 130
If no SessionStart hook exists, suggest one that injects TASKS.md
- Very specific: line 131
DO NOT modify settings.json directly.
- Distinctive: line 135
Read .claudeignore and check if the patterns make sense for the detected stack:
- Distinctive: line 148
Test fixtures or seed data (might be needed for context)
- Distinctive: line 150
If .claudeignore is missing entirely, create one with sensible defaults for the detected stack.
- Distinctive: line 151
If it exists but has gaps, print suggested additions.
- Distinctive: line 155
After improving CLAUDE.md, generate 2-3 custom eval scenarios that test whether Claude follows the project's specific rules.
- Distinctive: line 188
Write checks that verify compliance (grep for patterns, file-exists for structure)
- Very specific: line 201
If you detect a monorepo, suggest claudeMdExcludes in settings.json
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- lp-enhance-version: 10 -->lp-enhance - AI-powered CLAUDE.md improver
Read CLAUDE.md and the project's codebase, then update CLAUDE.md to fill in missing or incomplete sections.
Phase 1: Research
- Read CLAUDE.md (if it exists)
- Read .claude/CLAUDE.md (local config, if it exists)
- Read .claude/settings.json (hooks, permissions, MCP)
- Read .claude/settings.local.json (local settings, if it exists)
- Read .claude/rules/*.md (existing rules)
- Read .claudeignore (if it exists)
- Scan src/ directory structure (top-level dirs, key files)
- Read package.json / go.mod / pyproject.toml for stack detection
- Check for monorepo indicators (workspaces, nx.json, lerna.json)
- Check scenarios/ directory for existing eval scenarios
Done when: you have a mental model of the stack, architecture, and existing config.
Phase 2: Plan
Count current CLAUDE.md actionable lines. Budget is 200 lines max. Plan which sections to add or improve:
- ## Stack - detect language, framework, package manager
- ## Architecture - 3-5 bullets describing codebase shape
- ## Conventions - max 8 key patterns. Overflow to .claude/rules/conventions.md
- ## Off-Limits - max 8 guardrails specific to this project
- ## Memory (agentic-memory) - ONLY if agentic-memory is configured in settings.json. Max 6 bullets. Use this exact heading so
memory installstays idempotent. - ## Key Decisions - only decisions that affect how Claude works in this codebase
- Skill Authoring - if .claude/rules/conventions.md lacks a Skill Authoring section, plan to add one
If any section would exceed 8 bullets, plan a .claude/rules/ file for the overflow.
Done when: you know exactly what to add/change and the line count stays under 200.
Phase 3: Execute
Edit CLAUDE.md with the planned changes. Then:
- Create or update .claude/rules/ files for overflow content
- Generate path-scoped rules if the project has distinct areas (see below)
- Review .claudeignore and print suggestions (see below)
- Generate 2-3 custom eval scenarios in scenarios/custom/ (see below)
- Verify line count is under 200
Rules:
- Don't remove existing content, only add or improve
- Be specific to THIS project, not generic advice
- Use bullet points, not paragraphs
Phase 4: Verify
- Run
claude-launchpad doctorto check the score improved - Print suggested hooks (exact JSON) for .claude/settings.json but don't modify it
- Print suggested MCP servers if external services detected (Postgres, Redis, Stripe, etc.)
- If eval scenarios were generated, print: "Run this in your terminal (not inside Claude Code):
claude-launchpad eval --scenarios scenarios/ --runs 1"
Done when: doctor score is equal or higher, suggestions printed, eval scenarios created if applicable.
Path-scoped rules generation
Scan the project structure and generate focused .claude/rules/ files with paths: frontmatter. These load ONLY when Claude works on matching files, saving context tokens.
How to detect areas:
- List top-level directories under src/ (or equivalent). Each distinct area (api, components, lib, tests) is a candidate.
- Check for monorepo indicators: workspaces in package.json, pnpm-workspace.yaml, nx.json, lerna.json. Each workspace is a candidate.
- Check for docs/, tests/, scripts/ as separate scopes.
For each detected area, create a rules file with this format:
paths: ["src/api/**"]
API Rules
- Validate all request input with zod schemas
- Return typed error responses, never throw raw errors
- Keep route handlers under 30 lines
Stack-specific patterns to include:
- Next.js app/: "Use Server Components by default, add 'use client' only when needed"
- API routes / src/api/: "Validate input at boundaries, typed error responses"
- React components: "Colocate components near usage, props interface above component"
- Tests: "One assertion per test when possible, descriptive test names"
- Database / prisma/ / drizzle/: "Never write raw SQL, use the ORM, migrations required"
- Docs: "No em dashes, max 3 sentences per paragraph, code examples required"
When NOT to generate:
- Small projects with < 5 source files (one conventions.md is enough)
- Projects where all code is in one flat directory
- If path-scoped rules already exist, don't overwrite them
Monorepo handling:
- Each package gets its own rules file: .claude/rules/packages-
<name>.md - Suggest claudeMdExcludes in settings.json to skip irrelevant package CLAUDE.md files
Skill authoring conventions
If .claude/rules/conventions.md exists but has no Skill Authoring section, add this:
Skill Authoring
When creating Claude Code skills (.claude/skills/*/SKILL.md):
- Keep SKILL.md under 500 lines — move reference material to supporting files in the same directory
- Front-load description (first 250 chars shown in listings) with TRIGGER when / DO NOT TRIGGER when clauses
- Add allowed-tools in frontmatter to restrict tool access (e.g. Read, Glob, Grep for read-only skills)
- Add argument-hint in frontmatter showing the expected input format (use $ARGUMENTS or $0, $1 for dynamic input)
- Set disable-model-invocation: true for skills with side effects (deploy, send messages)
- Structure as phases: Research, Plan, Execute, Verify with "Done when:" success criteria per phase
- Handle edge cases and preconditions before execution
Hook review
Review .claude/settings.json hooks:
- If you see project-specific patterns that deserve hooks, suggest them
- If the SessionStart matcher misses compact/clear, suggest widening it to startup|resume|compact|clear (there is NO PostCompact event — it never fires)
- If no SessionStart hook exists, suggest one that injects TASKS.md
- DO NOT modify settings.json directly. Print exact JSON to add.
.claudeignore review
Read .claudeignore and check if the patterns make sense for the detected stack:
Always flag:
- Missing node_modules/ (JS/TS projects)
- Missing pycache/ or .venv/ (Python projects)
- Missing target/ (Rust/Java projects)
- Missing .env / .env.* patterns
- Missing lock files (pnpm-lock.yaml, package-lock.json, yarn.lock, etc.)
- Missing coverage/ directory
- Large generated files that waste context (*.min.js, *.map, migrations/)
Never flag:
- Patterns the user clearly added intentionally
- Test fixtures or seed data (might be needed for context)
If .claudeignore is missing entirely, create one with sensible defaults for the detected stack. If it exists but has gaps, print suggested additions. Do NOT modify it directly.
Eval scenario generation
After improving CLAUDE.md, generate 2-3 custom eval scenarios that test whether Claude follows the project's specific rules. Write them as YAML files in scenarios/ at the project root.
Scenario YAML format:
name: custom/scenario-name
description: What this scenario tests
setup:
files:
- path: src/example.ts
content: |
// Starter file that tempts Claude to break a rule
instructions: |
The specific rule from CLAUDE.md being tested.
prompt: "A task that would tempt Claude to break the rule"
checks:
- type: grep
pattern: "expected_pattern"
target: src/example.ts
expect: present
points: 5
label: What this check verifies
- type: file-exists
target: path/to/expected/file
expect: present
points: 5
label: What this check verifies
passingScore: 7
runs: 3How to choose scenarios:
- Pick the 2-3 most important rules from ## Off-Limits and ## Conventions
- Design a task that naturally tempts Claude to break each rule
- Write checks that verify compliance (grep for patterns, file-exists for structure)
Check types available: grep (pattern in file), file-exists (present/absent), max-lines (file length)
Examples of good custom scenarios:
- Off-limits says "never use any" → task asks to build types, check for no
anykeyword - Convention says "max 400 lines per file" → task asks to generate a large module, check line count
- Off-limits says "no raw SQL" → task asks to add a query, check for ORM usage
Skip if: scenarios/ already has 3+ YAML files, or CLAUDE.md has no project-specific rules worth testing.
Other advanced configuration
- If you detect a monorepo, suggest claudeMdExcludes in settings.json
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

