From sc-skills
Detects codebase conventions via git-aware scans and generates pattern briefs/summaries for AI-guided planning. Use for 'analyze patterns' queries or before major tasks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sc-skills:sc-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Purpose**: Extract high-confidence coding conventions from a codebase and make them available as planning constraints for AI agents.
Purpose: Extract high-confidence coding conventions from a codebase and make them available as planning constraints for AI agents.
Parse $ARGUMENTS to determine the mode:
| Input | Mode | Action |
|---|---|---|
Empty or analyze | Analyze | Full pattern scan, cache results |
brief <task description> | Brief | Task-scoped pattern constraints from cache |
init | Init | Analyze + generate starter policy.yaml |
refresh | Refresh | Force full re-analysis, ignore cache |
Run the sc-pattern-analyzer agent to scan the codebase.
Steps:
.patterns/evidence.json exists and is fresh:
.patterns/.cache-meta.json for the last-analyzed commit SHAgit rev-parse HEADgit status --porcelainsc-pattern-analyzer agent with the full analysis task.patterns/policy.yaml exists)Output example:
## Pattern Analysis Complete
Analyzed 342 files (89 excluded) | Primary: Ruby/Rails
### Enforceable (8 patterns)
- Service objects use `def call` pattern (92% in app/services/)
- Controllers use before_action guards (88% in app/controllers/)
- Models use scopes over class methods (78% in app/models/)
...
### Probable (4 patterns)
- Repository pattern for DB access (65% in app/repositories/)
...
### Conflicted (2 areas)
- Error handling in services: 40% Result objects, 35% exceptions, 25% booleans
- Component styling: 55% CSS modules, 45% styled-components
### No Strong Pattern
- Serializer conventions in app/serializers/
Cache written to .patterns/evidence.json
Brief written to .patterns/brief.json
Generate task-scoped pattern constraints from cached analysis.
Steps:
.patterns/evidence.json (run analyze first if missing/stale)app/services/).patterns/policy.yaml for any overrides affecting the task scopeOutput example for /sc-patterns brief add a new user registration service:
## Pattern Brief: User Registration Service
Relevant scope: app/services/, app/models/, spec/services/
### Follow These Patterns
1. **Service objects use `def call`** (enforceable, 92%)
See: app/services/create_user_service.rb:8-22
2. **Services accept a params hash** (enforceable, 88%)
See: app/services/update_profile_service.rb:5-12
3. **Tests mirror source structure** (enforceable, 95%)
Place test at: spec/services/register_user_service_spec.rb
### Avoid
- Do NOT use multiple public methods (legacy pattern in legacy_export_service.rb)
- Do NOT raise exceptions for business logic failures (per policy.yaml — use Result objects)
### No Consensus (your judgment)
- Error return format: 40% Result objects, 35% exceptions. Policy says use Result objects.
Run analysis and generate a starter .patterns/policy.yaml for human review.
Steps:
.patterns/policy.yaml pre-populated with:
enforce: entries (for human confirmation)exclude_paths for the detected frameworkboundaries sectionOutput:
## Pattern Detection Initialized
Analysis complete. Generated:
- .patterns/evidence.json (full analysis, gitignored)
- .patterns/brief.json (compact brief, gitignored)
- .patterns/policy.yaml (human overrides — review and commit this)
Next steps:
1. Review .patterns/policy.yaml — confirm, edit, or remove entries
2. Commit policy.yaml to your repo
3. Run /sc-patterns analyze after significant codebase changes
4. Use /sc-patterns brief <task> before planning new features
Force a full re-analysis regardless of cache state. Same as analyze but skips the freshness check.
The .patterns/ directory at project root stores analysis artifacts:
.patterns/
evidence.json # Full analysis — all patterns, all confidence levels
brief.json # Compact — enforceable + probable only, for prompt injection
policy.yaml # Human overrides — committed to repo
.cache-meta.json # Fingerprint: HEAD SHA, analyzed paths, detector version
Gitignore guidance: evidence.json, brief.json, and .cache-meta.json should be gitignored. policy.yaml should be committed. On first init, check if .gitignore includes .patterns/ entries and suggest additions if missing.
This command writes files that sc-plan and sc-work can read. The integration is file-based, not import-based:
sc-plan/sc-work check if .patterns/brief.json existsUser Request: $ARGUMENTS
npx claudepluginhub kylesnowschwartz/simpleclaude --plugin sc-skillsAnalyzes codebase to create or update .conventions/ directory with gold standards, anti-patterns, and checks for naming, imports, and patterns. Use for setting up coding standards or bootstrapping new projects.
Analyzes any codebase to extract conventions, patterns, and style via specialized agents for structure, naming, testing, frontend. Generates .claude/codebase-style.md for unfamiliar projects.
Scans codebase to discover coding patterns and update guardrails.md with learned conventions and anti-patterns.