Skip to content

docs: Adds HTTP communication guidance to Angular Skills - #69645

Merged
alxhub merged 2 commits into
angular:mainfrom
SkyZeroZx:skills/http-skill
Jul 29, 2026
Merged

docs: Adds HTTP communication guidance to Angular Skills#69645
alxhub merged 2 commits into
angular:mainfrom
SkyZeroZx:skills/http-skill

Conversation

@SkyZeroZx

Copy link
Copy Markdown
Contributor

Closes #68022

@pullapprove
pullapprove Bot requested a review from kirjs July 4, 2026 17:38
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Jul 4, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jul 4, 2026
- Calling `provideHttpClient()` with no features is not required for basic HTTP requests, but it configures the default HTTP feature set for that injector, including Angular's XSRF interceptor.
- Prefer `provideHttpClient(...)` over `HttpClientModule` for feature configuration, especially with multiple injectors.
- Use `withRequestsMadeViaParent()` when a child injector should add interceptors while still delegating to the parent HTTP chain.
- Prefer CORS over JSONP. Use `withJsonpSupport()` only for legacy APIs that require JSONP.

@SkyZeroZx SkyZeroZx Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I think we should avoid mentioning or directly say never to use JsonP because of the risk of XSS. Or should we still leave it as legacy support?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's just remove any mention of JSONP. It belongs in the past.

@SkyZeroZx SkyZeroZx Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to emphasize not using it (I say this to avoid confusion or to provide better guidance for the agents)?

Since, for example, if I start a new project (even with Angular skills) it adds withFetch for some reason when there's an unrelated problem, I would assume this might happen unexpectedly with JsonP

EDIT: According to GTP 5.5 using skill-creator, it indicates that it would be better to omit it, so let's go with that option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really be surprised if agents would even suggest it. It's really an old tech that isn't used anymore.

Comment thread skills/dev-skills/angular-developer/references/http-client.md

@dominicbachmann dominicbachmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about also adding examples of how to test this, as described in https://angular.dev/guide/http/testing?

import {input} from '@angular/core';

export class UserProfile {
userId = input.required<string>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HttpClient example above uses modifiers like private and readonly. Is there a particular reason they're not used here? Otherwise I'd keep the examples consistent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HttpClient example above uses modifiers like private and readonly. Is there a particular reason they're not used here? Otherwise I'd keep the examples consistent

I agree, it should be consistent.

What do you think about also adding examples of how to test this, as described in angular.dev/guide/http/testing?

I'm not sure if we should add testing to this guide because we might have context that would consume more tokens for our agent. I believe everything related to testing should be a separate skill, and it would also be called as required by the user prompt.

- **Component Harnesses**: Standard patterns for robust component interaction. Read [component-harnesses.md](references/component-harnesses.md)
- **Router Testing**: Using `RouterTestingHarness` for reliable navigation tests. Read [router-testing.md](references/router-testing.md)
- **End-to-End (E2E) Testing**: Best practices for E2E tests with Cypress. Read [e2e-testing.md](references/e2e-testing.md)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SkyZeroZx What do you think about adding a http testing reference here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense, but I think it would be better to address it in a follow-up PR to avoid adding extra overhead to this one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would add to this PR. Let's see what the others think.

@SkyZeroZx
SkyZeroZx force-pushed the skills/http-skill branch from a5372ee to 8ed3d3d Compare July 7, 2026 05:31

Important rules:

- `HttpClient` requests are cold `Observable`s. No request is sent until something subscribes. Multiple subscriptions send multiple backend requests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `HttpClient` requests are cold `Observable`s. No request is sent until something subscribes. Multiple subscriptions send multiple backend requests.
- `HttpClient` requests are cold `Observable`s. No request is sent until the `Observable` is subscribed to. Multiple subscriptions send multiple backend requests.


## `httpResource`

Use `httpResource` for reactive reads that should expose request status and value as signals.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this sentence could be improved.
httpResource isn't just reactive reads:

  • it's an async derivation
  • it fetchs over http
  • it is indeed reactive, via the signal it exposes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't seen it, it's been updated right now

- Calling `provideHttpClient()` with no features is not required for basic HTTP requests, but it configures the default HTTP feature set for that injector, including Angular's XSRF interceptor.
- Prefer `provideHttpClient(...)` over `HttpClientModule` for feature configuration, especially with multiple injectors.
- Use `withRequestsMadeViaParent()` when a child injector should add interceptors while still delegating to the parent HTTP chain.
- Prefer CORS over JSONP. Use `withJsonpSupport()` only for legacy APIs that require JSONP.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really be surprised if agents would even suggest it. It's really an old tech that isn't used anymore.

@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jul 21, 2026
@JeanMeche
JeanMeche removed the request for review from kirjs July 21, 2026 20:13
@angular-robot
angular-robot Bot requested a review from JeanMeche July 21, 2026 20:25
@pkozlowski-opensource

Copy link
Copy Markdown
Member

@pkozlowski-opensource pkozlowski-opensource added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Jul 22, 2026
@SkyZeroZx
SkyZeroZx force-pushed the skills/http-skill branch from fe6a04b to 104b5f6 Compare July 22, 2026 14:16
@SkyZeroZx

Copy link
Copy Markdown
Contributor Author

There are failing lint checks, see: angular/angular/actions/runs/29865635531/job/88886764693?pr=69645

It's updated, I think we could merge

@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jul 23, 2026
@alxhub
alxhub merged commit 840f071 into angular:main Jul 29, 2026
25 checks passed
@alxhub

alxhub commented Jul 29, 2026

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a file.md for http communication in the angular-developer Agent Skill

6 participants