Skip to content

Commit 31f5e2c

Browse files
committed
chore: improve notes claude skills (#276)
mprov### TL;DR Replaced hardcoded notes directory validation with a centralized script for better error handling and consistency. ### What changed? - Created a new script `echo-notes-dir.sh` that validates the `./.notes` directory and provides helpful error messages - Updated all skills to use this script instead of inline bash validation - Removed the outdated `notes/SKILL.md` file - Updated path references in `notes-layout.md` to use the correct script paths - Made the scripts more robust by using the new validation script ### How to test? 1. Verify that all skills load correctly with a valid `./.notes` symlink 2. Test error handling by temporarily removing the `./.notes` symlink: ```bash mv .notes .notes.bak # Try using a skill that requires notes # Verify you get a helpful error message mv .notes.bak .notes ``` 3. Check that the scripts work correctly: ```bash ./.claude/skills/notes/scripts/echo-notes-dir.sh ./.claude/skills/notes/scripts/list-titles scratch/ ./.claude/skills/notes/scripts/search "pattern" ``` ### Why make this change? - Centralizes the notes directory validation logic to avoid duplication - Provides more helpful error messages when the notes directory is missing or inaccessible - Makes the code more maintainable by having a single source of truth for directory validation - Removes dependency on environment variables, making the scripts more portable and reliable
1 parent c9d5452 commit 31f5e2c

File tree

14 files changed

+96
-206
lines changed

14 files changed

+96
-206
lines changed

.claude/skills/idea-refine/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ allowed-tools: Read, Edit, Bash, Grep, Glob
66

77
# Idea Refinement
88

9-
**Notes directory:** !`test -d ./.notes && test -r ./.notes && test -w ./.notes && echo "./.notes" || echo "ERROR: ./.notes is not a valid readable/writable directory! Ask user to create the symlink."`
9+
**Notes directory:** !`./.claude/skills/notes/scripts/echo-notes-dir.sh`
1010

1111
**Context:** @../notes/shared/directory.md @../notes/shared/conventions.md
1212

.claude/skills/notes/SKILL.md

Lines changed: 0 additions & 129 deletions
This file was deleted.

.claude/skills/notes/TROUBLESHOOTING.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# Troubleshooting
22

3-
## Scripts can't find $notes
3+
## .notes directory not found
44

5-
**Error:** `Error: $notes environment variable not set`
5+
**Error:** `ERROR: .notes directory not found at ./.notes`
66

77
**Fix:**
88
```bash
9-
# Check if set
10-
echo $notes
9+
# Create symlink to your notes directory
10+
ln -s /path/to/your/notes-directory .notes
1111

12-
# Set temporarily
13-
export notes="/path/to/notes"
14-
15-
# Set permanently (add to ~/.bashrc or ~/.zshrc)
16-
echo 'export notes="/path/to/notes"' >> ~/.bashrc
12+
# Example:
13+
ln -s ~/Documents/pgflow-notes .notes
1714
```
1815

1916
## Scripts not executable
@@ -22,7 +19,7 @@ echo 'export notes="/path/to/notes"' >> ~/.bashrc
2219

2320
**Fix:**
2421
```bash
25-
chmod +x .claude/skills/roadmap/scripts/*
22+
chmod +x .claude/skills/notes/scripts/*
2623
```
2724

2825
## No search results
@@ -34,7 +31,7 @@ chmod +x .claude/skills/roadmap/scripts/*
3431

3532
**Try:**
3633
- Broader pattern: `"feature"` instead of `"feature-x-implementation"`
37-
- Check directory: `ls "$notes/roadmaps/"`
34+
- Check directory: `ls ./.notes/`
3835
- Verify pattern syntax (regex)
3936

4037
## Git errors
@@ -43,7 +40,7 @@ chmod +x .claude/skills/roadmap/scripts/*
4340

4441
**Fix:**
4542
```bash
46-
cd "$notes"
43+
cd ./.notes
4744
git init
4845
git add .
4946
git commit -m "Initial commit"

.claude/skills/notes/organize-roadmap.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ Add to "Cross-Feature Constraints" section if:
9393
### 4. Commit
9494

9595
```bash
96-
git -C "$notes" add roadmap.md
97-
git -C "$notes" commit -m "Update: roadmap reordering (moved X before Y)"
96+
git -C ./.notes add roadmap.md
97+
git -C ./.notes commit -m "Update: roadmap reordering (moved X before Y)"
9898
```
9999

100100
## Key Principles
@@ -123,8 +123,8 @@ After (C is urgent):
123123

124124
Git commit:
125125
```bash
126-
git -C "$notes" add roadmap.md
127-
git -C "$notes" commit -m "Update: prioritize Feature C (customer blocker)"
126+
git -C ./.notes add roadmap.md
127+
git -C ./.notes commit -m "Update: prioritize Feature C (customer blocker)"
128128
```
129129

130130
## Marking Complete

.claude/skills/notes/promote-brewing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Promote an idea when:
2020

2121
```bash
2222
# Move from scratch to brewing
23-
git -C "$notes" mv scratch/idea-name.md brewing/
23+
git -C ./.notes mv scratch/idea-name.md brewing/
2424
```
2525

2626
### 2. Update the title (optional)
@@ -41,15 +41,15 @@ Add a few lines about:
4141
### 4. Git commit
4242

4343
```bash
44-
git -C "$notes" add brewing/idea-name.md
45-
git -C "$notes" commit -m "Promote: idea-name to brewing"
44+
git -C ./.notes add brewing/idea-name.md
45+
git -C ./.notes commit -m "Promote: idea-name to brewing"
4646
```
4747

4848
## Example
4949

5050
```bash
5151
# Move the file
52-
git -C "$notes" mv scratch/taskless-maps.md brewing/
52+
git -C ./.notes mv scratch/taskless-maps.md brewing/
5353

5454
# File content (brewing/taskless-maps.md):
5555
# IDEA: Taskless Map Steps
@@ -65,8 +65,8 @@ git -C "$notes" mv scratch/taskless-maps.md brewing/
6565
# Question: How do dependents handle empty arrays?
6666

6767
# Commit
68-
git -C "$notes" add brewing/taskless-maps.md
69-
git -C "$notes" commit -m "Promote: taskless-maps to brewing"
68+
git -C ./.notes add brewing/taskless-maps.md
69+
git -C ./.notes commit -m "Promote: taskless-maps to brewing"
7070
```
7171

7272
## Key Principles

.claude/skills/notes/refine-features.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Create a feature spec when:
2020

2121
```bash
2222
# Move the file
23-
git -C "$notes" mv brewing/idea-name.md features/feature-name.md
23+
git -C ./.notes mv brewing/idea-name.md features/feature-name.md
2424
```
2525

2626
### 2. Structure the spec
@@ -76,8 +76,8 @@ What problem does this solve? What value does it provide?
7676
### 3. Commit the feature
7777

7878
```bash
79-
git -C "$notes" add features/feature-name.md
80-
git -C "$notes" commit -m "Add: feature spec for feature-name"
79+
git -C ./.notes add features/feature-name.md
80+
git -C ./.notes commit -m "Add: feature spec for feature-name"
8181
```
8282

8383
### 4. Add to roadmap
@@ -97,14 +97,14 @@ Update roadmap.md with this feature's position:
9797

9898
```bash
9999
# Move from brewing
100-
git -C "$notes" mv brewing/manual-execution.md features/manual-execution.md
100+
git -C ./.notes mv brewing/manual-execution.md features/manual-execution.md
101101

102102
# Edit to add full spec structure
103103
# (Add objective, prerequisites, implementation steps, etc.)
104104

105105
# Commit
106-
git -C "$notes" add features/manual-execution.md
107-
git -C "$notes" commit -m "Add: feature spec for manual execution"
106+
git -C ./.notes add features/manual-execution.md
107+
git -C ./.notes commit -m "Add: feature spec for manual execution"
108108
```
109109

110110
## Next Steps

.claude/skills/notes/review-scratch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Scratch contains quick captures written by the Memory skill. This workflow helps
1414
### 1. List scratch items
1515

1616
```bash
17-
./.claude/skills/roadmap/scripts/list-titles "scratch/"
17+
./.claude/skills/notes/scripts/list-titles "scratch/"
1818
```
1919

2020
### 2. Search for specific topics
2121

2222
```bash
23-
./.claude/skills/roadmap/scripts/search "subflow" "scratch/"
23+
./.claude/skills/notes/scripts/search "subflow" "scratch/"
2424
```
2525

2626
### 3. Read promising items
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# echo-notes-dir.sh - Validate and echo the notes directory path
3+
#
4+
# Usage:
5+
# In bash scripts: NOTES_DIR=$(bash path/to/echo-notes-dir.sh)
6+
# In markdown: !`path/to/echo-notes-dir.sh`
7+
#
8+
# Exit codes:
9+
# 0 - Success, echoes "./.notes" to stdout
10+
# 1 - Error, prints error message to stderr
11+
12+
set -euo pipefail
13+
14+
NOTES_DIR="./.notes"
15+
16+
# Check if .notes directory exists
17+
if [ ! -d "$NOTES_DIR" ]; then
18+
echo "ERROR: .notes directory not found at $NOTES_DIR" >&2
19+
echo "" >&2
20+
echo "Please create a symlink to your notes directory:" >&2
21+
echo " ln -s /path/to/your/notes-directory .notes" >&2
22+
echo "" >&2
23+
echo "Example:" >&2
24+
echo " ln -s ~/Documents/pgflow-notes .notes" >&2
25+
exit 1
26+
fi
27+
28+
# Check if .notes is readable
29+
if [ ! -r "$NOTES_DIR" ]; then
30+
echo "ERROR: .notes directory is not readable: $NOTES_DIR" >&2
31+
echo "Please check permissions." >&2
32+
exit 1
33+
fi
34+
35+
# Check if .notes is writable
36+
if [ ! -w "$NOTES_DIR" ]; then
37+
echo "ERROR: .notes directory is not writable: $NOTES_DIR" >&2
38+
echo "Please check permissions." >&2
39+
exit 1
40+
fi
41+
42+
# Success - echo the path
43+
echo "$NOTES_DIR"
44+
exit 0

0 commit comments

Comments
 (0)