AgentSkillsCN

update-logs

当用户请求“更新日志”时,自动将最新的提交记录依次写入 log.md 文件,从最新到最旧。

SKILL.md
--- frontmatter
name: update-logs
description: Updates a log.md file with the full commit history from latest to earliest commit when the user requests "update logs".

Skill Instructions

Overview

This skill is designed to generate a log.md file containing detailed commit history of the Git repository, ordered from the most recent commit to the earliest. It includes full commit hashes, author information, dates, complete messages (subject and body), and file change statistics. It is activated when the user explicitly requests to "update logs".

When to Use

  • Use this skill only when the user says "update logs" or similar phrases indicating they want to update or create a commit log file.
  • Do not activate for general Git queries or other logging tasks.

Procedure

  1. Verify that the current directory is a Git repository.
  2. Run git log --pretty=format:"### %H%n**Author:** %an <%ae>%n**Date:** %ad%n%n**Message:**%n%s%n%n%b%n%n**Changes:**%n" --date=short --stat to retrieve detailed commit history including full hash, author details, date, message (subject and body), and file change statistics.
  3. Create or overwrite the log.md file in the workspace root with the following structure:
    • Header: # Commit History
    • Followed by the formatted commit details.
  4. Confirm the file has been created/updated successfully.

Examples

  • User Input: "update logs"
    • Action: Execute the procedure and create log.md with detailed commit history.
  • Expected Output: A log.md file like:
    code
    # Commit History
    
    ### abc1234abcd...
    **Author:** Author Name <email@example.com>
    **Date:** 2026-01-17
    
    **Message:**
    Add streaming support
    
    Detailed commit body if present.
    
    **Changes:**
     KMK_Chatbot.py | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    

Notes

  • Commits are listed from latest to earliest by default with git log.
  • If no commits exist, the file should contain just the header.
  • Ensure the skill only runs in a Git repository context.