Skip to content

Add path-scoped rules feature#20

Merged
HartBrook merged 2 commits intomainfrom
feature/rules
Jan 26, 2026
Merged

Add path-scoped rules feature#20
HartBrook merged 2 commits intomainfrom
feature/rules

Conversation

@HartBrook
Copy link
Copy Markdown
Owner

Summary

  • Add path-scoped rules system that syncs to ~/.claude/rules/
  • Rules use YAML frontmatter with paths: to scope guidelines to specific file patterns
  • Implement precedence model: project > personal > team > starter
  • Include 5 starter rules: security, testing, api/rest, frontend/react, error-handling

Changes

Core rules package (internal/rules/)

  • rule.go - Rule parsing with frontmatter support and ParseErrors type
  • registry.go - Precedence-based rule registry with deterministic ordering
  • claude.go - Convert rules to Claude Code format preserving frontmatter

Sync integration (internal/cli/sync.go)

  • Recursive fetching of rules from team repos
  • Sync to ~/.claude/rules/ with collision detection
  • Add --rules-only flag for isolated rule syncing
  • Fix os.RemoveAll error handling

Starter rules (internal/starter/rules/)

  • Security guidelines (secrets, input validation, auth)
  • Testing standards (coverage, quality, organization)
  • REST API standards (HTTP methods, status codes, error responses)
  • React guidelines (components, state, performance, accessibility)
  • Error handling patterns

Documentation

  • Add Path-Scoped Rules section to README
  • Update repository structure, file locations, CLI flags
  • Update example/README.md with rules structure

Test plan

  • Unit tests for rule parsing, registry, and conversion
  • Integration tests for sync, precedence, and subdirectories
  • All existing tests pass
  • Lint checks pass

@HartBrook HartBrook merged commit 0270ef3 into main Jan 26, 2026
4 checks passed
HartBrook added a commit that referenced this pull request Jan 28, 2026
Add entries for path-scoped rules (#20), multi-source sync (#21),
skills feature (#22), and integration test framework (#16).
@HartBrook HartBrook mentioned this pull request Jan 28, 2026
3 tasks
HartBrook added a commit that referenced this pull request Jan 28, 2026
Add entries for path-scoped rules (#20), multi-source sync (#21),
skills feature (#22), and integration test framework (#16).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant