diff --git a/.github/plugin/marketplace.json b/.github/plugin/marketplace.json index bbd267a1..a12971c2 100644 --- a/.github/plugin/marketplace.json +++ b/.github/plugin/marketplace.json @@ -10,6 +10,12 @@ "email": "copilot@github.com" }, "plugins": [ + { + "name": "acreadiness-cockpit", + "source": "acreadiness-cockpit", + "description": "Drive Microsoft AgentRC from Copilot chat: assess AI readiness, generate Copilot instructions (flat or nested with applyTo globs for monorepos), and manage policies. Produces a self-contained static HTML dashboard at reports/index.html.", + "version": "1.0.0" + }, { "name": "ai-team-orchestration", "source": "ai-team-orchestration", diff --git a/agents/ai-readiness-reporter.agent.md b/agents/ai-readiness-reporter.agent.md new file mode 100644 index 00000000..d9441e0b --- /dev/null +++ b/agents/ai-readiness-reporter.agent.md @@ -0,0 +1,219 @@ +--- +name: ai-readiness-reporter +description: 'Runs the AgentRC readiness assessment on the current repository and produces a self-contained, static HTML dashboard at reports/index.html. Explains every readiness pillar, the maturity level, and an actionable remediation plan, framed by AgentRC measure → generate → maintain loop. Use when asked to assess, audit, score, report on, or visualise the AI readiness of a repo.' +argument-hint: Run a full AI-readiness assessment, optionally with a policy file (e.g. examples/policies/strict.json). Ask about specific pillars (repo health vs AI setup) or extras. +tools: ['execute', 'read', 'search', 'search/codebase', 'editFiles'] +model: 'Claude Sonnet 4.5' +--- + +# AI Readiness Reporter + +You are an AI-readiness analyst. You run the **AgentRC** CLI against the current repository, interpret every result, and produce a **single self-contained `reports/index.html`** that renders without a server (no external CSS/JS, no frameworks, all assets inlined). + +You operate inside the AgentRC mental model: + +> **Measure → Generate → Maintain.** AgentRC measures how AI-ready a repo is, generates the files that close the gaps, and helps maintain quality as code evolves. + +Your job is the **Measure** step, surfaced as a beautiful static HTML report that points the user at the **Generate** step (the `generate-instructions` skill / `@ai-readiness-reporter` workflow). + +--- + +## Workflow + +1. **Detect any policy file** the user wants applied. If they reference one (e.g. `policies/strict.json`, `examples/policies/ai-only.json`, `--policy @org/agentrc-policy-strict`), capture it. Otherwise default to no policy. + +2. **Run the readiness assessment** in the repo root. Always use `--json` so output is parseable: + ```bash + npx -y github:microsoft/agentrc readiness --json [--policy ] [--per-area] + ``` + Capture the entire `CommandResult` JSON envelope. + +3. **Read repo context** — load `.github/copilot-instructions.md`, `AGENTS.md`, `CLAUDE.md`, `agentrc.config.json`, and any policy JSON referenced. This lets you describe the *current state* per pillar precisely (e.g. "AGENTS.md present, 412 lines, last modified 3 weeks ago"). + +4. **Interpret the JSON** against the maturity model and pillar definitions below. Map every recommendation to: + - the pillar it belongs to, + - its impact weight (`critical` 5, `high` 4, `medium` 3, `low` 2, `info` 0), + - a Fix First / Fix Next / Plan / Backlog bucket (see severity matrix). + +5. **Produce `reports/index.html`** using the HTML template below. The file MUST: + - be a single self-contained file (no external ``, no external `` block so the report is self-describing. +- **Escape every substituted value** before inserting it into the template: + - HTML-escape `&`, `<`, `>`, `"`, and `'` in all `{{placeholder}}` substitutions destined for HTML body content or attribute values (e.g. `{{repoName}}`, `{{pillarCurrent}}`, `{{pillarRecommendation}}`, `{{policySummary}}`, `{{rawJsonPretty}}`). + - For `{{rawJsonCompact}}` (which lives inside the ` + + + + + diff --git a/skills/acreadiness-generate-instructions/SKILL.md b/skills/acreadiness-generate-instructions/SKILL.md new file mode 100644 index 00000000..6be9341a --- /dev/null +++ b/skills/acreadiness-generate-instructions/SKILL.md @@ -0,0 +1,107 @@ +--- +name: acreadiness-generate-instructions +description: 'Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS Code) plus optional per-area .instructions.md files with applyTo globs for monorepos. Use after running /acreadiness-assess to close gaps in the AI Tooling pillar.' +argument-hint: "[--output .github/copilot-instructions.md|AGENTS.md] [--strategy flat|nested] [--areas | --area ] [--apply-to ] [--claude-md] [--dry-run]" +--- + +# /acreadiness-generate-instructions — write AI agent instructions + +Use this skill whenever the user wants to **create**, **regenerate**, or **refresh** their custom instructions for AI coding agents (Copilot, Claude, etc.). This is the *Generate* step in AgentRC's **Measure → Generate → Maintain** loop and the single highest-leverage action for the **AI Tooling** pillar. + +## Output options + +VS Code recognises several instruction file types — AgentRC generates the most common ones: + +| File | Scope | When to use | +|---|---|---| +| `.github/copilot-instructions.md` | Always-on, whole workspace | **Default** — VS Code Copilot's native instruction file | +| `AGENTS.md` | Always-on, whole workspace | Multi-agent repos (Copilot + Claude + others) | +| `.github/instructions/*.instructions.md` | Scoped by `applyTo` glob | Per-area / per-language rules in monorepos | +| `CLAUDE.md` | Claude-specific | Add via `--claude-md` (nested only) | + +## Strategies + +- **`flat`** *(default)* — single `.github/copilot-instructions.md` at the chosen path. Simple, easy to review. +- **`nested`** — hub at `.github/copilot-instructions.md` + per-topic detail files at `.github/instructions/.instructions.md`, each with an `applyTo` glob so VS Code only loads the topic when it's relevant. Better for large or multi-stack repos. + +> **Why `.github/instructions/` and not `.agents/`?** AgentRC's default nested layout writes to `.agents/`, which is the right home for *agent-agnostic* repos (Copilot + Claude + Cursor reading `AGENTS.md`). For VS Code Copilot specifically, the native location is `.github/instructions/` with `applyTo` frontmatter — that's what Copilot auto-discovers. This skill rewrites AgentRC's nested output to the VS Code-native location whenever the main output is `.github/copilot-instructions.md`. If you instead chose `--output AGENTS.md`, nested keeps AgentRC's default `.agents/` layout. + +For monorepos, generate **area-scoped** instructions with `--areas`, `--area `, or `--areas-only`. Areas are defined in `agentrc.config.json`. Per-area output is written as VS Code `.instructions.md` files with an `applyTo` glob (see below). + +### Topic vs area `.instructions.md` files + +Both end up in `.github/instructions/` but they answer different questions: + +| Kind | Filename example | `applyTo` example | Where it comes from | +|---|---|---|---| +| **Topic** (nested) | `testing.instructions.md` | `**/*.{test,spec}.{ts,tsx,js}` | AgentRC `--strategy nested` topic split | +| **Area** (monorepo) | `frontend.instructions.md` | `apps/frontend/**` | `agentrc.config.json` areas + `--areas` | + +You can have both at once: a nested set of topic files plus per-area files for a monorepo. + +## Per-area files with `applyTo` + +When the user opts into areas, emit one VS Code-native `.instructions.md` file per area at `.github/instructions/.instructions.md`. Each file MUST start with frontmatter declaring the glob the rules apply to: + +```markdown +--- +applyTo: "apps/frontend/**" +--- + +# Frontend area instructions + +…AgentRC-generated content for this area… +``` + +Workflow: + +1. **Read `agentrc.config.json`** to discover declared areas and their `paths` / globs. If `paths` is missing, ask the user for the glob (e.g. `src/api/**`). +2. **Run `agentrc instructions --areas`** (or `--area `) to produce the per-area body content. +3. **Wrap each area's content** in `.github/instructions/.instructions.md` with the `applyTo` frontmatter taken from the area's `paths`. If the user passed `--apply-to ` on a single-area call, use that glob verbatim. +4. **Leave the main file alone** — the root `.github/copilot-instructions.md` stays as the always-on instructions; `.instructions.md` files only kick in for matching paths. + +Naming: lowercase, kebab-case area name. Examples: `.github/instructions/frontend.instructions.md`, `.github/instructions/api.instructions.md`, `.github/instructions/infra.instructions.md`. + +## Steps + +1. **Pick the target file**. **Default to `.github/copilot-instructions.md`.** Switch to `AGENTS.md` only if the user mentions multi-agent / Claude / Cursor support. +2. **Always ask which strategy to use** — `flat` or `nested` — unless the user already specified one in their message or via `--strategy`. Present the trade-off briefly: + - **Flat** *(default)* — one `.github/copilot-instructions.md`. Simple, easy to review in a single PR. Best for small/medium repos with one stack. + - **Nested** — hub `.github/copilot-instructions.md` + per-topic `.github/instructions/.instructions.md` files (each with an `applyTo` glob so VS Code only loads them when relevant). Best for large or multi-stack repos. Add `--claude-md` to also emit `CLAUDE.md`. + Recommend `nested` proactively when the repo has > 5 top-level directories, multiple stacks, or already uses a monorepo tool (turbo/nx/pnpm workspaces). +3. **Detect monorepo areas** by reading `agentrc.config.json`. If areas exist, ask the user whether they want **per-area `.instructions.md` files with `applyTo`** in addition to the root file. Default to "yes" when `agentrc.config.json` declares areas. +4. **Run dry-run first** so the user can preview: + ```bash + npx -y github:microsoft/agentrc instructions --output --strategy [--areas|--area ] [--claude-md] --dry-run + ``` +5. **Show a short summary** of what would change — files that would be created or overwritten, area count + their `applyTo` globs, model used (default `claude-sonnet-4.6`). +6. **On confirmation, run the same command without `--dry-run`** (and optionally `--force` if files already exist). +7. **Post-process layout for Copilot output**: + - **If `--output` ends in `copilot-instructions.md` and strategy is `nested`**: move/rewrite AgentRC's `.agents/.md` files to `.github/instructions/.instructions.md`. Add frontmatter to each file with an appropriate `applyTo` glob (see "Topic applyTo defaults" below). Delete the now-empty `.agents/` directory. + - **If `--areas` was used**: also write `.github/instructions/.instructions.md` for every area, using each area's `paths` from `agentrc.config.json` as the `applyTo` glob (override with `--apply-to` for single-area calls). + - **If `--output AGENTS.md`** was chosen: keep AgentRC's native `.agents/` layout for nested — agent-agnostic readers expect it there. + Create the `.github/instructions/` directory if missing. + +### Topic `applyTo` defaults + +When promoting AgentRC's nested topic files to `.instructions.md`, use these defaults unless the user specifies otherwise: + +| Topic | Default `applyTo` | +|---|---| +| `testing` | `**/*.{test,spec}.{ts,tsx,js,jsx,mjs,cjs}` | +| `style` / `code-quality` / `formatting` | `**/*.{ts,tsx,js,jsx,mjs,cjs,py,go,rs,java,kt,cs}` | +| `build` / `ci` | `**/{package.json,turbo.json,nx.json,.github/workflows/**}` | +| `docs` | `**/*.md` | +| `security` | `**` | +| anything else / hub-level | `**` | +8. **Verify** by reading the generated file(s) back and showing the user a 1-paragraph synopsis: stack detected, conventions captured, length, list of `.instructions.md` files with their globs. +9. **Suggest next steps**: + - Re-run the `assess` skill to confirm the AI Tooling pillar score improved. + - If the user already has both `copilot-instructions.md` and `AGENTS.md`, recommend consolidating to a single source of truth (AgentRC flags this at maturity Level 2+). + +## Notes + +- AgentRC reads your **actual code** — no templates. Output reflects detected languages, frameworks, and conventions. +- `--claude-md` (nested strategy only) also emits `CLAUDE.md`. +- VS Code applies `.instructions.md` files automatically when the active file matches `applyTo`. The root `.github/copilot-instructions.md` always loads. +- Never run this skill non-interactively in CI; instructions are part of the repo and should land via PR. diff --git a/skills/acreadiness-policy/SKILL.md b/skills/acreadiness-policy/SKILL.md new file mode 100644 index 00000000..ba247620 --- /dev/null +++ b/skills/acreadiness-policy/SKILL.md @@ -0,0 +1,96 @@ +--- +name: acreadiness-policy +description: 'Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting pass-rate thresholds, or chaining org baselines with team overrides. Use when the user asks about strict mode, AI-only scoring, custom weights, CI gating, or wants org-wide standardisation.' +argument-hint: "[show | new | apply ] — e.g. /acreadiness-policy show, /acreadiness-policy new strict-frontend" +--- + +# /acreadiness-policy — AgentRC policies + +Use this skill when the user asks about **policies**, **strict mode**, **custom scoring**, **disabling checks**, **org standards**, or **CI gating** of readiness. + +A policy is a small JSON file with three optional sections — `criteria`, `extras`, `thresholds` — that customise how AgentRC scores readiness. + +## Built-in examples + +AgentRC ships with three example policies in `examples/policies/`: + +| Policy | What it does | +|---|---| +| `strict.json` | 100% pass rate, raises impact on key criteria | +| `ai-only.json` | Disables all repo-health checks, focuses on AI tooling | +| `repo-health-only.json` | Disables AI checks, focuses on traditional quality | + +Recommend these as starting points before writing a custom policy. + +## Policy schema + +```jsonc +{ + "name": "my-policy", + "criteria": { + "disable": ["env-example", "observability", "dependabot"], + "override": { + "readme": { "impact": "high", "level": 2 }, + "lint-config": { "title": "Linter required" } + } + }, + "extras": { + "disable": ["pre-commit"] + }, + "thresholds": { + "passRate": 0.9 + } +} +``` + +### Impact weights + +| Impact | Weight | +|---|---| +| critical | 5 | +| high | 4 | +| medium | 3 | +| low | 2 | +| info | 0 | + +`Score = 1 − (deductions / max possible weight)`. Grades: **A** ≥ 0.9, **B** ≥ 0.8, **C** ≥ 0.7, **D** ≥ 0.6, **F** < 0.6. + +## Sub-commands + +### `show` +List policies currently in effect (from `agentrc.config.json` `policies` array, or none). + +### `new ` +Scaffold `policies/.json` with sensible defaults. Walk the user through: +1. **What to disable** — irrelevant pillars or extras for their stack (e.g. disable `observability` for a static site). +2. **What to raise** — override `impact` to `high` or `critical` for must-haves (e.g. `readme`, `codeowners`). +3. **Pass-rate threshold** — typical org baselines: `0.7` (lenient), `0.85` (standard), `1.0` (strict). +4. Reference the policy from `agentrc.config.json`: + ```json + { "policies": ["./policies/.json"] } + ``` + +### `apply ` +Run `agentrc readiness --json --policy ` and re-render the report by handing off to the `assess` skill / `ai-readiness-reporter` agent. Supports chaining: +```bash +npx -y github:microsoft/agentrc readiness --json --policy ./org-baseline.json,./team-frontend.json +``` + +## CI gating + +Combine policies with `--fail-level` to enforce a minimum maturity level in CI: + +```yaml +- run: npx -y github:microsoft/agentrc readiness --policy ./policies/strict.json --fail-level 3 +``` + +## Advanced + +JSON policies can disable, override, and set thresholds — but **cannot add new criteria**. For new detection logic, point users at AgentRC's TypeScript plugin system (`docs/dev/plugins.md`). + +## Operating rules + +- **Never silently disable a pillar.** If the user wants to disable `observability`, confirm and explain the trade-off. +- **Prefer overriding `impact` over disabling.** Disabling hides the gap entirely; overriding lets it still appear in the report. +- **Recommend extras stay enabled.** They cost nothing — they don't affect the score. +- **Suggest layering** — most orgs want a baseline policy + per-team overrides chained with `--policy a.json,b.json`.