modify skill and plugin

This commit is contained in:
NINI
2026-05-13 22:27:48 +09:00
parent d414338780
commit 2d59191df2
24 changed files with 2051 additions and 1 deletions
@@ -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.
@@ -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>
```
@@ -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.
@@ -0,0 +1,97 @@
---
name: revise-agents-md
description: Capture durable learnings from the current Codex session into AGENTS.md or AGENTS.override.md. Use when the user asks to revise AGENTS.md, update Codex project instructions from this session, capture session learnings, or keep AGENTS.md current at the end of work.
---
# Revise AGENTS.md
Review this session for durable learnings about working with Codex in this codebase. Propose concise updates to `AGENTS.md` or `AGENTS.override.md` that would help future Codex sessions be more effective.
Always show proposed changes before editing. Only apply changes after user approval unless the user provided an exact patch to apply.
## Step 1: Reflect
Identify context that was missing or newly confirmed:
- Commands that were used or discovered.
- Code style patterns followed.
- Testing approaches that worked.
- Environment or configuration quirks.
- Warnings, gotchas, or failure modes encountered.
- Codex-specific workflow notes, such as hooks, plugins, skill locations, or project instruction precedence.
Do not add transient details, personal commentary, or one-off fixes.
## Step 2: Find Instruction Files
Find project instruction files:
```powershell
rg --files -g 'AGENTS.md' -g 'AGENTS.override.md'
```
Choose the right target:
- `AGENTS.md` - Normal shared guidance for the repo or a directory.
- `AGENTS.override.md` - Stronger guidance that should override sibling `AGENTS.md` in the same directory.
- `~/.codex/AGENTS.md` - User-wide Codex defaults, only when the learning is not repo-specific.
- `~/.codex/AGENTS.override.md` - User-wide hard override, use sparingly.
If no project `AGENTS.md` exists and the user wants persistent repo guidance, propose creating one at the project root.
## Step 3: Draft Additions
Keep additions concise. One line per concept is usually enough.
Preferred format:
```markdown
`<command or path>` - <brief durable note>
```
or, for rules:
```markdown
- <specific recurring rule or gotcha>
```
Avoid:
- Verbose explanations.
- Obvious information.
- Generic best practices.
- One-off fixes unlikely to recur.
- Duplicating content already present in a clearer form.
## Step 4: Show Proposed Changes
For each addition:
```markdown
### Update: ./AGENTS.md
**Why:** <one-line reason>
```diff
+<the addition - keep it brief>
```
```
If multiple files could receive the update, explain why the selected target has the right scope.
## Step 5: Apply with Approval
Ask whether the user wants to apply the changes. If approved:
- Edit only the approved files.
- Preserve existing section order where possible.
- Add a new section only when the content does not fit an existing one.
- Keep wording terse and actionable.
## Final Check
Before final response:
- Confirm the final file still reads cleanly.
- Confirm no stale or contradictory guidance was introduced.
- Mention which file changed and what category of learning was captured.