Skip to content

Commit 81ab38b

Browse files
committed
feat: add deterministic slash commands and improved SKILL.md descriptions for Qwen CLI
Since Qwen Code CLI lacks Gemini-style lifecycle hooks (BeforeAgent/ BeforeTool), this uses custom commands as deterministic skill triggers. Changes: - Create 8 custom commands (.qwen/commands/): /brainstorm, /debug, /plan, /tdd, /review, /verify, /execute, /finish - Broaden SKILL.md descriptions for brainstorming, writing-plans, and using-superpowers with semantic keywords to improve probabilistic model-driven activation - Update install.sh to symlink custom commands into ~/.qwen/commands/ - Add Quick Skill Commands section to injected QWEN.md context block
1 parent 744ad2b commit 81ab38b

File tree

12 files changed

+98
-3
lines changed

12 files changed

+98
-3
lines changed

.qwen/commands/brainstorm.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "brainstorming" skill now. You MUST read and follow the brainstorming skill workflow before doing any creative work, building, designing, or implementing.
2+
3+
Use `/skills activate brainstorming` or read `~/.qwen/skills/brainstorming/SKILL.md` and follow it exactly.
4+
5+
Then apply the brainstorming workflow to whatever follows this command.

.qwen/commands/debug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "systematic-debugging" skill now. You MUST read and follow the systematic debugging workflow before proposing any fixes.
2+
3+
Use `/skills activate systematic-debugging` or read `~/.qwen/skills/systematic-debugging/SKILL.md` and follow it exactly.
4+
5+
Then apply the debugging workflow to whatever follows this command.

.qwen/commands/execute.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "executing-plans" skill now. You MUST read and follow the plan execution workflow with review checkpoints between tasks.
2+
3+
Use `/skills activate executing-plans` or read `~/.qwen/skills/executing-plans/SKILL.md` and follow it exactly.
4+
5+
Then execute the implementation plan following the skill's structured approach.

.qwen/commands/finish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "finishing-a-development-branch" skill now. You MUST read and follow the branch completion workflow before merging or creating PRs.
2+
3+
Use `/skills activate finishing-a-development-branch` or read `~/.qwen/skills/finishing-a-development-branch/SKILL.md` and follow it exactly.
4+
5+
Present structured options for merge, PR, or cleanup.

.qwen/commands/plan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "writing-plans" skill now. You MUST read and follow the planning workflow before touching any code.
2+
3+
Use `/skills activate writing-plans` or read `~/.qwen/skills/writing-plans/SKILL.md` and follow it exactly.
4+
5+
Then apply the planning workflow to whatever follows this command.

.qwen/commands/review.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "requesting-code-review" skill now. You MUST read and follow the code review workflow to verify work meets requirements.
2+
3+
Use `/skills activate requesting-code-review` or read `~/.qwen/skills/requesting-code-review/SKILL.md` and follow it exactly.
4+
5+
Then apply the code review workflow to whatever follows this command.

.qwen/commands/tdd.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "test-driven-development" skill now. You MUST read and follow the TDD workflow: write test first, watch it fail, write minimal code to pass, refactor.
2+
3+
Use `/skills activate test-driven-development` or read `~/.qwen/skills/test-driven-development/SKILL.md` and follow it exactly.
4+
5+
Then apply the TDD workflow to whatever follows this command.

.qwen/commands/verify.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Activate the "verification-before-completion" skill now. You MUST verify your work is complete and correct BEFORE committing, pushing, or claiming success.
2+
3+
Use `/skills activate verification-before-completion` or read `~/.qwen/skills/verification-before-completion/SKILL.md` and follow it exactly.
4+
5+
Run all verification steps and confirm output before making any success claims. Evidence before assertions, always.

.qwen/install.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,50 @@ else
171171
fi
172172

173173

174+
# --- Link custom commands (deterministic skill triggers) ---
175+
COMMANDS_DIR="$QWEN_DIR/commands"
176+
REPO_COMMANDS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/commands"
177+
178+
mkdir -p "$COMMANDS_DIR"
179+
180+
if [ -d "$REPO_COMMANDS_DIR" ]; then
181+
echo "Linking custom commands from $REPO_COMMANDS_DIR to $COMMANDS_DIR..."
182+
for cmd_path in "$REPO_COMMANDS_DIR"/*.md; do
183+
if [ -f "$cmd_path" ]; then
184+
cmd_name=$(basename "$cmd_path")
185+
target_path="$COMMANDS_DIR/$cmd_name"
186+
187+
if [ -e "$target_path" ] || [ -L "$target_path" ]; then
188+
if [ -L "$target_path" ]; then
189+
link_target="$(realpath "$target_path" 2>/dev/null || readlink "$target_path")"
190+
if [[ "$link_target" == "$REPO_DIR"* ]]; then
191+
rm "$target_path"
192+
else
193+
echo "$cmd_name points to $link_target (not this repo). Skipping."
194+
continue
195+
fi
196+
else
197+
echo "$target_path exists and is not a symlink. Skipping."
198+
continue
199+
fi
200+
fi
201+
202+
if ln -sr "$cmd_path" "$target_path" 2>/dev/null; then
203+
:
204+
elif command -v python3 >/dev/null 2>&1; then
205+
rel_path="$(python3 -c "import os,sys; print(os.path.relpath(sys.argv[1], sys.argv[2]))" "$cmd_path" "$COMMANDS_DIR")"
206+
ln -s "$rel_path" "$target_path"
207+
else
208+
echo " ⚠ Warning: Neither GNU ln -sr nor python3 available. Using absolute path (less portable)."
209+
ln -s "$cmd_path" "$target_path"
210+
fi
211+
echo " ✓ /${cmd_name%.md}"
212+
fi
213+
done
214+
else
215+
echo "No commands directory found at $REPO_COMMANDS_DIR, skipping command linking."
216+
fi
217+
174218
# --- Context injection into QWEN.md ---
175219
CONTEXT_HEADER="<!-- SUPERPOWERS-CONTEXT-START -->"
176220
CONTEXT_FOOTER="<!-- SUPERPOWERS-CONTEXT-END -->"
@@ -196,6 +240,17 @@ The skills were originally written for Claude Code. Interpret as follows:
196240
- Search → `search_file_content` or `glob`
197241
- Shell → `run_shell_command`
198242
- Web fetch → `web_fetch`
243+
244+
## Quick Skill Commands
245+
These slash commands deterministically activate specific skills:
246+
- `/brainstorm` — brainstorming (design before implementation)
247+
- `/debug` — systematic debugging
248+
- `/plan` — write implementation plans
249+
- `/tdd` — test-driven development
250+
- `/review` — request code review
251+
- `/verify` — verification before completion
252+
- `/execute` — execute an implementation plan
253+
- `/finish` — finish a development branch
199254
<!-- SUPERPOWERS-CONTEXT-END -->
200255
EOM
201256

skills/brainstorming/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: brainstorming
3-
description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
3+
description: "Designs, plans, and brainstorms new apps, features, and components. You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
44
---
55

66
# Brainstorming Ideas Into Designs

0 commit comments

Comments
 (0)