Trigger
When a user provides a list of structured tasks that each involve:
- Auditing or analyzing a state.
- Creating or updating a documentation or plan file (e.g.,
.md). - Committing the file to Git.
- Closing a corresponding GitHub issue.
This skill is ideal for cron jobs or scripted, multi-step administrative actions.
Workflow
Parse Tasks: Break down the user prompt into a list of discrete tasks. Each task should have an associated file path, content creation step, commit message, and issue number.
Iterate Through Tasks: Execute the following steps for each task in the list, one by one. Do not proceed to the next task until the current one is complete.
Audit & Idempotency Check: Before creating the file, check if it already exists using
read_fileorsearch_files. This is the most critical step to prevent re-doing work or overwriting existing progress.Conditional File Creation:
- If the file does NOT exist: Perform the necessary research steps (e.g.,
search_files,read_file) to gather context. Then, usewrite_fileto create the specified document. - If the file already exists: Do nothing. Acknowledge that this step has already been completed and move on. Do not overwrite the file.
- If the file does NOT exist: Perform the necessary research steps (e.g.,
Commit Changes:
- Use
terminalto executegit add <file_path>. - Use
terminalto executegit commit -m "<commit_message>". - Note: This command may fail or return a non-zero exit code if there are no changes to commit (i.e., if the file already existed). This is expected and should not be treated as an error. The workflow should continue.
- Use
Close GitHub Issue:
- Use
terminalto executegh issue close <issue_number> -c "<comment>". - Note: This command may return a message indicating the issue is already closed. This is expected and should not be treated as an error.
- Use
Report Completion: After completing all tasks, provide a summary report of the actions taken for each task, noting which steps were performed and which were skipped because they were already complete.
Example Task Structure (from user prompt)
TASK 1: Mount Drive Resource Audit (#1776)
- Read docs/document-intelligence/ for mount drive docs
- Search for legal scan results: search_files pattern="legal" output_mode=files_only
- Create: docs/document-intelligence/mount-drive-audit.md covering resources...
- Commit: git add that file && git commit -m "doc-intel: mount drive resource audit (#1776)"
- Close: gh issue close 1776 -c "Mount drive audit completed..."