Skip to content

Commit 4a045d0

Browse files
authored
Merge pull request #153 from contentstack/update/DX-5380
update: added skill files
2 parents 84563ea + dfd6dbf commit 4a045d0

File tree

13 files changed

+690
-0
lines changed

13 files changed

+690
-0
lines changed

.cursor/rules/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cursor (optional)
2+
3+
**Cursor** users:
4+
5+
- Start at **[`AGENTS.md`](../../AGENTS.md)** — project entry point and commands.
6+
- Skills index: **[`skills/README.md`](../../skills/README.md)**.
7+
8+
All conventions live in **`skills/*/SKILL.md`**. This folder only points contributors to those paths so editor-specific config does not duplicate the canonical docs.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ api_referece/*
2828
*.html
2929
*.cobertura.xml
3030
integration-test-report_*.html
31+
*.zip
32+
.trx

AGENTS.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contentstack Management .NET SDK – Agent guide
2+
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
4+
5+
## What this repo is
6+
7+
| Field | Detail |
8+
| ----- | ------ |
9+
| **Name:** | [contentstack/contentstack-management-dotnet](https://github.com/contentstack/contentstack-management-dotnet) |
10+
| **Purpose:** | .NET SDK for the [Content Management API (CMA)](https://www.contentstack.com/docs/developers/apis/content-management-api/)—manage stacks, content types, entries, assets, and related resources. |
11+
| **Out of scope (if any):** | Content **delivery** to end users should use the Content Delivery API and its SDKs, not this package. This repo does not implement the CDA. |
12+
13+
## Tech stack (at a glance)
14+
15+
| Area | Details |
16+
| ---- | ------- |
17+
| **Language** | C# 8.0, nullable reference types enabled (`LangVersion` in core project). |
18+
| **Build** | .NET SDK; main solution [`Contentstack.Management.Core.sln`](Contentstack.Management.Core.sln). Core library targets `netstandard2.0` (and `net471` / `net472` on Windows—see [`skills/framework/SKILL.md`](skills/framework/SKILL.md)). |
19+
| **Tests** | MSTest; test projects target `net7.0`. Unit tests: [`Contentstack.Management.Core.Unit.Tests/`](Contentstack.Management.Core.Unit.Tests/). Integration tests: [`Contentstack.Management.Core.Tests/`](Contentstack.Management.Core.Tests/) (includes `IntegrationTest/`). |
20+
| **Lint / coverage** | No repo-wide `dotnet format` / lint script at root. Rely on **.NET SDK analyzers** and IDE analysis. Tests use **coverlet** (`XPlat code coverage`) when run as in CI. |
21+
| **Other** | NuGet packages: `contentstack.management.csharp` (core), `contentstack.management.aspnetcore` (ASP.NET Core helpers). Assembly signing via `CSManagementSDK.snk`. |
22+
23+
## Commands (quick reference)
24+
25+
| Command type | Command |
26+
| ------------ | ------- |
27+
| **Build** | `dotnet build Contentstack.Management.Core.sln` |
28+
| **Test (CI-parity, unit)** | `sh ./Scripts/run-unit-test-case.sh` — runs `dotnet test` on [`Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj`](Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj) with TRX logger and coverlet. |
29+
| **Test (integration)** | `dotnet test Contentstack.Management.Core.Tests/Contentstack.Management.Core.Tests.csproj` — requires local `appsettings.json` with credentials (see [`skills/testing/SKILL.md`](skills/testing/SKILL.md)). |
30+
| **Pack (release)** | `dotnet pack -c Release -o out` (as in [`.github/workflows/nuget-publish.yml`](.github/workflows/nuget-publish.yml)). |
31+
32+
**CI:** [`.github/workflows/unit-test.yml`](.github/workflows/unit-test.yml) (unit tests on PR/push). **Branches:** PRs normally target **`development`**; **`main`** is for **hotfixes**. PRs **into `main`** must come from **`staging`** per [`.github/workflows/check-branch.yml`](.github/workflows/check-branch.yml).
33+
34+
## Where the documentation lives: skills
35+
36+
| Skill | Path | What it covers |
37+
| ----- | ---- | -------------- |
38+
| Dev workflow | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, scripts, when to run which tests. |
39+
| SDK (CMA) | [`skills/contentstack-management-dotnet-sdk/SKILL.md`](skills/contentstack-management-dotnet-sdk/SKILL.md) | Public API, auth, package boundaries. |
40+
| Testing | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | MSTest layout, unit vs integration, credentials, coverage. |
41+
| Code review | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR expectations and checklist. |
42+
| Framework / platform | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | TFMs, signing, NuGet, HTTP pipeline overview. |
43+
| C# style | [`skills/csharp-style/SKILL.md`](skills/csharp-style/SKILL.md) | Language and layout conventions for this repo. |
44+
| HTTP pipeline (retries) | [`skills/http-pipeline/SKILL.md`](skills/http-pipeline/SKILL.md) | Handlers, retry policy, pipeline behavior. |
45+
| ASP.NET Core integration | [`skills/aspnetcore-integration/SKILL.md`](skills/aspnetcore-integration/SKILL.md) | `contentstack.management.aspnetcore` package and DI. |
46+
| Documentation (DocFX) | [`skills/documentation/SKILL.md`](skills/documentation/SKILL.md) | API docs under `docfx_project/`. |
47+
48+
An index with **when to use** hints is in [`skills/README.md`](skills/README.md).
49+
50+
## Using Cursor (optional)
51+
52+
If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) points to **`AGENTS.md`** and **`skills/`**—same docs as everyone else; no duplicated prose in `.cursor`.

skills/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Skills – Contentstack Management .NET SDK
2+
3+
Source of truth for detailed guidance. Read [`AGENTS.md`](../AGENTS.md) first, then open the skill that matches your task.
4+
5+
## Project context
6+
7+
| Area | This repo (CMA SDK) |
8+
| ---- | ------------------- |
9+
| **API** | [Content Management API (CMA)](https://www.contentstack.com/docs/developers/apis/content-management-api/) — not the Content Delivery API (CDA). |
10+
| **Packages** | `contentstack.management.csharp` (core), `contentstack.management.aspnetcore` (DI helpers). |
11+
| **HTTP** | `HttpClient` through [`ContentstackClient`](../Contentstack.Management.Core/ContentstackClient.cs) → runtime pipeline (`HttpHandler`, `RetryHandler`). |
12+
| **Language / tests** | C# 8, nullable enabled. **MSTest** on **net7.0**; unit tests use **Moq** and **AutoFixture** where existing tests do. |
13+
14+
## How to use these skills
15+
16+
- **In the repo:** open `skills/<folder>/SKILL.md` for the topic you need.
17+
- **In Cursor / other AI chats:** reference a skill by path, e.g. `skills/http-pipeline/SKILL.md` or `@skills/http-pipeline` if your tooling resolves that alias to this folder.
18+
19+
## Example prompts
20+
21+
- “Add a new CMA endpoint wrapper following `skills/contentstack-management-dotnet-sdk/SKILL.md`.”
22+
- “Adjust retry behavior for 429 responses using `skills/http-pipeline/SKILL.md` and update unit tests under `Contentstack.Management.Core.Unit.Tests/Runtime/Pipeline/`.”
23+
- “Write a unit test with MSTest + Moq following `skills/testing/SKILL.md`.”
24+
25+
## When to use which skill
26+
27+
| Skill folder | Use when |
28+
| ------------ | -------- |
29+
| [`dev-workflow/`](dev-workflow/) | Git branches, CI workflows, running build/test scripts, release/NuGet flow. |
30+
| [`contentstack-management-dotnet-sdk/`](contentstack-management-dotnet-sdk/) | `ContentstackClient`, options, authentication, public API and package boundaries. |
31+
| [`testing/`](testing/) | Writing or running unit/integration tests, MSTest, coverlet, local credentials. |
32+
| [`code-review/`](code-review/) | Preparing or reviewing a PR against this repository. |
33+
| [`framework/`](framework/) | Target frameworks, signing, NuGet packaging, OS-specific builds, high-level HTTP/runtime stack. |
34+
| [`csharp-style/`](csharp-style/) | C# language version, nullable usage, naming and folder layout consistent with the repo. |
35+
| [`http-pipeline/`](http-pipeline/) | Changing `HttpHandler`, `RetryHandler`, retry policy, or pipeline ordering. |
36+
| [`aspnetcore-integration/`](aspnetcore-integration/) | `Contentstack.Management.ASPNETCore` package, `IHttpClientFactory`, DI registration. |
37+
| [`documentation/`](documentation/) | Building or updating DocFX API documentation under `docfx_project/`. |
38+
39+
Each folder contains **`SKILL.md`** with YAML frontmatter (`name`, `description`).
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: aspnetcore-integration
3+
description: Use for the contentstack.management.aspnetcore package, HttpClient/DI registration with ASP.NET Core.
4+
---
5+
6+
# ASP.NET Core integration – Contentstack Management .NET SDK
7+
8+
## When to use
9+
10+
- Changing [`Contentstack.Management.ASPNETCore/`](../../Contentstack.Management.ASPNETCore/) or the NuGet package **`contentstack.management.aspnetcore`**.
11+
- Registering `ContentstackClient` with `IHttpClientFactory` / `IServiceCollection`.
12+
13+
## Instructions
14+
15+
### Package
16+
17+
- **Package ID:** `contentstack.management.aspnetcore`
18+
- **Target:** `netstandard2.1`
19+
- **Project:** [`contentstack.management.aspnetcore.csproj`](../../Contentstack.Management.ASPNETCore/contentstack.management.aspnetcore.csproj)
20+
21+
### Registration APIs
22+
23+
- [`ServiceCollectionExtensions`](../../Contentstack.Management.ASPNETCore/ServiceCollectionExtensions.cs) in namespace `Microsoft.Extensions.DependencyInjection`:
24+
- `AddContentstackClient(IServiceCollection, ContentstackClientOptions)` / `TryAddContentstackClient` — extend here when wiring options-based registration; keep behavior aligned with DI conventions.
25+
- `AddContentstackClient(IServiceCollection, Action<HttpClient>)` — registers `ContentstackClient` with **`AddHttpClient<ContentstackClient>`** for typed client configuration.
26+
27+
When extending DI support, align with Microsoft.Extensions.DependencyInjection and `Microsoft.Extensions.Http` patterns already referenced in the project file.
28+
29+
### Core dependency
30+
31+
- The ASP.NET Core project references the core management package; public types come from [`Contentstack.Management.Core`](../../Contentstack.Management.Core/).

skills/code-review/SKILL.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
name: code-review
3+
description: Use when reviewing or preparing a pull request for contentstack-management-dotnet.
4+
---
5+
6+
# Code review – Contentstack Management .NET SDK
7+
8+
## When to use
9+
10+
- Before requesting review or merging a PR.
11+
- When auditing changes for API safety, tests, and repo policies.
12+
13+
## Instructions
14+
15+
### Branch and merge expectations
16+
17+
- **Typical PRs** should target **`development`**. Use **`main`** as the base branch only for **hotfixes**.
18+
- **When the base is `main`:** only PRs from **`staging`** are allowed (enforced by [`.github/workflows/check-branch.yml`](../../.github/workflows/check-branch.yml)). Confirm head/base match team intent before approving.
19+
20+
### Summary checklist
21+
22+
- **Purpose:** Change matches the ticket/PR description; no unrelated refactors.
23+
- **Tests:** Unit tests updated or added for behavior changes; run `sh ./Scripts/run-unit-test-case.sh` locally for core changes. Integration tests only when behavior depends on live API—coordinate credentials.
24+
- **API compatibility:** Public surface (`ContentstackClient`, options, models) changes are intentional and versioned appropriately; avoid breaking changes without major bump and changelog.
25+
- **Security:** No secrets, tokens, or keys in source or commits; `appsettings.json` with real data must not be committed.
26+
- **Signing:** If assembly signing is affected, confirm `CSManagementSDK.snk` usage matches [`../framework/SKILL.md`](../framework/SKILL.md).
27+
- **Style:** Follow [`../csharp-style/SKILL.md`](../csharp-style/SKILL.md); match surrounding code.
28+
- **Documentation:** User-visible behavior changes reflected in `README.md` or package release notes when needed.
29+
30+
For markdown blocks to paste into PRs, copy from **PR review checklist (copy-paste)** below.
31+
32+
### Severity (optional labels)
33+
34+
- **Blocker:** Build or CI broken; security issue; violates branch policy.
35+
- **Major:** Missing tests for risky logic; breaking API without process.
36+
- **Minor:** Naming nits, non-user-facing cleanup.
37+
38+
### PR review checklist (copy-paste)
39+
40+
Copy sections into a PR comment when useful. This checklist is for **this** repo (`HttpClient` + pipeline + MSTest), **not** the Content Delivery .NET SDK.
41+
42+
#### Branch policy
43+
44+
```markdown
45+
- [ ] **Default:** PR targets **`development`** unless this is a documented **hotfix** to **`main`**
46+
- [ ] If base is **`main`**: head branch is **`staging`** (see `.github/workflows/check-branch.yml`)
47+
```
48+
49+
#### Breaking changes
50+
51+
```markdown
52+
- [ ] No public method/property removed or narrowed without deprecation / major version plan
53+
- [ ] `JsonProperty` / JSON names for API-facing models unchanged unless intentional and documented
54+
- [ ] New required `ContentstackClientOptions` fields have safe defaults or are optional
55+
- [ ] Strong naming: assembly signing still consistent if keys or `csproj` changed
56+
```
57+
58+
#### HTTP and pipeline
59+
60+
```markdown
61+
- [ ] New or changed HTTP calls go through existing client/pipeline (`ContentstackClient``IContentstackService` → pipeline), not ad-hoc `HttpClient` usage inside services without justification
62+
- [ ] Retry-sensitive changes reviewed alongside `RetryHandler` / `DefaultRetryPolicy` and unit tests under `Contentstack.Management.Core.Unit.Tests/Runtime/Pipeline/`
63+
- [ ] Headers, query params, and path segments align with CMA docs; no hardcoded production URLs where options.Host should be used
64+
```
65+
66+
#### Services and query API
67+
68+
```markdown
69+
- [ ] `IContentstackService` implementations set `ResourcePath`, `HttpMethod`, `Parameters` / `QueryResources` / `PathResources` / `Content` consistently with sibling services
70+
- [ ] New fluent `Query` methods only add to `ParameterCollection` with correct API parameter names
71+
```
72+
73+
#### Tests
74+
75+
```markdown
76+
- [ ] Unit tests use MSTest; `sh ./Scripts/run-unit-test-case.sh` passes for core changes
77+
- [ ] Integration tests only when needed; no secrets committed (`appsettings.json` stays local)
78+
```
79+
80+
#### Security and hygiene
81+
82+
```markdown
83+
- [ ] No API keys, tokens, or passwords in source or test data checked into git
84+
- [ ] OAuth / token handling does not log secrets
85+
```
86+
87+
#### Documentation
88+
89+
```markdown
90+
- [ ] User-visible behavior reflected in `README.md` or release notes when appropriate
91+
- [ ] `skills/` updated if agent/contributor workflow changed
92+
```

0 commit comments

Comments
 (0)