claude-code-pilot 3.1.1 → 3.3.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/CHANGELOG.md +57 -0
- package/README.md +16 -11
- package/bin/install.js +127 -11
- package/manifest.json +20 -1
- package/package.json +4 -3
- package/src/agents/a11y-architect.md +141 -0
- package/src/agents/code-architect.md +71 -0
- package/src/agents/code-explorer.md +69 -0
- package/src/agents/code-simplifier.md +47 -0
- package/src/agents/comment-analyzer.md +45 -0
- package/src/agents/csharp-reviewer.md +101 -0
- package/src/agents/dart-build-resolver.md +201 -0
- package/src/agents/django-build-resolver.md +252 -0
- package/src/agents/django-reviewer.md +169 -0
- package/src/agents/fastapi-reviewer.md +79 -0
- package/src/agents/fsharp-reviewer.md +109 -0
- package/src/agents/pr-test-analyzer.md +45 -0
- package/src/agents/silent-failure-hunter.md +50 -0
- package/src/agents/swift-build-resolver.md +170 -0
- package/src/agents/swift-reviewer.md +116 -0
- package/src/agents/type-design-analyzer.md +41 -0
- package/src/available-rules/README.md +3 -1
- package/src/available-rules/dart/coding-style.md +159 -0
- package/src/available-rules/dart/hooks.md +66 -0
- package/src/available-rules/dart/patterns.md +261 -0
- package/src/available-rules/dart/security.md +135 -0
- package/src/available-rules/dart/testing.md +215 -0
- package/src/available-rules/web/coding-style.md +105 -0
- package/src/available-rules/web/design-quality.md +72 -0
- package/src/available-rules/web/hooks.md +129 -0
- package/src/available-rules/web/patterns.md +88 -0
- package/src/available-rules/web/performance.md +73 -0
- package/src/available-rules/web/security.md +66 -0
- package/src/available-rules/web/testing.md +64 -0
- package/src/commands/ccp/ai-integration-phase.md +36 -0
- package/src/commands/ccp/audit-fix.md +33 -0
- package/src/commands/ccp/code-review-fix.md +52 -0
- package/src/commands/ccp/cost-report.md +107 -0
- package/src/commands/ccp/eval-review.md +32 -0
- package/src/commands/ccp/extract_learnings.md +22 -0
- package/src/commands/ccp/import.md +37 -0
- package/src/commands/ccp/ingest-docs.md +42 -0
- package/src/commands/ccp/intel.md +179 -0
- package/src/commands/ccp/mvp-phase.md +45 -0
- package/src/commands/ccp/plan-prd.md +160 -0
- package/src/commands/ccp/plan-review-convergence.md +58 -0
- package/src/commands/ccp/pr-ecc.md +184 -0
- package/src/commands/ccp/scan.md +26 -0
- package/src/commands/ccp/security-scan.md +74 -0
- package/src/commands/ccp/sketch-wrap-up.md +31 -0
- package/src/commands/ccp/sketch.md +54 -0
- package/src/commands/ccp/spec-phase.md +62 -0
- package/src/commands/ccp/spike-wrap-up.md +31 -0
- package/src/commands/ccp/spike.md +51 -0
- package/src/commands/ccp/ultraplan-phase.md +33 -0
- package/src/hooks/ccp-bash-hook-dispatcher.js +96 -0
- package/src/hooks/ccp-context-monitor.js +23 -0
- package/src/hooks/ccp-doc-file-warning.js +93 -0
- package/src/hooks/ccp-pre-bash-dispatcher.js +24 -0
- package/src/hooks/ccp-read-injection-scanner.js +152 -0
- package/src/hooks/ccp-write-gateguard.js +868 -0
- package/src/hooks/kit-check-update.js +59 -7
- package/src/hooks/run-with-flags-shell.sh +1 -0
- package/src/hooks/run-with-flags.js +48 -1
- package/src/hooks/session-end.js +88 -1
- package/src/lib/hook-flags.js +14 -0
- package/src/lib/project-detect.js +0 -2
- package/src/lib/shell-substitution.js +499 -0
- package/src/pilot/references/agent-contracts.md +79 -0
- package/src/pilot/references/ai-evals.md +156 -0
- package/src/pilot/references/ai-frameworks.md +186 -0
- package/src/pilot/references/doc-conflict-engine.md +91 -0
- package/src/pilot/references/execute-mvp-tdd.md +81 -0
- package/src/pilot/references/gate-prompts.md +100 -0
- package/src/pilot/references/gates.md +70 -0
- package/src/pilot/references/mandatory-initial-read.md +2 -0
- package/src/pilot/references/mvp-concepts.md +49 -0
- package/src/pilot/references/planner-graphify-auto-update.md +67 -0
- package/src/pilot/references/planner-human-verify-mode.md +57 -0
- package/src/pilot/references/planner-mvp-mode.md +53 -0
- package/src/pilot/references/project-skills-discovery.md +19 -0
- package/src/pilot/references/revision-loop.md +97 -0
- package/src/pilot/references/skeleton-template.md +48 -0
- package/src/pilot/references/sketch-interactivity.md +41 -0
- package/src/pilot/references/sketch-theme-system.md +94 -0
- package/src/pilot/references/sketch-tooling.md +45 -0
- package/src/pilot/references/sketch-variant-patterns.md +81 -0
- package/src/pilot/references/spidr-splitting.md +69 -0
- package/src/pilot/references/thinking-models-debug.md +44 -0
- package/src/pilot/references/thinking-models-execution.md +50 -0
- package/src/pilot/references/thinking-models-planning.md +62 -0
- package/src/pilot/references/thinking-models-research.md +50 -0
- package/src/pilot/references/thinking-models-verification.md +55 -0
- package/src/pilot/references/user-story-template.md +58 -0
- package/src/pilot/references/verify-mvp-mode.md +85 -0
- package/src/pilot/references/worktree-path-safety.md +89 -0
- package/src/pilot/templates/AI-SPEC.md +246 -0
- package/src/pilot/templates/spec.md +307 -0
- package/src/pilot/workflows/ai-integration-phase.md +284 -0
- package/src/pilot/workflows/audit-fix.md +175 -0
- package/src/pilot/workflows/code-review-fix.md +497 -0
- package/src/pilot/workflows/eval-review.md +155 -0
- package/src/pilot/workflows/extract_learnings.md +242 -0
- package/src/pilot/workflows/help.md +5 -0
- package/src/pilot/workflows/import.md +246 -0
- package/src/pilot/workflows/ingest-docs.md +328 -0
- package/src/pilot/workflows/mvp-phase.md +199 -0
- package/src/pilot/workflows/plan-review-convergence.md +329 -0
- package/src/pilot/workflows/scan.md +102 -0
- package/src/pilot/workflows/sketch-wrap-up.md +285 -0
- package/src/pilot/workflows/sketch.md +360 -0
- package/src/pilot/workflows/spec-phase.md +262 -0
- package/src/pilot/workflows/spike-wrap-up.md +306 -0
- package/src/pilot/workflows/spike.md +452 -0
- package/src/pilot/workflows/ultraplan-phase.md +189 -0
- package/src/skills/accessibility/SKILL.md +146 -0
- package/src/skills/agent-architecture-audit/SKILL.md +256 -0
- package/src/skills/agent-eval/SKILL.md +145 -0
- package/src/skills/agent-harness-design/SKILL.md +73 -0
- package/src/skills/agent-introspection-debugging/SKILL.md +153 -0
- package/src/skills/android-clean-architecture/SKILL.md +339 -0
- package/src/skills/angular-developer/SKILL.md +154 -0
- package/src/skills/angular-developer/references/angular-animations.md +160 -0
- package/src/skills/angular-developer/references/angular-aria.md +410 -0
- package/src/skills/angular-developer/references/cli.md +86 -0
- package/src/skills/angular-developer/references/component-harnesses.md +59 -0
- package/src/skills/angular-developer/references/component-styling.md +91 -0
- package/src/skills/angular-developer/references/components.md +117 -0
- package/src/skills/angular-developer/references/creating-services.md +97 -0
- package/src/skills/angular-developer/references/data-resolvers.md +69 -0
- package/src/skills/angular-developer/references/define-routes.md +67 -0
- package/src/skills/angular-developer/references/defining-providers.md +72 -0
- package/src/skills/angular-developer/references/di-fundamentals.md +120 -0
- package/src/skills/angular-developer/references/e2e-testing.md +56 -0
- package/src/skills/angular-developer/references/effects.md +83 -0
- package/src/skills/angular-developer/references/hierarchical-injectors.md +43 -0
- package/src/skills/angular-developer/references/host-elements.md +80 -0
- package/src/skills/angular-developer/references/injection-context.md +63 -0
- package/src/skills/angular-developer/references/inputs.md +101 -0
- package/src/skills/angular-developer/references/linked-signal.md +59 -0
- package/src/skills/angular-developer/references/loading-strategies.md +61 -0
- package/src/skills/angular-developer/references/mcp.md +108 -0
- package/src/skills/angular-developer/references/navigate-to-routes.md +69 -0
- package/src/skills/angular-developer/references/outputs.md +86 -0
- package/src/skills/angular-developer/references/reactive-forms.md +122 -0
- package/src/skills/angular-developer/references/rendering-strategies.md +44 -0
- package/src/skills/angular-developer/references/resource.md +77 -0
- package/src/skills/angular-developer/references/route-animations.md +56 -0
- package/src/skills/angular-developer/references/route-guards.md +52 -0
- package/src/skills/angular-developer/references/router-lifecycle.md +45 -0
- package/src/skills/angular-developer/references/router-testing.md +87 -0
- package/src/skills/angular-developer/references/show-routes-with-outlets.md +68 -0
- package/src/skills/angular-developer/references/signal-forms.md +795 -0
- package/src/skills/angular-developer/references/signals-overview.md +94 -0
- package/src/skills/angular-developer/references/tailwind-css.md +69 -0
- package/src/skills/angular-developer/references/template-driven-forms.md +114 -0
- package/src/skills/angular-developer/references/testing-fundamentals.md +65 -0
- package/src/skills/api-connector-builder/SKILL.md +120 -0
- package/src/skills/code-tour/SKILL.md +236 -0
- package/src/skills/compose-multiplatform-patterns/SKILL.md +299 -0
- package/src/skills/csharp-testing/SKILL.md +321 -0
- package/src/skills/dart-flutter-patterns/SKILL.md +563 -0
- package/src/skills/dashboard-builder/SKILL.md +108 -0
- package/src/skills/dotnet-patterns/SKILL.md +321 -0
- package/src/skills/error-handling/SKILL.md +376 -0
- package/src/skills/fastapi-patterns/SKILL.md +327 -0
- package/src/skills/flox-environments/SKILL.md +496 -0
- package/src/skills/frontend-design/SKILL.md +145 -0
- package/src/skills/frontend-slides/SKILL.md +184 -0
- package/src/skills/frontend-slides/STYLE_PRESETS.md +330 -0
- package/src/skills/fsharp-testing/SKILL.md +280 -0
- package/src/skills/gateguard/SKILL.md +121 -0
- package/src/skills/github-ops/SKILL.md +144 -0
- package/src/skills/hookify-rules/SKILL.md +128 -0
- package/src/skills/ios-icon-gen/SKILL.md +157 -0
- package/src/skills/ios-icon-gen/scripts/generate_icons.swift +258 -0
- package/src/skills/ios-icon-gen/scripts/iconify_gen.sh +235 -0
- package/src/skills/knowledge-ops/SKILL.md +154 -0
- package/src/skills/liquid-glass-design/SKILL.md +279 -0
- package/src/skills/make-interfaces-feel-better/SKILL.md +151 -0
- package/src/skills/mysql-patterns/SKILL.md +412 -0
- package/src/skills/nestjs-patterns/SKILL.md +230 -0
- package/src/skills/plan-orchestrate/SKILL.md +220 -0
- package/src/skills/prisma-patterns/SKILL.md +371 -0
- package/src/skills/production-audit/SKILL.md +206 -0
- package/src/skills/security-bounty-hunter/SKILL.md +99 -0
- package/src/skills/security-scan/references/agentshield-policy-exception/candidate-playbook.md +49 -0
- package/src/skills/security-scan/references/agentshield-policy-exception/report.json +35 -0
- package/src/skills/security-scan/references/agentshield-policy-exception/scenario.json +62 -0
- package/src/skills/security-scan/references/agentshield-policy-exception/trace.json +45 -0
- package/src/skills/security-scan/references/agentshield-policy-exception/verifier-result.json +35 -0
- package/src/skills/swift-actor-persistence/SKILL.md +143 -0
- package/src/skills/swift-protocol-di-testing/SKILL.md +190 -0
- package/src/skills/swiftui-patterns/SKILL.md +259 -0
- package/src/skills/terminal-ops/SKILL.md +109 -0
- package/src/skills/ui-demo/SKILL.md +465 -0
- package/src/skills/vite-patterns/SKILL.md +449 -0
- package/src/skills/windows-desktop-e2e/SKILL.md +887 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Angular Signals Overview
|
|
2
|
+
|
|
3
|
+
Signals are the foundation of reactivity in modern Angular applications. A **signal** is a wrapper around a value that notifies interested consumers when that value changes.
|
|
4
|
+
|
|
5
|
+
## Writable Signals (`signal`)
|
|
6
|
+
|
|
7
|
+
Use `signal()` to create state that can be directly updated.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {signal} from '@angular/core';
|
|
11
|
+
|
|
12
|
+
// Create a writable signal
|
|
13
|
+
const count = signal(0);
|
|
14
|
+
|
|
15
|
+
// Read the value (always requires calling the getter function)
|
|
16
|
+
console.log(count());
|
|
17
|
+
|
|
18
|
+
// Update the value directly
|
|
19
|
+
count.set(3);
|
|
20
|
+
|
|
21
|
+
// Update based on the previous value
|
|
22
|
+
count.update((value) => value + 1);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Exposing as Readonly
|
|
26
|
+
|
|
27
|
+
When exposing state from a service, it is a best practice to expose a readonly version to prevent external mutation.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
private readonly _count = signal(0);
|
|
31
|
+
// Consumers can read this, but cannot call .set() or .update()
|
|
32
|
+
readonly count = this._count.asReadonly();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Computed Signals (`computed`)
|
|
36
|
+
|
|
37
|
+
Use `computed()` to create read-only signals that derive their value from other signals.
|
|
38
|
+
|
|
39
|
+
- **Lazily Evaluated**: The derivation function doesn't run until the computed signal is read.
|
|
40
|
+
- **Memoized**: The result is cached. It only recalculates when one of the signals it depends on changes.
|
|
41
|
+
- **Dynamic Dependencies**: Only the signals _actually read_ during the derivation are tracked.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import {signal, computed} from '@angular/core';
|
|
45
|
+
|
|
46
|
+
const count = signal(0);
|
|
47
|
+
const doubleCount = computed(() => count() * 2);
|
|
48
|
+
|
|
49
|
+
// doubleCount automatically updates when count changes.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Reactive Contexts
|
|
53
|
+
|
|
54
|
+
A **reactive context** is a runtime state where Angular monitors signal reads to establish a dependency.
|
|
55
|
+
|
|
56
|
+
Angular automatically enters a reactive context when evaluating:
|
|
57
|
+
|
|
58
|
+
- `computed` signals
|
|
59
|
+
- `effect` callbacks
|
|
60
|
+
- `linkedSignal` computations
|
|
61
|
+
- Component templates
|
|
62
|
+
|
|
63
|
+
### Untracked Reads (`untracked`)
|
|
64
|
+
|
|
65
|
+
If you need to read a signal inside a reactive context _without_ creating a dependency (so that the context doesn't re-run when the signal changes), use `untracked()`.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import {effect, untracked} from '@angular/core';
|
|
69
|
+
|
|
70
|
+
effect(() => {
|
|
71
|
+
// This effect only runs when currentUser changes.
|
|
72
|
+
// It does NOT run when counter changes, even though counter is read here.
|
|
73
|
+
console.log(`User: ${currentUser()}, Count: ${untracked(counter)}`);
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Async Operations in Reactive Contexts
|
|
78
|
+
|
|
79
|
+
The reactive context is only active for **synchronous** code. Signal reads after an `await` will not be tracked. **Always read signals before asynchronous boundaries.**
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// Incorrect: theme() is not tracked because it is read after await
|
|
83
|
+
effect(async () => {
|
|
84
|
+
const data = await fetchUserData();
|
|
85
|
+
console.log(theme());
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Correct: Read the signal before the await
|
|
89
|
+
effect(async () => {
|
|
90
|
+
const currentTheme = theme();
|
|
91
|
+
const data = await fetchUserData();
|
|
92
|
+
console.log(currentTheme);
|
|
93
|
+
});
|
|
94
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Using Tailwind CSS with Angular
|
|
2
|
+
|
|
3
|
+
Tailwind CSS is a utility-first CSS framework that integrates seamlessly with Angular.
|
|
4
|
+
|
|
5
|
+
**CRITICAL AGENT GUIDANCE: ALWAYS focus on Tailwind CSS v4 practices. DO NOT revert to old Tailwind v3 patterns (like creating `tailwind.config.js` with `@tailwind` directives) as this will break the application build. Modern Angular projects use Tailwind v4.**
|
|
6
|
+
|
|
7
|
+
## Automated Setup (Recommended)
|
|
8
|
+
|
|
9
|
+
The easiest way to add Tailwind CSS to an Angular project is via the Angular CLI:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
ng add tailwindcss
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This will automatically:
|
|
16
|
+
|
|
17
|
+
1. Install `tailwindcss` and peer dependencies.
|
|
18
|
+
2. Configure the project to use Tailwind CSS.
|
|
19
|
+
3. Add the proper import to your global styles.
|
|
20
|
+
|
|
21
|
+
## Manual Setup (Tailwind v4)
|
|
22
|
+
|
|
23
|
+
If setting up manually, use the following Tailwind v4 pattern:
|
|
24
|
+
|
|
25
|
+
### 1. Install Dependencies
|
|
26
|
+
|
|
27
|
+
Install Tailwind CSS and PostCSS:
|
|
28
|
+
|
|
29
|
+
```shell
|
|
30
|
+
npm install tailwindcss @tailwindcss/postcss postcss
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Configure PostCSS
|
|
34
|
+
|
|
35
|
+
Create a `.postcssrc.json` file in the project root:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"plugins": {
|
|
40
|
+
"@tailwindcss/postcss": {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
_(Do NOT create a `tailwind.config.js` file! Configuration in v4 is handled through CSS variables)._
|
|
46
|
+
|
|
47
|
+
### 3. Import Tailwind CSS
|
|
48
|
+
|
|
49
|
+
In your global styles file (e.g., `src/styles.css`), add the standard v4 import:
|
|
50
|
+
|
|
51
|
+
```css
|
|
52
|
+
@import 'tailwindcss';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
_(If using SCSS, use `@use 'tailwindcss';` instead)._
|
|
56
|
+
|
|
57
|
+
### 4. Use Utility Classes
|
|
58
|
+
|
|
59
|
+
You can now use Tailwind classes directly in your component templates:
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<h1 class="text-3xl font-bold underline">Hello world!</h1>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Summary for AI Agents
|
|
66
|
+
|
|
67
|
+
- **Do not use `@tailwind base; @tailwind components; @tailwind utilities;`**. Use `@import 'tailwindcss';`.
|
|
68
|
+
- **Do not create `tailwind.config.js`**. Configuration is managed directly in CSS via theme variables or using PostCSS configurations.
|
|
69
|
+
- Stick strictly to v4 syntax and workflows.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Template-Driven Forms
|
|
2
|
+
|
|
3
|
+
Template-driven forms use two-way data binding (`[(ngModel)]`) to update the data model in the component as changes are made in the template and vice versa. They are ideal for simple forms and use directives in the HTML template to manage form state and validation.
|
|
4
|
+
|
|
5
|
+
## Core Directives
|
|
6
|
+
|
|
7
|
+
Template-driven forms rely on the `FormsModule` which provides these key directives:
|
|
8
|
+
|
|
9
|
+
- `NgModel`: Reconciles value changes in the form element with the data model (`[(ngModel)]`).
|
|
10
|
+
- `NgForm`: Automatically creates a top-level `FormGroup` bound to the `<form>` tag.
|
|
11
|
+
- `NgModelGroup`: Creates a nested `FormGroup` bound to a DOM element.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
First, import `FormsModule` into your component or module.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {Component} from '@angular/core';
|
|
19
|
+
import {FormsModule} from '@angular/forms';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'app-user-form',
|
|
23
|
+
imports: [FormsModule],
|
|
24
|
+
templateUrl: './user-form.component.html',
|
|
25
|
+
})
|
|
26
|
+
export class UserForm {
|
|
27
|
+
user = {name: '', role: 'Guest'};
|
|
28
|
+
|
|
29
|
+
onSubmit() {
|
|
30
|
+
console.log('Form submitted!', this.user);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Building the Form Template
|
|
36
|
+
|
|
37
|
+
### Two-Way Binding with `[(ngModel)]`
|
|
38
|
+
|
|
39
|
+
Use `[(ngModel)]` on input elements. **Every element using `[(ngModel)]` MUST have a `name` attribute.** Angular uses the `name` attribute to register the control with the parent `NgForm`.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<form #userForm="ngForm" (ngSubmit)="onSubmit()">
|
|
43
|
+
<!-- Basic Input -->
|
|
44
|
+
<div>
|
|
45
|
+
<label for="name">Name:</label>
|
|
46
|
+
<input type="text" id="name" required [(ngModel)]="user.name" name="name" #nameCtrl="ngModel" />
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- Select Box -->
|
|
50
|
+
<div>
|
|
51
|
+
<label for="role">Role:</label>
|
|
52
|
+
<select id="role" [(ngModel)]="user.role" name="role">
|
|
53
|
+
<option value="Admin">Admin</option>
|
|
54
|
+
<option value="Guest">Guest</option>
|
|
55
|
+
</select>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- Submit Button (disabled if form is invalid) -->
|
|
59
|
+
<button type="submit" [disabled]="!userForm.form.valid">Submit</button>
|
|
60
|
+
</form>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Form and Control State
|
|
64
|
+
|
|
65
|
+
Angular automatically applies CSS classes to controls and forms based on their state:
|
|
66
|
+
|
|
67
|
+
| State | Class if True | Class if False |
|
|
68
|
+
| :------------- | :-------------------------------- | :------------- |
|
|
69
|
+
| Visited | `ng-touched` | `ng-untouched` |
|
|
70
|
+
| Value Changed | `ng-dirty` | `ng-pristine` |
|
|
71
|
+
| Value is Valid | `ng-valid` | `ng-invalid` |
|
|
72
|
+
| Form Submitted | `ng-submitted` (on `<form>` only) | - |
|
|
73
|
+
|
|
74
|
+
You can use these classes to provide visual feedback in your CSS:
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
.ng-valid[required],
|
|
78
|
+
.ng-valid.required {
|
|
79
|
+
border-left: 5px solid #42a948; /* green */
|
|
80
|
+
}
|
|
81
|
+
.ng-invalid:not(form) {
|
|
82
|
+
border-left: 5px solid #a94442; /* red */
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Validation and Error Messages
|
|
87
|
+
|
|
88
|
+
To display error messages conditionally, export the `ngModel` directive to a template reference variable (e.g., `#nameCtrl="ngModel"`).
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<input type="text" id="name" required [(ngModel)]="user.name" name="name" #nameCtrl="ngModel" />
|
|
92
|
+
|
|
93
|
+
<!-- Show error only if the control is invalid AND (touched OR dirty) -->
|
|
94
|
+
@if (nameCtrl.invalid && (nameCtrl.dirty || nameCtrl.touched)) {
|
|
95
|
+
<div class="alert alert-danger">
|
|
96
|
+
@if (nameCtrl.errors?.['required']) {
|
|
97
|
+
<div>Name is required.</div>
|
|
98
|
+
}
|
|
99
|
+
</div>
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Submitting the Form
|
|
104
|
+
|
|
105
|
+
1. Use the `(ngSubmit)` event on the `<form>` element.
|
|
106
|
+
2. Bind the submit button's disabled state to the overall form validity using the `NgForm` template reference variable (e.g., `[disabled]="!userForm.form.valid"`).
|
|
107
|
+
|
|
108
|
+
## Resetting the Form
|
|
109
|
+
|
|
110
|
+
To programmatically reset the form to its pristine state (clearing values and validation flags), use the `reset()` method on the `NgForm` instance.
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<button type="button" (click)="userForm.reset()">Reset</button>
|
|
114
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Testing Fundamentals
|
|
2
|
+
|
|
3
|
+
This guide covers the fundamental principles and practices for writing Angular unit and component tests. Use the runner already configured in the project.
|
|
4
|
+
|
|
5
|
+
## Core Philosophy: Async-First
|
|
6
|
+
|
|
7
|
+
Modern Angular applications often schedule state changes asynchronously, especially when using signals or zoneless change detection. Tests should account for this.
|
|
8
|
+
|
|
9
|
+
Prefer the "Act, Wait, Assert" pattern:
|
|
10
|
+
|
|
11
|
+
1. **Act:** Update state or perform an action (e.g., set a component input, click a button).
|
|
12
|
+
2. **Wait:** Use `await fixture.whenStable()` to allow the framework to process the scheduled update and render the changes.
|
|
13
|
+
3. **Assert:** Verify the outcome.
|
|
14
|
+
|
|
15
|
+
### Basic Test Structure Example
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
|
19
|
+
import {MyComponent} from './my.component';
|
|
20
|
+
|
|
21
|
+
describe('MyComponent', () => {
|
|
22
|
+
let component: MyComponent;
|
|
23
|
+
let fixture: ComponentFixture<MyComponent>;
|
|
24
|
+
let h1: HTMLElement;
|
|
25
|
+
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
// 1. Configure the test module
|
|
28
|
+
await TestBed.configureTestingModule({
|
|
29
|
+
imports: [MyComponent],
|
|
30
|
+
}).compileComponents();
|
|
31
|
+
|
|
32
|
+
// 2. Create the component fixture
|
|
33
|
+
fixture = TestBed.createComponent(MyComponent);
|
|
34
|
+
component = fixture.componentInstance;
|
|
35
|
+
h1 = fixture.nativeElement.querySelector('h1');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should display the default title', async () => {
|
|
39
|
+
// ACT: (Implicit) Component is created with default state.
|
|
40
|
+
// WAIT for initial data binding.
|
|
41
|
+
await fixture.whenStable();
|
|
42
|
+
// ASSERT the initial state.
|
|
43
|
+
expect(h1.textContent).toContain('Default Title');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should display a different title after a change', async () => {
|
|
47
|
+
// ACT: Change the component's title property.
|
|
48
|
+
component.title.set('New Test Title');
|
|
49
|
+
|
|
50
|
+
// WAIT for the asynchronous update to complete.
|
|
51
|
+
await fixture.whenStable();
|
|
52
|
+
|
|
53
|
+
// ASSERT the DOM has been updated.
|
|
54
|
+
expect(h1.textContent).toContain('New Test Title');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## TestBed and ComponentFixture
|
|
60
|
+
|
|
61
|
+
- **`TestBed`**: The primary utility for creating a test-specific Angular module. Use `TestBed.configureTestingModule({...})` in your `beforeEach` to declare components, provide services, and set up imports needed for your test.
|
|
62
|
+
- **`ComponentFixture`**: A handle on the created component instance and its environment.
|
|
63
|
+
- `fixture.componentInstance`: Access the component's class instance.
|
|
64
|
+
- `fixture.nativeElement`: Access the component's root DOM element.
|
|
65
|
+
- `fixture.debugElement`: An Angular-specific wrapper around the `nativeElement` that provides safer, platform-agnostic ways to query the DOM (e.g., `debugElement.query(By.css('p'))`).
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-connector-builder
|
|
3
|
+
description: Build a new API connector or provider by matching the target repo's existing integration pattern exactly. Use when adding one more integration without inventing a second architecture.
|
|
4
|
+
origin: ECC direct-port adaptation
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API Connector Builder
|
|
9
|
+
|
|
10
|
+
Use this when the job is to add a repo-native integration surface, not just a generic HTTP client.
|
|
11
|
+
|
|
12
|
+
The point is to match the host repository's pattern:
|
|
13
|
+
|
|
14
|
+
- connector layout
|
|
15
|
+
- config schema
|
|
16
|
+
- auth model
|
|
17
|
+
- error handling
|
|
18
|
+
- test style
|
|
19
|
+
- registration/discovery wiring
|
|
20
|
+
|
|
21
|
+
## When to Use
|
|
22
|
+
|
|
23
|
+
- "Build a Jira connector for this project"
|
|
24
|
+
- "Add a Slack provider following the existing pattern"
|
|
25
|
+
- "Create a new integration for this API"
|
|
26
|
+
- "Build a plugin that matches the repo's connector style"
|
|
27
|
+
|
|
28
|
+
## Guardrails
|
|
29
|
+
|
|
30
|
+
- do not invent a new integration architecture when the repo already has one
|
|
31
|
+
- do not start from vendor docs alone; start from existing in-repo connectors first
|
|
32
|
+
- do not stop at transport code if the repo expects registry wiring, tests, and docs
|
|
33
|
+
- do not cargo-cult old connectors if the repo has a newer current pattern
|
|
34
|
+
|
|
35
|
+
## Workflow
|
|
36
|
+
|
|
37
|
+
### 1. Learn the house style
|
|
38
|
+
|
|
39
|
+
Inspect at least 2 existing connectors/providers and map:
|
|
40
|
+
|
|
41
|
+
- file layout
|
|
42
|
+
- abstraction boundaries
|
|
43
|
+
- config model
|
|
44
|
+
- retry / pagination conventions
|
|
45
|
+
- registry hooks
|
|
46
|
+
- test fixtures and naming
|
|
47
|
+
|
|
48
|
+
### 2. Narrow the target integration
|
|
49
|
+
|
|
50
|
+
Define only the surface the repo actually needs:
|
|
51
|
+
|
|
52
|
+
- auth flow
|
|
53
|
+
- key entities
|
|
54
|
+
- core read/write operations
|
|
55
|
+
- pagination and rate limits
|
|
56
|
+
- webhook or polling model
|
|
57
|
+
|
|
58
|
+
### 3. Build in repo-native layers
|
|
59
|
+
|
|
60
|
+
Typical slices:
|
|
61
|
+
|
|
62
|
+
- config/schema
|
|
63
|
+
- client/transport
|
|
64
|
+
- mapping layer
|
|
65
|
+
- connector/provider entrypoint
|
|
66
|
+
- registration
|
|
67
|
+
- tests
|
|
68
|
+
|
|
69
|
+
### 4. Validate against the source pattern
|
|
70
|
+
|
|
71
|
+
The new connector should look obvious in the codebase, not imported from a different ecosystem.
|
|
72
|
+
|
|
73
|
+
## Reference Shapes
|
|
74
|
+
|
|
75
|
+
### Provider-style
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
providers/
|
|
79
|
+
existing_provider/
|
|
80
|
+
__init__.py
|
|
81
|
+
provider.py
|
|
82
|
+
config.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Connector-style
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
integrations/
|
|
89
|
+
existing/
|
|
90
|
+
client.py
|
|
91
|
+
models.py
|
|
92
|
+
connector.py
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### TypeScript plugin-style
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
src/integrations/
|
|
99
|
+
existing/
|
|
100
|
+
index.ts
|
|
101
|
+
client.ts
|
|
102
|
+
types.ts
|
|
103
|
+
test.ts
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Quality Checklist
|
|
107
|
+
|
|
108
|
+
- [ ] matches an existing in-repo integration pattern
|
|
109
|
+
- [ ] config validation exists
|
|
110
|
+
- [ ] auth and error handling are explicit
|
|
111
|
+
- [ ] pagination/retry behavior follows repo norms
|
|
112
|
+
- [ ] registry/discovery wiring is complete
|
|
113
|
+
- [ ] tests mirror the host repo's style
|
|
114
|
+
- [ ] docs/examples are updated if expected by the repo
|
|
115
|
+
|
|
116
|
+
## Related Skills
|
|
117
|
+
|
|
118
|
+
- `backend-patterns`
|
|
119
|
+
- `mcp-server-patterns`
|
|
120
|
+
- `github-ops`
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-tour
|
|
3
|
+
description: Create CodeTour `.tour` files — persona-targeted, step-by-step walkthroughs with real file and line anchors. Use for onboarding tours, architecture walkthroughs, PR tours, RCA tours, and structured "explain how this works" requests.
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Tour
|
|
8
|
+
|
|
9
|
+
Create **CodeTour** `.tour` files for codebase walkthroughs that open directly to real files and line ranges. Tours live in `.tours/` and are meant for the CodeTour format, not ad hoc Markdown notes.
|
|
10
|
+
|
|
11
|
+
A good tour is a narrative for a specific reader:
|
|
12
|
+
- what they are looking at
|
|
13
|
+
- why it matters
|
|
14
|
+
- what path they should follow next
|
|
15
|
+
|
|
16
|
+
Only create `.tour` JSON files. Do not modify source code as part of this skill.
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
Use this skill when:
|
|
21
|
+
- the user asks for a code tour, onboarding tour, architecture walkthrough, or PR tour
|
|
22
|
+
- the user says "explain how X works" and wants a reusable guided artifact
|
|
23
|
+
- the user wants a ramp-up path for a new engineer or reviewer
|
|
24
|
+
- the task is better served by a guided sequence than a flat summary
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
- onboarding a new maintainer
|
|
28
|
+
- architecture tour for one service or package
|
|
29
|
+
- PR-review walk-through anchored to changed files
|
|
30
|
+
- RCA tour showing the failure path
|
|
31
|
+
- security review tour of trust boundaries and key checks
|
|
32
|
+
|
|
33
|
+
## When NOT to Use
|
|
34
|
+
|
|
35
|
+
| Instead of code-tour | Use |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| A one-off explanation in chat is enough | answer directly |
|
|
38
|
+
| The user wants prose docs, not a `.tour` artifact | `documentation-lookup` or repo docs editing |
|
|
39
|
+
| The task is implementation or refactoring | do the implementation work |
|
|
40
|
+
| The task is broad codebase onboarding without a tour artifact | `codebase-onboarding` |
|
|
41
|
+
|
|
42
|
+
## Workflow
|
|
43
|
+
|
|
44
|
+
### 1. Discover
|
|
45
|
+
|
|
46
|
+
Explore the repo before writing anything:
|
|
47
|
+
- README and package/app entry points
|
|
48
|
+
- folder structure
|
|
49
|
+
- relevant config files
|
|
50
|
+
- the changed files if the tour is PR-focused
|
|
51
|
+
|
|
52
|
+
Do not start writing steps before you understand the shape of the code.
|
|
53
|
+
|
|
54
|
+
### 2. Infer the reader
|
|
55
|
+
|
|
56
|
+
Decide the persona and depth from the request.
|
|
57
|
+
|
|
58
|
+
| Request shape | Persona | Suggested depth |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| "onboarding", "new joiner" | `new-joiner` | 9-13 steps |
|
|
61
|
+
| "quick tour", "vibe check" | `vibecoder` | 5-8 steps |
|
|
62
|
+
| "architecture" | `architect` | 14-18 steps |
|
|
63
|
+
| "tour this PR" | `pr-reviewer` | 7-11 steps |
|
|
64
|
+
| "why did this break" | `rca-investigator` | 7-11 steps |
|
|
65
|
+
| "security review" | `security-reviewer` | 7-11 steps |
|
|
66
|
+
| "explain how this feature works" | `feature-explainer` | 7-11 steps |
|
|
67
|
+
| "debug this path" | `bug-fixer` | 7-11 steps |
|
|
68
|
+
|
|
69
|
+
### 3. Read and verify anchors
|
|
70
|
+
|
|
71
|
+
Every file path and line anchor must be real:
|
|
72
|
+
- confirm the file exists
|
|
73
|
+
- confirm the line numbers are in range
|
|
74
|
+
- if using a selection, verify the exact block
|
|
75
|
+
- if the file is volatile, prefer a pattern-based anchor
|
|
76
|
+
|
|
77
|
+
Never guess line numbers.
|
|
78
|
+
|
|
79
|
+
### 4. Write the `.tour`
|
|
80
|
+
|
|
81
|
+
Write to:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
.tours/<persona>-<focus>.tour
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Keep the path deterministic and readable.
|
|
88
|
+
|
|
89
|
+
### 5. Validate
|
|
90
|
+
|
|
91
|
+
Before finishing:
|
|
92
|
+
- every referenced path exists
|
|
93
|
+
- every line or selection is valid
|
|
94
|
+
- the first step is anchored to a real file or directory
|
|
95
|
+
- the tour tells a coherent story rather than listing files
|
|
96
|
+
|
|
97
|
+
## Step Types
|
|
98
|
+
|
|
99
|
+
### Content
|
|
100
|
+
|
|
101
|
+
Use sparingly, usually only for a closing step:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{ "title": "Next Steps", "description": "You can now trace the request path end to end." }
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Do not make the first step content-only.
|
|
108
|
+
|
|
109
|
+
### Directory
|
|
110
|
+
|
|
111
|
+
Use to orient the reader to a module:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{ "directory": "src/services", "title": "Service Layer", "description": "The core orchestration logic lives here." }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### File + line
|
|
118
|
+
|
|
119
|
+
This is the default step type:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{ "file": "src/auth/middleware.ts", "line": 42, "title": "Auth Gate", "description": "Every protected request passes here first." }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Selection
|
|
126
|
+
|
|
127
|
+
Use when one code block matters more than the whole file:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"file": "src/core/pipeline.ts",
|
|
132
|
+
"selection": {
|
|
133
|
+
"start": { "line": 15, "character": 0 },
|
|
134
|
+
"end": { "line": 34, "character": 0 }
|
|
135
|
+
},
|
|
136
|
+
"title": "Request Pipeline",
|
|
137
|
+
"description": "This block wires validation, auth, and downstream execution."
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Pattern
|
|
142
|
+
|
|
143
|
+
Use when exact lines may drift:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{ "file": "src/app.ts", "pattern": "export default class App", "title": "Application Entry" }
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### URI
|
|
150
|
+
|
|
151
|
+
Use for PRs, issues, or docs when helpful:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{ "uri": "https://github.com/org/repo/pull/456", "title": "The PR" }
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Writing Rule: SMIG
|
|
158
|
+
|
|
159
|
+
Each description should answer:
|
|
160
|
+
- **Situation**: what the reader is looking at
|
|
161
|
+
- **Mechanism**: how it works
|
|
162
|
+
- **Implication**: why it matters for this persona
|
|
163
|
+
- **Gotcha**: what a smart reader might miss
|
|
164
|
+
|
|
165
|
+
Keep descriptions compact, specific, and grounded in the actual code.
|
|
166
|
+
|
|
167
|
+
## Narrative Shape
|
|
168
|
+
|
|
169
|
+
Use this arc unless the task clearly needs something different:
|
|
170
|
+
1. orientation
|
|
171
|
+
2. module map
|
|
172
|
+
3. core execution path
|
|
173
|
+
4. edge case or gotcha
|
|
174
|
+
5. closing / next move
|
|
175
|
+
|
|
176
|
+
The tour should feel like a path, not an inventory.
|
|
177
|
+
|
|
178
|
+
## Example
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"$schema": "https://aka.ms/codetour-schema",
|
|
183
|
+
"title": "API Service Tour",
|
|
184
|
+
"description": "Walkthrough of the request path for the payments service.",
|
|
185
|
+
"ref": "main",
|
|
186
|
+
"steps": [
|
|
187
|
+
{
|
|
188
|
+
"directory": "src",
|
|
189
|
+
"title": "Source Root",
|
|
190
|
+
"description": "All runtime code for the service starts here."
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"file": "src/server.ts",
|
|
194
|
+
"line": 12,
|
|
195
|
+
"title": "Entry Point",
|
|
196
|
+
"description": "The server boots here and wires middleware before any route is reached."
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"file": "src/routes/payments.ts",
|
|
200
|
+
"line": 8,
|
|
201
|
+
"title": "Payment Routes",
|
|
202
|
+
"description": "Every payments request enters through this router before hitting service logic."
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"title": "Next Steps",
|
|
206
|
+
"description": "You can now follow any payment request end to end with the main anchors in place."
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Anti-Patterns
|
|
213
|
+
|
|
214
|
+
| Anti-pattern | Fix |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| Flat file listing | Tell a story with dependency between steps |
|
|
217
|
+
| Generic descriptions | Name the concrete code path or pattern |
|
|
218
|
+
| Guessed anchors | Verify every file and line first |
|
|
219
|
+
| Too many steps for a quick tour | Cut aggressively |
|
|
220
|
+
| First step is content-only | Anchor the first step to a real file or directory |
|
|
221
|
+
| Persona mismatch | Write for the actual reader, not a generic engineer |
|
|
222
|
+
|
|
223
|
+
## Best Practices
|
|
224
|
+
|
|
225
|
+
- keep step count proportional to repo size and persona depth
|
|
226
|
+
- use directory steps for orientation, file steps for substance
|
|
227
|
+
- for PR tours, cover changed files first
|
|
228
|
+
- for monorepos, scope to the relevant packages instead of touring everything
|
|
229
|
+
- close with what the reader can now do, not a recap
|
|
230
|
+
|
|
231
|
+
## Related Skills
|
|
232
|
+
|
|
233
|
+
- `codebase-onboarding`
|
|
234
|
+
- `coding-standards`
|
|
235
|
+
- `council`
|
|
236
|
+
- official upstream format: `microsoft/codetour`
|