plan-qa
Generate QA test plan YAML from ticket
rlajous · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add rlajous/claude-code-commands --skill plan-qa技能说明
name: plan-qa description: Generate QA test plan YAML from ticket argument-hint: " [--url ]" disable-model-invocation: false allowed-tools: Read, Grep, Glob, WebFetch, Write, Bash(gh issue view:), Bash(mkdir:), Bash(cat:*) user-invocable: true
Cross-runtime: follow runtime compatibility for invocation, delegation, configuration precedence, state paths, and permissions.
You are helping generate a QA test plan from a ticket description, issue tracker ticket, or requirements. This command creates a structured YAML test plan that can be executed with /start-qa.
Step 1: Load Configuration
Check for configuration:
if [ -f ".git-workflow/config.yaml" ]; then CONFIG_PATH=".git-workflow/config.yaml"; elif [ -f ".claude/config.yaml" ]; then CONFIG_PATH=".claude/config.yaml"; else CONFIG_PATH=""; fi
Load from the resolved CONFIG_PATH (canonical first, legacy read-only fallback):
qa:
apiBaseUrl: ${API_BASE_URL}
testPlansDir: tests/qa
resultsDir: tests/qa/results
timeout: 10
sqsQueueUrl: ${SQS_QUEUE_URL}
issueTracker:
type: auto
Default Values:
qa:
apiBaseUrl: http://localhost:3000
testPlansDir: tests/qa
timeout: 10
Step 2: Parse Arguments
Extract from $ARGUMENTS:
$ARGUMENTS
Patterns to Extract:
| Pattern | Example | Meaning |
|---|---|---|
| Ticket ID | PROJ-123, ENG-456 | Issue tracker ticket |
--url <base_url> | --url https://api.example.com | Override API base URL |
--sqs <queue_url> | --sqs https://sqs.../queue | SQS queue for events |
--sqs-env <VAR_NAME> | --sqs-env SQS_EVENTS_QUEUE | SQS queue from env var |
| Remaining text | Test the /v2/risk endpoint | Task description |
Parsing Logic:
// Extract ticket ID
const ticketMatch = args.match(/([A-Z]+-\d+)/);
const ticketId = ticketMatch ? ticketMatch[1] : null;
// Extract URL override
const urlMatch = args.match(/--url\s+(\S+)/);
const baseUrl = urlMatch ? urlMatch[1] : config.qa.apiBaseUrl;
// Extract SQS queue
const sqsMatch = args.match(/--sqs\s+(\S+)/);
const sqsEnvMatch = args.match(/--sqs-env\s+(\S+)/);
const sqsQueue = sqsMatch ? sqsMatch[1] : sqsEnvMatch ? `\${${sqsEnvMatch[1]}}` : null;
// Remaining is description
const description = args.replace(ticketMatch, '').replace(urlMatch, '').trim();
Step 3: Fetch Ticket Details (If ID Provided)
Linear Integration (via MCP)
If ticket matches Linear format, use the Linear MCP server:
mcp__linear__get_issue(id: ticketId)
Extract:
- Title
- Description
- Acceptance criteria (from comments or description)
- Labels/tags
The MCP server handles authentication automatically via OAuth.
Jira Integration (via MCP)
If Jira configured, use the Jira MCP server:
mcp__jira__get_issue(issueKey: ticketId)
Extract:
- Summary (title)
- Description
- Acceptance criteria
- Labels
The MCP server handles authentication automatically.
GitHub Issues
If GitHub issue format (#123), use the gh CLI:
gh issue view ${ISSUE_NUMBER} --json title,body,labels
Step 4: Analyze Requirements
From the ticket or description, identify:
Endpoints to Test
Look for patterns in description:
GET /api/v1/usersPOST /endpoint- Path patterns:
/v1/,/v2/,/api/ - HTTP methods: GET, POST, PUT, PATCH, DELETE
Expected Behaviors
Extract from acceptance criteria:
- Success conditions
- Error scenarios
- Edge cases
- Authentication requirements
SQS Events (If Mentioned)
Look for:
- Event names (e.g., "USER_CREATED", "ORDER_PLACED")
- Queue mentions
- Async processing requirements
Step 5: Generate Test Plan
Create the test plan YAML:
# Auto-generated QA Test Plan
# Generated: {ISO_TIMESTAMP}
# Source: {TICKET_ID or "Manual description"}
name: "{DESCRIPTIVE_NAME}"
type: feature # feature | bug_fix | regression | smoke
description: |
{DESCRIPTION_FROM_TICKET_OR_INPUT}
# Base configuration
base_url: "${API_BASE_URL}" # or explicit URL
timeout: 10 # seconds
# Endpoints under test
endpoints:
- path: /api/v1/{endpoint}
method: GET
description: "{What this endpoint does}"
auth_required: true
# Test cases
test_cases:
# Happy path tests
- id: TC-001
name: "{Descriptive test name}"
type: happy_path
endpoint: /api/v1/{endpoint}
method: GET
headers:
Authorization: "Bearer ${API_TOKEN}"
Content-Type: application/json
params:
key: value
expected:
status: 200
body:
# Key assertions
success: true
priority: high
tags: [smoke, happy-path]
# Validation tests
- id: TC-002
name: "Invalid input returns 400"
type: validation
endpoint: /api/v1/{endpoint}
method: POST
body:
invalid_field: "bad_value"
expected:
status: 400
body:
error: true
priority: medium
tags: [validation]
# Authentication tests
- id: TC-003
name: "Missing auth returns 401"
type: auth
endpoint: /api/v1/{endpoint}
method: GET
# No Authorization header
expected:
status: 401
priority: high
tags: [auth, security]
# Edge cases
- id: TC-004
name: "Empty list returns empty array"
type: edge_case
endpoint: /api/v1/{endpoint}
method: GET
params:
filter: "nonexistent"
expected:
status: 200
body:
items: []
priority: low
tags: [edge-case]
# SQS assertions (if applicable)
sqs_assertions:
- name: "Event published after action"
queue_url: "${SQS_QUEUE_URL}"
trigger_test: TC-001 # Which test triggers this event
match_mode: json_field # json_field | contain
阅读完整来源 ↗