Agent skill
ccn:update-topic
Add an entry to an existing topic file in .notes/
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/update-topic
SKILL.md
Update Topic Skill
This skill adds a timestamped entry to an existing topic file in the .notes/ directory.
Instructions for Claude
When this command is invoked with /ccn:update-topic $ARGUMENTS:
Step 1: Validate argument
If $ARGUMENTS is empty or not provided:
- Show error: "Error: Topic name required"
- Show usage: "Usage: /ccn:update-topic "
- STOP - do not continue
Step 2: Normalize topic name to filename
Take the provided topic name and transform it:
- Replace all spaces with underscores
- Replace all hyphens with underscores
- Convert to UPPERCASE
- Add
.mdextension
Examples:
- "api-design" → "API_DESIGN.md"
- "my topic" → "MY_TOPIC.md"
- "error_handling" → "ERROR_HANDLING.md"
Store the result as the filename.
Step 3: Check if file exists
Use the Read tool to check if .notes/{filename} exists.
-
If the file DOES NOT exist:
- Tell user: "Error: Topic not found: .notes/{filename}"
- Tell user: "Use /ccn:create-topic to create a new topic first"
- STOP - do not continue
-
If the file EXISTS:
- Continue to next step
Step 4: Prompt for entry details
Ask the user for entry information:
- Entry title: Ask "What is the title for this entry?"
- Entry content: Ask "What content would you like to add? (You can provide multiple lines)"
Wait for the user to provide both pieces of information before continuing.
Step 5: Read existing file
Use the Read tool to get the complete current content of .notes/{filename}.
Step 6: Parse and update frontmatter
Extract the YAML frontmatter (the content between the first two --- lines):
- Parse the frontmatter to preserve existing fields
- Update the
last_updatedfield to today's date (YYYY-MM-DD) - Keep all other fields unchanged
Step 7: Append new entry
Add the new entry to the end of the file with this format:
### [YYYY-MM-DD] {entry title}
{entry content}
Formatting notes:
- Use H3 heading (
###) for the entry - Include today's date in square brackets
- Add a blank line between heading and content
- Add blank lines before and after the entry for readability
Step 8: Write updated file
Use the Write tool to write the complete updated content back to .notes/{filename}.
The final file structure should be:
- Updated frontmatter (with new last_updated date)
- All existing content (unchanged)
- New entry appended at the end
Step 9: Confirm completion
Tell the user: "Updated: .notes/{filename}"
Error Handling
If any tool fails (Read, Write):
- Show the error message
- Explain what went wrong
- Do NOT overwrite files if there's an error parsing content
Didn't find tool you were looking for?