Skip to content

Commit cc9e53c

Browse files
Improve org-wide workflow prompt based on claude-code-action
Extract meaningful prompt structure from anthropics/claude-code-action's prompt template and apply it to the org-wide workflow: - Strip trigger phrase from comment body before passing to Claude - Add CLAUDE.md awareness (check and follow repo-specific instructions) - Add read-before-modify discipline - Add minimal/focused change guidelines (no over-engineering) - Add security awareness (no secrets, no force push) - Add structured PR creation instructions with descriptive messages Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
1 parent 7702aa3 commit cc9e53c

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

.github/workflows/claude-org-wide.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,42 @@ jobs:
101101
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
102102
COMMENT_BODY: ${{ github.event.comment.body }}
103103
REPO_NAME: ${{ matrix.repo }}
104+
TRIGGER_PHRASE: "@phpstan-bot"
104105
run: |
105-
PROMPT="You are working on the repository ${REPO_NAME}.
106+
# Strip the trigger phrase from the comment to get the actual request
107+
REQUEST=$(echo "$COMMENT_BODY" | sed "s|${TRIGGER_PHRASE}||g" | sed 's/^[[:space:]]*//')
106108
107-
Here is the request from the issue comment:
108-
${COMMENT_BODY}
109+
PROMPT="You are an AI assistant working on the repository ${REPO_NAME}.
109110
110-
After making changes, you must create a pull request (not a draft) with your changes.
111-
Do not just push a branch — always open a real, non-draft pull request so the changes can be reviewed and merged."
111+
You are being triggered by an issue comment in the phpstan/.github repository. The comment contains a request that should be applied to this repository.
112+
113+
Here is the request:
114+
${REQUEST}
115+
116+
Follow these steps:
117+
118+
1. First, check if there is a CLAUDE.md file in the repository root. If it exists, read and follow its instructions and guidelines.
119+
120+
2. Understand the request carefully. Read any relevant code before making changes. Do not modify code you have not read.
121+
122+
3. Implement the requested changes:
123+
- Keep changes focused and minimal — only make what was requested.
124+
- Do not add unnecessary features, refactoring, or documentation beyond what was asked.
125+
- Be careful not to introduce security vulnerabilities.
126+
- Do not over-engineer the solution.
127+
128+
4. After making changes, commit and create a pull request:
129+
- Stage your changes with git add.
130+
- Write a clear, descriptive commit message that explains why the change was made.
131+
- Push your branch and create a non-draft pull request using gh pr create.
132+
- The PR title should be concise and descriptive.
133+
- The PR body should clearly describe what was changed and why.
134+
- Do not just push a branch — always open a real, non-draft pull request so the changes can be reviewed and merged.
135+
136+
Important:
137+
- Never force push or use destructive git commands.
138+
- Never commit files that may contain secrets (.env, credentials, etc.).
139+
- Only make changes that are directly requested or clearly necessary."
112140
113141
claude -p "$PROMPT" \
114142
--model claude-opus-4-6 \

0 commit comments

Comments
 (0)