blueprint-derive-rules
БесплатноБез исполняемых скриптовНе проверенDerive Claude rules from git commit history. Use when extracting implicit decisions from commits or codifying code-style, testing, and API-design rules.
от laurigates★ 61 звезда на GitHubОб этом скилле
/blueprint:derive-rules
Extract project decisions from git commit history and codify them as Claude rules. Newer commits override older decisions when conflicts exist.
Use case: Derive implicit project patterns from git history to establish consistent AI-assisted development guidelines.
Usage: /blueprint:derive-rules [--since DATE] [--scope SCOPE]
When to Use This Skill
| Use this skill when... | Use alternative when... |
|---|---|
| Want to extract implicit decisions from git history | Creating rules from requirements (use PRDs instead) |
| Project has significant commit history | New project with little history |
| Establishing project coding standards | Quick manual rule creation |
Context
- Git repository: !
git rev-parse --git-dir - Blueprint initialized: !
find . -path '*/docs/blueprint/*' -maxdepth 3 -name 'manifest.json' -type f - Total commits: !
git rev-list --count HEAD - Conventional commits %: !
git log --format="%s" - Existing rules in default location: !
find . -path '*/.claude/rules/*' -maxdepth 3 -name "*.md" -type f - Existing rules in blueprint subdir: !
find . -path '*/.claude/rules/blueprint/*' -maxdepth 4 -name "*.md" -type f
Parameters
Parse $ARGUMENTS:
--since DATE: Analyze commits from specific date (e.g.,--since 2024-01-01)--scope SCOPE: Focus on specific area (e.g.,--scope api,--scope testing)
Execution
Execute the complete git-to-rules derivation workflow:
Step 0: Resolve the output path
Read structure.generated_rules_path from docs/blueprint/manifest.json (default .claude/rules/):
RULES_DIR=$(jq -r '.structure.generated_rules_path // ".claude/rules/"' docs/blueprint/manifest.json)
mkdir -p "$RULES_DIR"
Use $RULES_DIR for all subsequent reads/writes and conflict checks. Hand-written files in the parent .claude/rules/ are intentionally invisible to this skill (issue #1043).
Step 1: Verify prerequisites
- If not a git repository → Error: "This directory is not a git repository"
- If Blueprint not initialized → Suggest
/blueprint:initfirst - If few commits (< 20) → Warn: "Limited commit history; derived rules may be incomplete"
Step 2: Analyze git history quality
- Calculate total commits in scope
- Calculate conventional commits percentage
- Report quality: Higher % = higher confidence in extracted rules
- Parse
--sinceand--scopeflags to determine analysis range
Step 3: Extract decision-bearing commits
Use parallel agents to analyze git history efficiently (see REFERENCE.md):
- Agent 1: Analyze
refactor:commits for code style patterns - Agent 2: Analyze
fix:commits for repeated issue types - Agent 3: Analyze
feat!:andBREAKING CHANGE:commits for architecture decisions - Agent 4: Analyze
chore:andbuild:commits for tooling decisions
Consolidate findings by domain (code-style, testing, api-design, etc.), chronologically (newest first), and by frequency (most common wins).
Step 4: Resolve conflicts
When multiple commits address the same topic:
- Detect conflicts using pattern matching:
git log --format="%H|%ai|%s" | grep "{topic}" - Apply resolution strategy:
- Newer overrides older: Latest decision wins
- Higher frequency wins: If 5 commits say X and 1 says Y, X wins
- Breaking changes override:
feat!:trumps regular commits
- Mark overridden decisions as "superseded" with reference to newer decision
- Confirm significant decisions with user via AskUserQuestion
Step 5: Generate rules in $RULES_DIR
For each decision, generate rule file using template from REFERENCE.md. Write each file to $RULES_DIR/<filename>.md (the configured structure.generated_rules_path):
Extract source commit, date, type
Determine confidence level (High/Medium/Low based on commit frequency and clarity)
Generate actionable rule statement
Include code examples from commit diffs
Reference any superseded earlier decisions
REQUIRED: scope every generated rule via
paths:frontmatter unless the rule genuinely applies everywhere. Rules withoutpaths:load on every session and pollute context for unrelated work. Pickpaths:from the source signal:Signal Source paths:valueRule body cites a specific file via "patterns extracted from <path>"Step 3 / 4 conflict resolution Glob over that file's directory: <dir>/**/*.<ext>Rule was derived from chore(deps)/build:commitsTooling-decision agent Lockfiles + manifests: package.json,pyproject.toml,Cargo.toml,go.mod,*.lock,biome.json, etc.Rule references a language ( refactor:+ JS-only code blocks)Code-style agent Language Glob: **/*.{js,jsx,ts,tsx},**/*.py,**/*.rsRule is about tests Test-strategy agent `**/.{test,spec}.
Установить blueprint-derive-rules в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteGlobGrepBash(git rev-parse *)Bash(git rev-list *)Bash(git log *)Bash(find *)Bash(grep *)Bash(sed *)Bash(sort *)Bash(uniq *)Bash(mkdir *)Bash(jq *)Bash(date *)Bash(mv *)AskUserQuestionTaskВложенные файлы
FAQ
Что делает скилл blueprint-derive-rules?
Derive Claude rules from git commit history. Use when extracting implicit decisions from commits or codifying code-style, testing, and API-design rules.
Как установить скилл blueprint-derive-rules?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл blueprint-derive-rules запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic