AgentSkillsCN

ralph implementer

从 ./.scratch/prd.json 中实现单个任务。

SKILL.md
--- frontmatter
name: ralph implementer
description: "Implement a single task from the ./.scratch/prd.json"

Ralph Agent Instructions

You are an autonomous coding agent working on a software project. Implement ONLY A SINGLE TASK PER SESSION!! After a task is finished, DO NOT CONTINUE WITH OTHER TASKS!

Your Task

  1. Read the PRD at ./.scratch/ralph/prd.json (in the root of the )
  2. Read the progress log at ./.scratch/ralph/progress.txt (check Codebase Patterns section first)
  3. Check you're on the correct branch from PRD branchName. If not, check it out or create from main.
  4. Pick the highest priority user story where passes: false
  • change the status to in-progress: true
  1. Implement that single user story
  2. Run quality checks (e.g., typecheck, lint, test)
  3. If checks pass, commit ALL changes with message: feat: [Story ID] - [Story Title]
  4. Update the PRD to set passes: true for the completed story and in-progress: false
  5. Append your progress to progress.txt

Progress Report Format

APPEND to progress.txt (never replace, always append):

code
## [Date/Time] - [Story ID]
- What was implemented
- Files changed
- **Learnings for future iterations:**
  - Patterns discovered (e.g., "this codebase uses X for Y")
  - Gotchas encountered (e.g., "don't forget to update Z when changing W")
  - Useful context (e.g., "the evaluation panel is in component X")
---

The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.

Consolidate Patterns

If you discover a reusable pattern that future iterations should know, add it to the ## Codebase Patterns section at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important learnings:

code
## Codebase Patterns
- Example: Export types from packages/types for UI components

Only add patterns that are general and reusable, not story-specific details.

Meta Skills in AGENTS.md

For project-specific guidance that should persist across all Ralph sessions (not just within a PRD), add a ## Meta Skills section to your project's AGENTS.md file:

markdown
## Meta Skills

### Testing Patterns
- Always use `vitest` for unit tests, `playwright` for e2e
- Mock external APIs in `__mocks__/` directory
- Use `data-testid` attributes for e2e selectors

### Code Style
- Prefer composition over inheritance
- Use barrel exports (`index.ts`) for public APIs
- Keep components under 200 lines, extract hooks when larger

### Architecture Decisions
- State management: Zustand for client, React Query for server state
- API layer lives in `src/api/`, never call fetch directly from components
- Feature flags checked via `useFeatureFlag()` hook

### Common Gotchas
- Remember to run `pnpm generate` after schema changes
- The CI runs on Node 20, local dev uses Node 22
- Env vars need to be prefixed with `VITE_` for client access

These meta skills act as persistent memory across PRDs, helping Ralph (and other agents) understand project conventions without rediscovering them each time.

When to use AGENTS.md vs progress.txt:

  • AGENTS.md: Permanent project knowledge, conventions, architecture decisions
  • progress.txt: PRD-specific learnings, story context, iteration history

Quality Requirements

  • ALL commits must pass the project's quality checks (typecheck, lint, test)
  • If a spec file is available, there should be a test for the feature
  • Do NOT commit broken code
  • Keep changes focused and minimal
  • Follow existing code patterns

Browser Testing (Required for Frontend Stories)

For any story that changes UI, you MUST verify it works in the browser:

  1. Load the dev-browser skill
  2. Navigate to the relevant page
  3. Verify the UI changes work as expected
  4. Take a screenshot if helpful for the progress log

A frontend story is NOT complete until browser verification passes.

Stop Condition

After completing a user story, check if ALL stories have passes: true.

If ALL stories are complete and passing, reply with just the following: <promise>COMPLETE</promise>

If there are still stories with passes: false, end your response normally (another iteration will pick up the next story).

Important

  • Work on ONE story per iteration
  • Commit frequently
  • Keep CI green
  • Read the Codebase Patterns section in progress.txt before starting