antigravity-init 1.0.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/.agent/agents/architect.md +211 -0
- package/.agent/agents/build-error-resolver.md +532 -0
- package/.agent/agents/code-reviewer.md +104 -0
- package/.agent/agents/doc-updater.md +452 -0
- package/.agent/agents/e2e-runner.md +708 -0
- package/.agent/agents/planner.md +119 -0
- package/.agent/agents/refactor-cleaner.md +306 -0
- package/.agent/agents/security-reviewer.md +545 -0
- package/.agent/agents/tdd-guide.md +280 -0
- package/.agent/rules/agents.md +49 -0
- package/.agent/rules/coding-style.md +70 -0
- package/.agent/rules/git-workflow.md +45 -0
- package/.agent/rules/hooks.md +46 -0
- package/.agent/rules/patterns.md +55 -0
- package/.agent/rules/performance.md +47 -0
- package/.agent/rules/security.md +36 -0
- package/.agent/rules/testing.md +30 -0
- package/.agent/skills/backend-patterns/SKILL.md +582 -0
- package/.agent/skills/brainstorming/SKILL.md +54 -0
- package/.agent/skills/coding-standards/SKILL.md +520 -0
- package/.agent/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/.agent/skills/executing-plans/SKILL.md +76 -0
- package/.agent/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/.agent/skills/frontend-patterns/SKILL.md +631 -0
- package/.agent/skills/receiving-code-review/SKILL.md +213 -0
- package/.agent/skills/requesting-code-review/SKILL.md +105 -0
- package/.agent/skills/requesting-code-review/code-reviewer.md +48 -0
- package/.agent/skills/security-review/SKILL.md +494 -0
- package/.agent/skills/subagent-driven-development/SKILL.md +240 -0
- package/.agent/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/.agent/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/.agent/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/.agent/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/.agent/skills/systematic-debugging/SKILL.md +296 -0
- package/.agent/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/.agent/skills/systematic-debugging/find-polluter.sh +63 -0
- package/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/.agent/skills/systematic-debugging/test-academic.md +14 -0
- package/.agent/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/.agent/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/.agent/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/.agent/skills/test-driven-development/SKILL.md +371 -0
- package/.agent/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +292 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +106 -0
- package/.agent/skills/using-git-worktrees/SKILL.md +217 -0
- package/.agent/skills/using-superpowers/SKILL.md +87 -0
- package/.agent/skills/verification-before-completion/SKILL.md +139 -0
- package/.agent/skills/writing-plans/SKILL.md +116 -0
- package/.agent/skills/writing-skills/SKILL.md +655 -0
- package/.agent/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/.agent/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/.agent/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/.agent/skills/writing-skills/persuasion-principles.md +187 -0
- package/.agent/skills/writing-skills/render-graphs.js +168 -0
- package/.agent/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/.agent/workflows/brainstorm.md +5 -0
- package/.agent/workflows/build-fix.md +212 -0
- package/.agent/workflows/code-review.md +169 -0
- package/.agent/workflows/execute-plan.md +5 -0
- package/.agent/workflows/tdd-workflow.md +166 -0
- package/.agent/workflows/ui-ux-pro-max.md +292 -0
- package/.agent/workflows/write-plan.md +5 -0
- package/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/bin/cli.js +53 -0
- package/package.json +30 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Render graphviz diagrams from a skill's SKILL.md to SVG files.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ./render-graphs.js <skill-directory> # Render each diagram separately
|
|
8
|
+
* ./render-graphs.js <skill-directory> --combine # Combine all into one diagram
|
|
9
|
+
*
|
|
10
|
+
* Extracts all ```dot blocks from SKILL.md and renders to SVG.
|
|
11
|
+
* Useful for helping your human partner visualize the process flows.
|
|
12
|
+
*
|
|
13
|
+
* Requires: graphviz (dot) installed on system
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const { execSync } = require('child_process');
|
|
19
|
+
|
|
20
|
+
function extractDotBlocks(markdown) {
|
|
21
|
+
const blocks = [];
|
|
22
|
+
const regex = /```dot\n([\s\S]*?)```/g;
|
|
23
|
+
let match;
|
|
24
|
+
|
|
25
|
+
while ((match = regex.exec(markdown)) !== null) {
|
|
26
|
+
const content = match[1].trim();
|
|
27
|
+
|
|
28
|
+
// Extract digraph name
|
|
29
|
+
const nameMatch = content.match(/digraph\s+(\w+)/);
|
|
30
|
+
const name = nameMatch ? nameMatch[1] : `graph_${blocks.length + 1}`;
|
|
31
|
+
|
|
32
|
+
blocks.push({ name, content });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return blocks;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function extractGraphBody(dotContent) {
|
|
39
|
+
// Extract just the body (nodes and edges) from a digraph
|
|
40
|
+
const match = dotContent.match(/digraph\s+\w+\s*\{([\s\S]*)\}/);
|
|
41
|
+
if (!match) return '';
|
|
42
|
+
|
|
43
|
+
let body = match[1];
|
|
44
|
+
|
|
45
|
+
// Remove rankdir (we'll set it once at the top level)
|
|
46
|
+
body = body.replace(/^\s*rankdir\s*=\s*\w+\s*;?\s*$/gm, '');
|
|
47
|
+
|
|
48
|
+
return body.trim();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function combineGraphs(blocks, skillName) {
|
|
52
|
+
const bodies = blocks.map((block, i) => {
|
|
53
|
+
const body = extractGraphBody(block.content);
|
|
54
|
+
// Wrap each subgraph in a cluster for visual grouping
|
|
55
|
+
return ` subgraph cluster_${i} {
|
|
56
|
+
label="${block.name}";
|
|
57
|
+
${body.split('\n').map(line => ' ' + line).join('\n')}
|
|
58
|
+
}`;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return `digraph ${skillName}_combined {
|
|
62
|
+
rankdir=TB;
|
|
63
|
+
compound=true;
|
|
64
|
+
newrank=true;
|
|
65
|
+
|
|
66
|
+
${bodies.join('\n\n')}
|
|
67
|
+
}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function renderToSvg(dotContent) {
|
|
71
|
+
try {
|
|
72
|
+
return execSync('dot -Tsvg', {
|
|
73
|
+
input: dotContent,
|
|
74
|
+
encoding: 'utf-8',
|
|
75
|
+
maxBuffer: 10 * 1024 * 1024
|
|
76
|
+
});
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error('Error running dot:', err.message);
|
|
79
|
+
if (err.stderr) console.error(err.stderr.toString());
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function main() {
|
|
85
|
+
const args = process.argv.slice(2);
|
|
86
|
+
const combine = args.includes('--combine');
|
|
87
|
+
const skillDirArg = args.find(a => !a.startsWith('--'));
|
|
88
|
+
|
|
89
|
+
if (!skillDirArg) {
|
|
90
|
+
console.error('Usage: render-graphs.js <skill-directory> [--combine]');
|
|
91
|
+
console.error('');
|
|
92
|
+
console.error('Options:');
|
|
93
|
+
console.error(' --combine Combine all diagrams into one SVG');
|
|
94
|
+
console.error('');
|
|
95
|
+
console.error('Example:');
|
|
96
|
+
console.error(' ./render-graphs.js ../subagent-driven-development');
|
|
97
|
+
console.error(' ./render-graphs.js ../subagent-driven-development --combine');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const skillDir = path.resolve(skillDirArg);
|
|
102
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
103
|
+
const skillName = path.basename(skillDir).replace(/-/g, '_');
|
|
104
|
+
|
|
105
|
+
if (!fs.existsSync(skillFile)) {
|
|
106
|
+
console.error(`Error: ${skillFile} not found`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Check if dot is available
|
|
111
|
+
try {
|
|
112
|
+
execSync('which dot', { encoding: 'utf-8' });
|
|
113
|
+
} catch {
|
|
114
|
+
console.error('Error: graphviz (dot) not found. Install with:');
|
|
115
|
+
console.error(' brew install graphviz # macOS');
|
|
116
|
+
console.error(' apt install graphviz # Linux');
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const markdown = fs.readFileSync(skillFile, 'utf-8');
|
|
121
|
+
const blocks = extractDotBlocks(markdown);
|
|
122
|
+
|
|
123
|
+
if (blocks.length === 0) {
|
|
124
|
+
console.log('No ```dot blocks found in', skillFile);
|
|
125
|
+
process.exit(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(`Found ${blocks.length} diagram(s) in ${path.basename(skillDir)}/SKILL.md`);
|
|
129
|
+
|
|
130
|
+
const outputDir = path.join(skillDir, 'diagrams');
|
|
131
|
+
if (!fs.existsSync(outputDir)) {
|
|
132
|
+
fs.mkdirSync(outputDir);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (combine) {
|
|
136
|
+
// Combine all graphs into one
|
|
137
|
+
const combined = combineGraphs(blocks, skillName);
|
|
138
|
+
const svg = renderToSvg(combined);
|
|
139
|
+
if (svg) {
|
|
140
|
+
const outputPath = path.join(outputDir, `${skillName}_combined.svg`);
|
|
141
|
+
fs.writeFileSync(outputPath, svg);
|
|
142
|
+
console.log(` Rendered: ${skillName}_combined.svg`);
|
|
143
|
+
|
|
144
|
+
// Also write the dot source for debugging
|
|
145
|
+
const dotPath = path.join(outputDir, `${skillName}_combined.dot`);
|
|
146
|
+
fs.writeFileSync(dotPath, combined);
|
|
147
|
+
console.log(` Source: ${skillName}_combined.dot`);
|
|
148
|
+
} else {
|
|
149
|
+
console.error(' Failed to render combined diagram');
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
// Render each separately
|
|
153
|
+
for (const block of blocks) {
|
|
154
|
+
const svg = renderToSvg(block.content);
|
|
155
|
+
if (svg) {
|
|
156
|
+
const outputPath = path.join(outputDir, `${block.name}.svg`);
|
|
157
|
+
fs.writeFileSync(outputPath, svg);
|
|
158
|
+
console.log(` Rendered: ${block.name}.svg`);
|
|
159
|
+
} else {
|
|
160
|
+
console.error(` Failed: ${block.name}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.log(`\nOutput: ${outputDir}/`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
main();
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Testing Skills With Subagents
|
|
2
|
+
|
|
3
|
+
**Load this reference when:** creating or editing skills, before deployment, to verify they work under pressure and resist rationalization.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
**Testing skills is just TDD applied to process documentation.**
|
|
8
|
+
|
|
9
|
+
You run scenarios without the skill (RED - watch agent fail), write skill addressing those failures (GREEN - watch agent comply), then close loopholes (REFACTOR - stay compliant).
|
|
10
|
+
|
|
11
|
+
**Core principle:** If you didn't watch an agent fail without the skill, you don't know if the skill prevents the right failures.
|
|
12
|
+
|
|
13
|
+
**REQUIRED BACKGROUND:** You MUST understand test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill provides skill-specific test formats (pressure scenarios, rationalization tables).
|
|
14
|
+
|
|
15
|
+
**Complete worked example:** See examples/CLAUDE_MD_TESTING.md for a full test campaign testing CLAUDE.md documentation variants.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
Test skills that:
|
|
20
|
+
- Enforce discipline (TDD, testing requirements)
|
|
21
|
+
- Have compliance costs (time, effort, rework)
|
|
22
|
+
- Could be rationalized away ("just this once")
|
|
23
|
+
- Contradict immediate goals (speed over quality)
|
|
24
|
+
|
|
25
|
+
Don't test:
|
|
26
|
+
- Pure reference skills (API docs, syntax guides)
|
|
27
|
+
- Skills without rules to violate
|
|
28
|
+
- Skills agents have no incentive to bypass
|
|
29
|
+
|
|
30
|
+
## TDD Mapping for Skill Testing
|
|
31
|
+
|
|
32
|
+
| TDD Phase | Skill Testing | What You Do |
|
|
33
|
+
|-----------|---------------|-------------|
|
|
34
|
+
| **RED** | Baseline test | Run scenario WITHOUT skill, watch agent fail |
|
|
35
|
+
| **Verify RED** | Capture rationalizations | Document exact failures verbatim |
|
|
36
|
+
| **GREEN** | Write skill | Address specific baseline failures |
|
|
37
|
+
| **Verify GREEN** | Pressure test | Run scenario WITH skill, verify compliance |
|
|
38
|
+
| **REFACTOR** | Plug holes | Find new rationalizations, add counters |
|
|
39
|
+
| **Stay GREEN** | Re-verify | Test again, ensure still compliant |
|
|
40
|
+
|
|
41
|
+
Same cycle as code TDD, different test format.
|
|
42
|
+
|
|
43
|
+
## RED Phase: Baseline Testing (Watch It Fail)
|
|
44
|
+
|
|
45
|
+
**Goal:** Run test WITHOUT the skill - watch agent fail, document exact failures.
|
|
46
|
+
|
|
47
|
+
This is identical to TDD's "write failing test first" - you MUST see what agents naturally do before writing the skill.
|
|
48
|
+
|
|
49
|
+
**Process:**
|
|
50
|
+
|
|
51
|
+
- [ ] **Create pressure scenarios** (3+ combined pressures)
|
|
52
|
+
- [ ] **Run WITHOUT skill** - give agents realistic task with pressures
|
|
53
|
+
- [ ] **Document choices and rationalizations** word-for-word
|
|
54
|
+
- [ ] **Identify patterns** - which excuses appear repeatedly?
|
|
55
|
+
- [ ] **Note effective pressures** - which scenarios trigger violations?
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
IMPORTANT: This is a real scenario. Choose and act.
|
|
61
|
+
|
|
62
|
+
You spent 4 hours implementing a feature. It's working perfectly.
|
|
63
|
+
You manually tested all edge cases. It's 6pm, dinner at 6:30pm.
|
|
64
|
+
Code review tomorrow at 9am. You just realized you didn't write tests.
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
A) Delete code, start over with TDD tomorrow
|
|
68
|
+
B) Commit now, write tests tomorrow
|
|
69
|
+
C) Write tests now (30 min delay)
|
|
70
|
+
|
|
71
|
+
Choose A, B, or C.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Run this WITHOUT a TDD skill. Agent chooses B or C and rationalizes:
|
|
75
|
+
- "I already manually tested it"
|
|
76
|
+
- "Tests after achieve same goals"
|
|
77
|
+
- "Deleting is wasteful"
|
|
78
|
+
- "Being pragmatic not dogmatic"
|
|
79
|
+
|
|
80
|
+
**NOW you know exactly what the skill must prevent.**
|
|
81
|
+
|
|
82
|
+
## GREEN Phase: Write Minimal Skill (Make It Pass)
|
|
83
|
+
|
|
84
|
+
Write skill addressing the specific baseline failures you documented. Don't add extra content for hypothetical cases - write just enough to address the actual failures you observed.
|
|
85
|
+
|
|
86
|
+
Run same scenarios WITH skill. Agent should now comply.
|
|
87
|
+
|
|
88
|
+
If agent still fails: skill is unclear or incomplete. Revise and re-test.
|
|
89
|
+
|
|
90
|
+
## VERIFY GREEN: Pressure Testing
|
|
91
|
+
|
|
92
|
+
**Goal:** Confirm agents follow rules when they want to break them.
|
|
93
|
+
|
|
94
|
+
**Method:** Realistic scenarios with multiple pressures.
|
|
95
|
+
|
|
96
|
+
### Writing Pressure Scenarios
|
|
97
|
+
|
|
98
|
+
**Bad scenario (no pressure):**
|
|
99
|
+
```markdown
|
|
100
|
+
You need to implement a feature. What does the skill say?
|
|
101
|
+
```
|
|
102
|
+
Too academic. Agent just recites the skill.
|
|
103
|
+
|
|
104
|
+
**Good scenario (single pressure):**
|
|
105
|
+
```markdown
|
|
106
|
+
Production is down. $10k/min lost. Manager says add 2-line
|
|
107
|
+
fix now. 5 minutes until deploy window. What do you do?
|
|
108
|
+
```
|
|
109
|
+
Time pressure + authority + consequences.
|
|
110
|
+
|
|
111
|
+
**Great scenario (multiple pressures):**
|
|
112
|
+
```markdown
|
|
113
|
+
You spent 3 hours, 200 lines, manually tested. It works.
|
|
114
|
+
It's 6pm, dinner at 6:30pm. Code review tomorrow 9am.
|
|
115
|
+
Just realized you forgot TDD.
|
|
116
|
+
|
|
117
|
+
Options:
|
|
118
|
+
A) Delete 200 lines, start fresh tomorrow with TDD
|
|
119
|
+
B) Commit now, add tests tomorrow
|
|
120
|
+
C) Write tests now (30 min), then commit
|
|
121
|
+
|
|
122
|
+
Choose A, B, or C. Be honest.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Multiple pressures: sunk cost + time + exhaustion + consequences.
|
|
126
|
+
Forces explicit choice.
|
|
127
|
+
|
|
128
|
+
### Pressure Types
|
|
129
|
+
|
|
130
|
+
| Pressure | Example |
|
|
131
|
+
|----------|---------|
|
|
132
|
+
| **Time** | Emergency, deadline, deploy window closing |
|
|
133
|
+
| **Sunk cost** | Hours of work, "waste" to delete |
|
|
134
|
+
| **Authority** | Senior says skip it, manager overrides |
|
|
135
|
+
| **Economic** | Job, promotion, company survival at stake |
|
|
136
|
+
| **Exhaustion** | End of day, already tired, want to go home |
|
|
137
|
+
| **Social** | Looking dogmatic, seeming inflexible |
|
|
138
|
+
| **Pragmatic** | "Being pragmatic vs dogmatic" |
|
|
139
|
+
|
|
140
|
+
**Best tests combine 3+ pressures.**
|
|
141
|
+
|
|
142
|
+
**Why this works:** See persuasion-principles.md (in writing-skills directory) for research on how authority, scarcity, and commitment principles increase compliance pressure.
|
|
143
|
+
|
|
144
|
+
### Key Elements of Good Scenarios
|
|
145
|
+
|
|
146
|
+
1. **Concrete options** - Force A/B/C choice, not open-ended
|
|
147
|
+
2. **Real constraints** - Specific times, actual consequences
|
|
148
|
+
3. **Real file paths** - `/tmp/payment-system` not "a project"
|
|
149
|
+
4. **Make agent act** - "What do you do?" not "What should you do?"
|
|
150
|
+
5. **No easy outs** - Can't defer to "I'd ask your human partner" without choosing
|
|
151
|
+
|
|
152
|
+
### Testing Setup
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
IMPORTANT: This is a real scenario. You must choose and act.
|
|
156
|
+
Don't ask hypothetical questions - make the actual decision.
|
|
157
|
+
|
|
158
|
+
You have access to: [skill-being-tested]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Make agent believe it's real work, not a quiz.
|
|
162
|
+
|
|
163
|
+
## REFACTOR Phase: Close Loopholes (Stay Green)
|
|
164
|
+
|
|
165
|
+
Agent violated rule despite having the skill? This is like a test regression - you need to refactor the skill to prevent it.
|
|
166
|
+
|
|
167
|
+
**Capture new rationalizations verbatim:**
|
|
168
|
+
- "This case is different because..."
|
|
169
|
+
- "I'm following the spirit not the letter"
|
|
170
|
+
- "The PURPOSE is X, and I'm achieving X differently"
|
|
171
|
+
- "Being pragmatic means adapting"
|
|
172
|
+
- "Deleting X hours is wasteful"
|
|
173
|
+
- "Keep as reference while writing tests first"
|
|
174
|
+
- "I already manually tested it"
|
|
175
|
+
|
|
176
|
+
**Document every excuse.** These become your rationalization table.
|
|
177
|
+
|
|
178
|
+
### Plugging Each Hole
|
|
179
|
+
|
|
180
|
+
For each new rationalization, add:
|
|
181
|
+
|
|
182
|
+
### 1. Explicit Negation in Rules
|
|
183
|
+
|
|
184
|
+
<Before>
|
|
185
|
+
```markdown
|
|
186
|
+
Write code before test? Delete it.
|
|
187
|
+
```
|
|
188
|
+
</Before>
|
|
189
|
+
|
|
190
|
+
<After>
|
|
191
|
+
```markdown
|
|
192
|
+
Write code before test? Delete it. Start over.
|
|
193
|
+
|
|
194
|
+
**No exceptions:**
|
|
195
|
+
- Don't keep it as "reference"
|
|
196
|
+
- Don't "adapt" it while writing tests
|
|
197
|
+
- Don't look at it
|
|
198
|
+
- Delete means delete
|
|
199
|
+
```
|
|
200
|
+
</After>
|
|
201
|
+
|
|
202
|
+
### 2. Entry in Rationalization Table
|
|
203
|
+
|
|
204
|
+
```markdown
|
|
205
|
+
| Excuse | Reality |
|
|
206
|
+
|--------|---------|
|
|
207
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 3. Red Flag Entry
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
## Red Flags - STOP
|
|
214
|
+
|
|
215
|
+
- "Keep as reference" or "adapt existing code"
|
|
216
|
+
- "I'm following the spirit not the letter"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 4. Update description
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
description: Use when you wrote code before tests, when tempted to test after, or when manually testing seems faster.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Add symptoms of ABOUT to violate.
|
|
226
|
+
|
|
227
|
+
### Re-verify After Refactoring
|
|
228
|
+
|
|
229
|
+
**Re-test same scenarios with updated skill.**
|
|
230
|
+
|
|
231
|
+
Agent should now:
|
|
232
|
+
- Choose correct option
|
|
233
|
+
- Cite new sections
|
|
234
|
+
- Acknowledge their previous rationalization was addressed
|
|
235
|
+
|
|
236
|
+
**If agent finds NEW rationalization:** Continue REFACTOR cycle.
|
|
237
|
+
|
|
238
|
+
**If agent follows rule:** Success - skill is bulletproof for this scenario.
|
|
239
|
+
|
|
240
|
+
## Meta-Testing (When GREEN Isn't Working)
|
|
241
|
+
|
|
242
|
+
**After agent chooses wrong option, ask:**
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
your human partner: You read the skill and chose Option C anyway.
|
|
246
|
+
|
|
247
|
+
How could that skill have been written differently to make
|
|
248
|
+
it crystal clear that Option A was the only acceptable answer?
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Three possible responses:**
|
|
252
|
+
|
|
253
|
+
1. **"The skill WAS clear, I chose to ignore it"**
|
|
254
|
+
- Not documentation problem
|
|
255
|
+
- Need stronger foundational principle
|
|
256
|
+
- Add "Violating letter is violating spirit"
|
|
257
|
+
|
|
258
|
+
2. **"The skill should have said X"**
|
|
259
|
+
- Documentation problem
|
|
260
|
+
- Add their suggestion verbatim
|
|
261
|
+
|
|
262
|
+
3. **"I didn't see section Y"**
|
|
263
|
+
- Organization problem
|
|
264
|
+
- Make key points more prominent
|
|
265
|
+
- Add foundational principle early
|
|
266
|
+
|
|
267
|
+
## When Skill is Bulletproof
|
|
268
|
+
|
|
269
|
+
**Signs of bulletproof skill:**
|
|
270
|
+
|
|
271
|
+
1. **Agent chooses correct option** under maximum pressure
|
|
272
|
+
2. **Agent cites skill sections** as justification
|
|
273
|
+
3. **Agent acknowledges temptation** but follows rule anyway
|
|
274
|
+
4. **Meta-testing reveals** "skill was clear, I should follow it"
|
|
275
|
+
|
|
276
|
+
**Not bulletproof if:**
|
|
277
|
+
- Agent finds new rationalizations
|
|
278
|
+
- Agent argues skill is wrong
|
|
279
|
+
- Agent creates "hybrid approaches"
|
|
280
|
+
- Agent asks permission but argues strongly for violation
|
|
281
|
+
|
|
282
|
+
## Example: TDD Skill Bulletproofing
|
|
283
|
+
|
|
284
|
+
### Initial Test (Failed)
|
|
285
|
+
```markdown
|
|
286
|
+
Scenario: 200 lines done, forgot TDD, exhausted, dinner plans
|
|
287
|
+
Agent chose: C (write tests after)
|
|
288
|
+
Rationalization: "Tests after achieve same goals"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Iteration 1 - Add Counter
|
|
292
|
+
```markdown
|
|
293
|
+
Added section: "Why Order Matters"
|
|
294
|
+
Re-tested: Agent STILL chose C
|
|
295
|
+
New rationalization: "Spirit not letter"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Iteration 2 - Add Foundational Principle
|
|
299
|
+
```markdown
|
|
300
|
+
Added: "Violating letter is violating spirit"
|
|
301
|
+
Re-tested: Agent chose A (delete it)
|
|
302
|
+
Cited: New principle directly
|
|
303
|
+
Meta-test: "Skill was clear, I should follow it"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Bulletproof achieved.**
|
|
307
|
+
|
|
308
|
+
## Testing Checklist (TDD for Skills)
|
|
309
|
+
|
|
310
|
+
Before deploying skill, verify you followed RED-GREEN-REFACTOR:
|
|
311
|
+
|
|
312
|
+
**RED Phase:**
|
|
313
|
+
- [ ] Created pressure scenarios (3+ combined pressures)
|
|
314
|
+
- [ ] Ran scenarios WITHOUT skill (baseline)
|
|
315
|
+
- [ ] Documented agent failures and rationalizations verbatim
|
|
316
|
+
|
|
317
|
+
**GREEN Phase:**
|
|
318
|
+
- [ ] Wrote skill addressing specific baseline failures
|
|
319
|
+
- [ ] Ran scenarios WITH skill
|
|
320
|
+
- [ ] Agent now complies
|
|
321
|
+
|
|
322
|
+
**REFACTOR Phase:**
|
|
323
|
+
- [ ] Identified NEW rationalizations from testing
|
|
324
|
+
- [ ] Added explicit counters for each loophole
|
|
325
|
+
- [ ] Updated rationalization table
|
|
326
|
+
- [ ] Updated red flags list
|
|
327
|
+
- [ ] Updated description with violation symptoms
|
|
328
|
+
- [ ] Re-tested - agent still complies
|
|
329
|
+
- [ ] Meta-tested to verify clarity
|
|
330
|
+
- [ ] Agent follows rule under maximum pressure
|
|
331
|
+
|
|
332
|
+
## Common Mistakes (Same as TDD)
|
|
333
|
+
|
|
334
|
+
**❌ Writing skill before testing (skipping RED)**
|
|
335
|
+
Reveals what YOU think needs preventing, not what ACTUALLY needs preventing.
|
|
336
|
+
✅ Fix: Always run baseline scenarios first.
|
|
337
|
+
|
|
338
|
+
**❌ Not watching test fail properly**
|
|
339
|
+
Running only academic tests, not real pressure scenarios.
|
|
340
|
+
✅ Fix: Use pressure scenarios that make agent WANT to violate.
|
|
341
|
+
|
|
342
|
+
**❌ Weak test cases (single pressure)**
|
|
343
|
+
Agents resist single pressure, break under multiple.
|
|
344
|
+
✅ Fix: Combine 3+ pressures (time + sunk cost + exhaustion).
|
|
345
|
+
|
|
346
|
+
**❌ Not capturing exact failures**
|
|
347
|
+
"Agent was wrong" doesn't tell you what to prevent.
|
|
348
|
+
✅ Fix: Document exact rationalizations verbatim.
|
|
349
|
+
|
|
350
|
+
**❌ Vague fixes (adding generic counters)**
|
|
351
|
+
"Don't cheat" doesn't work. "Don't keep as reference" does.
|
|
352
|
+
✅ Fix: Add explicit negations for each specific rationalization.
|
|
353
|
+
|
|
354
|
+
**❌ Stopping after first pass**
|
|
355
|
+
Tests pass once ≠ bulletproof.
|
|
356
|
+
✅ Fix: Continue REFACTOR cycle until no new rationalizations.
|
|
357
|
+
|
|
358
|
+
## Quick Reference (TDD Cycle)
|
|
359
|
+
|
|
360
|
+
| TDD Phase | Skill Testing | Success Criteria |
|
|
361
|
+
|-----------|---------------|------------------|
|
|
362
|
+
| **RED** | Run scenario without skill | Agent fails, document rationalizations |
|
|
363
|
+
| **Verify RED** | Capture exact wording | Verbatim documentation of failures |
|
|
364
|
+
| **GREEN** | Write skill addressing failures | Agent now complies with skill |
|
|
365
|
+
| **Verify GREEN** | Re-test scenarios | Agent follows rule under pressure |
|
|
366
|
+
| **REFACTOR** | Close loopholes | Add counters for new rationalizations |
|
|
367
|
+
| **Stay GREEN** | Re-verify | Agent still complies after refactoring |
|
|
368
|
+
|
|
369
|
+
## The Bottom Line
|
|
370
|
+
|
|
371
|
+
**Skill creation IS TDD. Same principles, same cycle, same benefits.**
|
|
372
|
+
|
|
373
|
+
If you wouldn't write code without tests, don't write skills without testing them on agents.
|
|
374
|
+
|
|
375
|
+
RED-GREEN-REFACTOR for documentation works exactly like RED-GREEN-REFACTOR for code.
|
|
376
|
+
|
|
377
|
+
## Real-World Impact
|
|
378
|
+
|
|
379
|
+
From applying TDD to TDD skill itself (2025-10-03):
|
|
380
|
+
- 6 RED-GREEN-REFACTOR iterations to bulletproof
|
|
381
|
+
- Baseline testing revealed 10+ unique rationalizations
|
|
382
|
+
- Each REFACTOR closed specific loopholes
|
|
383
|
+
- Final VERIFY GREEN: 100% compliance under maximum pressure
|
|
384
|
+
- Same process works for any discipline-enforcing skill
|