spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / plugins / accept-with-feedback / README.md
151 lines · 4.2 KBPreviewCodeRaw
1# Accept with Feedback
2
3A Claude Code plugin that lets you approve operations while providing guidance to Claude. Instead of just accepting or rejecting permission requests, you can accept *with feedback* - approving the operation while giving Claude additional context or instructions.
4
5## Why?
6
7Sometimes you want to approve an operation but also want to guide Claude's behavior:
8
9- "Yes, edit that file, but make sure to add error handling"
10- "Okay to run those tests, but skip the slow integration tests"
11- "Go ahead and commit, but use conventional commit format"
12
13This plugin bridges the gap between simple approval and rejection-with-feedback.
14
15## Installation
16
17This plugin is included in the Claude Code repository. Enable it in your settings or use:
18
19```bash
20claude /plugin install accept-with-feedback
21```
22
23## Usage
24
25### One-time feedback
26
27Use the `/accept-feedback` command to queue feedback for the next permission request:
28
29```
30/accept-feedback Make sure to preserve backwards compatibility
31```
32
33When Claude next asks for permission (e.g., to edit a file), the operation will be automatically approved and Claude will receive your guidance as a system message.
34
35### Persistent feedback rules
36
37Create rules that automatically provide feedback for certain types of operations. Add configuration to `.claude/accept-feedback.json`:
38
39```json
40{
41 "rules": [
42 {
43 "matcher": "Edit|Write",
44 "conditions": {
45 "file_path": ".py"
46 },
47 "feedback": "Follow PEP 8 style and add type hints to all functions."
48 },
49 {
50 "matcher": "Bash",
51 "conditions": {
52 "command": "npm"
53 },
54 "feedback": "Use --legacy-peer-deps if you encounter peer dependency issues."
55 }
56 ]
57}
58```
59
60Use `/configure-feedback` for an interactive configuration experience.
61
62## Configuration
63
64### Rule properties
65
66| Property | Description | Example |
67|----------|-------------|---------|
68| `matcher` | Tool name pattern | `"Edit"`, `"Write\|Edit"`, `"*"` |
69| `conditions` | Optional filters on tool input | `{"file_path": ".ts"}` |
70| `feedback` | Guidance message for Claude | `"Add JSDoc comments"` |
71
72### Configuration locations
73
74- **User-level**: `~/.claude/accept-feedback.json`
75- **Project-level**: `.claude/accept-feedback.json` (takes precedence)
76
77## Commands
78
79| Command | Description |
80|---------|-------------|
81| `/accept-feedback <message>` | Queue feedback for the next permission request |
82| `/configure-feedback` | Interactive configuration of persistent rules |
83
84## How it works
85
861. The plugin uses a `PermissionRequest` hook to intercept permission requests
872. When a permission request occurs:
88 - If there's pending feedback (from `/accept-feedback`), approve with that feedback
89 - If a configured rule matches, approve with the rule's feedback
90 - Otherwise, let the normal permission flow proceed
913. Feedback is sent to Claude as a system message, providing guidance for the operation
92
93## Examples
94
95### Example 1: One-time guidance
96
97```
98You: /accept-feedback Please add comprehensive error handling
99
100Claude: I'll edit src/api.ts to add the new endpoint...
101[Permission automatically approved with your feedback]
102
103Claude: I've added the endpoint with try-catch blocks and proper error responses...
104```
105
106### Example 2: Persistent Python style rules
107
108`.claude/accept-feedback.json`:
109```json
110{
111 "rules": [
112 {
113 "matcher": "Edit|Write",
114 "conditions": {
115 "file_path": ".py"
116 },
117 "feedback": "Use Google-style docstrings and add type hints to all function signatures."
118 }
119 ]
120}
121```
122
123Every time Claude edits a Python file, it receives this style guidance.
124
125### Example 3: Git workflow rules
126
127```json
128{
129 "rules": [
130 {
131 "matcher": "Bash",
132 "conditions": {
133 "command": "git commit"
134 },
135 "feedback": "Use conventional commit format: type(scope): description"
136 }
137 ]
138}
139```
140
141## Tips
142
143- Use specific matchers to avoid unnecessary approvals
144- Conditions use substring matching - `".py"` matches any path containing `.py`
145- Combine with other permission management for a comprehensive workflow
146- Feedback is visible in the conversation, so Claude can reference it
147
148## Related
149
150- Rejecting with feedback: Built into Claude Code's plan rejection flow
151- Permission hooks: See the [hook development guide](../plugin-dev/skills/hook-development/SKILL.md)