Skip to content

Agent Guide - #474

Open
ChengShi-1 wants to merge 3 commits into
developfrom
AgentSkill
Open

Agent Guide#474
ChengShi-1 wants to merge 3 commits into
developfrom
AgentSkill

Conversation

@ChengShi-1

@ChengShi-1 ChengShi-1 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds an AGENTS.md at the repo root. Claude generated the initial draft as a skill, and I added notes and questions based on problems I encountered while working with it, including how to handle flaky tests and how to verify API behavior before writing new use cases.

Additional guidance is welcome, especially rules that could reduce hallucinations and improve the agent’s accuracy and overall performance.

A human readable format, link for AGENTS.md: https://github.com/IQSS/dataverse-client-javascript/blob/d90e9b009849a7c8f88543e5ef3905571d55cc1f/AGENTS.md

Which issue(s) this PR closes:

  • Closes #

Related Dataverse PRs:

  • Depends on #

Special notes for your reviewer:

GitHub Copilot can read for every chat and PR-review interaction in this repo by design; that's the entire reason that file exists.

Tools that natively support the AGENTS.md convention (Cursor, Codex, and others converging on it) load it as ambient context automatically too. Zero prompt needed. Codex or Copilot auto-discovers AGENTS.md at the repo root and loads it as instructions for every session in that repo.

Suggestions on how to test this:

No functional code changed; this is documentation only.

Is there a release notes or changelog update needed for this change?:

No. This only adds contributor/agent documentation; it doesn't change any use case, public API, or behavior.

Additional documentation:

  • AGENTS.md

Comment thread .github/copilot-instructions.md Outdated
@@ -0,0 +1,165 @@
# Copilot instructions: dataverse-client-javascript

This file is a copy of [AGENTS.md](../AGENTS.md) at the repository root, kept here because this is the path GitHub Copilot reads automatically for repository-wide chat and code-review context. Keep both in sync.

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.

Please check this out: https://docs.github.com/en/enterprise-cloud@latest/copilot/tutorials/cloud-agent/get-the-best-results#adding-custom-instructions-to-your-repository

Here's a screenshot:

Image

I think this means we can safely delete the .github/copilot-instructions.md file. No syncing! 🎉

p.s. I found those docs via https://github.blog/changelog/2025-08-28-copilot-coding-agent-now-supports-agents-md-custom-instructions/

@ChengShi-1
ChengShi-1 marked this pull request as ready for review August 5, 2026 14:54
Copilot AI lite review requested due to automatic review settings August 5, 2026 14:54

Copilot AI 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.

Pull request overview

Adds a new repository-root AGENTS.md meant to serve as the canonical “agent guide” for AI tools and contributors working in this SDK repo, documenting architecture, HTTP/auth behavior, and testing/CI workflows.

Changes:

  • Introduces AGENTS.md describing the SDK’s clean-architecture layering and composition-root pattern.
  • Documents HTTP/auth configuration patterns and common “gotchas”.
  • Documents test suite structure (unit/integration/functional) and CI workflow expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AGENTS.md
Comment on lines +46 to +49
- `ApiRepository`, in `src/core/infra/repositories/`, is the base class every `<Domain>Repository` extends. It exposes `doGet`, `doPost`, `doPut`, `doDelete`, thin wrappers around axios.
- `ApiConfig` is a global singleton holding the configured `dataverseApiUrl` and auth mechanism (`API_KEY`, `SESSION_COOKIE`, or `BEARER_TOKEN`), set once via `ApiConfig.init(...)`.
- Every `doGet`/`doPost` call takes an `authRequired: boolean` as an explicit argument. When `true`, `buildRequestConfig` (in `apiConfigBuilders.ts`) attaches whichever credential `ApiConfig` currently holds: an `X-Dataverse-key` header for `API_KEY`, a cookie for `SESSION_COOKIE`, or an `Authorization: Bearer` header for `BEARER_TOKEN`. When `false`, no ambient credential is attached at all, regardless of what's configured.
- Dataverse itself accepts an API key, or any equivalent token, via the `X-Dataverse-key` header or a `?key=` query parameter; either works, for any authenticated endpoint. That equivalence is why token-based access (see Preview URLs below) can be threaded through as a query param without touching the auth-mechanism plumbing at all.
Comment thread AGENTS.md
Comment on lines +113 to +118
| Command | Config | Docker? |
| ------------------------------------- | ---------------------------- | -------------------------------------------- |
| `npm run test:unit` | `jest.config.unit.ts` | No: `globalSetup` is deleted for this config |
| `npm run test:integration` | `jest.config.integration.ts` | Yes, full stack |
| `npm run test:functional` | `jest.config.functional.ts` | Yes |
| `npm test` / `jest -c jest.config.ts` | base config | Yes, runs everything including unit |
Comment thread AGENTS.md
5. **Link the backend PR** in the "Related Dataverse PRs" field when this SDK change depends on one, the same PR the "Finding the API spec" section above points to when an endpoint isn't documented yet.
6. **Match the existing commit-message convention**: recent history uses a `type: description` prefix (`feat: ...`, `fix: ...`, `chore(deps): ...`), even though it isn't formally enforced.

`deploy_pr.yml` runs three CI jobs on every PR: `test-unit`, `test-integration`, and `test-functional` (the last only after integration passes). This is the actual enforcement behind step 7 of the use-case recipe: skipping integration tests locally still means CI runs them before merge.
Comment thread AGENTS.md

## Git hygiene

The `.husky/pre-commit` hook runs `npm run format && npm run typecheck && npm run lint:fix && git add .`. That final `git add .` stages every modified or untracked file in the working tree, not just what got `git add`ed deliberately. Unrelated in-progress edits sitting in the working tree at commit time get swept in regardless of intent. Set aside anything that shouldn't be bundled before committing, for example with `git stash push -- <path>`, or by copying it elsewhere and restoring it after.
@ChengShi-1 ChengShi-1 moved this to Ready for Review ⏩ in IQSS Dataverse Project Aug 5, 2026
@ChengShi-1 ChengShi-1 added Size: 3 A percentage of a sprint. 2.1 hours. GREI Re-arch GREI re-architecture-related SPA FY26 Sprint 3 (2025-07-30 - 2025-08-13) labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 3 (2025-07-30 - 2025-08-13) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours. SPA

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

3 participants