一键导入
writing-skills
TDD for process documentation - test with subagents before writing, iterate until bulletproof
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
TDD for process documentation - test with subagents before writing, iterate until bulletproof
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Manage Google Jules PR lifecycle - batch investigation, reverse-order processing, and tiered decision presentation.
Testing strategy, test pyramid (70% unit/25% integration/5% E2E), PGlite patterns, Playwright best practices. Use when writing tests, debugging test failures, or when user mentions testing/test/spec/E2E.
TypeScript strictest patterns, type guards, optional properties (exactOptionalPropertyTypes), Drizzle query safety, null checks. Use when fixing type errors, implementing complex types, or when user mentions TypeScript/types/generics.
shadcn/ui patterns, progressive enhancement, Server Components, Client Components, form handling, Tailwind CSS v4, accessibility. Use when building UI, forms, components, or when user mentions UI/styling/components/forms.
Project-specific code patterns for Server Actions, data fetching, error handling, file organization. Use when implementing features to follow established patterns, or when user asks about project conventions/patterns/architecture.
Security patterns, CSP nonces, input validation, auth checks, Supabase SSR patterns. Use when implementing authentication, forms, security features, or when user mentions security/validation/auth.
| name | Writing Skills |
| description | TDD for process documentation - test with subagents before writing, iterate until bulletproof |
| version | 1.0.0 |
Writing skills IS Test-Driven Development applied to process documentation.
Skills are stored in .gemini/skills/ (project-local) or ~/.gemini/skills/ (user-global). You edit skills directly in the project's codebase.
You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes).
Core principle: If you didn't watch an agent fail without the skill, you don't know if the skill teaches the right thing.
See skills/testing/test-driven-development for the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.
A skill is a reference guide for proven techniques, patterns, or tools. Skills help future Agent instances find and apply effective approaches.
Skills are: Reusable techniques, patterns, tools, reference guides
Skills are NOT: Narratives about how you solved a problem once
Create when:
Don't create for:
GEMINI.md)Situations:
| TDD Concept | Skill Creation |
|---|---|
| Test case | Pressure scenario with subagent |
| Production code | Skill document (SKILL.md) |
| Test fails (RED) | Agent violates rule without skill (baseline) |
| Test passes (GREEN) | Agent complies with skill present |
| Refactor | Close loopholes while maintaining compliance |
| Write test first | Run baseline scenario BEFORE writing skill |
| Watch it fail | Document exact rationalizations agent uses |
| Minimal code | Write skill addressing those specific violations |
| Watch it pass | Verify agent now complies |
| Refactor cycle | Find new rationalizations → plug → re-verify |
The entire skill creation process follows RED-GREEN-REFACTOR.
Concrete method with steps to follow (condition-based-waiting, root-cause-tracing)
Way of thinking about problems (flatten-with-flags, test-invariants)
API docs, syntax guides, tool documentation
All skills are stored in .gemini/skills/:
.gemini/skills/
skill-name/
SKILL.md # Main reference (required)
supporting-file.* # Only if needed
Flat namespace - all skills in one searchable location
Separate files for:
Keep inline:
---
name: Human-Readable Name
description: One-line summary of what this does (ASO-critical)
version: 1.0.0
---
# Skill Name
## Overview
What is this? Core principle in 1-2 sentences.
## When to Use
[Small inline flowchart IF decision non-obvious]
Bullet list with SYMPTOMS and use cases
When NOT to use
## Core Pattern (for techniques/patterns)
Before/after code comparison
## Quick Reference
Table or bullets for scanning common operations
## Implementation
Inline code for simple patterns
Link to file for heavy reference or reusable tools
## Common Mistakes
What goes wrong + fixes
## Real-World Impact (optional)
Concrete results
Critical for discovery: Future Agents need to FIND your skill.
Include SYMPTOMS and key keywords in the description field, as this is the primary discovery mechanism:
# ❌ BAD: Too abstract
description: For async testing
# ✅ GOOD: Symptoms and context
description: Fix flaky async tests using condition-based waiting. Handles timeouts, race conditions, and CI failures.
Use words an Agent would search for:
Use active voice, verb-first:
creating-skills not skill-creationtesting-skills-with-subagents not subagent-skill-testingProblem: Skills are loaded into the Agent's context. Every token counts.
Target word counts:
Techniques:
Move details to tool help:
# ✅ GOOD: Reference --help
npm run test -- --help
Use cross-references:
# ✅ GOOD: Reference other skill
Always use subagents. See `skills/getting-started` for workflow.
Eliminate redundancy:
Name by what you DO or core insight:
condition-based-waiting > async-test-helpersusing-skills not skill-usageflatten-with-flags > data-structure-refactoringroot-cause-tracing > debugging-techniquesGerunds (-ing) work well for processes:
creating-skills, testing-skills, debugging-with-logsMention key concepts in the description, overview, and section headers to increase Grep hits.
Use path format relative to the skills root:
skills/testing/test-driven-developmentdigraph when_flowchart {
"Need to show information?" [shape=diamond];
"Decision where I might go wrong?" [shape=diamond];
"Use markdown" [shape=box];
"Small inline flowchart" [shape=box];
"Need to show information?" -> "Decision where I might go wrong?" [label="yes"];
"Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"];
"Decision where I might go wrong?" -> "Use markdown" [label="no"];
}
Use flowcharts ONLY for:
See docs/ui-patterns/graphviz-conventions.dot for graphviz style rules.
One excellent example beats many mediocre ones.
Good example:
NO SKILL WITHOUT A FAILING TEST FIRST
This applies to NEW skills AND EDITS to existing skills.
Write skill before testing? Delete it. Start over. Edit skill without testing? Same violation.
No exceptions:
See skills/testing/test-driven-development for why this matters.
Test with: Pressure scenarios (time + sunk cost + exhaustion). Identify rationalizations and add counters.
Test with: Application scenarios. Can the Agent apply the technique to new scenarios?
Test with: Recognition scenarios. Does the Agent know when pattern applies?
Test with: Retrieval scenarios. Can the Agent find and use the right info?
| Excuse | Reality |
|---|---|
| "Skill is obviously clear" | Clear to you ≠ clear to other agents. Test it. |
| "Testing is overkill" | Untested skills have issues. Always. |
| "I'm confident it's good" | Overconfidence guarantees issues. Test anyway. |
Forbid specific workarounds:
Write code before test? Delete it. Start over.
**No exceptions:** Don't keep it as "reference". Delete means delete.
Capture excuses from baseline testing and provide counters.
## Red Flags - STOP and Start Over
- Code before test
- "I already manually tested it"
- "It's about spirit not ritual"
Run scenario with subagent WITHOUT the skill. Document baseline behavior and rationalizations verbatim.
Write skill addressing those specific failures. Verify Agent now complies.
Add explicit counters for any new rationalizations found during testing.
After writing ANY skill, you MUST STOP and complete the verification process.
Do NOT:
How future Agents find your skill:
.gemini/skills/ descriptions)Creating skills IS TDD for process documentation.
Same Iron Law: No skill without failing test first. Same cycle: RED (baseline) → GREEN (write skill) → REFACTOR (close loopholes). Same benefits: Better quality, fewer surprises, bulletproof results.