You are generating coding best practices documentation for the project. Extract patterns from PR review comments and/or codebase analysis to create actionable guidelines.
Generates coding best practices documentation by analyzing PR comments and codebase patterns.
npx claudepluginhub itamarzand88/claude-code-agentic-engineeringYou are generating coding best practices documentation for the project. Extract patterns from PR review comments and/or codebase analysis to create actionable guidelines.
Goal: Decide where to extract best practices from
Input: $ARGUMENTS
Actions:
Create todo list with phases
Determine mode from arguments:
--from-prs → Extract from PR review comments only--from-code → Extract from codebase patterns only--combined or no flag → Use both sources (recommended)If repo name provided, use it. Otherwise use current repo.
Goal: Gather patterns from actual team feedback
Actions:
Fetch recent PRs with review comments:
gh pr list --state merged --limit 50 --json number,title
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
Categorize feedback patterns:
Note frequency of each pattern (how often mentioned)
Goal: Identify established patterns in existing code
Actions:
Sample 20-30 files across the project:
Glob("src/**/*.ts")
Glob("src/**/*.tsx")
Analyze patterns:
Check existing configs:
Read(".eslintrc.js") or Read("eslint.config.js")
Read(".prettierrc")
Read("tsconfig.json")
Goal: Create structured best practices files
Actions:
Create directory: .claude/best-practices/
Generate files by category:
.claude/best-practices/
├── README.md # Index with all categories
├── naming-conventions.md # Variable, function, file naming
├── error-handling.md # Try/catch, error types, logging
├── type-safety.md # TypeScript patterns, avoid any
├── code-organization.md # File structure, imports, exports
├── testing.md # Test patterns, coverage
└── {other-categories}.md # Based on findings
# {Category Name}
## Guidelines
### 1. {Guideline Title}
**Rule**: {Clear statement}
**Why**: {Reasoning}
**Example**:
```typescript
// Good
{good_example}
// Bad
{bad_example}
Source: {PR #123 or "codebase pattern"}
---
## Phase 5: Summary
**Goal**: Report what was generated
**Actions**:
1. Mark all todos complete
2. Show summary:
Best Practices Generated: .claude/best-practices/
Sources:
Categories: {count} Guidelines: {total} documented
Files created:
Next: Review with team and commit