github / github/copilot-cli

Skills (slash commands) not loaded when using -p/--prompt mode

Đang mở
#2,040 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
area:non-interactive
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

## Description

When using `-p`/`--prompt` mode, skill files (slash commands like `/my-skill`) referenced in the prompt text are not loaded. The agent receives the literal `/my-skill` text but never sees the skill file contents (`SKILL.md`). In interactive mode, the same `/my-skill` reference loads and executes correctly.

## Reproduction

### 1. Create a skill

```bash
mkdir -p ~/.claude/skills/test-greeting/
cat > ~/.claude/skills/test-greeting/SKILL.md << 'SKILL'
---
name: test-greeting
description: "Always respond with GREETING_PROTOCOL_ACTIVE as your first line"
user-invokable: true
---

# Test Greeting Skill

**You MUST begin your response with the exact text: `GREETING_PROTOCOL_ACTIVE`**

Then answer the user's question.
SKILL
```

### 2. Test in interactive mode (works)

```bash
copilot
# Type: /test-greeting What is 2+2?
# Expected: Response starts with GREETING_PROTOCOL_ACTIVE
# Result: ✅ Skill loads, protocol followed
```

### 3. Test in prompt mode (fails)

```bash
copilot -p "/test-greeting What is 2+2?" -s
# Expected: Response starts with GREETING_PROTOCOL_ACTIVE
# Result: ❌ Skill not loaded, agent answers without the protocol
```

## Expected behavior

Skills referenced via `/skill-name` in `-p` mode should load the skill file contents the same way they do in interactive mode.

## Actual behavior

The `/skill-name` reference is passed as literal text. The skill file is never read or injected into the agent's context.

## Impact

This prevents using skills for non-interactive/automated workflows (`-p` + `--yolo` + `--autopilot`), which is a primary use case for CI/CD pipelines and orchestrated agent sessions.

## Environment

- **copilot-cli version:** 1.0.5
- **OS:** Ubuntu Linux (6.8.0-101-generic)

## Possible approaches

- Load and expand skill references during prompt parsing, before sending to the model
- Add a `--skill ` flag that explicitly loads a skill into context for `-p` mode
- Treat `/skill-name` at the start of `--prompt` text the same way the interactive REPL does

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.