thought-cabinet 0.1.13 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/index.js +845 -406
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +24 -13
- package/package.json +1 -1
- package/src/agent-assets/skills/implementing-plan/SKILL.md +16 -7
- package/src/agent-assets/skills/init-agent-memory/SKILL.md +161 -0
- package/src/agent-assets/skills/init-agent-memory/architectural-patterns-template.md +36 -0
- package/src/agent-assets/skills/init-agent-memory/claude-memory-template.md +40 -0
- package/src/agent-assets/skills/navigate-thoughts/SKILL.md +45 -0
- package/src/agent-assets/skills/test-driven-development/SKILL.md +6 -1
- package/src/agent-assets/skills/writing-skill/SKILL.md +207 -0
- package/src/agent-assets/skills/writing-skill/best-practices.md +1211 -0
- package/src/agent-assets/skills/writing-skill/skill-template.md +63 -0
package/docs/CLI.md
CHANGED
|
@@ -75,22 +75,35 @@ thc prune --apply # Actually remove stale mappings
|
|
|
75
75
|
| `--apply` | Apply changes (default is dry-run) |
|
|
76
76
|
| `--config-file <path>` | Path to config file |
|
|
77
77
|
|
|
78
|
+
### `thc migrate`
|
|
79
|
+
|
|
80
|
+
Migrate configuration from `~/.config/thought-cabinet/` to `~/.thought-cabinet/`. Moves config file, agent assets, and thoughts repos, then updates all paths in the config.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
thc migrate # Interactive migration with confirmation
|
|
84
|
+
thc migrate --dry-run # Show what would be migrated without changes
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Flag | Description |
|
|
88
|
+
| ---------------------- | ------------------------------------------ |
|
|
89
|
+
| `--dry-run` | Show migration plan without making changes |
|
|
90
|
+
| `--config-file <path>` | Path to legacy config file |
|
|
91
|
+
|
|
78
92
|
## Agent Configuration
|
|
79
93
|
|
|
80
|
-
### `thc
|
|
94
|
+
### `thc skill install`
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
Install all bundled skills and agents to your AI coding agent's config directory.
|
|
83
97
|
|
|
84
|
-
Assets are installed via **symlink** by default: a canonical copy is stored in `.thought-cabinet/` (project) or `~/.
|
|
98
|
+
Assets are installed via **symlink** by default: a canonical copy is stored in `.thought-cabinet/` (project) or `~/.thought-cabinet/` (global), and symlinks are created in the agent's config directory. This means updating the canonical copy updates all agents at once.
|
|
85
99
|
|
|
86
100
|
```bash
|
|
87
|
-
thc
|
|
88
|
-
thc
|
|
89
|
-
thc
|
|
90
|
-
thc
|
|
91
|
-
thc
|
|
92
|
-
thc
|
|
93
|
-
thc agent init --force # Overwrite existing installations
|
|
101
|
+
thc skill install # Install all assets
|
|
102
|
+
thc skill install --target claude-code # Install for a specific agent
|
|
103
|
+
thc skill install --target cursor codex # Install for multiple agents
|
|
104
|
+
thc skill install --global # Install to global scope
|
|
105
|
+
thc skill install --mode copy # Copy files instead of symlinking
|
|
106
|
+
thc skill install --force # Overwrite existing installations
|
|
94
107
|
```
|
|
95
108
|
|
|
96
109
|
| Flag | Description |
|
|
@@ -98,9 +111,7 @@ thc agent init --force # Overwrite existing installations
|
|
|
98
111
|
| `--target <agents...>` | Target agents (e.g., `claude-code`, `codebuddy`, `cursor`, `codex`, `gemini-cli`, `cline`) |
|
|
99
112
|
| `-g, --global` | Install to global scope |
|
|
100
113
|
| `--mode <mode>` | Installation mode: `symlink` (default) or `copy` |
|
|
101
|
-
| `--source <path>` | Source directory for assets |
|
|
102
114
|
| `--force` | Force overwrite of existing installations |
|
|
103
|
-
| `--all` | Install all assets without prompting |
|
|
104
115
|
|
|
105
116
|
#### Installed Skills
|
|
106
117
|
|
|
@@ -239,7 +250,7 @@ thc config --json # Output as JSON
|
|
|
239
250
|
| `--json` | Output configuration as JSON |
|
|
240
251
|
| `--config-file <path>` | Path to config file |
|
|
241
252
|
|
|
242
|
-
Configuration is stored at `~/.config/thought-cabinet/config.json
|
|
253
|
+
Configuration is stored at `~/.thought-cabinet/config.json` (falls back to `~/.config/thought-cabinet/config.json`; respects `XDG_CONFIG_HOME`).
|
|
243
254
|
|
|
244
255
|
## Hooks
|
|
245
256
|
|
package/package.json
CHANGED
|
@@ -30,7 +30,14 @@ The procedure for each unit of work:
|
|
|
30
30
|
|
|
31
31
|
After all TDD cycles in the phase are complete, run the phase's automated verification commands as the final gate.
|
|
32
32
|
|
|
33
|
-
**Resolving conflicts with the plan**: If the plan says "no tests needed", evaluate independently
|
|
33
|
+
**Resolving conflicts with the plan**: If the plan says "no tests needed", evaluate independently. The plan may be wrong — verify by reading existing test files. Apply TDD unless the code meets ALL of these criteria:
|
|
34
|
+
1. Zero conditional logic (no if/else, no switches, no ternaries, no loops with conditions)
|
|
35
|
+
2. Zero data transformation (no mapping, filtering, formatting, restructuring)
|
|
36
|
+
3. The function is a pure pass-through that only calls other already-tested functions with static arguments
|
|
37
|
+
|
|
38
|
+
"Wiring", "integration-level", "mostly delegation", and "would require too many mocks" are NOT valid reasons to skip TDD. If mocking is hard, that's a design signal — simplify the interface or extract testable units.
|
|
39
|
+
|
|
40
|
+
**When skipping TDD**: Document the skip in the phase completion message with the specific criteria met (1-3 above). If you cannot clearly articulate which criterion applies, you must write tests.
|
|
34
41
|
|
|
35
42
|
## Getting Started
|
|
36
43
|
|
|
@@ -38,9 +45,10 @@ When given a plan path:
|
|
|
38
45
|
|
|
39
46
|
1. Read the plan completely - check for existing checkmarks (- [x])
|
|
40
47
|
2. Read ALL files mentioned in the plan without limit/offset
|
|
41
|
-
3.
|
|
42
|
-
4.
|
|
43
|
-
5.
|
|
48
|
+
3. **Read existing test files** for every module the plan modifies (use glob: `**/__tests__/*`, `**/*.test.*`, `**/*.spec.*` near changed files). This is mandatory — never assume "no tests exist" without checking.
|
|
49
|
+
4. Understand how the pieces fit together
|
|
50
|
+
5. Create a todo list to track progress
|
|
51
|
+
6. Begin implementation of the **first uncompleted phase only**
|
|
44
52
|
|
|
45
53
|
If no plan path provided, ask for one:
|
|
46
54
|
|
|
@@ -81,9 +89,10 @@ How should I proceed?
|
|
|
81
89
|
|
|
82
90
|
Before writing any production code for a phase:
|
|
83
91
|
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
86
|
-
3.
|
|
92
|
+
1. Read existing test files for the modules being changed (if not already read in Getting Started)
|
|
93
|
+
2. Identify the testable behaviors the phase introduces or changes
|
|
94
|
+
3. Apply the `test-driven-development` RED-GREEN-REFACTOR cycle for each behavior
|
|
95
|
+
4. Only after all TDD cycles are complete, proceed to the completion checklist below
|
|
87
96
|
|
|
88
97
|
## Phase Completion Checklist
|
|
89
98
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-agent-memory
|
|
3
|
+
description: Initializes agent memory for a new project by creating a concise AGENTS.md and supporting docs with progressive disclosure. Use when onboarding an agent to a repository, bootstrapping first-run project context, or replacing an overly long memory file with a scoped index to docs references.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Initializing Agent Memory
|
|
7
|
+
|
|
8
|
+
Create high-signal project memory for new repositories by generating `AGENTS.md` plus focused supporting docs under `docs/`, then creating `CLAUDE.md` as a compatibility symlink.
|
|
9
|
+
|
|
10
|
+
## Workflow Overview
|
|
11
|
+
|
|
12
|
+
1. **Gather context** - Read user instructions and repository facts; ask only unresolved questions
|
|
13
|
+
2. **Research evidence** - Identify tech stack, project layout, commands, and repeated architectural patterns with file:line references
|
|
14
|
+
3. **Propose structure** - Share planned AGENTS.md sections and supporting docs before writing
|
|
15
|
+
4. **Write docs** - Generate `AGENTS.md`, supporting docs, and the `CLAUDE.md` symlink
|
|
16
|
+
5. **Quality review** - Validate constraints from the request and improve clarity
|
|
17
|
+
|
|
18
|
+
## Step 1: Gather Context
|
|
19
|
+
|
|
20
|
+
### Read Inputs First
|
|
21
|
+
|
|
22
|
+
If present, read these in order:
|
|
23
|
+
1. User-provided memory instructions (for example `init_agent_memory.md`)
|
|
24
|
+
2. Existing `AGENTS.md` and `CLAUDE.md`
|
|
25
|
+
3. `README.md` and package/build metadata
|
|
26
|
+
|
|
27
|
+
Read full files before drafting. Do not assume conventions.
|
|
28
|
+
|
|
29
|
+
### Ask Only Missing Questions
|
|
30
|
+
|
|
31
|
+
Only ask if required information cannot be inferred from repository files. Keep questions minimal and concrete.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
I can generate the initial memory docs. One point is still unclear: should AGENTS.md include only project-level workflows, or also team-specific process notes?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Step 2: Research Evidence
|
|
40
|
+
|
|
41
|
+
Collect concrete references for each required section.
|
|
42
|
+
|
|
43
|
+
### Required Evidence Buckets
|
|
44
|
+
|
|
45
|
+
- **Project overview (WHY):** repository purpose and problem domain
|
|
46
|
+
- **Tech stack (WHAT):** languages, frameworks, runtime, major tooling
|
|
47
|
+
- **Key directories (WHAT):** top-level modules and responsibilities
|
|
48
|
+
- **Essential commands (HOW):** build, test, lint, run workflows used daily
|
|
49
|
+
- **Architectural patterns:** conventions/design decisions that appear in multiple files
|
|
50
|
+
|
|
51
|
+
### Evidence Rules
|
|
52
|
+
|
|
53
|
+
- Use file:line references instead of code snippets
|
|
54
|
+
- Prefer primary sources (`src/`, command definitions, config files)
|
|
55
|
+
- For architectural patterns, include only patterns supported by at least two code references
|
|
56
|
+
- If evidence conflicts across docs and code, prefer the code and mention mismatch briefly
|
|
57
|
+
|
|
58
|
+
## Step 3: Propose Structure
|
|
59
|
+
|
|
60
|
+
Before writing files, share a concise structure proposal and get confirmation.
|
|
61
|
+
|
|
62
|
+
Use this format:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Here is the proposed memory layout.
|
|
66
|
+
|
|
67
|
+
AGENTS.md (under 150 lines):
|
|
68
|
+
1. Project Overview
|
|
69
|
+
2. Tech Stack
|
|
70
|
+
3. Key Directories
|
|
71
|
+
4. Essential Build/Test Commands
|
|
72
|
+
5. Additional Documentation
|
|
73
|
+
|
|
74
|
+
Supporting docs:
|
|
75
|
+
- docs/architectural-patterns.md
|
|
76
|
+
|
|
77
|
+
I will keep AGENTS.md as an index and push detail into supporting docs (progressive disclosure).
|
|
78
|
+
I will then create CLAUDE.md as a symlink to AGENTS.md for backward compatibility.
|
|
79
|
+
Should I proceed with this structure?
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If the user already requested this exact structure explicitly, treat that as approval and proceed.
|
|
83
|
+
|
|
84
|
+
## Step 4: Write Docs
|
|
85
|
+
|
|
86
|
+
### 4a. Create `AGENTS.md`
|
|
87
|
+
|
|
88
|
+
Use [claude-memory-template.md](claude-memory-template.md).
|
|
89
|
+
|
|
90
|
+
Required constraints:
|
|
91
|
+
- Keep total length under 150 lines
|
|
92
|
+
- Include WHAT, WHY, HOW coverage
|
|
93
|
+
- Use file:line references instead of code snippets
|
|
94
|
+
- Do not include formatting/style rules that linters already enforce
|
|
95
|
+
- Add an "Additional Documentation" section that points to `docs/*`
|
|
96
|
+
|
|
97
|
+
### 4b. Create `docs/architectural-patterns.md`
|
|
98
|
+
|
|
99
|
+
Use [architectural-patterns-template.md](architectural-patterns-template.md).
|
|
100
|
+
|
|
101
|
+
Required constraints:
|
|
102
|
+
- Document only recurring patterns and conventions
|
|
103
|
+
- Every pattern needs concrete evidence with file:line references
|
|
104
|
+
- Focus on decisions that influence future implementation work
|
|
105
|
+
|
|
106
|
+
### 4c. Create `CLAUDE.md` Symlink
|
|
107
|
+
|
|
108
|
+
After writing `AGENTS.md`, create `CLAUDE.md` as a symlink to `AGENTS.md` in the same directory.
|
|
109
|
+
|
|
110
|
+
If `CLAUDE.md` already exists as a regular file (not a symlink):
|
|
111
|
+
1. Read the existing `CLAUDE.md` content
|
|
112
|
+
2. Identify any useful, non-redundant content not already covered by the new `AGENTS.md`
|
|
113
|
+
3. Incorporate that content into `AGENTS.md` (respecting the 150-line limit) or into a supporting doc under `docs/`
|
|
114
|
+
4. Remove the old `CLAUDE.md` file and replace it with the symlink
|
|
115
|
+
|
|
116
|
+
Create the symlink with:
|
|
117
|
+
```bash
|
|
118
|
+
ln -sf AGENTS.md CLAUDE.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Required constraints:
|
|
122
|
+
- `AGENTS.md` is the canonical file
|
|
123
|
+
- `CLAUDE.md` is a symlink (not a duplicate copy)
|
|
124
|
+
- The symlink target resolves to `AGENTS.md` from the repository root
|
|
125
|
+
- Pre-existing `CLAUDE.md` content must be preserved (merged into `AGENTS.md` or `docs/`) before replacement
|
|
126
|
+
|
|
127
|
+
### 4d. Progressive Disclosure Rules
|
|
128
|
+
|
|
129
|
+
- Keep `AGENTS.md` concise and universally applicable
|
|
130
|
+
- Put specialized details in `docs/*.md`
|
|
131
|
+
- References from `AGENTS.md` should be direct and descriptive
|
|
132
|
+
- Avoid deep reference chains
|
|
133
|
+
|
|
134
|
+
## Step 5: Quality Review
|
|
135
|
+
|
|
136
|
+
Run this checklist before presenting output:
|
|
137
|
+
|
|
138
|
+
- [ ] `AGENTS.md` is under 150 lines
|
|
139
|
+
- [ ] `CLAUDE.md` is a symlink to `AGENTS.md`
|
|
140
|
+
- [ ] Sections cover project overview, tech stack, key directories, essential commands, additional docs
|
|
141
|
+
- [ ] File:line references are present and accurate
|
|
142
|
+
- [ ] No code snippets in `AGENTS.md`
|
|
143
|
+
- [ ] No generic formatting/style guidance duplicated from linters
|
|
144
|
+
- [ ] `docs/architectural-patterns.md` includes only repeated patterns with evidence
|
|
145
|
+
- [ ] Terminology is consistent (`AGENTS.md`, `CLAUDE.md` symlink, "Additional Documentation", `docs/`)
|
|
146
|
+
|
|
147
|
+
Present result with file paths and invite targeted revision requests.
|
|
148
|
+
|
|
149
|
+
## Guidelines
|
|
150
|
+
|
|
151
|
+
**Scope discipline:**
|
|
152
|
+
- Optimize for first-session usefulness, not exhaustive documentation
|
|
153
|
+
- Prefer omission over speculative or weakly supported claims
|
|
154
|
+
|
|
155
|
+
**Progressive disclosure:**
|
|
156
|
+
- `AGENTS.md` is an entrypoint index
|
|
157
|
+
- Keep advanced details in dedicated `docs/` files
|
|
158
|
+
|
|
159
|
+
**Reliability:**
|
|
160
|
+
- Cite source lines for every non-trivial claim
|
|
161
|
+
- Re-check references after edits
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Architectural Patterns
|
|
2
|
+
|
|
3
|
+
Document recurring patterns observed across the codebase. Include only patterns backed by multiple examples.
|
|
4
|
+
|
|
5
|
+
## Pattern: [Name]
|
|
6
|
+
|
|
7
|
+
- Intent: [Why this pattern exists]
|
|
8
|
+
- How it appears:
|
|
9
|
+
- [Description of implementation shape]
|
|
10
|
+
- Evidence:
|
|
11
|
+
- `path/to/file:line`
|
|
12
|
+
- `path/to/another-file:line`
|
|
13
|
+
- Implication for new changes:
|
|
14
|
+
- [How contributors/agents should align with this pattern]
|
|
15
|
+
|
|
16
|
+
## Pattern: [Name]
|
|
17
|
+
|
|
18
|
+
- Intent: [Why this pattern exists]
|
|
19
|
+
- How it appears:
|
|
20
|
+
- [Description of implementation shape]
|
|
21
|
+
- Evidence:
|
|
22
|
+
- `path/to/file:line`
|
|
23
|
+
- `path/to/another-file:line`
|
|
24
|
+
- Implication for new changes:
|
|
25
|
+
- [How contributors/agents should align with this pattern]
|
|
26
|
+
|
|
27
|
+
## Placement
|
|
28
|
+
|
|
29
|
+
Store this file at `docs/architectural-patterns.md` (same level as `AGENTS.md`).
|
|
30
|
+
|
|
31
|
+
## Exclusions
|
|
32
|
+
|
|
33
|
+
Do not include:
|
|
34
|
+
- One-off implementation details found in only one file
|
|
35
|
+
- Preference statements without evidence
|
|
36
|
+
- Forward-looking proposals not present in current code
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# AGENTS.md Template
|
|
2
|
+
|
|
3
|
+
Use this template to create the concise canonical memory document.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
- Purpose: [What the project does and why it exists]
|
|
8
|
+
- Scope: [Core responsibilities and boundaries]
|
|
9
|
+
- Evidence: `path/to/file:line`
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- Languages/runtime: [TypeScript, Node.js, etc.]
|
|
14
|
+
- Frameworks/libraries: [Commander.js, Vitest, etc.]
|
|
15
|
+
- Tooling: [build/lint/test tools]
|
|
16
|
+
- Evidence: `path/to/file:line`
|
|
17
|
+
|
|
18
|
+
## Key Directories
|
|
19
|
+
|
|
20
|
+
- `src/...`: [responsibility]
|
|
21
|
+
- `...`: [responsibility]
|
|
22
|
+
- Evidence per directory: `path/to/file:line`
|
|
23
|
+
|
|
24
|
+
## Essential Build/Test Commands
|
|
25
|
+
|
|
26
|
+
- `...`: [what it does and when to use it]
|
|
27
|
+
- `...`: [what it does and when to use it]
|
|
28
|
+
- Evidence: `path/to/file:line`
|
|
29
|
+
|
|
30
|
+
## Additional Documentation
|
|
31
|
+
|
|
32
|
+
- `docs/architectural-patterns.md`: Recurring design patterns and conventions
|
|
33
|
+
- Add only docs that provide specialized detail not suitable for AGENTS.md
|
|
34
|
+
|
|
35
|
+
## Constraints
|
|
36
|
+
|
|
37
|
+
- Keep full document under 150 lines
|
|
38
|
+
- Use file:line references instead of code snippets
|
|
39
|
+
- Keep guidance universally applicable for contributors and agents
|
|
40
|
+
- Treat `AGENTS.md` as canonical, then create `CLAUDE.md` as a symlink to `AGENTS.md`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: navigate-thoughts
|
|
3
|
+
description: Resolves thoughts/ paths and navigates thought documents. Use when user references a thoughts/ path, asks to find/read/list thoughts documents, or encounters symlinks in the thoughts directory.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Navigating Thoughts
|
|
7
|
+
|
|
8
|
+
Resolve thoughts paths to canonical form and locate documents in the local thoughts directory.
|
|
9
|
+
|
|
10
|
+
## Background
|
|
11
|
+
|
|
12
|
+
`thoughts/` is a symlink-based directory managed by ThoughtCabinet. It points into a central thoughts git repo but is accessed locally via relative paths from the project root.
|
|
13
|
+
|
|
14
|
+
**Directory structure:**
|
|
15
|
+
- `thoughts/{user}/` — Personal repo-specific notes
|
|
16
|
+
- `thoughts/shared/` — Team-shared repo-specific notes (plans, research, PRs)
|
|
17
|
+
- `thoughts/global/` — Cross-repository notes
|
|
18
|
+
- `thoughts/searchable/` — Hard links for search tools (NOT canonical, never reference)
|
|
19
|
+
|
|
20
|
+
**Common subdirectories under `shared/`:**
|
|
21
|
+
- `shared/plans/` — Implementation plans (`YYYY-MM-DD-description.md`)
|
|
22
|
+
- `shared/research/` — Research documents (`YYYY-MM-DD-description.md`)
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
1. **Normalize path**
|
|
27
|
+
- Strip `searchable/` segment: `thoughts/searchable/shared/plans/foo.md` → `thoughts/shared/plans/foo.md`
|
|
28
|
+
- Ensure `thoughts/` prefix (add if user gives bare path like `shared/plans/foo.md`)
|
|
29
|
+
- If user gives a description instead of a path, proceed to search
|
|
30
|
+
|
|
31
|
+
2. **Locate document**
|
|
32
|
+
- Exact path given: read it directly
|
|
33
|
+
- Partial/fuzzy: `ls` the likely directory, then match by name or grep for content
|
|
34
|
+
- No path given: `ls -lt thoughts/shared/ thoughts/{user}/ | head -20` to show recent documents
|
|
35
|
+
|
|
36
|
+
3. **Present**
|
|
37
|
+
- Read and present the document content
|
|
38
|
+
- If the path was non-canonical (e.g. contained `searchable/`), note the canonical path
|
|
39
|
+
|
|
40
|
+
## Rules
|
|
41
|
+
|
|
42
|
+
- **NEVER reference `thoughts/searchable/` paths** in output — always use canonical paths
|
|
43
|
+
- **All paths are relative** to the project root (e.g. `thoughts/shared/plans/...`, never absolute)
|
|
44
|
+
- If `thoughts/` doesn't exist, tell the user to run `thc thoughts init`
|
|
45
|
+
- When listing, prefer `ls -lt` (recent first) for discoverability
|
|
@@ -198,4 +198,9 @@ When working within a plan phase:
|
|
|
198
198
|
|
|
199
199
|
The phase's automated verification is the final gate. TDD cycles happen within that gate, not instead of it.
|
|
200
200
|
|
|
201
|
-
**When the plan says tests aren't needed**: Evaluate independently —
|
|
201
|
+
**When the plan says tests aren't needed**: Evaluate independently — the plan may be wrong. Read existing test files first. Apply TDD unless the code meets ALL of these criteria:
|
|
202
|
+
1. Zero conditional logic (no if/else, switches, ternaries, or loops with conditions)
|
|
203
|
+
2. Zero data transformation (no mapping, filtering, formatting, restructuring)
|
|
204
|
+
3. The function is a pure pass-through calling already-tested functions with static arguments
|
|
205
|
+
|
|
206
|
+
"Wiring", "integration-level", "mostly delegation", and "would require too many mocks" are NOT valid skip reasons. Document any skip with the specific criterion (1-3) that applies.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-skill
|
|
3
|
+
description: Create, revise, or distill workflows into skills following best practices. Use when user asks to create a new skill, iterate on an existing skill, distill a session workflow into a reusable skill, or improve skill quality.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Skills
|
|
7
|
+
|
|
8
|
+
Create new skills, revise existing ones, or distill workflows into reusable skills. Follow [best practices](best-practices.md) and use [skill-template](skill-template.md).
|
|
9
|
+
|
|
10
|
+
## Workflow Context
|
|
11
|
+
|
|
12
|
+
This meta-skill produces skills. Common skill patterns:
|
|
13
|
+
- **Complex workflow** — Multiple phases, planning/implementation/validation
|
|
14
|
+
- **Research/synthesis** — Discovery, analysis, pattern extraction
|
|
15
|
+
- **Simple imperative** — Single task, straightforward execution
|
|
16
|
+
- **Integration-focused** — Modifies/enhances other workflows
|
|
17
|
+
|
|
18
|
+
**Skills are saved to your Thought Cabinet skills directory**:
|
|
19
|
+
- `~/.thought-cabinet/skills/` (new)
|
|
20
|
+
- `~/.config/thought-cabinet/skills/` (legacy, if config exists there)
|
|
21
|
+
|
|
22
|
+
## Determine the Mode
|
|
23
|
+
|
|
24
|
+
Infer from user query:
|
|
25
|
+
- "create", "new", "write" → Step 1
|
|
26
|
+
- "revise", "update", "fix", "improve", "modify" → Step 2
|
|
27
|
+
- "distill", "extract", "turn into skill" → Step 3
|
|
28
|
+
|
|
29
|
+
Only ask if ambiguous.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 1: Create New Skill
|
|
34
|
+
|
|
35
|
+
### 1a. Requirements
|
|
36
|
+
|
|
37
|
+
Only ask what user hasn't provided:
|
|
38
|
+
- Task automated/guided
|
|
39
|
+
- Trigger contexts (words/situations)
|
|
40
|
+
- Inputs needed and outputs produced
|
|
41
|
+
- Relation to existing skills
|
|
42
|
+
|
|
43
|
+
### 1b. Resolve Skills Directory
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Check for existing config
|
|
47
|
+
if [ -f ~/.thought-cabinet/config.json ]; then
|
|
48
|
+
export THC_SKILLS_DIR=~/.thought-cabinet/skills
|
|
49
|
+
elif [ -f ~/.config/thought-cabinet/config.json ]; then
|
|
50
|
+
export THC_SKILLS_DIR=~/.config/thought-cabinet/skills
|
|
51
|
+
else
|
|
52
|
+
export THC_SKILLS_DIR=~/.thought-cabinet/skills
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
mkdir -p "$THC_SKILLS_DIR"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Save to `$THC_SKILLS_DIR/[skill-name]/`.
|
|
59
|
+
|
|
60
|
+
### 1c. Research Patterns
|
|
61
|
+
|
|
62
|
+
Spawn parallel sub-agents to searche for analog skills in skill directories:
|
|
63
|
+
- `$THC_SKILLS_DIR`
|
|
64
|
+
- agent skill directories, e.g. `~/.claude/skills/` and `.claude/skills/` for Claude Code
|
|
65
|
+
|
|
66
|
+
**Choose analog** based on characteristics:
|
|
67
|
+
- Multi-phase workflow → find complex workflow skills
|
|
68
|
+
- Simple imperative → find single-task skills
|
|
69
|
+
- Research/synthesis → find discovery/analysis skills
|
|
70
|
+
- Integration-focused → find skills that modify/enhance other workflows
|
|
71
|
+
|
|
72
|
+
### 1d. Design Present
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
**Name**: kebab-case-name
|
|
76
|
+
**Description**: Third-person, specific, includes triggers
|
|
77
|
+
**Modeled after**: [skill pattern] + rationale
|
|
78
|
+
**Save to**: $THC_SKILLS_DIR/[skill-name]
|
|
79
|
+
|
|
80
|
+
**Workflow**:
|
|
81
|
+
1. Step - action
|
|
82
|
+
2. Step - action
|
|
83
|
+
|
|
84
|
+
**Integration**: how it connects
|
|
85
|
+
|
|
86
|
+
**Files**: SKILL.md, [supplements + rationale]
|
|
87
|
+
|
|
88
|
+
Confirm before writing?
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 1e. Write
|
|
92
|
+
|
|
93
|
+
1. Create `$THC_SKILLS_DIR/[skill-name]/`
|
|
94
|
+
2. Write SKILL.md following template
|
|
95
|
+
3. Add supplementary files
|
|
96
|
+
4. Verify against analog skill
|
|
97
|
+
|
|
98
|
+
### 1f. Quality Check
|
|
99
|
+
|
|
100
|
+
Run the checklist from best-practices.md:
|
|
101
|
+
- [ ] Description specific with triggers
|
|
102
|
+
- [ ] Under 500 lines
|
|
103
|
+
- [ ] Concise (no unnecessary explanations)
|
|
104
|
+
- [ ] Consistent terminology
|
|
105
|
+
- [ ] One-level references
|
|
106
|
+
- [ ] Clear workflow steps
|
|
107
|
+
- [ ] Integrates naturally
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Created: $THC_SKILLS_DIR/[name]/SKILL.md
|
|
111
|
+
Key decisions: [rationales]
|
|
112
|
+
Quality: [x] passes checklist
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 1g. Install Skill
|
|
116
|
+
|
|
117
|
+
Make the skill available:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
thc skill install --target [agent-name] --force
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Step 2: Revise Existing Skill
|
|
126
|
+
|
|
127
|
+
### 2a. Locate Skills Directory
|
|
128
|
+
|
|
129
|
+
Resolve directory (Step 1b), then list available skills:
|
|
130
|
+
```bash
|
|
131
|
+
ls -la "$THC_SKILLS_DIR"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 2b. Audit
|
|
135
|
+
|
|
136
|
+
Read SKILL.md and best-practices.md.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
**Strengths**: [what works]
|
|
140
|
+
**Issues**: [specific problems from checklist]
|
|
141
|
+
**Changes**: 1. [change] 2. [change]
|
|
142
|
+
|
|
143
|
+
Which changes?
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 2c. Apply
|
|
147
|
+
|
|
148
|
+
Make surgical edits to `$THC_SKILLS_DIR/[skill-name]/`. Maintain structure unless changing it.
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
Updated [skill-name]:
|
|
152
|
+
- [change 1]
|
|
153
|
+
- [change 2]
|
|
154
|
+
Quality check passed. Further?
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Step 3: Distill Session Workflow
|
|
160
|
+
|
|
161
|
+
### 3a. Extract
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
**Task pattern**: what we did
|
|
165
|
+
**Steps**: 1. [step] 2. [step]
|
|
166
|
+
**Context needed**: what helps future runs
|
|
167
|
+
**Proposed name**: kebab-case-name
|
|
168
|
+
Save to: $THC_SKILLS_DIR/[name]/
|
|
169
|
+
Create?
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 3b. Generalize
|
|
173
|
+
|
|
174
|
+
Replace specifics with patterns, frameworks. Remove session artifacts.
|
|
175
|
+
|
|
176
|
+
### 3c. Write
|
|
177
|
+
|
|
178
|
+
Resolve directory (Step 1b), then follow Step 1e-1g.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Sync to Source (thought-cabinet repo only)
|
|
183
|
+
|
|
184
|
+
After creating, revising, or distilling a skill, check if you're working inside the `thought-cabinet` repository:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Check if src/agent-assets/skills/ exists in the repo root
|
|
188
|
+
if [ -d "$(git rev-parse --show-toplevel 2>/dev/null)/src/agent-assets/skills" ]; then
|
|
189
|
+
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
190
|
+
# Copy the skill directory into the bundled assets
|
|
191
|
+
cp -r "$THC_SKILLS_DIR/[skill-name]" "$REPO_ROOT/src/agent-assets/skills/[skill-name]"
|
|
192
|
+
fi
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This ensures new or updated skills are tracked in `src/agent-assets/skills/` for packaging and distribution. The copy goes into the repo's working tree — it is NOT committed automatically.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Guidelines
|
|
200
|
+
|
|
201
|
+
**Conciseness**: Challenge every paragraph — does it justify its token cost?
|
|
202
|
+
|
|
203
|
+
**Integration**: Reference related skills in Workflow Context. Match tone/structure to analog.
|
|
204
|
+
|
|
205
|
+
**Iterate**: Ship minimal working skill, refine from usage.
|
|
206
|
+
|
|
207
|
+
**Config Compatibility**: Check `~/.thought-cabinet/` (new) and `~/.config/thought-cabinet/` (legacy). Use existing location; default to new.
|