Hooks Automation
Skill này làm gì
Skill này thiết lập các hook tự động chạy trước và sau các hành động lập trình của AI, như định dạng file hoặc lưu trạng thái phiên. Skill dành cho lập trình viên muốn các bước thường xuyên được xử lý tự động.
Khi nào nên dùng
- ✓Khi bạn muốn code được định dạng tự động sau mỗi thay đổi của AI.
- ✓Khi bạn muốn AI tiếp tục từ chỗ đã dừng ở phiên trước.
- ✓Khi bạn cần các kiểm tra thường xuyên chạy trước khi mỗi tác vụ bắt đầu.
Liên kết skill
https://github.com/ruvnet/RuView/blob/main/.claude/skills/hooks-automation/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thiết lập để code của tôi được định dạng tự động mỗi khi bạn sửa một file, và lưu ghi chú khi phiên kết thúc.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Hook là các lệnh nhỏ được đặt trong một file cài đặt, chạy vào những thời điểm đã chọn, chẳng hạn trước một tác vụ hoặc sau một lần sửa. Skill chỉ cách cấu hình chúng và kết nối với các công cụ claude-flow.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Hooks Automation
Intelligent automation system that coordinates, validates, and learns from Claude Code operations through hooks integrated with MCP tools and neural pattern training.
What This Skill Does
This skill provides a comprehensive hook system that automatically manages development operations, coordinates swarm agents, maintains session state, and continuously learns from coding patterns. It enables automated agent assignment, code formatting, performance tracking, and cross-session memory persistence.
Key Capabilities:
- Pre-Operation Hooks: Validate, prepare, and auto-assign agents before operations
- Post-Operation Hooks: Format, analyze, and train patterns after operations
- Session Management: Persist state, restore context, generate summaries
- Memory Coordination: Synchronize knowledge across swarm agents
- Git Integration: Automated commit hooks with quality verification
- Neural Training: Continuous learning from successful patterns
- MCP Integration: Seamless coordination with swarm tools
Prerequisites
Required:
- Claude Flow CLI installed (
npm install -g claude-flow@alpha) - Claude Code with hooks enabled
.claude/settings.jsonwith hook configurations
Optional:
- MCP servers configured (claude-flow, ruv-swarm, flow-nexus)
- Git repository for version control
- Testing framework for quality verification
Quick Start
Initialize Hooks System
# Initialize with default hooks configuration
npx claude-flow init --hooks
This creates:
.claude/settings.jsonwith pre-configured hooks- Hook command documentation in
.claude/commands/hooks/ - Default hook handlers for common operations
Basic Hook Usage
# Pre-task hook (auto-spawns agents)
npx claude-flow hook pre-task --description "Implement authentication"
# Post-edit hook (auto-formats and stores in memory)
npx claude-flow hook post-edit --file "src/auth.js" --memory-key "auth/login"
# Session end hook (saves state and metrics)
npx claude-flow hook session-end --session-id "dev-session" --export-metrics
Complete Guide
Available Hooks
Pre-Operation Hooks
Hooks that execute BEFORE operations to prepare and validate:
pre-edit - Validate and assign agents before file modifications
npx claude-flow hook pre-edit [options]
Options:
--file, -f <path> File path to be edited
--auto-assign-agent Automatically assign best agent (default: true)
--validate-syntax Pre-validate syntax before edit
--check-conflicts Check for merge conflicts
--backup-file Create backup before editing
Examples:
npx claude-flow hook pre-edit --file "src/auth/login.js"
npx claude-flow hook pre-edit -f "config/db.js" --validate-syntax
npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
Features:
- Auto agent assignment based on file type
- Syntax validation to prevent broken code
- Conflict detection for concurrent edits
- Automatic file backups for safety
pre-bash - Check command safety and resource requirements
npx claude-flow hook pre-bash --command <cmd>
Options:
--command, -c <cmd> Command to validate
--check-safety Verify command safety (default: true)
--estimate-resources Estimate resource usage
--require-confirmation Request user confirmation for risky commands
Examples:
npx claude-flow hook pre-bash -c "rm -rf /tmp/cache"
npx claude-flow hook pre-bash --command "docker build ." --estimate-resources
Features:
- Command safety validation
- Resource requirement estimation
- Destructive command confirmation
- Permission checks
pre-task - Auto-spawn agents and prepare for complex tasks
npx claude-flow hook pre-task [options]
Options:
--description, -d <text> Task description for context
--auto-spawn-agents Automatically spawn required agents (default: true)
--load-memory Load relevant memory from previous sessions
--optimize-topology Select optimal swarm topology
--estimate-complexity Analyze task complexity
Examples:
npx claude-flow hook pre-task --description "Implement user authentication"
npx claude-flow hook pre-task -d "Continue API dev" --load-memory
npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology
Features:
- Automatic agent spawning based on task analysis
- Memory loading for context continuity
Câu hỏi thường gặp
Hook được thiết lập ở đâu?
Trong một file cài đặt trong dự án của bạn, chẳng hạn .claude/settings.json.
Cần chuẩn bị gì trước khi dùng?
Claude Code đã bật hook, công cụ claude-flow, và một file cài đặt chứa cấu hình hook.
Nó có lưu bộ nhớ phiên không?
Có. Skill bao gồm quản lý phiên và bộ nhớ dùng chung giữa các phiên.
Chi tiết
Mô tả gốc của tác giả
Automated coordination, formatting, and learning from Claude Code operations using intelligent hooks with MCP integration. Includes pre/post task hooks, session management, Git integration, memory coordination, and neural pattern training for enhanced development workflows.
repo: ruvnet/RuView
Độ phổ biến
- Sao GitHub
- 102k
- Vị trí xếp hạng
- #834
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
AgentDB Advanced Features
102kGiới thiệu cho agent của bạn các tính năng nâng cao của AgentDB, như đồng bộ cơ sở dữ liệu giữa nhiều máy và kết hợp tìm kiếm vector với bộ lọc metadata.
AgentDB Learning Plugins
102kCho phép agent của bạn xây dựng và huấn luyện plugin học cho AgentDB, dùng các phương pháp học tăng cường để cải thiện từ kinh nghiệm trước đó.
AgentDB Memory Patterns
102kCho phép agent của bạn ghi nhớ các cuộc trò chuyện và ngữ cảnh qua nhiều phiên, dùng AgentDB làm kho bộ nhớ lâu dài.
AgentDB Performance Optimization
102kChỉ cho agent của bạn cách tăng tốc tìm kiếm AgentDB và giảm dung lượng bộ nhớ, bằng nén, chỉ mục tìm kiếm nhanh và bộ nhớ đệm.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.