From agent-skills
Scaffolds initial CLAUDE.md files for repositories lacking them — auto-detects stack, integrates GitHub/Jira/Confluence context, and outputs concise files focused on non-obvious patterns.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-skills:bootstrap-claudemdThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create initial CLAUDE.md files for a repository that has none. Auto-detect the stack, gather ecosystem context, and produce concise files containing only what Claude cannot infer from the code itself.
Create initial CLAUDE.md files for a repository that has none. Auto-detect the stack, gather ecosystem context, and produce concise files containing only what Claude cannot infer from the code itself.
The user may pass a repo path as an argument, or default to the current working directory.
These rules govern every line written. Violating them produces files that are too long, too vague, or duplicate what tooling already enforces.
# inferred.Each CLAUDE.md starts with:
<!-- Last reviewed: YYYY-MM -->
Section order (omit any section that doesn't apply — no empty headings):
## Project — 2-4 sentences: what this does, what system it belongs to## Stack — language, runtime, framework, database, test runner, build tool, with versions where visible## Commands — build, test, lint, run, and any other commands developers use regularly## Data Models — key input/output data shapes and how they flow. Where schemas/types are defined, what generates them (codegen, ORM, manual), what consumes them, non-obvious shape constraints (backwards-compatibility rules, required-but-not-validated fields, enum evolution rules), cross-boundary contracts (API shapes shared between repos, database schemas consumed by multiple services). Only what Claude would get wrong without guidance.## Conventions — non-obvious patterns not enforced by tooling## Architecture — key module boundaries or data flow, only if non-obvious from directory structure## Constraints — hard rules Claude must never violate, each with a reason## Anti-Patterns — Do NOT — things Claude must AVOID doing, each with evidence and a reason. Sourced from: reverted PRs, reviewer pushback, HACK/FIXME comments protecting intentional patterns, production incidents. Format: "Do NOT X — because Y (evidence: PR #N / revert hash / Jira ticket)."## Testing — only if the approach is non-standard## Related Systems — sibling repos/services this interacts with, only if the relationship is non-obvious| Type | Location | Purpose |
|---|---|---|
| Project root | ./CLAUDE.md | Primary project context (checked into git, shared with team) |
| Package-specific | ./packages/*/CLAUDE.md | Module-level context in monorepos |
| Subdirectory | Any nested location | Feature/domain-specific context |
Same format but scoped to the module. Even shorter — often just Project + Conventions + Constraints.
Every directory is a candidate. The question is not "is this complex enough?" but "does this directory (or its children) have anything non-obvious that Claude needs to know?" Use these rules to decide placement:
### Rolled-up subdirectories section in the parent to name each covered child and briefly describe what it contains — so readers know the child was intentionally covered here, not forgotten.The goal is full coverage: every directory's non-obvious patterns should be documented somewhere — either in its own CLAUDE.md or in an ancestor's. No directory should fall through the cracks.
Before presenting generated content to the user, score each file against this rubric. Include the score in the Step 5 discovery summary.
| Criterion | Max Points | What to check |
|---|---|---|
| Commands/workflows | 20 | Are build, test, lint, deploy commands present with context? |
| Architecture clarity | 20 | Can Claude understand codebase structure, module relationships, entry points? |
| Non-obvious patterns | 15 | Are gotchas, quirks, workarounds, and "why we do it this way" captured? |
| Conciseness | 15 | No filler, no obvious info, no redundancy with code comments? |
| Currency | 15 | Do commands work? Are file references accurate? Tech stack current? |
| Actionability | 15 | Are instructions executable and copy-paste ready? Paths real? |
Target grade A for all generated files. If a file scores below B, revisit the generation rules and fill gaps before presenting.
Before finalizing any file, verify none of these are present:
Default to the current working directory. If the user passed a path argument, use that instead.
git rev-parse --git-dir).git remote get-url origin.Sage-Bionetworks/Synapse-Repository-Services).Launch up to 3 Explore agents in parallel:
Find and read:
pom.xml, package.json, go.mod, Cargo.toml, requirements.txt, pyproject.toml, build.gradle, Gemfile, *.csproj, Makefile, CMakeLists.txt, *.sln.nvmrc, .java-version, .python-version, .tool-versions, rust-toolchain.toml.github/workflows/*.yml, Jenkinsfile, .gitlab-ci.yml, buildspec.yml, .circleci/config.yml.eslintrc*, .prettierrc*, tsconfig.json, .flake8, pyproject.toml [tool.*], rustfmt.toml, .editorconfig, checkstyle.xmlExtract:
docs/) with their own build systems, conventions, or content frameworks are candidates — not just source code directories. Any directory with non-obvious patterns needs coverage.This step is critical. Step 2 gives a structural overview. Step 2b reads source files deeply to find behavioral conventions — the non-obvious patterns that cause the most mistakes. Skip this step only for trivially small repos (<10 source files total).
Launch up to 3 Explore agents in parallel, one per major source directory. For each, instruct the agent to read entire files (not sample), focusing on:
(error, warning) while all others return (warning, error))? Document ALL non-obvious return types.HACK, FIXME, WORKAROUND, XXX. These are documented gotchas from the original authors. Each one likely needs a CLAUDE.md entry.; exit 0 to suppress errors).git log --oneline --all --grep="Revert"). Each revert is a lesson learned — document what was tried and why it failed as a "Do NOT" rule. Also search for defensive comments: grep -rn "DO NOT\|NEVER\|WARNING\|CAREFUL\|don't remove\|do not change" --include="*.py" --include="*.ts" --include="*.java" --include="*.go".IMPORTANT: Always use MCP server tools for all GitHub, Jira, and Confluence operations. Never use the gh CLI — it may not be available. Use mcp__github__* for GitHub, mcp__atlassian__* for Jira/Confluence.
Use mcp__github__* tools:
mcp__github__list_pull_requests — last 100 merged PRs. Read titles and descriptions for convention signals.mcp__github__list_issues — last 100 open issues. Look for architectural discussions, planned changes, known gotchas.Use mcp__atlassian__* tools:
mcp__atlassian__getAccessibleAtlassianResources to get the cloudId.Synapse-Repository-Services -> PLFM), or search issues mentioning the repo name.mcp__atlassian__searchJiraIssuesUsingJql — active epics: project = <KEY> AND type = Epic AND status != Done ORDER BY updated DESC (limit 10).If the project key cannot be determined, ask the user.
Use mcp__atlassian__* tools:
mcp__atlassian__searchConfluenceUsingCql — search for text ~ "<repo-name>" AND type = page ORDER BY lastModified DESC (limit 10).Before presenting anything to the user, apply the content principles:
.eslintrc enforces semicolons, don't put "Use semicolons" in CLAUDE.md.| Bad (remove) | Why it fails | Good (keep) |
|---|---|---|
"The UserService class handles user operations." | Obvious from class name | (omit entirely) |
| "Always write tests for new features." | Generic advice, not project-specific | (omit entirely) |
| "The authentication system uses JWT tokens. JWT (JSON Web Tokens) are an open standard (RFC 7519)..." | Verbose, encyclopedic | "Auth: JWT with HS256, tokens in Authorization: Bearer <token> header." |
| "Use meaningful variable names." | Universal advice | (omit entirely) |
| "We fixed a bug in commit abc123 where login broke." | One-off fix, won't recur | (omit entirely) |
Before finalizing, verify:
Show the user what was found and what will be generated:
## Repo: <name>
Examined: <list of key files read>
### Root CLAUDE.md will cover:
- Project: <2-4 sentence draft>
- Stack: <detected stack with versions>
- Commands: <N verified commands from configs>
- Data Models: <N data model flows identified>
- Conventions: <N non-obvious patterns found>
- Constraints: <N hard rules with reasons>
- [other applicable sections]
### CLAUDE.md placement plan:
#### Own file:
- <dir> — <why it needs its own file>
#### Rolled up into parent:
- <dir> → covered in <parent>/CLAUDE.md — <brief reason>
#### Covered by ancestor:
- <dir> → already covered by <ancestor>/CLAUDE.md
### From GitHub PRs:
- <convention or constraint discovered from PR reviews>
### From Jira:
- <active epic creating a constraint>
### From Confluence:
- <architectural decision affecting conventions>
### Estimated total: ~X lines root, ~Y lines per module
Ask the user to confirm, correct, or skip sections before generating.
See references/templates.md for starter templates by project type.
For each approved CLAUDE.md:
<!-- Last reviewed: YYYY-MM --> using the current month.Present each generated file's full content to the user using diff format for easy review:
### File: ./CLAUDE.md
**Quality Score: XX/100 (Grade: X)**
```diff
+ ## Project
+
+ <content>
Why this section helps:
Run the Red Flags Checklist from the Quality Validation section before presenting.
Apply any corrections the user requests.
Write all files using the Write tool.
Optionally commit with message: Add initial CLAUDE.md files for AI-assisted development
See README.md for setup instructions./evolve-claudemd instead. Do not overwrite existing files without explicit confirmation.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
npx claudepluginhub sage-bionetworks/agent-skills --plugin agent-skills