claude-code-kit 0.7.0__py3-none-any.whl
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.
- claude_code_kit-0.7.0.dist-info/METADATA +384 -0
- claude_code_kit-0.7.0.dist-info/RECORD +209 -0
- claude_code_kit-0.7.0.dist-info/WHEEL +4 -0
- claude_code_kit-0.7.0.dist-info/entry_points.txt +4 -0
- claude_code_kit-0.7.0.dist-info/licenses/LICENSE +21 -0
- claude_kit/__init__.py +10 -0
- claude_kit/__main__.py +8 -0
- claude_kit/_payload/agents/acceptance-reviewer.md +60 -0
- claude_kit/_payload/agents/auditor.md +76 -0
- claude_kit/_payload/agents/dependency-scanner.md +84 -0
- claude_kit/_payload/agents/developer.md +187 -0
- claude_kit/_payload/agents/devils-advocate.md +62 -0
- claude_kit/_payload/agents/devops-engineer.md +134 -0
- claude_kit/_payload/agents/e2e-tester.md +152 -0
- claude_kit/_payload/agents/em-reviewer.md +105 -0
- claude_kit/_payload/agents/incident-responder.md +64 -0
- claude_kit/_payload/agents/merge-reviewer.md +194 -0
- claude_kit/_payload/agents/observability-engineer.md +94 -0
- claude_kit/_payload/agents/orchestrator.md +551 -0
- claude_kit/_payload/agents/owasp-reviewer.md +76 -0
- claude_kit/_payload/agents/policy-validator.md +63 -0
- claude_kit/_payload/agents/pr-raiser.md +138 -0
- claude_kit/_payload/agents/risk-classifier.md +50 -0
- claude_kit/_payload/agents/sdlc-code-reviewer.md +196 -0
- claude_kit/_payload/agents/secret-scanner.md +70 -0
- claude_kit/_payload/agents/security-reviewer.md +80 -0
- claude_kit/_payload/agents/senior-backend-dev.md +199 -0
- claude_kit/_payload/agents/senior-frontend-dev.md +181 -0
- claude_kit/_payload/agents/senior-tester.md +206 -0
- claude_kit/_payload/agents/spec-doc-writer.md +331 -0
- claude_kit/_payload/agents/story-planner.md +56 -0
- claude_kit/_payload/agents/technical-architect.md +139 -0
- claude_kit/_payload/agents/tester.md +193 -0
- claude_kit/_payload/agents/ui-designer.md +73 -0
- claude_kit/_payload/agents/unit-tester.md +119 -0
- claude_kit/_payload/catalog/mcp.yaml +54 -0
- claude_kit/_payload/catalog/org.yaml +145 -0
- claude_kit/_payload/catalog/profiles.yaml +96 -0
- claude_kit/_payload/catalog/stacks.yaml +96 -0
- claude_kit/_payload/commands/init.md +36 -0
- claude_kit/_payload/commands/sdlc.md +18 -0
- claude_kit/_payload/commands/status.md +20 -0
- claude_kit/_payload/hooks/hooks.json +58 -0
- claude_kit/_payload/hooks/scripts/audit-log.sh +18 -0
- claude_kit/_payload/hooks/scripts/guard-secrets.sh +26 -0
- claude_kit/_payload/hooks/scripts/lint-fix.sh +38 -0
- claude_kit/_payload/hooks/scripts/load-continuity.sh +32 -0
- claude_kit/_payload/hooks/scripts/load-learnings.sh +40 -0
- claude_kit/_payload/hooks/scripts/type-check.sh +23 -0
- claude_kit/_payload/hooks/scripts/validate-frontmatter.sh +34 -0
- claude_kit/_payload/hooks/scripts/validate-settings.sh +21 -0
- claude_kit/_payload/hooks/scripts/warn-large-edits.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-missing-tests.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-sensitive-files.sh +30 -0
- claude_kit/_payload/hooks/scripts/warn-shared-modules.sh +33 -0
- claude_kit/_payload/rules/agent-guardrails.md +83 -0
- claude_kit/_payload/rules/agent-memory.md +106 -0
- claude_kit/_payload/rules/agent-resilience.md +61 -0
- claude_kit/_payload/rules/autonomy-levels.md +30 -0
- claude_kit/_payload/rules/code-organization.md +312 -0
- claude_kit/_payload/rules/continuity.md +84 -0
- claude_kit/_payload/rules/design-patterns.md +422 -0
- claude_kit/_payload/rules/devops-observability.md +57 -0
- claude_kit/_payload/rules/documentation.md +326 -0
- claude_kit/_payload/rules/evals.md +62 -0
- claude_kit/_payload/rules/frontend-best-practices.md +157 -0
- claude_kit/_payload/rules/goal-setting-and-monitoring.md +72 -0
- claude_kit/_payload/rules/human-in-the-loop.md +64 -0
- claude_kit/_payload/rules/linting-and-formatting.md +220 -0
- claude_kit/_payload/rules/mandatory-workflow.md +309 -0
- claude_kit/_payload/rules/model-tiers.md +34 -0
- claude_kit/_payload/rules/quality-gates.md +107 -0
- claude_kit/_payload/rules/rarv-cycle.md +31 -0
- claude_kit/_payload/rules/reasoning-techniques.md +62 -0
- claude_kit/_payload/rules/responsive-and-accessibility.md +353 -0
- claude_kit/_payload/rules/risk-classification.md +36 -0
- claude_kit/_payload/rules/testing.md +417 -0
- claude_kit/_payload/rules/tool-design.md +66 -0
- claude_kit/_payload/skills/_references/accessibility-checklist.md +160 -0
- claude_kit/_payload/skills/_references/orchestration-patterns.md +405 -0
- claude_kit/_payload/skills/_references/performance-checklist.md +153 -0
- claude_kit/_payload/skills/_references/security-checklist.md +134 -0
- claude_kit/_payload/skills/_references/testing-patterns.md +236 -0
- claude_kit/_payload/skills/accessibility-review/SKILL.md +56 -0
- claude_kit/_payload/skills/api-and-interface-design/SKILL.md +294 -0
- claude_kit/_payload/skills/api-integration/SKILL.md +348 -0
- claude_kit/_payload/skills/archive-sprint/SKILL.md +31 -0
- claude_kit/_payload/skills/backlog/SKILL.md +41 -0
- claude_kit/_payload/skills/backlog/item-template.md +20 -0
- claude_kit/_payload/skills/browser-testing-with-devtools/SKILL.md +302 -0
- claude_kit/_payload/skills/ci-cd-and-automation/SKILL.md +402 -0
- claude_kit/_payload/skills/code-review-and-quality/SKILL.md +347 -0
- claude_kit/_payload/skills/code-simplification/SKILL.md +331 -0
- claude_kit/_payload/skills/component-design/SKILL.md +171 -0
- claude_kit/_payload/skills/consolidate-learnings/SKILL.md +55 -0
- claude_kit/_payload/skills/context-engineering/SKILL.md +321 -0
- claude_kit/_payload/skills/debugging-and-error-recovery/SKILL.md +300 -0
- claude_kit/_payload/skills/decision/SKILL.md +46 -0
- claude_kit/_payload/skills/decision/adr-template.md +36 -0
- claude_kit/_payload/skills/deprecation-and-migration/SKILL.md +207 -0
- claude_kit/_payload/skills/documentation-and-adrs/SKILL.md +299 -0
- claude_kit/_payload/skills/doubt-driven-development/SKILL.md +243 -0
- claude_kit/_payload/skills/execute/SKILL.md +27 -0
- claude_kit/_payload/skills/frontend-ui-engineering/SKILL.md +328 -0
- claude_kit/_payload/skills/git-workflow-and-versioning/SKILL.md +300 -0
- claude_kit/_payload/skills/idea-refine/SKILL.md +178 -0
- claude_kit/_payload/skills/idea-refine/examples.md +238 -0
- claude_kit/_payload/skills/idea-refine/frameworks.md +99 -0
- claude_kit/_payload/skills/idea-refine/refinement-criteria.md +113 -0
- claude_kit/_payload/skills/idea-refine/scripts/idea-refine.sh +15 -0
- claude_kit/_payload/skills/incident-postmortem/SKILL.md +74 -0
- claude_kit/_payload/skills/incremental-implementation/SKILL.md +245 -0
- claude_kit/_payload/skills/interview-me/SKILL.md +221 -0
- claude_kit/_payload/skills/load-testing/SKILL.md +83 -0
- claude_kit/_payload/skills/manual-test/SKILL.md +516 -0
- claude_kit/_payload/skills/performance-optimization/SKILL.md +277 -0
- claude_kit/_payload/skills/planning-and-task-breakdown/SKILL.md +223 -0
- claude_kit/_payload/skills/playwright-verification/SKILL.md +205 -0
- claude_kit/_payload/skills/refresh-docs/SKILL.md +63 -0
- claude_kit/_payload/skills/remember/SKILL.md +96 -0
- claude_kit/_payload/skills/scope/SKILL.md +52 -0
- claude_kit/_payload/skills/scope/scope-template.md +82 -0
- claude_kit/_payload/skills/sdlc/SKILL.md +83 -0
- claude_kit/_payload/skills/security-and-hardening/SKILL.md +368 -0
- claude_kit/_payload/skills/security-verification/SKILL.md +209 -0
- claude_kit/_payload/skills/shipping-and-launch/SKILL.md +309 -0
- claude_kit/_payload/skills/smoke-test/SKILL.md +78 -0
- claude_kit/_payload/skills/source-driven-development/SKILL.md +195 -0
- claude_kit/_payload/skills/spec-driven-development/SKILL.md +200 -0
- claude_kit/_payload/skills/sprint/SKILL.md +67 -0
- claude_kit/_payload/skills/sprint/sprint-template.md +90 -0
- claude_kit/_payload/skills/test-driven-development/SKILL.md +383 -0
- claude_kit/_payload/skills/threat-model/SKILL.md +60 -0
- claude_kit/_payload/skills/triage/SKILL.md +87 -0
- claude_kit/_payload/skills/ui-ux-design/SKILL.md +71 -0
- claude_kit/_payload/skills/unit-test/SKILL.md +237 -0
- claude_kit/_payload/skills/using-agent-skills/SKILL.md +180 -0
- claude_kit/_payload/templates/CLAUDE.md +238 -0
- claude_kit/_payload/templates/CLAUDE.stack.md.tmpl +53 -0
- claude_kit/_payload/templates/CONTINUITY.template.md +35 -0
- claude_kit/_payload/templates/README.claude-sdlc.md.tmpl +219 -0
- claude_kit/_payload/templates/agent-memory/MEMORY.md +30 -0
- claude_kit/_payload/templates/agent-memory/api/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/architecture/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/debugging/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/gotchas/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/patterns/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/performance/.gitkeep +0 -0
- claude_kit/_payload/templates/artifacts/adr.md +18 -0
- claude_kit/_payload/templates/artifacts/feature-spec.md +29 -0
- claude_kit/_payload/templates/artifacts/release-plan.md +23 -0
- claude_kit/_payload/templates/artifacts/runbook.md +24 -0
- claude_kit/_payload/templates/artifacts/security-review.md +23 -0
- claude_kit/_payload/templates/artifacts/test-plan.md +22 -0
- claude_kit/_payload/templates/org/README.md +53 -0
- claude_kit/_payload/templates/org/agents/data-workflow-agent.md +59 -0
- claude_kit/_payload/templates/org/agents/founder-prototype-agent.md +61 -0
- claude_kit/_payload/templates/org/agents/internal-tools-builder.md +63 -0
- claude_kit/_payload/templates/org/agents/pm-copilot.md +60 -0
- claude_kit/_payload/templates/org/agents/support-ticket-engineer.md +63 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/README.md +46 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/pack.yaml +32 -0
- claude_kit/_payload/templates/org/packs/engineering-core/README.md +46 -0
- claude_kit/_payload/templates/org/packs/engineering-core/pack.yaml +44 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/README.md +53 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/pack.yaml +39 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/README.md +49 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/pack.yaml +26 -0
- claude_kit/_payload/templates/org/packs/product-to-code/README.md +50 -0
- claude_kit/_payload/templates/org/packs/product-to-code/pack.yaml +34 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/README.md +53 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/pack.yaml +40 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/README.md +50 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/pack.yaml +36 -0
- claude_kit/_payload/templates/org/rules/ai-working-agreement.md +45 -0
- claude_kit/_payload/templates/org/rules/ambiguity-resolution.md +36 -0
- claude_kit/_payload/templates/org/rules/branch-and-pr-policy.md +41 -0
- claude_kit/_payload/templates/org/rules/compliance-policy.md +50 -0
- claude_kit/_payload/templates/org/rules/non-engineer-safe-coding.md +37 -0
- claude_kit/_payload/templates/org/rules/pii-policy.md +46 -0
- claude_kit/_payload/templates/org/rules/production-data-policy.md +35 -0
- claude_kit/_payload/templates/org/rules/prompt-to-task-conversion.md +30 -0
- claude_kit/_payload/templates/org/rules/prototype-boundaries.md +40 -0
- claude_kit/_payload/templates/org/rules/secrets-policy.md +34 -0
- claude_kit/_payload/templates/org/skills/customer-issue-to-fix/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/feature-from-idea/SKILL.md +56 -0
- claude_kit/_payload/templates/org/skills/prompt-to-safe-task/SKILL.md +59 -0
- claude_kit/_payload/templates/org/skills/prototype-to-production/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/repo-onboarding/SKILL.md +60 -0
- claude_kit/_payload/templates/settings.json +53 -0
- claude_kit/_payload/templates/stacks/backend/python/fastapi/rules/fastapi-patterns.md +64 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/migration-specialist.md +61 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/mongodb-specialist.md +59 -0
- claude_kit/_payload/templates/stacks/db/mongodb/rules/mongodb-patterns.md +39 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/db-performance-reviewer.md +66 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/migration-specialist.md +56 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/postgres-specialist.md +58 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/database-performance.md +64 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/postgres-patterns.md +43 -0
- claude_kit/_payload/templates/stacks/frontend/react/rules/react-patterns.md +63 -0
- claude_kit/catalog.py +476 -0
- claude_kit/cli.py +327 -0
- claude_kit/hooks.py +246 -0
- claude_kit/models.py +205 -0
- claude_kit/prompts.py +209 -0
- claude_kit/render.py +146 -0
- claude_kit/scaffold.py +492 -0
- claude_kit/upgrader.py +294 -0
- claude_kit/validator.py +197 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unit-test
|
|
3
|
+
description: Write unit tests for frontend components and hooks. Follows testing best practices focusing on user behavior over implementation details. Adapts to the project's test runner and component framework.
|
|
4
|
+
argument-hint: [component or hook name]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Write unit tests for: $ARGUMENTS.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Read the target code**: Read the component or hook file for `$ARGUMENTS` to understand its props, behavior, state, and edge cases.
|
|
13
|
+
|
|
14
|
+
2. **Identify what to test**:
|
|
15
|
+
|
|
16
|
+
### Always Test
|
|
17
|
+
- Component renders without crashing (smoke test)
|
|
18
|
+
- Props produce expected visible output
|
|
19
|
+
- User interactions trigger expected behavior (click, type, submit)
|
|
20
|
+
- Conditional rendering: loading state, empty state, error state, data state
|
|
21
|
+
- Accessibility: correct roles, labels, ARIA attributes
|
|
22
|
+
|
|
23
|
+
### Never Test
|
|
24
|
+
- Implementation details (internal state values, private functions)
|
|
25
|
+
- Third-party library behavior (UI libraries, chart libraries, state management internals)
|
|
26
|
+
- Exact CSS classes or styling utilities
|
|
27
|
+
- Mock data structure (the type checker handles this)
|
|
28
|
+
- Snapshot tests (fragile, noisy diffs)
|
|
29
|
+
|
|
30
|
+
3. **Write the test file**: Create the test file following the project's test file naming convention (e.g., `<ComponentName>.test.tsx`, `<ComponentName>.spec.tsx`, or `__tests__/<ComponentName>.test.tsx`).
|
|
31
|
+
|
|
32
|
+
### Test File Template (Component Testing Library Pattern)
|
|
33
|
+
```typescript
|
|
34
|
+
import { render, screen } from '@testing-library/react';
|
|
35
|
+
import userEvent from '@testing-library/user-event';
|
|
36
|
+
import { describe, it, expect, vi } from 'vitest'; // or jest
|
|
37
|
+
import { ComponentName } from './ComponentName';
|
|
38
|
+
|
|
39
|
+
// Wrap in providers if needed (router, state management, etc.)
|
|
40
|
+
function renderComponent(props: Partial<ComponentNameProps> = {}) {
|
|
41
|
+
const defaultProps: ComponentNameProps = {
|
|
42
|
+
// sensible defaults
|
|
43
|
+
};
|
|
44
|
+
return render(<ComponentName {...defaultProps} {...props} />);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe('ComponentName', () => {
|
|
48
|
+
it('renders with default props', () => {
|
|
49
|
+
renderComponent();
|
|
50
|
+
expect(screen.getByRole('...')).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('displays the provided title', () => {
|
|
54
|
+
renderComponent({ title: 'Test Title' });
|
|
55
|
+
expect(screen.getByText('Test Title')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('calls onClick when button is clicked', async () => {
|
|
59
|
+
const user = userEvent.setup();
|
|
60
|
+
const handleClick = vi.fn();
|
|
61
|
+
renderComponent({ onClick: handleClick });
|
|
62
|
+
|
|
63
|
+
await user.click(screen.getByRole('button', { name: /action/i }));
|
|
64
|
+
expect(handleClick).toHaveBeenCalledOnce();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('shows empty state when no data', () => {
|
|
68
|
+
renderComponent({ data: [] });
|
|
69
|
+
expect(screen.getByText(/no.*found/i)).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('shows loading spinner when loading', () => {
|
|
73
|
+
renderComponent({ isLoading: true });
|
|
74
|
+
expect(screen.getByRole('status')).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4. **Follow query priority** (from Testing Library best practices):
|
|
80
|
+
|
|
81
|
+
| Priority | Method | When to Use |
|
|
82
|
+
|----------|--------|-------------|
|
|
83
|
+
| 1 | `getByRole` | Accessible elements (buttons, headings, links) |
|
|
84
|
+
| 2 | `getByLabelText` | Form inputs |
|
|
85
|
+
| 3 | `getByText` | Non-interactive text content |
|
|
86
|
+
| 4 | `getByDisplayValue` | Current input values |
|
|
87
|
+
| 5 | `getByTestId` | Last resort — add `data-testid` to element |
|
|
88
|
+
|
|
89
|
+
5. **Handle providers and wrappers**:
|
|
90
|
+
|
|
91
|
+
### Router Context (React Router example)
|
|
92
|
+
```typescript
|
|
93
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
94
|
+
|
|
95
|
+
function renderWithRouter(ui: React.ReactElement, { route = '/' } = {}) {
|
|
96
|
+
return render(
|
|
97
|
+
<MemoryRouter initialEntries={[route]}>{ui}</MemoryRouter>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### State Store Mocking (example for a state management library)
|
|
103
|
+
```typescript
|
|
104
|
+
import { useAppStore } from '@/hooks/useAppStore';
|
|
105
|
+
|
|
106
|
+
vi.mock('@/hooks/useAppStore');
|
|
107
|
+
|
|
108
|
+
beforeEach(() => {
|
|
109
|
+
vi.mocked(useAppStore).mockImplementation((selector) =>
|
|
110
|
+
selector({
|
|
111
|
+
currentUser: { id: '1', name: 'Test User' },
|
|
112
|
+
// ... other store values
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
6. **Test async behavior**:
|
|
119
|
+
```typescript
|
|
120
|
+
it('loads and displays data', async () => {
|
|
121
|
+
renderComponent();
|
|
122
|
+
// Wait for async content
|
|
123
|
+
expect(await screen.findByText('Expected Content')).toBeInTheDocument();
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
7. **Test accessibility**:
|
|
128
|
+
```typescript
|
|
129
|
+
it('has accessible button labels', () => {
|
|
130
|
+
renderComponent();
|
|
131
|
+
expect(screen.getByRole('button', { name: 'Close dialog' })).toBeInTheDocument();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('supports keyboard navigation', async () => {
|
|
135
|
+
const user = userEvent.setup();
|
|
136
|
+
renderComponent();
|
|
137
|
+
await user.tab();
|
|
138
|
+
expect(screen.getByRole('button')).toHaveFocus();
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
8. **Run tests**: Execute the project's test command (check `package.json` scripts or the project's test runner docs).
|
|
143
|
+
|
|
144
|
+
## Test Organization
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
src/
|
|
148
|
+
components/
|
|
149
|
+
ui/
|
|
150
|
+
Button.tsx
|
|
151
|
+
Button.test.tsx # Co-located test
|
|
152
|
+
FeatureCard.tsx
|
|
153
|
+
FeatureCard.test.tsx # Co-located test
|
|
154
|
+
hooks/
|
|
155
|
+
useAppStore.ts
|
|
156
|
+
useAppStore.test.ts # Hook tests
|
|
157
|
+
pages/
|
|
158
|
+
DashboardPage.tsx
|
|
159
|
+
DashboardPage.test.tsx # Page-level tests (lighter, focused on integration)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Conventions
|
|
163
|
+
|
|
164
|
+
### Naming
|
|
165
|
+
- Test files: Follow project convention (e.g., `<Component>.test.tsx`, `<Component>.spec.tsx`, or `<hook>.test.ts`)
|
|
166
|
+
- Describe blocks: component/hook name
|
|
167
|
+
- Test names: describe behavior in plain English — `it('shows error message when form is invalid')`
|
|
168
|
+
|
|
169
|
+
### Assertions
|
|
170
|
+
- Prefer `toBeInTheDocument()` over `toBeTruthy()`
|
|
171
|
+
- Prefer `toHaveTextContent()` over checking `.textContent`
|
|
172
|
+
- Use `toHaveAttribute()` for ARIA and HTML attributes
|
|
173
|
+
- Use `not.toBeInTheDocument()` to assert absence (with `queryBy*`)
|
|
174
|
+
|
|
175
|
+
### Mocking
|
|
176
|
+
- Mock external dependencies, not internal logic
|
|
177
|
+
- Use the test runner's mock function (e.g., `vi.fn()`, `jest.fn()`) for callback props
|
|
178
|
+
- Use module-level mocks for state stores and API calls
|
|
179
|
+
- Reset mocks in `beforeEach` or use the test runner's clear/reset utilities
|
|
180
|
+
|
|
181
|
+
### Coverage Targets
|
|
182
|
+
| Metric | Target |
|
|
183
|
+
|--------|--------|
|
|
184
|
+
| Statements | 70% |
|
|
185
|
+
| Branches | 65% |
|
|
186
|
+
| Functions | 70% |
|
|
187
|
+
| Lines | 70% |
|
|
188
|
+
|
|
189
|
+
Focus coverage on business logic and user-facing behavior, not boilerplate.
|
|
190
|
+
|
|
191
|
+
## Setup Requirements
|
|
192
|
+
|
|
193
|
+
The project's test runner and assertion library should be configured. Common stacks:
|
|
194
|
+
|
|
195
|
+
### Example: Vitest + React Testing Library
|
|
196
|
+
```bash
|
|
197
|
+
# Install test dependencies (if not already installed)
|
|
198
|
+
npm install -D vitest @testing-library/react @testing-library/jest-dom @testing-library/user-event jsdom @vitest/coverage-v8
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Example: Jest + React Testing Library
|
|
202
|
+
```bash
|
|
203
|
+
npm install -D jest @testing-library/react @testing-library/jest-dom @testing-library/user-event jest-environment-jsdom
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Test Runner Config (Vitest example)
|
|
207
|
+
```typescript
|
|
208
|
+
// vitest.config.ts
|
|
209
|
+
import { defineConfig } from 'vitest/config';
|
|
210
|
+
import react from '@vitejs/plugin-react';
|
|
211
|
+
import path from 'path';
|
|
212
|
+
|
|
213
|
+
export default defineConfig({
|
|
214
|
+
plugins: [react()],
|
|
215
|
+
test: {
|
|
216
|
+
environment: 'jsdom',
|
|
217
|
+
globals: true,
|
|
218
|
+
setupFiles: './src/test/setup.ts',
|
|
219
|
+
include: ['src/**/*.test.{ts,tsx}'],
|
|
220
|
+
coverage: {
|
|
221
|
+
provider: 'v8',
|
|
222
|
+
reporter: ['text', 'html'],
|
|
223
|
+
include: ['src/**/*.{ts,tsx}'],
|
|
224
|
+
exclude: ['src/**/*.test.*', 'src/data/**', 'src/test/**'],
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
resolve: {
|
|
228
|
+
alias: { '@': path.resolve(__dirname, './src') },
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Test Setup File (Testing Library example)
|
|
234
|
+
```typescript
|
|
235
|
+
// src/test/setup.ts
|
|
236
|
+
import '@testing-library/jest-dom/vitest'; // or '@testing-library/jest-dom' for Jest
|
|
237
|
+
```
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-agent-skills
|
|
3
|
+
description: Discovers and invokes agent skills. Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Agent Skills
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Agent Skills is a collection of engineering workflow skills organized by development phase. Each skill encodes a specific process that senior engineers follow. This meta-skill helps you discover and apply the right skill for your current task.
|
|
11
|
+
|
|
12
|
+
## Skill Discovery
|
|
13
|
+
|
|
14
|
+
When a task arrives, identify the development phase and apply the corresponding skill:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Task arrives
|
|
18
|
+
│
|
|
19
|
+
├── Don't know what you want yet? ──────→ interview-me
|
|
20
|
+
├── Have a rough concept, need variants? → idea-refine
|
|
21
|
+
├── New project/feature/change? ──→ spec-driven-development
|
|
22
|
+
├── Have a spec, need tasks? ──────→ planning-and-task-breakdown
|
|
23
|
+
├── Implementing code? ────────────→ incremental-implementation
|
|
24
|
+
│ ├── UI work? ─────────────────→ frontend-ui-engineering
|
|
25
|
+
│ ├── API work? ────────────────→ api-and-interface-design
|
|
26
|
+
│ ├── Need better context? ─────→ context-engineering
|
|
27
|
+
│ ├── Need doc-verified code? ───→ source-driven-development
|
|
28
|
+
│ └── Stakes high / unfamiliar code? ──→ doubt-driven-development
|
|
29
|
+
├── Writing/running tests? ────────→ test-driven-development
|
|
30
|
+
│ └── Browser-based? ───────────→ browser-testing-with-devtools
|
|
31
|
+
├── Something broke? ──────────────→ debugging-and-error-recovery
|
|
32
|
+
├── Reviewing code? ───────────────→ code-review-and-quality
|
|
33
|
+
│ ├── Security concerns? ───────→ security-and-hardening
|
|
34
|
+
│ └── Performance concerns? ────→ performance-optimization
|
|
35
|
+
├── Committing/branching? ─────────→ git-workflow-and-versioning
|
|
36
|
+
├── CI/CD pipeline work? ──────────→ ci-cd-and-automation
|
|
37
|
+
├── Writing docs/ADRs? ───────────→ documentation-and-adrs
|
|
38
|
+
└── Deploying/launching? ─────────→ shipping-and-launch
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Core Operating Behaviors
|
|
42
|
+
|
|
43
|
+
These behaviors apply at all times, across all skills. They are non-negotiable.
|
|
44
|
+
|
|
45
|
+
### 1. Surface Assumptions
|
|
46
|
+
|
|
47
|
+
Before implementing anything non-trivial, explicitly state your assumptions:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
ASSUMPTIONS I'M MAKING:
|
|
51
|
+
1. [assumption about requirements]
|
|
52
|
+
2. [assumption about architecture]
|
|
53
|
+
3. [assumption about scope]
|
|
54
|
+
→ Correct me now or I'll proceed with these.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Don't silently fill in ambiguous requirements. The most common failure mode is making wrong assumptions and running with them unchecked. Surface uncertainty early — it's cheaper than rework.
|
|
58
|
+
|
|
59
|
+
### 2. Manage Confusion Actively
|
|
60
|
+
|
|
61
|
+
When you encounter inconsistencies, conflicting requirements, or unclear specifications:
|
|
62
|
+
|
|
63
|
+
1. **STOP.** Do not proceed with a guess.
|
|
64
|
+
2. Name the specific confusion.
|
|
65
|
+
3. Present the tradeoff or ask the clarifying question.
|
|
66
|
+
4. Wait for resolution before continuing.
|
|
67
|
+
|
|
68
|
+
**Bad:** Silently picking one interpretation and hoping it's right.
|
|
69
|
+
**Good:** "I see X in the spec but Y in the existing code. Which takes precedence?"
|
|
70
|
+
|
|
71
|
+
### 3. Push Back When Warranted
|
|
72
|
+
|
|
73
|
+
You are not a yes-machine. When an approach has clear problems:
|
|
74
|
+
|
|
75
|
+
- Point out the issue directly
|
|
76
|
+
- Explain the concrete downside (quantify when possible — "this adds ~200ms latency" not "this might be slower")
|
|
77
|
+
- Propose an alternative
|
|
78
|
+
- Accept the human's decision if they override with full information
|
|
79
|
+
|
|
80
|
+
Sycophancy is a failure mode. "Of course!" followed by implementing a bad idea helps no one. Honest technical disagreement is more valuable than false agreement.
|
|
81
|
+
|
|
82
|
+
### 4. Enforce Simplicity
|
|
83
|
+
|
|
84
|
+
Your natural tendency is to overcomplicate. Actively resist it.
|
|
85
|
+
|
|
86
|
+
Before finishing any implementation, ask:
|
|
87
|
+
- Can this be done in fewer lines?
|
|
88
|
+
- Are these abstractions earning their complexity?
|
|
89
|
+
- Would a staff engineer look at this and say "why didn't you just..."?
|
|
90
|
+
|
|
91
|
+
If you build 1000 lines and 100 would suffice, you have failed. Prefer the boring, obvious solution. Cleverness is expensive.
|
|
92
|
+
|
|
93
|
+
### 5. Maintain Scope Discipline
|
|
94
|
+
|
|
95
|
+
Touch only what you're asked to touch.
|
|
96
|
+
|
|
97
|
+
Do NOT:
|
|
98
|
+
- Remove comments you don't understand
|
|
99
|
+
- "Clean up" code orthogonal to the task
|
|
100
|
+
- Refactor adjacent systems as a side effect
|
|
101
|
+
- Delete code that seems unused without explicit approval
|
|
102
|
+
- Add features not in the spec because they "seem useful"
|
|
103
|
+
|
|
104
|
+
Your job is surgical precision, not unsolicited renovation.
|
|
105
|
+
|
|
106
|
+
### 6. Verify, Don't Assume
|
|
107
|
+
|
|
108
|
+
Every skill includes a verification step. A task is not complete until verification passes. "Seems right" is never sufficient — there must be evidence (passing tests, build output, runtime data).
|
|
109
|
+
|
|
110
|
+
## Failure Modes to Avoid
|
|
111
|
+
|
|
112
|
+
These are the subtle errors that look like productivity but create problems:
|
|
113
|
+
|
|
114
|
+
1. Making wrong assumptions without checking
|
|
115
|
+
2. Not managing your own confusion — plowing ahead when lost
|
|
116
|
+
3. Not surfacing inconsistencies you notice
|
|
117
|
+
4. Not presenting tradeoffs on non-obvious decisions
|
|
118
|
+
5. Being sycophantic ("Of course!") to approaches with clear problems
|
|
119
|
+
6. Overcomplicating code and APIs
|
|
120
|
+
7. Modifying code or comments orthogonal to the task
|
|
121
|
+
8. Removing things you don't fully understand
|
|
122
|
+
9. Building without a spec because "it's obvious"
|
|
123
|
+
10. Skipping verification because "it looks right"
|
|
124
|
+
|
|
125
|
+
## Skill Rules
|
|
126
|
+
|
|
127
|
+
1. **Check for an applicable skill before starting work.** Skills encode processes that prevent common mistakes.
|
|
128
|
+
|
|
129
|
+
2. **Skills are workflows, not suggestions.** Follow the steps in order. Don't skip verification steps.
|
|
130
|
+
|
|
131
|
+
3. **Multiple skills can apply.** A feature implementation might involve `idea-refine` → `spec-driven-development` → `planning-and-task-breakdown` → `incremental-implementation` → `test-driven-development` → `code-review-and-quality` → `shipping-and-launch` in sequence.
|
|
132
|
+
|
|
133
|
+
4. **When in doubt, start with a spec.** If the task is non-trivial and there's no spec, begin with `spec-driven-development`.
|
|
134
|
+
|
|
135
|
+
## Lifecycle Sequence
|
|
136
|
+
|
|
137
|
+
For a complete feature, the typical skill sequence is:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
1. interview-me → Extract what the user actually wants
|
|
141
|
+
2. idea-refine → Refine vague ideas
|
|
142
|
+
3. spec-driven-development → Define what we're building
|
|
143
|
+
4. planning-and-task-breakdown → Break into verifiable chunks
|
|
144
|
+
5. context-engineering → Load the right context
|
|
145
|
+
6. source-driven-development → Verify against official docs
|
|
146
|
+
7. incremental-implementation → Build slice by slice
|
|
147
|
+
8. doubt-driven-development → Cross-examine non-trivial decisions in-flight
|
|
148
|
+
9. test-driven-development → Prove each slice works
|
|
149
|
+
10. code-review-and-quality → Review before merge
|
|
150
|
+
11. git-workflow-and-versioning → Clean commit history
|
|
151
|
+
12. documentation-and-adrs → Document decisions
|
|
152
|
+
13. shipping-and-launch → Deploy safely
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Not every task needs every skill. A bug fix might only need: `debugging-and-error-recovery` → `test-driven-development` → `code-review-and-quality`.
|
|
156
|
+
|
|
157
|
+
## Quick Reference
|
|
158
|
+
|
|
159
|
+
| Phase | Skill | One-Line Summary |
|
|
160
|
+
|-------|-------|-----------------|
|
|
161
|
+
| Define | interview-me | Surface what the user actually wants before any plan, spec, or code exists |
|
|
162
|
+
| Define | idea-refine | Refine ideas through structured divergent and convergent thinking |
|
|
163
|
+
| Define | spec-driven-development | Requirements and acceptance criteria before code |
|
|
164
|
+
| Plan | planning-and-task-breakdown | Decompose into small, verifiable tasks |
|
|
165
|
+
| Build | incremental-implementation | Thin vertical slices, test each before expanding |
|
|
166
|
+
| Build | source-driven-development | Verify against official docs before implementing |
|
|
167
|
+
| Build | doubt-driven-development | Adversarial fresh-context review of every non-trivial decision |
|
|
168
|
+
| Build | context-engineering | Right context at the right time |
|
|
169
|
+
| Build | frontend-ui-engineering | Production-quality UI with accessibility |
|
|
170
|
+
| Build | api-and-interface-design | Stable interfaces with clear contracts |
|
|
171
|
+
| Verify | test-driven-development | Failing test first, then make it pass |
|
|
172
|
+
| Verify | browser-testing-with-devtools | Chrome DevTools MCP for runtime verification |
|
|
173
|
+
| Verify | debugging-and-error-recovery | Reproduce → localize → fix → guard |
|
|
174
|
+
| Review | code-review-and-quality | Five-axis review with quality gates |
|
|
175
|
+
| Review | security-and-hardening | OWASP prevention, input validation, least privilege |
|
|
176
|
+
| Review | performance-optimization | Measure first, optimize only what matters |
|
|
177
|
+
| Ship | git-workflow-and-versioning | Atomic commits, clean history |
|
|
178
|
+
| Ship | ci-cd-and-automation | Automated quality gates on every change |
|
|
179
|
+
| Ship | documentation-and-adrs | Document the why, not just the what |
|
|
180
|
+
| Ship | shipping-and-launch | Pre-launch checklist, monitoring, rollback plan |
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Engineering Delivery Rules
|
|
2
|
+
|
|
3
|
+
These rules are mandatory for all work in this repository. They define an autonomous,
|
|
4
|
+
agent-driven software development lifecycle (SDLC): every change moves through spec →
|
|
5
|
+
review → implementation → code review → testing → security → delivery, with quality
|
|
6
|
+
gates between phases.
|
|
7
|
+
|
|
8
|
+
> Installed by **claude-kit**. The full pipeline, agents, skills, and rule details live in
|
|
9
|
+
> `.claude/rules/`, `.claude/agents/`, and `.claude/skills/`. This file is the entry point.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Coding Behavior (applies to ALL implementation work)
|
|
14
|
+
|
|
15
|
+
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
|
16
|
+
|
|
17
|
+
### Think Before Coding
|
|
18
|
+
|
|
19
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
20
|
+
|
|
21
|
+
Before implementing:
|
|
22
|
+
- State your assumptions explicitly. If uncertain, ask.
|
|
23
|
+
- If multiple interpretations exist, present them — don't pick silently.
|
|
24
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
25
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
26
|
+
|
|
27
|
+
### Simplicity First
|
|
28
|
+
|
|
29
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
30
|
+
|
|
31
|
+
- No features beyond what was asked.
|
|
32
|
+
- No abstractions for single-use code.
|
|
33
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
34
|
+
- No error handling for impossible scenarios.
|
|
35
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
36
|
+
|
|
37
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
|
38
|
+
|
|
39
|
+
### Surgical Changes
|
|
40
|
+
|
|
41
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
42
|
+
|
|
43
|
+
When editing existing code:
|
|
44
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
45
|
+
- Don't refactor things that aren't broken.
|
|
46
|
+
- Match existing style, even if you'd do it differently.
|
|
47
|
+
- If you notice unrelated dead code, mention it — don't delete it.
|
|
48
|
+
|
|
49
|
+
When your changes create orphans:
|
|
50
|
+
- Remove imports/variables/functions that YOUR changes made unused.
|
|
51
|
+
- Don't remove pre-existing dead code unless asked.
|
|
52
|
+
|
|
53
|
+
The test: Every changed line should trace directly to the user's request.
|
|
54
|
+
|
|
55
|
+
### Goal-Driven Execution
|
|
56
|
+
|
|
57
|
+
**Define success criteria. Loop until verified.**
|
|
58
|
+
|
|
59
|
+
Transform tasks into verifiable goals:
|
|
60
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
61
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
62
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
63
|
+
|
|
64
|
+
For multi-step tasks, state a brief plan with a verification check per step.
|
|
65
|
+
|
|
66
|
+
Strong success criteria let you loop independently. Weak criteria ("make it work")
|
|
67
|
+
require constant clarification.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 1) Spec-first rule
|
|
72
|
+
Do not write implementation code until a written spec exists.
|
|
73
|
+
|
|
74
|
+
Before coding:
|
|
75
|
+
- identify whether a relevant spec already exists
|
|
76
|
+
- if not, draft one first
|
|
77
|
+
- if the task changes, update the spec before continuing
|
|
78
|
+
|
|
79
|
+
A task is not ready for implementation until the spec is explicit enough to review.
|
|
80
|
+
|
|
81
|
+
## 2) Review workflow before implementation
|
|
82
|
+
Before writing code, follow this workflow:
|
|
83
|
+
|
|
84
|
+
1. **Spec & Doc Writer** writes specification + developer documentation in a single pass
|
|
85
|
+
2. **UI Designer** (if UI work) — drafts and self-reviews the design spec
|
|
86
|
+
3. Spec is reviewed by the appropriate **Senior Developer** (per work stream)
|
|
87
|
+
4. Spec is reviewed by the **Technical Architect** — validates system design, scalability, integration
|
|
88
|
+
5. Spec is reviewed by the **Engineering Manager** — final strategic and completeness check
|
|
89
|
+
6. **Implementation** starts only after all reviews are complete
|
|
90
|
+
|
|
91
|
+
At any stage, reviewers may request corrections. If anything is missing, update the spec
|
|
92
|
+
and re-run the affected review.
|
|
93
|
+
|
|
94
|
+
### Parallel execution for multi-stream work
|
|
95
|
+
When a task spans two or more **independent work streams** (the canonical example is a
|
|
96
|
+
backend lane and a frontend lane, but it applies to any split — service A vs. service B,
|
|
97
|
+
API vs. client, data layer vs. UI):
|
|
98
|
+
|
|
99
|
+
- Each stream's review chain (Senior Developer → Technical Architect → EM) runs **in parallel**.
|
|
100
|
+
- After all review chains pass, a **Merge Reviewer** verifies cross-stream consistency
|
|
101
|
+
(shared contracts, data models, shared state).
|
|
102
|
+
- Implementation then runs **in parallel**, one stream per isolated worktree, each with
|
|
103
|
+
its own **Code Reviewer**.
|
|
104
|
+
- After all implementations pass code review and unit tests, the **Merge Reviewer** verifies
|
|
105
|
+
integration compatibility.
|
|
106
|
+
- Only then does integration testing proceed.
|
|
107
|
+
|
|
108
|
+
Independent work streams must never block each other. Merge-reviewer gates ensure
|
|
109
|
+
consistency at join points.
|
|
110
|
+
|
|
111
|
+
## 3) Design-first workflow for UI changes
|
|
112
|
+
For any frontend, UI, UX, or interaction change:
|
|
113
|
+
|
|
114
|
+
1. the **UI Designer** drafts a design spec (includes self-review against a quality checklist)
|
|
115
|
+
2. the design spec describes: screen states, interactions, component behavior,
|
|
116
|
+
empty/loading/error states, responsive behavior, accessibility
|
|
117
|
+
3. UI implementation begins only after the design spec is complete
|
|
118
|
+
|
|
119
|
+
Do not start UI implementation from a vague request when a design spec is required.
|
|
120
|
+
|
|
121
|
+
## 4) Required roles
|
|
122
|
+
Each role maps to a dedicated agent in `.claude/agents/`:
|
|
123
|
+
|
|
124
|
+
**Spec & Documentation:** Spec & Doc Writer · UI Designer
|
|
125
|
+
**Review chain (per work stream):** Senior Developer · Technical Architect · Engineering Manager
|
|
126
|
+
**Implementation & code review:** Developer · Code Reviewer
|
|
127
|
+
**Testing:** Tester · Senior Tester · Unit Tester · E2E Tester
|
|
128
|
+
**Security:** Security Reviewer + sub-scanners (Secret · Dependency · OWASP · Policy)
|
|
129
|
+
**Review rigor:** Devil's Advocate (anti-sycophancy, on a unanimous PASS)
|
|
130
|
+
**Integration:** Merge Reviewer
|
|
131
|
+
**Delivery & operability:** DevOps Engineer · Observability Engineer · PR Raiser
|
|
132
|
+
**Coordination:** Orchestrator (never writes code — only delegates and gates)
|
|
133
|
+
|
|
134
|
+
State which role is being simulated at each stage when it helps clarity.
|
|
135
|
+
|
|
136
|
+
## 5) Testing workflow
|
|
137
|
+
After implementation, testing runs in parallel lanes for multi-stream work:
|
|
138
|
+
|
|
139
|
+
- **Tester phase (parallel):** API/contract tester · UI tester · integration (end-to-end) tester
|
|
140
|
+
- **Senior Tester phase (parallel, after testers):** each independently verifies a tester's
|
|
141
|
+
coverage and findings
|
|
142
|
+
- **Test-coverage merge review:** the Merge Reviewer confirms every acceptance criterion is
|
|
143
|
+
covered across lanes, with no gaps and no contradictions
|
|
144
|
+
|
|
145
|
+
For single-stream or small features, a single Tester + single Senior Tester is sufficient.
|
|
146
|
+
Testing is not complete until senior verification AND the coverage merge review pass.
|
|
147
|
+
|
|
148
|
+
## 6) Defect loop
|
|
149
|
+
If any failure, defect, regression, or spec mismatch is found:
|
|
150
|
+
|
|
151
|
+
1. document the issue clearly and classify it by work stream
|
|
152
|
+
2. update the spec if expected behavior is unclear
|
|
153
|
+
3. re-run **only the affected stream(s)** through their chain
|
|
154
|
+
4. re-run the Merge Reviewer for cross-stream consistency
|
|
155
|
+
5. then re-run Tester → Senior Tester for the affected lanes only
|
|
156
|
+
|
|
157
|
+
Do not patch defects informally outside the process. Do not re-run unaffected lanes.
|
|
158
|
+
|
|
159
|
+
## 7) Output expectations
|
|
160
|
+
For each meaningful task, produce outputs in this order unless explicitly overridden:
|
|
161
|
+
|
|
162
|
+
1. feature spec + developer documentation
|
|
163
|
+
2. design spec (if UI work)
|
|
164
|
+
3. review notes (senior developer → technical architect → EM, per stream)
|
|
165
|
+
4. merge review (spec consistency) — multi-stream only
|
|
166
|
+
5. implementation / code changes
|
|
167
|
+
6. code review notes (per stream)
|
|
168
|
+
7. merge review (code integration) — multi-stream only
|
|
169
|
+
8. tester reports → senior tester verification → test-coverage merge review
|
|
170
|
+
9. security review (Security Clear)
|
|
171
|
+
10. DevOps (Pipeline Green) + Observability (Observability Ready) — for deployable/observable changes
|
|
172
|
+
11. final summary with open issues, if any
|
|
173
|
+
|
|
174
|
+
## 8) Quality bar
|
|
175
|
+
Optimize for: simplicity, correctness, scalability, reliability, maintainability,
|
|
176
|
+
observability, testability, security, and user experience.
|
|
177
|
+
|
|
178
|
+
## 9) Documentation standard
|
|
179
|
+
Every change must maintain or improve documentation. See `.claude/rules/documentation.md`.
|
|
180
|
+
|
|
181
|
+
Mandatory for every change:
|
|
182
|
+
- **Module/file docstring or header** in every new/modified source file
|
|
183
|
+
- **Docstring on every public function** (arguments, return value, errors/exceptions raised)
|
|
184
|
+
- **Full type annotations** where the language supports them — no untyped public signatures
|
|
185
|
+
- **No bare/loose container types** — prefer named, typed structures over opaque maps
|
|
186
|
+
- **README updated** when endpoints, env vars, project structure, or architecture change
|
|
187
|
+
- **API metadata** (summary, response schema, status codes) on every endpoint, where applicable
|
|
188
|
+
|
|
189
|
+
## 10) Guardrails
|
|
190
|
+
Do not:
|
|
191
|
+
- skip the spec + dev-doc stage
|
|
192
|
+
- skip the design flow for UI work
|
|
193
|
+
- skip the senior developer, technical architect, or EM review
|
|
194
|
+
- skip the code review
|
|
195
|
+
- mark work complete without tester validation
|
|
196
|
+
- mark testing complete without senior tester verification
|
|
197
|
+
- skip the merge reviewer at join points for multi-stream work
|
|
198
|
+
- submit code with missing docstrings or type annotations
|
|
199
|
+
- submit code without updating the README when endpoints or architecture changed
|
|
200
|
+
|
|
201
|
+
If the user asks for speed, you may compress the process but must preserve the sequence
|
|
202
|
+
and outputs.
|
|
203
|
+
|
|
204
|
+
**Fast-track mode:** For bug fixes, typos, single-component changes, or config updates
|
|
205
|
+
(< 5 files), skip the spec/design/review chain and go straight to:
|
|
206
|
+
Developer → Code Reviewer → Tester → PR Raiser.
|
|
207
|
+
|
|
208
|
+
See `.claude/rules/mandatory-workflow.md` for the full step-by-step pipeline with agent
|
|
209
|
+
roles, gating rules, and the defect-loop protocol.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 11) Working memory, self-check & quality gates
|
|
214
|
+
|
|
215
|
+
- **Working memory:** read/write `.claude/CONTINUITY.md` every turn and at each stage
|
|
216
|
+
transition so work survives context compaction and new sessions. Distinct from
|
|
217
|
+
`.claude/agent-memory/` (durable learnings). See `.claude/rules/continuity.md`.
|
|
218
|
+
- **RARV:** every agent runs Reason → Act → Reflect → Verify and shows a green Verify
|
|
219
|
+
before handoff. See `.claude/rules/rarv-cycle.md`.
|
|
220
|
+
- **Severity model:** classify every finding Critical/High/Medium/Low/Cosmetic; a gate
|
|
221
|
+
passes only with zero Critical/High/Medium open. See `.claude/rules/quality-gates.md`.
|
|
222
|
+
- **Blind review + Devil's Advocate:** parallel reviewers assess independently; a unanimous
|
|
223
|
+
PASS triggers the `devils-advocate` agent before the gate counts. See `.claude/rules/quality-gates.md`.
|
|
224
|
+
- **Security review:** the `security-reviewer` dispatches `secret-scanner`,
|
|
225
|
+
`dependency-scanner`, `owasp-reviewer`, and `policy-validator`, and gates **Security Clear**
|
|
226
|
+
before delivery. See `.claude/rules/quality-gates.md`.
|
|
227
|
+
- **DevOps & Observability:** for changes touching a deployable/observable surface, the
|
|
228
|
+
`devops-engineer` (Pipeline Green) and `observability-engineer` (Observability Ready)
|
|
229
|
+
gates run after testing and before the PR. See `.claude/rules/devops-observability.md`.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Project-specific rules
|
|
234
|
+
|
|
235
|
+
> Add your stack's conventions here (language style, framework patterns, naming, directory
|
|
236
|
+
> layout, test commands). The pipeline is stack-agnostic; this section is where you make it
|
|
237
|
+
> yours. Add matching rule files under `.claude/rules/` and reference them from the relevant
|
|
238
|
+
> agents.
|