modify skill and plugin
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
---
|
||||
name: agents-md-improver
|
||||
description: Audit and improve Codex AGENTS.md and AGENTS.override.md files in repositories. Use when the user asks to check, audit, update, improve, fix, optimize, or maintain AGENTS.md files, Codex project instructions, or agent guidance.
|
||||
---
|
||||
|
||||
# AGENTS.md Improver
|
||||
|
||||
Audit, evaluate, and improve Codex instruction files so future Codex sessions get concise, current, actionable project context.
|
||||
|
||||
This skill can write to AGENTS.md files. Always present a quality report and proposed diffs before editing. Only apply changes after the user approves the exact target files or has explicitly asked you to apply a specific diff.
|
||||
|
||||
## Codex Instruction Model
|
||||
|
||||
Codex discovers guidance in this order:
|
||||
|
||||
1. Global scope: `~/.codex/AGENTS.override.md` if present, otherwise `~/.codex/AGENTS.md`.
|
||||
2. Project scope: from the project root toward the current working directory. In each directory, Codex checks `AGENTS.override.md`, then `AGENTS.md`, then configured fallback names.
|
||||
3. Merge order: root guidance appears first; files closer to the current directory appear later and can override earlier guidance.
|
||||
|
||||
Use `AGENTS.override.md` for stronger or more specific overrides. Use `AGENTS.md` for normal shared guidance.
|
||||
|
||||
## Workflow
|
||||
|
||||
### Phase 1: Discovery
|
||||
|
||||
Find repository instruction files:
|
||||
|
||||
```powershell
|
||||
rg --files -g 'AGENTS.md' -g 'AGENTS.override.md'
|
||||
```
|
||||
|
||||
When the user asks about global defaults too, inspect:
|
||||
|
||||
```powershell
|
||||
Test-Path "$env:USERPROFILE/.codex/AGENTS.md"
|
||||
Test-Path "$env:USERPROFILE/.codex/AGENTS.override.md"
|
||||
```
|
||||
|
||||
Also inspect relevant project files that prove current reality:
|
||||
|
||||
- Package or build manifests: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Makefile`, `justfile`, workflow files.
|
||||
- Repo structure: top-level directories and any nested package boundaries.
|
||||
- Test and lint configuration.
|
||||
- Existing `.codex/config.toml`, hooks, and project-specific scripts.
|
||||
|
||||
Prefer `rg` and `rg --files` for search. Use the repo's existing conventions before proposing new sections.
|
||||
|
||||
### Phase 2: Quality Assessment
|
||||
|
||||
For each file, evaluate against `references/quality-criteria.md`.
|
||||
|
||||
Score out of 100:
|
||||
|
||||
| Criterion | Points |
|
||||
| --- | ---: |
|
||||
| Commands and workflows | 20 |
|
||||
| Architecture clarity | 20 |
|
||||
| Non-obvious patterns | 15 |
|
||||
| Conciseness | 15 |
|
||||
| Currency | 15 |
|
||||
| Actionability | 15 |
|
||||
|
||||
Grades:
|
||||
|
||||
- A: 90-100, comprehensive, current, actionable.
|
||||
- B: 70-89, good coverage with minor gaps.
|
||||
- C: 50-69, basic info with important gaps.
|
||||
- D: 30-49, sparse or outdated.
|
||||
- F: 0-29, missing or severely outdated.
|
||||
|
||||
### Phase 3: Quality Report
|
||||
|
||||
Always output the report before edits:
|
||||
|
||||
```markdown
|
||||
## AGENTS.md Quality Report
|
||||
|
||||
### Summary
|
||||
- Files found: X
|
||||
- Average score: X/100
|
||||
- Files needing update: X
|
||||
|
||||
### File-by-File Assessment
|
||||
|
||||
#### 1. ./AGENTS.md
|
||||
**Score: XX/100 (Grade: X)**
|
||||
|
||||
| Criterion | Score | Notes |
|
||||
| --- | ---: | --- |
|
||||
| Commands/workflows | X/20 | ... |
|
||||
| Architecture clarity | X/20 | ... |
|
||||
| Non-obvious patterns | X/15 | ... |
|
||||
| Conciseness | X/15 | ... |
|
||||
| Currency | X/15 | ... |
|
||||
| Actionability | X/15 | ... |
|
||||
|
||||
**Issues:**
|
||||
- ...
|
||||
|
||||
**Recommended additions:**
|
||||
- ...
|
||||
```
|
||||
|
||||
### Phase 4: Targeted Updates
|
||||
|
||||
Propose only changes that help future Codex sessions:
|
||||
|
||||
- Real commands or workflows discovered during analysis.
|
||||
- Current architecture facts that are not obvious from filenames.
|
||||
- Gotchas, environment quirks, or testing approaches that save rediscovery.
|
||||
- Repository-specific rules that affect how Codex should edit or verify work.
|
||||
|
||||
Avoid:
|
||||
|
||||
- Generic best practices.
|
||||
- Obvious descriptions of self-named classes or directories.
|
||||
- Verbose explanations where one line is enough.
|
||||
- One-off fixes unlikely to recur.
|
||||
- Instructions that contradict higher-priority user or project guidance.
|
||||
|
||||
Show every proposed change as a focused diff:
|
||||
|
||||
```markdown
|
||||
### Update: ./AGENTS.md
|
||||
|
||||
**Why:** The repo has a lint command but the current instructions do not mention verification.
|
||||
|
||||
```diff
|
||||
+## Commands
|
||||
+
|
||||
+`npm run lint` - Run ESLint before handing off frontend changes.
|
||||
```
|
||||
```
|
||||
|
||||
### Phase 5: Apply Approved Updates
|
||||
|
||||
After approval, edit only approved files. Preserve existing structure when it is clear. If a file is mostly placeholder content, replace it with a concise project-specific structure using `references/templates.md`.
|
||||
|
||||
Before finalizing, validate:
|
||||
|
||||
- Commands exist and are named correctly.
|
||||
- Paths are real.
|
||||
- Each addition is project-specific.
|
||||
- The result stays concise enough to be prompt-friendly.
|
||||
- Nested `AGENTS.override.md` files do not accidentally hide useful `AGENTS.md` guidance in the same directory.
|
||||
|
||||
## References
|
||||
|
||||
- `references/quality-criteria.md` - scoring rubric.
|
||||
- `references/templates.md` - concise AGENTS.md templates.
|
||||
- `references/update-guidelines.md` - what to add and what to avoid.
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
# AGENTS.md Quality Criteria
|
||||
|
||||
## Scoring Rubric
|
||||
|
||||
### 1. Commands and Workflows - 20 points
|
||||
|
||||
20 points: all essential commands documented with context.
|
||||
|
||||
- Build, test, lint, format, dev, and deploy commands are present when relevant.
|
||||
- Development workflow is clear.
|
||||
- Common operations and verification expectations are documented.
|
||||
|
||||
15 points: most commands present, some missing context.
|
||||
|
||||
10 points: basic commands only, little workflow.
|
||||
|
||||
5 points: few commands, many missing.
|
||||
|
||||
0 points: no commands documented.
|
||||
|
||||
### 2. Architecture Clarity - 20 points
|
||||
|
||||
20 points: clear codebase map.
|
||||
|
||||
- Key directories explained.
|
||||
- Module relationships documented.
|
||||
- Entry points identified.
|
||||
- Data flow described where relevant.
|
||||
|
||||
15 points: good structure overview, minor gaps.
|
||||
|
||||
10 points: basic directory listing only.
|
||||
|
||||
5 points: vague or incomplete.
|
||||
|
||||
0 points: no architecture info.
|
||||
|
||||
### 3. Non-Obvious Patterns - 15 points
|
||||
|
||||
15 points: gotchas and quirks captured.
|
||||
|
||||
- Known issues documented.
|
||||
- Workarounds explained.
|
||||
- Edge cases noted.
|
||||
- Unusual "why this way" rules explained briefly.
|
||||
|
||||
10 points: some patterns documented.
|
||||
|
||||
5 points: minimal pattern documentation.
|
||||
|
||||
0 points: no patterns or gotchas.
|
||||
|
||||
### 4. Conciseness - 15 points
|
||||
|
||||
15 points: dense, valuable content.
|
||||
|
||||
- No filler or obvious info.
|
||||
- Each line adds value.
|
||||
- No redundancy with code comments or README basics unless Codex specifically needs it.
|
||||
|
||||
10 points: mostly concise, some padding.
|
||||
|
||||
5 points: verbose in places.
|
||||
|
||||
0 points: mostly filler or restates obvious code.
|
||||
|
||||
### 5. Currency - 15 points
|
||||
|
||||
15 points: reflects current codebase.
|
||||
|
||||
- Commands work as documented.
|
||||
- File references are accurate.
|
||||
- Tech stack and architecture are current.
|
||||
|
||||
10 points: mostly current, minor staleness.
|
||||
|
||||
5 points: several outdated references.
|
||||
|
||||
0 points: severely outdated.
|
||||
|
||||
### 6. Actionability - 15 points
|
||||
|
||||
15 points: instructions are executable.
|
||||
|
||||
- Commands can be copied and run.
|
||||
- Steps are concrete.
|
||||
- Paths are real.
|
||||
- Verification expectations are clear.
|
||||
|
||||
10 points: mostly actionable.
|
||||
|
||||
5 points: some vague instructions.
|
||||
|
||||
0 points: vague or theoretical.
|
||||
|
||||
## Assessment Process
|
||||
|
||||
1. Read each instruction file completely.
|
||||
2. Cross-reference with the actual codebase.
|
||||
3. Check documented commands against package manifests, scripts, and config.
|
||||
4. Verify file and directory references.
|
||||
5. Score each criterion.
|
||||
6. Calculate total and assign grade.
|
||||
7. List specific issues.
|
||||
8. Propose concrete, concise improvements.
|
||||
|
||||
## Red Flags
|
||||
|
||||
- Commands that would fail.
|
||||
- References to deleted files or folders.
|
||||
- Outdated tech versions.
|
||||
- Placeholder template content.
|
||||
- Generic advice not specific to the project.
|
||||
- Duplicate or contradictory guidance across nested instruction files.
|
||||
- An `AGENTS.override.md` that accidentally hides a sibling `AGENTS.md`.
|
||||
@@ -0,0 +1,180 @@
|
||||
# AGENTS.md Templates
|
||||
|
||||
## Key Principles
|
||||
|
||||
- Concise: dense, human-readable content; one line per concept when possible.
|
||||
- Actionable: commands should be copy-paste ready.
|
||||
- Project-specific: document patterns unique to this repo.
|
||||
- Current: reflect the actual codebase and active tooling.
|
||||
- Scoped: put broad rules at the repo root; put narrow rules in nested `AGENTS.md` or `AGENTS.override.md`.
|
||||
|
||||
## Recommended Sections
|
||||
|
||||
Use only sections that matter for the project.
|
||||
|
||||
### Commands
|
||||
|
||||
```markdown
|
||||
## Commands
|
||||
|
||||
| Command | Purpose |
|
||||
| --- | --- |
|
||||
| `<install command>` | Install dependencies |
|
||||
| `<dev command>` | Start development server |
|
||||
| `<build command>` | Production build |
|
||||
| `<test command>` | Run tests |
|
||||
| `<lint command>` | Lint or format |
|
||||
```
|
||||
|
||||
### Architecture
|
||||
|
||||
```markdown
|
||||
## Architecture
|
||||
|
||||
```
|
||||
<root>/
|
||||
<dir>/ # <purpose>
|
||||
<dir>/ # <purpose>
|
||||
<dir>/ # <purpose>
|
||||
```
|
||||
```
|
||||
|
||||
### Key Files
|
||||
|
||||
```markdown
|
||||
## Key Files
|
||||
|
||||
- `<path>` - <purpose>
|
||||
- `<path>` - <purpose>
|
||||
```
|
||||
|
||||
### Code Style
|
||||
|
||||
```markdown
|
||||
## Code Style
|
||||
|
||||
- <project-specific convention>
|
||||
- <preference over alternative>
|
||||
```
|
||||
|
||||
### Environment
|
||||
|
||||
```markdown
|
||||
## Environment
|
||||
|
||||
Required:
|
||||
- `<VAR_NAME>` - <purpose>
|
||||
|
||||
Setup:
|
||||
- <setup step>
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```markdown
|
||||
## Testing
|
||||
|
||||
- `<test command>` - <what it tests>
|
||||
- <testing convention or pattern>
|
||||
```
|
||||
|
||||
### Gotchas
|
||||
|
||||
```markdown
|
||||
## Gotchas
|
||||
|
||||
- <non-obvious issue, prerequisite, or ordering dependency>
|
||||
```
|
||||
|
||||
### Workflow
|
||||
|
||||
```markdown
|
||||
## Workflow
|
||||
|
||||
- <when to do X>
|
||||
- <preferred approach for Y>
|
||||
```
|
||||
|
||||
## Minimal Project Root Template
|
||||
|
||||
```markdown
|
||||
# <Project Name>
|
||||
|
||||
<One-line description>
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Purpose |
|
||||
| --- | --- |
|
||||
| `<command>` | <description> |
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
<structure>
|
||||
```
|
||||
|
||||
## Gotchas
|
||||
|
||||
- <gotcha>
|
||||
```
|
||||
|
||||
## Comprehensive Project Root Template
|
||||
|
||||
```markdown
|
||||
# <Project Name>
|
||||
|
||||
<One-line description>
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Purpose |
|
||||
| --- | --- |
|
||||
| `<command>` | <description> |
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
<structure with descriptions>
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
- `<path>` - <purpose>
|
||||
|
||||
## Code Style
|
||||
|
||||
- <convention>
|
||||
|
||||
## Environment
|
||||
|
||||
- `<VAR>` - <purpose>
|
||||
|
||||
## Testing
|
||||
|
||||
- `<command>` - <scope>
|
||||
|
||||
## Gotchas
|
||||
|
||||
- <gotcha>
|
||||
```
|
||||
|
||||
## Nested Override Template
|
||||
|
||||
Use this for a subdirectory whose rules differ from the repo root.
|
||||
|
||||
```markdown
|
||||
# <Directory> Instructions
|
||||
|
||||
## Scope
|
||||
|
||||
- Applies to `<path>/`.
|
||||
|
||||
## Local Rules
|
||||
|
||||
- <specific rule that differs from root guidance>
|
||||
|
||||
## Verification
|
||||
|
||||
- `<command>` - <focused check for this directory>
|
||||
```
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
# AGENTS.md Update Guidelines
|
||||
|
||||
## Core Principle
|
||||
|
||||
Only add information that will genuinely help future Codex sessions. The context window is precious; every line must earn its place.
|
||||
|
||||
## What To Add
|
||||
|
||||
### Commands and Workflows Discovered
|
||||
|
||||
```markdown
|
||||
## Commands
|
||||
|
||||
`npm run build` - Production build.
|
||||
`npm run lint` - ESLint check required before handoff.
|
||||
```
|
||||
|
||||
Why: saves future sessions from rediscovering commands.
|
||||
|
||||
### Gotchas and Non-Obvious Patterns
|
||||
|
||||
```markdown
|
||||
## Gotchas
|
||||
|
||||
- Tests must run sequentially because they share a local database.
|
||||
- Regenerate API clients with `npm run codegen` after editing OpenAPI files.
|
||||
```
|
||||
|
||||
Why: prevents repeated debugging.
|
||||
|
||||
### Package Relationships
|
||||
|
||||
```markdown
|
||||
## Architecture
|
||||
|
||||
- `packages/api` owns route handlers; `packages/ui` must call it through the shared client.
|
||||
```
|
||||
|
||||
Why: captures relationships that are not obvious from filenames.
|
||||
|
||||
### Testing Approaches That Worked
|
||||
|
||||
```markdown
|
||||
## Testing
|
||||
|
||||
- API endpoint tests use `tests/helpers/request.ts`; avoid ad hoc server setup.
|
||||
```
|
||||
|
||||
Why: establishes known-good patterns.
|
||||
|
||||
### Configuration Quirks
|
||||
|
||||
```markdown
|
||||
## Environment
|
||||
|
||||
- `NEXT_PUBLIC_*` variables must be set at build time.
|
||||
```
|
||||
|
||||
Why: environment details often waste time when omitted.
|
||||
|
||||
## What Not To Add
|
||||
|
||||
### Obvious Code Info
|
||||
|
||||
Bad:
|
||||
|
||||
```markdown
|
||||
The `UserService` class handles user operations.
|
||||
```
|
||||
|
||||
The class name already says that.
|
||||
|
||||
### Generic Best Practices
|
||||
|
||||
Bad:
|
||||
|
||||
```markdown
|
||||
Always write tests for new features.
|
||||
Use meaningful variable names.
|
||||
```
|
||||
|
||||
Add only project-specific rules.
|
||||
|
||||
### One-Off Fixes
|
||||
|
||||
Bad:
|
||||
|
||||
```markdown
|
||||
We fixed a bug where the login button did not work.
|
||||
```
|
||||
|
||||
Unless the lesson is durable, leave it out.
|
||||
|
||||
### Verbose Explanations
|
||||
|
||||
Bad:
|
||||
|
||||
```markdown
|
||||
The authentication system uses JWT tokens. JWT means JSON Web Token...
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```markdown
|
||||
Auth: JWT HS256 tokens in `Authorization: Bearer <token>`.
|
||||
```
|
||||
|
||||
## Diff Format
|
||||
|
||||
For each suggested change:
|
||||
|
||||
```markdown
|
||||
### Update: ./AGENTS.md
|
||||
|
||||
**Why:** The build command exists but was missing from project instructions.
|
||||
|
||||
```diff
|
||||
+## Commands
|
||||
+
|
||||
+`npm run build` - Production build.
|
||||
```
|
||||
```
|
||||
|
||||
## Validation Checklist
|
||||
|
||||
- Each addition is project-specific.
|
||||
- No generic advice or obvious info.
|
||||
- Commands are verified against the repo.
|
||||
- File paths are accurate.
|
||||
- The wording is concise.
|
||||
- A new Codex session would benefit from the line.
|
||||
Reference in New Issue
Block a user