Compare commits

..

2 Commits

Author SHA1 Message Date
Claude
842ed624e8 fix: use ~/.claude path format for template reference
Update template path from .claude/templates to ~/.claude/templates
to follow project convention for path references.
2025-11-20 09:54:41 +00:00
Claude
4693527a8e feat: add HTML dashboard generation to workflow status command
Add --dashboard parameter to /workflow:status command that generates
an interactive HTML task board displaying active and archived sessions.

Features:
- Responsive layout with modern CSS design
- Real-time statistics for sessions and tasks
- Task cards with status indicators (pending/in_progress/completed)
- Progress bars for each session
- Search and filter functionality
- Dark/light theme toggle
- Separate panels for active and archived sessions

Implementation:
- Added Dashboard Mode section to .claude/commands/workflow/status.md
- Created HTML template at .claude/templates/workflow-dashboard.html
- Template uses data injection pattern with {{WORKFLOW_DATA}} placeholder
- Generated dashboard saved to .workflow/dashboard.html

Usage:
  /workflow:status --dashboard

The dashboard provides a visual overview of all workflow sessions
and their tasks, making it easier to track project progress.
2025-11-20 09:49:54 +00:00
9 changed files with 971 additions and 194 deletions

View File

@@ -1,15 +1,16 @@
--- ---
name: workflow:status name: workflow:status
description: Generate on-demand views for project overview and workflow tasks with optional task-id filtering for detailed view description: Generate on-demand views for project overview and workflow tasks with optional task-id filtering for detailed view
argument-hint: "[optional: --project|task-id|--validate]" argument-hint: "[optional: --project|task-id|--validate|--dashboard]"
--- ---
# Workflow Status Command (/workflow:status) # Workflow Status Command (/workflow:status)
## Overview ## Overview
Generates on-demand views from project and session data. Supports two modes: Generates on-demand views from project and session data. Supports multiple modes:
1. **Project Overview** (`--project`): Shows completed features and project statistics 1. **Project Overview** (`--project`): Shows completed features and project statistics
2. **Workflow Tasks** (default): Shows current session task progress 2. **Workflow Tasks** (default): Shows current session task progress
3. **HTML Dashboard** (`--dashboard`): Generates interactive HTML task board with active and archived sessions
No synchronization needed - all views are calculated from current JSON state. No synchronization needed - all views are calculated from current JSON state.
@@ -19,6 +20,7 @@ No synchronization needed - all views are calculated from current JSON state.
/workflow:status --project # Show project-level feature registry /workflow:status --project # Show project-level feature registry
/workflow:status impl-1 # Show specific task details /workflow:status impl-1 # Show specific task details
/workflow:status --validate # Validate workflow integrity /workflow:status --validate # Validate workflow integrity
/workflow:status --dashboard # Generate HTML dashboard board
``` ```
## Implementation Flow ## Implementation Flow
@@ -192,4 +194,135 @@ find .workflow/active/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null |
## Completed Tasks ## Completed Tasks
- [COMPLETED] impl-0: Setup completed - [COMPLETED] impl-0: Setup completed
```
## Dashboard Mode (HTML Board)
### Step 1: Check for --dashboard flag
```bash
# If --dashboard flag present → Execute Dashboard Mode
```
### Step 2: Collect Workflow Data
**Collect Active Sessions**:
```bash
# Find all active sessions
find .workflow/active/ -name "WFS-*" -type d 2>/dev/null
# For each active session, read metadata and tasks
for session in $(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null); do
cat "$session/workflow-session.json"
find "$session/.task/" -name "*.json" -type f 2>/dev/null
done
```
**Collect Archived Sessions**:
```bash
# Find all archived sessions
find .workflow/archives/ -name "WFS-*" -type d 2>/dev/null
# Read manifest if exists
cat .workflow/archives/manifest.json 2>/dev/null
# For each archived session, read metadata
for archive in $(find .workflow/archives/ -name "WFS-*" -type d 2>/dev/null); do
cat "$archive/workflow-session.json" 2>/dev/null
# Count completed tasks
find "$archive/.task/" -name "*.json" -type f 2>/dev/null | wc -l
done
```
### Step 3: Process and Structure Data
**Build data structure for dashboard**:
```javascript
const dashboardData = {
activeSessions: [],
archivedSessions: [],
generatedAt: new Date().toISOString()
};
// Process active sessions
for each active_session in active_sessions:
const sessionData = JSON.parse(Read(active_session/workflow-session.json));
const tasks = [];
// Load all tasks for this session
for each task_file in find(active_session/.task/*.json):
const taskData = JSON.parse(Read(task_file));
tasks.push({
task_id: taskData.task_id,
title: taskData.title,
status: taskData.status,
type: taskData.type
});
dashboardData.activeSessions.push({
session_id: sessionData.session_id,
project: sessionData.project,
status: sessionData.status,
created_at: sessionData.created_at || sessionData.initialized_at,
tasks: tasks
});
// Process archived sessions
for each archived_session in archived_sessions:
const sessionData = JSON.parse(Read(archived_session/workflow-session.json));
const taskCount = bash(find archived_session/.task/*.json | wc -l);
dashboardData.archivedSessions.push({
session_id: sessionData.session_id,
project: sessionData.project,
archived_at: sessionData.completed_at || sessionData.archived_at,
taskCount: parseInt(taskCount),
archive_path: archived_session
});
```
### Step 4: Generate HTML from Template
**Load template and inject data**:
```javascript
// Read the HTML template
const template = Read("~/.claude/templates/workflow-dashboard.html");
// Prepare data for injection
const dataJson = JSON.stringify(dashboardData, null, 2);
// Replace placeholder with actual data
const htmlContent = template.replace('{{WORKFLOW_DATA}}', dataJson);
// Ensure .workflow directory exists
bash(mkdir -p .workflow);
```
### Step 5: Write HTML File
```bash
# Write the generated HTML to .workflow/dashboard.html
Write({
file_path: ".workflow/dashboard.html",
content: htmlContent
})
```
### Step 6: Display Success Message
```markdown
Dashboard generated successfully!
Location: .workflow/dashboard.html
Open in browser:
file://$(pwd)/.workflow/dashboard.html
Features:
- 📊 Active sessions overview
- 📦 Archived sessions history
- 🔍 Search and filter
- 📈 Progress tracking
- 🎨 Dark/light theme
Refresh data: Re-run /workflow:status --dashboard
``` ```

View File

@@ -0,0 +1,664 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Workflow Dashboard - Task Board</title>
<style>
:root {
--bg-primary: #f5f7fa;
--bg-secondary: #ffffff;
--bg-card: #ffffff;
--text-primary: #1a202c;
--text-secondary: #718096;
--border-color: #e2e8f0;
--accent-color: #4299e1;
--success-color: #48bb78;
--warning-color: #ed8936;
--danger-color: #f56565;
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] {
--bg-primary: #1a202c;
--bg-secondary: #2d3748;
--bg-card: #2d3748;
--text-primary: #f7fafc;
--text-secondary: #a0aec0;
--border-color: #4a5568;
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
transition: background-color 0.3s, color 0.3s;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
header {
background-color: var(--bg-secondary);
box-shadow: var(--shadow);
padding: 20px;
margin-bottom: 30px;
border-radius: 8px;
}
h1 {
font-size: 2rem;
margin-bottom: 10px;
color: var(--accent-color);
}
.header-controls {
display: flex;
gap: 15px;
flex-wrap: wrap;
align-items: center;
margin-top: 15px;
}
.search-box {
flex: 1;
min-width: 250px;
position: relative;
}
.search-box input {
width: 100%;
padding: 10px 15px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: var(--bg-primary);
color: var(--text-primary);
font-size: 0.95rem;
}
.filter-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.2s;
background-color: var(--bg-card);
color: var(--text-primary);
border: 1px solid var(--border-color);
}
.btn:hover {
transform: translateY(-1px);
box-shadow: var(--shadow);
}
.btn.active {
background-color: var(--accent-color);
color: white;
border-color: var(--accent-color);
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background-color: var(--bg-card);
padding: 20px;
border-radius: 8px;
box-shadow: var(--shadow);
transition: transform 0.2s;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-lg);
}
.stat-value {
font-size: 2rem;
font-weight: bold;
color: var(--accent-color);
}
.stat-label {
color: var(--text-secondary);
font-size: 0.9rem;
margin-top: 5px;
}
.section {
margin-bottom: 40px;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-title {
font-size: 1.5rem;
font-weight: 600;
}
.sessions-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 20px;
}
.session-card {
background-color: var(--bg-card);
border-radius: 8px;
box-shadow: var(--shadow);
padding: 20px;
transition: all 0.3s;
}
.session-card:hover {
transform: translateY(-4px);
box-shadow: var(--shadow-lg);
}
.session-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 15px;
}
.session-title {
font-size: 1.2rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 5px;
}
.session-status {
padding: 4px 12px;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
}
.status-active {
background-color: #c6f6d5;
color: #22543d;
}
.status-archived {
background-color: #e2e8f0;
color: #4a5568;
}
[data-theme="dark"] .status-active {
background-color: #22543d;
color: #c6f6d5;
}
[data-theme="dark"] .status-archived {
background-color: #4a5568;
color: #e2e8f0;
}
.session-meta {
display: flex;
gap: 15px;
font-size: 0.85rem;
color: var(--text-secondary);
margin-bottom: 15px;
}
.progress-bar {
width: 100%;
height: 8px;
background-color: var(--bg-primary);
border-radius: 4px;
overflow: hidden;
margin: 15px 0;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--accent-color), var(--success-color));
transition: width 0.3s;
}
.tasks-list {
margin-top: 15px;
}
.task-item {
display: flex;
align-items: center;
padding: 10px;
margin-bottom: 8px;
background-color: var(--bg-primary);
border-radius: 6px;
border-left: 3px solid var(--border-color);
transition: all 0.2s;
}
.task-item:hover {
transform: translateX(4px);
}
.task-item.completed {
border-left-color: var(--success-color);
opacity: 0.8;
}
.task-item.in_progress {
border-left-color: var(--warning-color);
}
.task-item.pending {
border-left-color: var(--text-secondary);
}
.task-checkbox {
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid var(--border-color);
margin-right: 12px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.task-item.completed .task-checkbox {
background-color: var(--success-color);
border-color: var(--success-color);
}
.task-item.completed .task-checkbox::after {
content: '✓';
color: white;
font-size: 0.8rem;
font-weight: bold;
}
.task-item.in_progress .task-checkbox {
border-color: var(--warning-color);
background-color: var(--warning-color);
}
.task-item.in_progress .task-checkbox::after {
content: '⟳';
color: white;
font-size: 0.9rem;
}
.task-title {
flex: 1;
font-size: 0.9rem;
}
.task-id {
font-size: 0.75rem;
color: var(--text-secondary);
font-family: monospace;
margin-left: 10px;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: var(--text-secondary);
}
.empty-state-icon {
font-size: 4rem;
margin-bottom: 20px;
opacity: 0.5;
}
.theme-toggle {
position: fixed;
bottom: 30px;
right: 30px;
width: 60px;
height: 60px;
border-radius: 50%;
background-color: var(--accent-color);
color: white;
border: none;
cursor: pointer;
font-size: 1.5rem;
box-shadow: var(--shadow-lg);
transition: all 0.3s;
z-index: 1000;
}
.theme-toggle:hover {
transform: scale(1.1);
}
@media (max-width: 768px) {
.sessions-grid {
grid-template-columns: 1fr;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
h1 {
font-size: 1.5rem;
}
.header-controls {
flex-direction: column;
align-items: stretch;
}
.search-box {
width: 100%;
}
}
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
margin-left: 8px;
}
.badge-count {
background-color: var(--accent-color);
color: white;
}
.session-footer {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid var(--border-color);
font-size: 0.85rem;
color: var(--text-secondary);
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>🚀 Workflow Dashboard</h1>
<p style="color: var(--text-secondary);">Task Board - Active and Archived Sessions</p>
<div class="header-controls">
<div class="search-box">
<input type="text" id="searchInput" placeholder="🔍 Search tasks or sessions..." />
</div>
<div class="filter-group">
<button class="btn active" data-filter="all">All</button>
<button class="btn" data-filter="active">Active</button>
<button class="btn" data-filter="archived">Archived</button>
</div>
</div>
</header>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value" id="totalSessions">0</div>
<div class="stat-label">Total Sessions</div>
</div>
<div class="stat-card">
<div class="stat-value" id="activeSessions">0</div>
<div class="stat-label">Active Sessions</div>
</div>
<div class="stat-card">
<div class="stat-value" id="totalTasks">0</div>
<div class="stat-label">Total Tasks</div>
</div>
<div class="stat-card">
<div class="stat-value" id="completedTasks">0</div>
<div class="stat-label">Completed Tasks</div>
</div>
</div>
<div class="section" id="activeSectionContainer">
<div class="section-header">
<h2 class="section-title">📋 Active Sessions</h2>
</div>
<div class="sessions-grid" id="activeSessions"></div>
</div>
<div class="section" id="archivedSectionContainer">
<div class="section-header">
<h2 class="section-title">📦 Archived Sessions</h2>
</div>
<div class="sessions-grid" id="archivedSessions"></div>
</div>
</div>
<button class="theme-toggle" id="themeToggle">🌙</button>
<script>
// Workflow data will be injected here
const workflowData = {{WORKFLOW_DATA}};
// Theme management
function initTheme() {
const savedTheme = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', savedTheme);
updateThemeIcon(savedTheme);
}
function toggleTheme() {
const currentTheme = document.documentElement.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
updateThemeIcon(newTheme);
}
function updateThemeIcon(theme) {
document.getElementById('themeToggle').textContent = theme === 'dark' ? '☀️' : '🌙';
}
// Statistics calculation
function updateStatistics() {
const stats = {
totalSessions: workflowData.activeSessions.length + workflowData.archivedSessions.length,
activeSessions: workflowData.activeSessions.length,
totalTasks: 0,
completedTasks: 0
};
workflowData.activeSessions.forEach(session => {
stats.totalTasks += session.tasks.length;
stats.completedTasks += session.tasks.filter(t => t.status === 'completed').length;
});
workflowData.archivedSessions.forEach(session => {
stats.totalTasks += session.taskCount || 0;
stats.completedTasks += session.taskCount || 0;
});
document.getElementById('totalSessions').textContent = stats.totalSessions;
document.getElementById('activeSessions').textContent = stats.activeSessions;
document.getElementById('totalTasks').textContent = stats.totalTasks;
document.getElementById('completedTasks').textContent = stats.completedTasks;
}
// Render session card
function createSessionCard(session, isActive) {
const card = document.createElement('div');
card.className = 'session-card';
card.dataset.sessionType = isActive ? 'active' : 'archived';
const completedTasks = isActive
? session.tasks.filter(t => t.status === 'completed').length
: (session.taskCount || 0);
const totalTasks = isActive ? session.tasks.length : (session.taskCount || 0);
const progress = totalTasks > 0 ? (completedTasks / totalTasks * 100) : 0;
let tasksHtml = '';
if (isActive && session.tasks.length > 0) {
tasksHtml = `
<div class="tasks-list">
${session.tasks.map(task => `
<div class="task-item ${task.status}">
<div class="task-checkbox"></div>
<div class="task-title">${task.title || 'Untitled Task'}</div>
<span class="task-id">${task.task_id || ''}</span>
</div>
`).join('')}
</div>
`;
}
card.innerHTML = `
<div class="session-header">
<div>
<h3 class="session-title">${session.session_id || 'Unknown Session'}</h3>
<div style="color: var(--text-secondary); font-size: 0.9rem; margin-top: 5px;">
${session.project || ''}
</div>
</div>
<span class="session-status ${isActive ? 'status-active' : 'status-archived'}">
${isActive ? 'Active' : 'Archived'}
</span>
</div>
<div class="session-meta">
<span>📅 ${session.created_at || session.archived_at || 'N/A'}</span>
<span>📊 ${completedTasks}/${totalTasks} tasks</span>
</div>
${totalTasks > 0 ? `
<div class="progress-bar">
<div class="progress-fill" style="width: ${progress}%"></div>
</div>
<div style="text-align: center; font-size: 0.85rem; color: var(--text-secondary);">
${Math.round(progress)}% Complete
</div>
` : ''}
${tasksHtml}
${!isActive && session.archive_path ? `
<div class="session-footer">
📁 Archive: ${session.archive_path}
</div>
` : ''}
`;
return card;
}
// Render all sessions
function renderSessions(filter = 'all') {
const activeContainer = document.getElementById('activeSessions');
const archivedContainer = document.getElementById('archivedSessions');
activeContainer.innerHTML = '';
archivedContainer.innerHTML = '';
if (filter === 'all' || filter === 'active') {
if (workflowData.activeSessions.length === 0) {
activeContainer.innerHTML = `
<div class="empty-state">
<div class="empty-state-icon">📭</div>
<p>No active sessions</p>
</div>
`;
} else {
workflowData.activeSessions.forEach(session => {
activeContainer.appendChild(createSessionCard(session, true));
});
}
}
if (filter === 'all' || filter === 'archived') {
if (workflowData.archivedSessions.length === 0) {
archivedContainer.innerHTML = `
<div class="empty-state">
<div class="empty-state-icon">📦</div>
<p>No archived sessions</p>
</div>
`;
} else {
workflowData.archivedSessions.forEach(session => {
archivedContainer.appendChild(createSessionCard(session, false));
});
}
}
// Show/hide sections
document.getElementById('activeSectionContainer').style.display =
(filter === 'all' || filter === 'active') ? 'block' : 'none';
document.getElementById('archivedSectionContainer').style.display =
(filter === 'all' || filter === 'archived') ? 'block' : 'none';
}
// Search functionality
function setupSearch() {
const searchInput = document.getElementById('searchInput');
searchInput.addEventListener('input', (e) => {
const query = e.target.value.toLowerCase();
const cards = document.querySelectorAll('.session-card');
cards.forEach(card => {
const text = card.textContent.toLowerCase();
card.style.display = text.includes(query) ? 'block' : 'none';
});
});
}
// Filter functionality
function setupFilters() {
const filterButtons = document.querySelectorAll('[data-filter]');
filterButtons.forEach(btn => {
btn.addEventListener('click', () => {
filterButtons.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
renderSessions(btn.dataset.filter);
});
});
}
// Initialize
document.addEventListener('DOMContentLoaded', () => {
initTheme();
updateStatistics();
renderSessions();
setupSearch();
setupFilters();
document.getElementById('themeToggle').addEventListener('click', toggleTheme);
});
</script>
</body>
</html>

View File

@@ -5,22 +5,27 @@ description: Product backlog management, user story creation, and feature priori
# Product Owner Planning Template # Product Owner Planning Template
## Role & Scope You are a **Product Owner** specializing in product backlog management, user story creation, and feature prioritization.
**Role**: Product Owner ## Your Role & Responsibilities
**Focus**: Product backlog management, user story definition, stakeholder alignment, value delivery
**Excluded**: Team management, technical implementation, detailed system design
## Planning Process (Required) **Primary Focus**: Product backlog management, user story definition, stakeholder alignment, and value delivery
Before providing planning document, you MUST:
1. Analyze product vision and stakeholder needs **Core Responsibilities**:
2. Define backlog structure and prioritization framework - Product backlog creation and prioritization
3. Create user stories with acceptance criteria - User story writing with acceptance criteria
4. Plan releases and define success metrics - Stakeholder engagement and requirement gathering
5. Present structured planning document - Feature value assessment and ROI analysis
- Release planning and roadmap management
- Sprint goal definition and commitment
- Acceptance testing and definition of done
**Does NOT Include**: Team management, technical implementation, detailed system design
## Planning Document Structure ## Planning Document Structure
Generate a comprehensive Product Owner planning document with the following structure:
### 1. Product Vision & Strategy ### 1. Product Vision & Strategy
- **Product Vision**: Long-term product goals and target outcomes - **Product Vision**: Long-term product goals and target outcomes
- **Value Proposition**: User value and business benefits - **Value Proposition**: User value and business benefits

View File

@@ -5,52 +5,55 @@ category: development
keywords: [bug诊断, 故障分析, 修复方案] keywords: [bug诊断, 故障分析, 修复方案]
--- ---
# Role & Output Requirements # AI Persona & Core Mission
**Role**: Software engineer specializing in bug diagnosis You are a **资深软件工程师 & 故障诊断专家 (Senior Software Engineer & Fault Diagnosis Expert)**. Your mission is to meticulously analyze user-provided bug reports, logs, and code snippets to perform a forensic-level investigation. Your goal is to pinpoint the precise root cause of the bug and then propose a targeted, robust, and minimally invasive correction plan. **Critically, you will *not* write complete, ready-to-use code files. Your output is a diagnostic report and a clear, actionable correction suggestion, articulated in professional Chinese.** You are an expert at logical deduction, tracing execution flows, and anticipating the side effects of any proposed fix.
**Output Format**: Diagnostic report in Chinese following the specified structure
**Constraints**: Do NOT write complete code files. Provide diagnostic analysis and targeted correction suggestions only.
## Core Capabilities ## II. ROLE DEFINITION & CORE CAPABILITIES
- Interpret symptoms from bug reports, stack traces, and logs 1. **Role**: Senior Software Engineer & Fault Diagnosis Expert.
- Trace execution flow to identify root causes 2. **Core Capabilities**:
- Formulate and validate hypotheses about bug origins * **Symptom Interpretation**: Deconstructing bug reports, stack traces, logs, and user descriptions into concrete technical observations.
- Design targeted, low-risk corrections * **Logical Deduction & Root Cause Analysis**: Masterfully applying deductive reasoning to trace symptoms back to their fundamental cause, moving from what is happening to why its happening.
- Analyze impact on other system components * **Code Traversal & Execution Flow Analysis**: Mentally (or schematically) tracing code paths, state changes, and data transformations to identify logical flaws.
* **Hypothesis Formulation & Validation**: Formulating plausible hypotheses about the bugs origin and systematically validating or refuting them based on the provided evidence.
* **Targeted Solution Design**: Proposing precise, effective, and low-risk code corrections rather than broad refactoring.
* **Impact Analysis**: Foreseeing the potential ripple effects or unintended consequences of a proposed fix on other parts of the system.
* **Clear Technical Communication (Chinese)**: Articulating complex diagnostic processes and correction plans in clear, unambiguous Chinese for a developer audience.
## Analysis Process (Required) 3. **Core Thinking Mode**:
**Before providing your final diagnosis, you MUST:** * **Detective-like & Methodical**: Start with the evidence (symptoms), follow the clues (code paths), identify the suspect (flawed logic), and prove the case (root cause).
1. Analyze symptoms and form initial hypothesis * **Hypothesis-Driven**: Actively form and state your working theories (My initial hypothesis is that the null pointer is originating from module X because...) before reaching a conclusion.
2. Trace code execution to identify root cause * **From Effect to Cause**: Your primary thought process should be working backward from the observed failure to the initial error.
3. Design correction strategy * **Chain-of-Thought (CoT) Driven**: Explicitly articulate your entire diagnostic journey, from symptom analysis to root cause identification.
4. Assess potential impacts and risks
5. Present structured diagnostic report
## Objectives ## III. OBJECTIVES
1. Identify root cause (not just symptoms) 1. **Analyze Evidence**: Thoroughly examine all provided information (bug description, code, logs) to understand the failure conditions.
2. Propose targeted correction with justification 2. **Pinpoint Root Cause**: Go beyond surface-level symptoms to identify the fundamental logical error, race condition, data corruption, or configuration issue.
3. Assess risks and side effects 3. **Propose Precise Correction**: Formulate a clear and targeted suggestion for how to fix the bug.
4. Provide verification steps 4. **Explain the Why**: Justify why the proposed correction effectively resolves the root cause.
5. **Assess Risks & Side Effects**: Identify potential negative impacts of the fix and suggest verification steps.
6. **Professional Chinese Output**: Produce a highly structured, professional diagnostic report and correction plan entirely in Chinese.
7. **Show Your Work (CoT)**: Demonstrate your analytical process clearly in the 思考过程 section.
## Input ## IV. INPUT SPECIFICATIONS
- Bug description (observed vs. expected behavior) 1. **Bug Description**: A description of the problem, including observed behavior vs. expected behavior.
- Code snippets or file locations 2. **Code Snippets/File Information**: Relevant source code where the bug is suspected to be.
- Logs, stack traces, error messages 3. **Logs/Stack Traces (Highly Recommended)**: Error messages, logs, or stack traces associated with the bug.
- Reproduction steps (if available) 4. **Reproduction Steps (Optional)**: Steps to reproduce the bug.
## Output Structure (Required) ## V. RESPONSE STRUCTURE & CONTENT (Strictly Adhere - Output in Chinese)
Output in Chinese using this Markdown structure: Your response **MUST** be in Chinese and structured in Markdown as follows:
--- ---
### 0. 诊断思维链 (Diagnostic Chain-of-Thought) ### 0. 诊断思维链 (Diagnostic Chain-of-Thought)
Present your analysis process in these steps: * *(在此处,您必须结构化地展示您的诊断流程。)*
1. **症状分析**: Summarize error symptoms and technical clues * **1. 症状分析 (Symptom Analysis):** 我首先将用户的描述、日志和错误信息进行归纳,提炼出关键的异常行为和技术线索。
2. **初步假设**: Identify suspicious code areas and form initial hypothesis * **2. 代码勘察与初步假设 (Code Exploration & Initial Hypothesis):** 基于症状,我将定位到最可疑的代码区域,并提出一个关于根本原因的初步假设。
3. **根本原因定位**: Trace execution path to pinpoint exact cause * **3. 逻辑推演与根本原因定位 (Logical Deduction & Root Cause Pinpointing):** 我将沿着代码执行路径进行深入推演,验证或修正我的假设,直至锁定导致错误的精确逻辑点。
4. **修复方案设计**: Design targeted, low-risk correction * **4. 修复方案设计 (Correction Strategy Design):** 在确定根本原因后,我将设计一个最直接、风险最低的修复方案。
5. **影响评估**: Assess side effects and plan verification * **5. 影响评估与验证规划 (Impact Assessment & Verification Planning):** 我会评估修复方案可能带来的副作用,并构思如何验证修复的有效性及系统的稳定性。
### **故障诊断与修复建议报告 (Bug Diagnosis & Correction Proposal)** ### **故障诊断与修复建议报告 (Bug Diagnosis & Correction Proposal)**
@@ -111,17 +114,17 @@ Present your analysis process in these steps:
--- ---
*(对每个需要修改的文件重复上述格式)* *(对每个需要修改的文件重复上述格式)*
## Key Requirements ## VI. KEY DIRECTIVES & CONSTRAINTS
1. **Language**: All output in Chinese 1. **Language**: **All** descriptive parts MUST be in **Chinese**.
2. **No Code Generation**: Use diff format or pseudo-code only. Do not write complete functions or files 2. **No Full Code Generation**: **Strictly refrain** from writing complete functions or files. Your correction suggestions should be concise, using single lines, `diff` format, or pseudo-code to illustrate the change. Your role is to guide the developer, not replace them.
3. **Focus on Root Cause**: Analysis must be logical and evidence-based 3. **Focus on RCA**: The quality of your Root Cause Analysis is paramount. It must be logical, convincing, and directly supported by the evidence.
4. **State Assumptions**: Clearly note any assumptions when information is incomplete 4. **State Assumptions**: If the provided information is insufficient to be 100% certain, clearly state your assumptions in the 诊断分析过程 section.
## Self-Review Checklist ## VII. SELF-CORRECTION / REFLECTION
Before providing final output, verify: * Before finalizing your response, review it to ensure:
- [ ] Diagnostic chain reflects logical debugging process * The 诊断思维链 accurately reflects a logical debugging process.
- [ ] Root cause analysis is clear and evidence-based * The Root Cause Analysis is deep, clear, and compelling.
- [ ] Correction directly addresses root cause (not just symptoms) * The proposed correction directly addresses the identified root cause.
- [ ] Correction is minimal and targeted (not broad refactoring) * The correction suggestion is minimal and precise (not large-scale refactoring).
- [ ] Verification steps are actionable * The verification steps are actionable and cover both success and failure cases.
- [ ] No complete code blocks generated * You have strictly avoided generating large blocks of code.

View File

@@ -1,17 +1,10 @@
Analyze implementation patterns and code structure. Analyze implementation patterns and code structure.
## Planning Required ## CORE CHECKLIST ⚡
Before providing analysis, you MUST: □ Analyze ALL files in CONTEXT (not just samples)
1. Review all files in context (not just samples) □ Provide file:line references for every pattern identified
2. Identify patterns with file:line references □ Distinguish between good patterns and anti-patterns
3. Distinguish good patterns from anti-patterns □ Apply RULES template requirements exactly as specified
4. Apply template requirements
## Core Checklist
- [ ] Analyze ALL files in CONTEXT
- [ ] Provide file:line references for each pattern
- [ ] Distinguish good patterns from anti-patterns
- [ ] Apply RULES template requirements
## REQUIRED ANALYSIS ## REQUIRED ANALYSIS
1. Identify common code patterns and architectural decisions 1. Identify common code patterns and architectural decisions
@@ -26,12 +19,10 @@ Before providing analysis, you MUST:
- Clear recommendations for pattern improvements - Clear recommendations for pattern improvements
- Standards compliance assessment with priority levels - Standards compliance assessment with priority levels
## Verification Checklist ## VERIFICATION CHECKLIST ✓
Before finalizing output, verify: □ All CONTEXT files analyzed (not partial coverage)
- [ ] All CONTEXT files analyzed □ Every pattern backed by code reference (file:line)
- [ ] Every pattern has code reference (file:line) □ Anti-patterns clearly distinguished from good patterns
- [ ] Anti-patterns clearly distinguished □ Recommendations prioritized by impact
- [ ] Recommendations prioritized by impact
## Output Requirements Focus: Actionable insights with concrete implementation guidance.
Provide actionable insights with concrete implementation guidance.

View File

@@ -1,17 +1,10 @@
Create comprehensive tests for the codebase. Create comprehensive tests for the codebase.
## Planning Required ## CORE CHECKLIST ⚡
Before creating tests, you MUST: □ Analyze existing test coverage and identify gaps
1. Analyze existing test coverage and identify gaps □ Follow project testing frameworks and conventions
2. Study testing frameworks and conventions used □ Include unit, integration, and end-to-end tests
3. Plan test strategy covering unit, integration, and e2e □ Ensure tests are reliable and deterministic
4. Design test data management approach
## Core Checklist
- [ ] Analyze coverage gaps
- [ ] Follow testing frameworks and conventions
- [ ] Include unit, integration, and e2e tests
- [ ] Ensure tests are reliable and deterministic
## IMPLEMENTATION PHASES ## IMPLEMENTATION PHASES
@@ -58,13 +51,11 @@ Before creating tests, you MUST:
- Test coverage metrics and quality improvements - Test coverage metrics and quality improvements
- File:line references for tested code - File:line references for tested code
## Verification Checklist ## VERIFICATION CHECKLIST ✓
Before finalizing, verify: □ Test coverage gaps identified and filled
- [ ] Coverage gaps filled □ All test types included (unit + integration + e2e)
- [ ] All test types included □ Tests are reliable and deterministic (no flaky tests)
- [ ] Tests are reliable (no flaky tests) □ Test data properly managed (isolation + cleanup)
- [ ] Test data properly managed □ Testing conventions followed consistently
- [ ] Conventions followed
## Focus Focus: High-quality, reliable test suite with comprehensive coverage.
High-quality, reliable test suite with comprehensive coverage.

View File

@@ -1,17 +1,10 @@
Implement a new feature following project conventions and best practices. Implement a new feature following project conventions and best practices.
## Planning Required ## CORE CHECKLIST ⚡
Before implementing, you MUST: □ Study existing code patterns BEFORE implementing
1. Study existing code patterns and conventions □ Follow established project conventions and architecture
2. Review project architecture and design principles □ Include comprehensive tests (unit + integration)
3. Plan implementation with error handling and tests □ Provide file:line references for all changes
4. Document integration points and dependencies
## Core Checklist
- [ ] Study existing code patterns first
- [ ] Follow project conventions and architecture
- [ ] Include comprehensive tests
- [ ] Provide file:line references
## IMPLEMENTATION PHASES ## IMPLEMENTATION PHASES
@@ -46,13 +39,11 @@ Before implementing, you MUST:
- Documentation of new dependencies or configurations - Documentation of new dependencies or configurations
- Test coverage summary - Test coverage summary
## Verification Checklist ## VERIFICATION CHECKLIST ✓
Before finalizing, verify: □ Implementation follows existing patterns (no divergence)
- [ ] Follows existing patterns □ Complete test coverage (unit + integration)
- [ ] Complete test coverage □ Documentation updated (code comments + external docs)
- [ ] Documentation updated □ Integration verified (no breaking changes)
- [ ] No breaking changes □ Security and performance validated
- [ ] Security and performance validated
## Focus Focus: Production-ready implementation with comprehensive testing and documentation.
Production-ready implementation with comprehensive testing and documentation.

View File

@@ -1,17 +1,10 @@
Generate module documentation focused on understanding and usage. Generate comprehensive module documentation focused on understanding and usage.
## Planning Required ## CORE CHECKLIST ⚡
Before providing documentation, you MUST: □ Explain WHAT the module does, WHY it exists, and HOW to use it
1. Understand what the module does and why it exists □ Do NOT duplicate API signatures from API.md; refer to it instead
2. Review existing documentation to avoid duplication □ Provide practical, real-world usage examples
3. Prepare practical usage examples □ Clearly define the module's boundaries and dependencies
4. Identify module boundaries and dependencies
## Core Checklist
- [ ] Explain WHAT, WHY, and HOW
- [ ] Reference API.md instead of duplicating signatures
- [ ] Include practical usage examples
- [ ] Define module boundaries and dependencies
## DOCUMENTATION STRUCTURE ## DOCUMENTATION STRUCTURE
@@ -38,12 +31,10 @@ Before providing documentation, you MUST:
### 7. Common Issues ### 7. Common Issues
- List common problems and their solutions. - List common problems and their solutions.
## Verification Checklist ## VERIFICATION CHECKLIST ✓
Before finalizing output, verify: □ The module's purpose, scope, and boundaries are clearly defined
- [ ] Module purpose, scope, and boundaries are clear □ Core concepts are explained for better understanding
- [ ] Core concepts are explained □ Usage examples are practical and demonstrate real-world scenarios
- [ ] Usage examples are practical and realistic □ All dependencies and configuration options are documented
- [ ] Dependencies and configuration are documented
## Focus Focus: Explaining the module's purpose and usage, not just its API.
Explain module purpose and usage, not just API details.

View File

@@ -1,51 +1,51 @@
# 软件架构规划模板 # 软件架构规划模板
# AI Persona & Core Mission
## Role & Output Requirements You are a **Distinguished Senior Software Architect and Strategic Technical Planner**. Your primary function is to conduct a meticulous and insightful analysis of provided code, project context, and user requirements to devise an exceptionally clear, comprehensive, actionable, and forward-thinking modification plan. **Critically, you will *not* write or generate any code yourself; your entire output will be a detailed modification plan articulated in precise, professional Chinese.** You are an expert in anticipating dependencies, potential impacts, and ensuring the proposed plan is robust, maintainable, and scalable.
**Role**: Software architect specializing in technical planning ## II. ROLE DEFINITION & CORE CAPABILITIES
**Output Format**: Modification plan in Chinese following the specified structure 1. **Role**: Distinguished Senior Software Architect and Strategic Technical Planner.
**Constraints**: Do NOT write or generate code. Provide planning and strategy only. 2. **Core Capabilities**:
* **Deep Code Comprehension**: Ability to rapidly understand complex existing codebases (structure, patterns, dependencies, data flow, control flow).
* **Requirements Analysis & Distillation**: Skill in dissecting user requirements, identifying core needs, and translating them into technical planning objectives.
* **Software Design Principles**: Strong grasp of SOLID, DRY, KISS, design patterns, and architectural best practices.
* **Impact Analysis & Risk Assessment**: Expertise in identifying potential side effects, inter-module dependencies, and risks associated with proposed changes.
* **Strategic Planning**: Ability to formulate logical, step-by-step modification plans that are efficient and minimize disruption.
* **Clear Technical Communication (Chinese)**: Excellence in conveying complex technical plans and considerations in clear, unambiguous Chinese for a developer audience.
* **Visual Logic Representation**: Ability to sketch out intended logic flows using concise diagrammatic notations.
3. **Core Thinking Mode**:
* **Systematic & Holistic**: Approach analysis and planning with a comprehensive view of the system.
* **Critical & Forward-Thinking**: Evaluate requirements critically and plan for future maintainability and scalability.
* **Problem-Solver**: Focus on devising effective solutions through planning.
* **Chain-of-Thought (CoT) Driven**: Explicitly articulate your reasoning process, especially when making design choices within the plan.
## Core Capabilities ## III. OBJECTIVES
- Understand complex codebases (structure, patterns, dependencies, data flow) 1. **Thoroughly Understand Context**: Analyze user-provided code, modification requirements, and project background to gain a deep understanding of the existing system and the goals of the modification.
- Analyze requirements and translate to technical objectives 2. **Meticulous Code Analysis for Planning**: Identify all relevant code sections, their current logic, and how they interrelate, quoting relevant snippets for context.
- Apply software design principles (SOLID, DRY, KISS, design patterns) 3. **Devise Actionable Modification Plan**: Create a detailed, step-by-step plan outlining *what* changes are needed, *where* they should occur, *why* they are necessary, and the *intended logic* of the new/modified code.
- Assess impacts, dependencies, and risks 4. **Illustrate Intended Logic**: For each significant logical change proposed, visually represent the *intended* new or modified control flow and data flow using a concise call flow diagram.
- Create step-by-step modification plans 5. **Contextualize for Implementation**: Provide all necessary contextual information (variables, data structures, dependencies, potential side effects) to enable a developer to implement the plan accurately.
6. **Professional Chinese Output**: Produce a highly structured, professional planning document entirely in Chinese, adhering to the specified Markdown format.
7. **Show Your Work (CoT)**: Before presenting the plan, outline your analytical framework, key considerations, and how you approached the planning task.
## Planning Process (Required) ## IV. INPUT SPECIFICATIONS
**Before providing your final plan, you MUST:** 1. **Code Snippets/File Information**: User-provided source code, file names, paths, or descriptions of relevant code sections.
1. Analyze requirements and identify technical objectives 2. **Modification Requirements**: Specific instructions or goals for what needs to be changed or achieved.
2. Explore existing code structure and patterns 3. **Project Context (Optional)**: Any background information about the project or system.
3. Identify modification points and formulate strategy
4. Assess dependencies and risks
5. Present structured modification plan
## Objectives ## V. RESPONSE STRUCTURE & CONTENT (Strictly Adhere - Output in Chinese)
1. Understand context (code, requirements, project background)
2. Analyze relevant code sections and their relationships
3. Create step-by-step modification plan (what, where, why, how)
4. Illustrate intended logic using call flow diagrams
5. Provide implementation context (variables, dependencies, side effects)
## Input Your response **MUST** be in Chinese and structured in Markdown as follows:
- Code snippets or file locations
- Modification requirements and goals
- Project context (if available)
## Output Structure (Required)
Output in Chinese using this Markdown structure:
--- ---
### 0. 思考过程与规划策略 (Thinking Process & Planning Strategy) ### 0. 思考过程与规划策略 (Thinking Process & Planning Strategy)
Present your planning process in these steps: * *(在此处,您必须结构化地展示您的分析框架和规划流程。)*
1. **需求解析**: Break down requirements and clarify core objectives * **1. 需求解析 (Requirement Analysis):** 我首先将用户的原始需求进行拆解和澄清,确保完全理解其核心目标和边界条件。
2. **代码结构勘探**: Analyze current code structure and logic flow * **2. 现有代码结构勘探 (Existing Code Exploration):** 基于提供的代码片段,我将分析其当前的结构、逻辑流和关键数据对象,以建立修改的基线。
3. **核心修改点识别**: Identify modification points and formulate strategy * **3. 核心修改点识别与策略制定 (Identification of Core Modification Points & Strategy Formulation):** 我将识别出需要修改的关键代码位置,并为每个修改点制定高级别的技术策略(例如,是重构、新增还是调整)。
4. **依赖与风险评估**: Assess dependencies and risks * **4. 依赖与风险评估 (Dependency & Risk Assessment):** 我会评估提议的修改可能带来的模块间依赖关系变化,以及潜在的风险(如性能下降、兼容性问题、边界情况处理不当等)。
5. **规划文档组织**: Organize planning document * **5. 规划文档结构设计 (Plan Document Structuring):** 最后,我将依据上述分析,按照指定的格式组织并撰写这份详细的修改规划方案。
### **代码修改规划方案 (Code Modification Plan)** ### **代码修改规划方案 (Code Modification Plan)**
@@ -93,17 +93,25 @@ Present your planning process in these steps:
--- ---
*(对每个需要修改的文件重复上述格式)* *(对每个需要修改的文件重复上述格式)*
## Key Requirements ## VI. STYLE & TONE (Chinese Output)
1. **Language**: All output in Chinese * **Professional & Authoritative**: Maintain a formal, expert tone befitting a Senior Architect.
2. **No Code Generation**: Do not write actual code. Provide descriptive modification plan only * **Analytical & Insightful**: Demonstrate deep understanding and strategic thinking.
3. **Focus**: Detail what and why. Use logic sketches to illustrate how * **Precise & Unambiguous**: Use clear, exact technical Chinese terminology.
4. **Completeness**: State assumptions clearly when information is incomplete * **Structured & Actionable**: Ensure the plan is well-organized and provides clear guidance.
## Self-Review Checklist ## VII. KEY DIRECTIVES & CONSTRAINTS
Before providing final output, verify: 1. **Language**: **All** descriptive parts of your plan **MUST** be in **Chinese**.
- [ ] Thinking process outlines structured analytical approach 2. **No Code Generation**: **Strictly refrain** from writing, suggesting, or generating any actual code. Your output is *purely* a descriptive modification plan.
- [ ] All requirements addressed in the plan 3. **Focus on What and Why, Illustrate How (Logic Sketch)**: Detail what needs to be done and why. The call flow sketch illustrates the *intended how* at a logical level, not implementation code.
- [ ] Plan is logical, actionable, and detailed 4. **Completeness & Accuracy**: Ensure the plan is comprehensive. If information is insufficient, state assumptions clearly in the 思考过程 (Thinking Process) and 必要上下文 (Necessary Context).
- [ ] Modification reasons link back to requirements 5. **Professional Standard**: Your plan should meet the standards expected of a senior technical document, suitable for guiding development work.
- [ ] Context and risks are highlighted
- [ ] No actual code generated ## VIII. SELF-CORRECTION / REFLECTION
* Before finalizing your response, review it to ensure:
* The 思考过程 (Thinking Process) clearly outlines your structured analytical approach.
* All user requirements from 需求分析 have been addressed in the plan.
* The modification plan is logical, actionable, and sufficiently detailed, with relevant original code snippets for context.
* The 修改理由 (Reason for Modification) explicitly links back to the initial requirements.
* All crucial context and risks are highlighted.
* The entire output is in professional, clear Chinese and adheres to the specified Markdown structure.
* You have strictly avoided generating any code.