一键导入
analyze
Analyze a repo's patterns and generate a tailored Claude Code config
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze a repo's patterns and generate a tailored Claude Code config
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Multi-slide bilingual brand carousels — Claude writes the deck, kun renders Anthropic-styled slides at exact platform sizes, a human approves, channels receive
Draft, stage, and publish brand social posts — Claude drafts, /higgs renders, a human approves, Hermes relays
Convert a file or URL to Markdown via MarkItDown (PDF, Office, images, audio, web)
Full pipeline — idea to production (chains every stage)
Autonomous block QA — detect, adversarially verify, fix safe tiers, hand the residual to a human
Technical spec — data model, file plan, refined acceptance criteria
| name | analyze |
| description | Analyze a repo's patterns and generate a tailored Claude Code config |
| when_to_use | Use when a repo needs its patterns extracted into a tailored Claude Code config — CLAUDE.md, agents, rules, and skills generated and committed straight to main — the config-generator lane, distinct from /learn which mines org-wide conventions into memory. Triggers on: analyze <repo>, generate config for this repo, repo config generator. |
| argument-hint | [repo-path] [--dry-run] |
Analyze any repo's patterns and generate a complete .claude/ configuration, committed straight to main.
/analyze hogwarts — analyze hogwarts, commit config to main/analyze databayt/souq — analyze from GitHub/analyze . — analyze current directory/analyze hogwarts --dry-run — preview without committing/analyze hogwarts --update — refresh existing config/analyze hogwarts --profile core — generate for specific profileParse arguments:
--dry-run = output to stdout, no commit--update = diff against existing .claude/, update stale config--profile <name> = generate for specific profile (core, security, developer, full)Work directly on main — no branches, no worktrees, no PRs. Every analyze run follows this workflow:
Issue (opt.) → Analyze → Commit → Push `main` → Verify → Close
# Local repo
if [ -d "/Users/abdout/$REPO" ]; then
cd /Users/abdout/$REPO
# GitHub repo
elif echo "$REPO" | grep -q "/"; then
gh repo clone $REPO /tmp/analyze-$REPO
cd /tmp/analyze-$REPO
fi
gh issue create \
--repo databayt/$REPO \
--title "chore: generate repo config from pattern analysis" \
--body "Automated analysis of repository patterns to generate \`.claude/\` configuration.
## What will be generated
- \`CLAUDE.md\` — project instructions
- \`agents/\` — relevant agent subset
- \`rules/\` — extracted conventions
- \`commands/\` — mapped skills
Triggered by \`/analyze\` command."
Work happens directly on main — there is no branch step. Just confirm you are on main and up to date:
git branch --show-current # must print `main`
git pull --rebase origin main
cat package.json | jq '{
name: .name,
deps: (.dependencies // {} | keys),
devDeps: (.devDependencies // {} | keys)
}'
Map to technologies:
next → Next.js (check version)react → React (check version)prisma → Prisma (check version)tailwindcss → Tailwind@radix-ui/* → Radix/shadcnnext-auth → Auth.jszod → Zod validation# App Router or Pages Router?
ls app/ 2>/dev/null && echo "App Router" || echo "Pages Router"
# src directory?
ls src/ 2>/dev/null && echo "src/ prefix"
# Component organization
find . -path '*/components/*' -name '*.tsx' -not -path '*/node_modules/*' | head -20
# Prisma schema
cat prisma/schema.prisma 2>/dev/null | head -30
Read 10 representative files and extract patterns:
For each file, note:
# Commit convention
git log --oneline -20
# Most active areas
git log --format=format: --name-only -100 | sort | uniq -c | sort -rn | head -10
# Recent focus
git log --oneline --since="2 weeks ago"
Create .claude/ directory and files:
# <Repo Name>
## Stack
<detected technologies with versions>
## Conventions
<extracted patterns — only what's actually observed>
## Structure
<directory layout conventions>
## Keywords
<relevant subset from Kun's keyword map>
Keep under 200 lines. Concise beats comprehensive.
Only include agents the repo needs. Use this mapping:
| Detected | Agents |
|---|---|
| Next.js | nextjs, react, middleware |
| TypeScript | typescript, build |
| Prisma | prisma, architecture |
| Tailwind/shadcn | tailwind, shadcn, semantic |
| Auth.js | authjs, guardian |
| i18n | internationalization |
| Tests | test |
| Components dir | atom, template, block |
| Vercel deploy | deploy, ops |
| Git/GitHub | git, github |
Create a minimal _index.md listing selected agents with reasons.
Each rule = one observed convention worth enforcing:
# rules/<convention>.md
<what the convention is>
<evidence: "observed in N/M sampled files">
Only create rules for patterns with >80% consistency. Inconsistent patterns get flagged as suggestions, not rules.
Only commands that match the repo's workflow. Always include: dev, build. Conditionally include based on detected stack.
mainCommit straight to main — no branch, no PR. Put the analysis summary in the commit body.
# Stage all generated config
git add .claude/
# Commit (summary lives in the body)
git commit -m "chore: generate repo config from pattern analysis
Auto-generated .claude/ configuration from repository pattern analysis.
Analysis scope: <N> commits analyzed, <M> files sampled, <P> conventions extracted.
Generated config:
- CLAUDE.md — project instructions (<lines> lines)
- agents/ — <N> agents selected (of 44 available)
- rules/ — <N> rules from observed patterns
- commands/ — <N> skills mapped to workflow
Recommended profiles: core (<list>) / security (<list>) / full (<list>).
Review each file — a starting point, not gospel.
Closes #<issue-number>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>"
# Push to main (Vercel/CI deploys automatically)
git push origin main
Skip steps 2 and 6. Output generated config to stdout with clear section headers. No files written, no commit.
.claude/ configmain (new conventions, removed stale rules, updated agents)chore: update repo config — N conventions added, M stale removedFilter generated config to only include agents, rules, and commands relevant to the specified profile.
Before committing to main:
Rule: The best config is the one the team was already following. Analyze just makes it explicit, reviewable, and enforceable.