Claude md
Skill givepro91/cc-skills/plugins/claude-md/skills/claude-md
Generate or refresh a project's agent rules — a tailored preamble plus an idempotent managed block (working discipline, verification, adaptive parallel-git workflow, self-learning rules). Writes to the repo's canonical agent file (CLAUDE.md by default, or AGENTS.md when it is canonical, e.g. CLAUDE.md imports @AGENTS.md). Works on new and existing projects; only ever rewrites its own managed block. Use when setting up a repo, standardizing AI working rules, or adopting the parallel-git + self-learning workflow.From its SKILL.md
npx -y skills add givepro91/cc-skills --skill claude-mdAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.5 KB, ~1.9k tokens by cl100k_base, as published. Nobody here has run it
/claude-md — generate & maintain agent rules
Write a high-quality agent-rules file using a hybrid model and an idempotent managed block, so it works on new and existing projects and is safe to re-run.
Design (read first)
<canonical agent file> ← CLAUDE.md (default) OR AGENTS.md (when canonical)
## Project … (tailored preamble — scan/interview; written once, then user-owned)
<!-- CC-RULES:START --> ← managed by this skill; regen rewrites ONLY this block
## Working Discipline (Karpathy)
## Verification (Anthropic best-practice)
## Parallel Git Workflow (adaptive: team / solo / none)
## Self-Learning Rules (grows via /learn; PRESERVED across regen)
<!-- CC-RULES:END -->
… anything below/around the block is the user's free area — never touched
- Idempotent. The block is upserted between the markers. Re-running replaces only that region; everything else (incl. an OMC
<!-- OMC:START -->block or hand-written sections) is left byte-identical. - Self-learning preserved. Rules accumulated under
<!-- LEARN:ANCHOR -->survive regeneration (the helper carries them over). - One block, one file. The block lives in exactly ONE canonical file; never split or duplicated across CLAUDE.md and AGENTS.md.
Target resolution (which file gets the block)
The rules are tool-agnostic, so they belong in the file every agent on this repo reads. Detect the canonical file:
CLAUDE.mdis a symlink (readlink CLAUDE.md) → resolve it; the target is the real file (usuallyAGENTS.md). One physical file — done.CLAUDE.mdimports@AGENTS.md(a line that is exactly@AGENTS.md), orAGENTS.mdself-declares canonical → the repo is multi-tool (e.g. Claude + Codex). Target =AGENTS.mdso Codex/others also get the rules.- Only
AGENTS.mdexists (noCLAUDE.md) → Target =AGENTS.md. Do not create a redundant CLAUDE.md. - Otherwise → Target =
CLAUDE.md(default, Claude-native).
Confirm before writing to AGENTS.md. Whenever the target is AGENTS.md (cases 2–3), state it and get a yes first — agent-config has a large blast radius:
Detected
@AGENTS.mdimport → AGENTS.md is the canonical agent file (Codex reads it too). I'll put the managed block in AGENTS.md and keep CLAUDE.md as the pointer. OK?
For the plain CLAUDE.md-only case, no confirmation is needed.
Note: recent Claude Code may read
AGENTS.mdnatively. If so, a@AGENTS.mdimport in CLAUDE.md double-loads it — consider a symlink or dropping the import. Mention this; don't change their structure without asking.
Procedure
- Find the project root (
git rev-parse --show-toplevel, fallback cwd) and resolve the target per the rules above (confirm if AGENTS.md). - Detect environment for the adaptive git section:
- git?
git rev-parse --is-inside-work-tree - remote + GitHub?
git remote -v,gh repo view/gh auth status(treat failure as "no gh") - team if a remote exists and
ghworks; solo if git but no usable remote/gh; none if not a git repo.--team/--soloflags override. - Language = English by default;
--ko→ Korean prose. (Match the target file's existing language when obvious.)
- git?
- Remove any stale block from the OTHER file. If the target is AGENTS.md but a
CC-RULESblock already exists in CLAUDE.md (or vice-versa), delete it from the non-canonical file first so the block never lives in two places:node "${CLAUDE_PLUGIN_ROOT}/scripts/apply-block.mjs" --remove <root>/CLAUDE.md - Tailored preamble (only if the target file does NOT already exist):
- Scan for stack & commands:
package.jsonscripts,Makefile,pyproject.toml,Cargo.toml,go.mod, README, lockfiles, test/build config. - Optionally ask 1–2 short questions only for facts you cannot infer. Don't ask what the repo already tells you.
Writea minimal preamble: a one-line project description + a## Projectsection with build / test / run commands.- If the target file already exists, do not rewrite the preamble — go straight to the block.
- Scan for stack & commands:
- Compose the managed block body from the template below, choosing the matching Parallel Git Workflow variant and translating prose if
--ko. Keep<!-- LEARN:ANCHOR -->exactly as written. - Upsert the block idempotently:
node "${CLAUDE_PLUGIN_ROOT}/scripts/apply-block.mjs" <target file> <<'BLOCK' …composed block body… BLOCK - Verify & report: show the resulting block, confirm pre-existing content is intact, and note that re-running is safe. Offer to commit (don't commit without approval).
Managed block body — template
Render this between the markers. Pick ONE Parallel Git Workflow variant.
--kotranslates the prose; keep headings/markers/anchor verbatim.
## Working Discipline
- **Think before coding.** State assumptions; if uncertain, ask. Surface tradeoffs and competing interpretations instead of silently picking one.
- **Simplicity first.** Write the minimum code that solves the stated problem. No speculative features, abstractions, or configuration for single-use code.
- **Surgical changes.** Touch only what the task requires. Don't refactor or reformat adjacent code; match the existing style. Remove only what your change made unused.
- **Goal-driven.** Define a concrete success check (test / build / command / screenshot) before coding, then loop until it passes.
## Verification
- Always give yourself a way to verify — a test, a bash command, a curl, a screenshot. A working feedback loop is the single biggest quality lever.
- Report honestly: if a check fails, say so with the output; mark unverified work "unverified". Never present incomplete work as done.
## Parallel Git Workflow
<!-- variant: TEAM (git + remote + gh) -->
- Never work on or commit to the default branch (`main`/`master`). **One task = one ISSUE = one branch.**
- **Create the branch/worktree BEFORE you start editing — not at commit time.** Isolate each task in its own **git worktree** (`git worktree add ../<task> -b <branch>`), or use your agent's native worktree support — **Claude Code provides worktrees** — so parallel sessions never share a checkout and never collide on `main`.
- Open small, surgical PRs that reference the issue (e.g. "Fixes #42"); keep one concern per PR.
- If cc-handoff is installed: **one branch = one handoff** (`docs/handoff/<branch>.md`).
<!-- variant: SOLO (git, no remote/gh) — use instead of TEAM -->
- Don't work on or commit to the default branch. **Create a branch/worktree per task BEFORE editing — not at commit time** (`git switch -c <task>`, or `git worktree add ../<task> -b <task>`; **Claude Code provides native worktrees** for isolation).
- Commit in small, focused steps with the *why* in the body. (No PR ceremony needed for a solo repo.)
<!-- variant: NONE (not a git repo) — replace section body with this single line -->
- Not a git repo yet — run `git init` to enable branch/worktree isolation for parallel sessions.
## Self-Learning Rules
<!-- Append one concise rule per correction. `/learn` writes here automatically; newest first. -->
<!-- LEARN:ANCHOR -->
Notes
- The block uses distinct markers (
CC-RULES), so it never collides with an OMC (OMC:START) block in the same file. - Keep the block lean — it's guidance, not documentation. Project-specific detail belongs in the preamble or the user's free area.
/learnis the companion that grows the Self-Learning Rules; it writes to the same canonical file this skill chose.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.