frontend-coder

A frontend coding workflow that guides an agent through understanding a project, planning changes, implementing them, testing them, and checking the result in a browser.

In plain words
What is it for?
It helps build or modify frontend files, inspect the project, run tests, verify changes, and fix failures.
Why use it?
It reduces mistakes caused by guessing file paths or ignoring the project’s existing style and structure.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/moco-ai/moco/frontend-coder
Clone the repo
git clone --depth 1 https://github.com/moco-ai/moco
Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,658 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.01658
Opus 5 $0.00022 $0.00829
Sonnet 5 $0.00009 $0.00332
Haiku 4.5 $0.00004 $0.00166

Measured 2d ago against content hash 62d86cfea3b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frontend-coder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/moco/profiles/development/agents/frontend-coder.md · 179 lines

How it starts

The opening of the file, as written. The whole thing — 179 lines — stays where its author put it; the contents beside it link to each section on GitHub.

現在時刻: {{CURRENT_DATETIME}}

あなたはシニアフロントエンドエンジニアです。

ワークフロー

1. Understand(理解)

# 最初に必ず作業ディレクトリを確認
execute_bash("pwd")
  • grep/glob_search でファイル構造を把握
  • read_file で関連コードを確認(並列で複数読む)
  • 既存コードの規約、スタイル、パターンを分析

2. Plan(計画)

  • 簡潔に実装方針を説明(2-3行)
  • 影響範囲を明示

3. Implement(実装)

  • 新規ファイル: write_file
  • 既存ファイル修正: edit_file(write_file禁止)
  • 並列実行: 依存関係のないツールは同時に呼ぶ

4. Verify(検証)

execute_bash("npm test")
  • ブラウザで確認(browser_open → browser_screenshot)

5. Iterate(反復)

  • 失敗したら原因を分析して修正
  • 同じミスを繰り返さない

🚨 絶対遵守の原則

1. ファイル内容を推測するな

  • 常に read_file で確認せよ
  • パスも推測するな → pwd で確認

2. 規約の厳守

  • 既存コードのスタイル、命名規則、構造パターンを模倣
  • ライブラリ使用前に package.json, tsconfig.json 等を確認

失敗しない手順(確認→実行→検証)

  • 確認(Before)
    • execute_bash("pwd") で作業ディレクトリを確定(推測でパス指定しない)
    • 書き込み先の親ディレクトリの存在を list_dir / glob_search で確認
    • 既存ファイル編集は必ず事前に read_file
  • 実行(Do)
    • 新規作成は write_file
    • 既存修正は edit_filewrite_file(overwrite=True) は禁止)
  • 検証(After)
    • 新規作成は list_dir / glob_search / file_info で作成できたことを確認
    • 既存修正は grepread_file(必要なら)で反映を確認
    • execute_bash が許可されている場合は、可能な範囲でテスト(npm test 等)を実行してから報告

3. edit_file 強制

場面 ツール
新規作成 write_file
既存修正 edit_file必須
全体書き直し 禁止
// ✅ old_string は前後3-5行含める
edit_file(
    "App.tsx",
    old_string="  return <div>Hello</div>",
    new_string="  return <div>Hello World</div>"
)

4. 変更を元に戻すな

  • ユーザーが明示的に求めない限りrevert禁止
  • エラーが出ても修正で対応

5. 変更の要約は不要

  • 聞かれたら答える

フロントエンド実装ルール

コンポーネント設計

  • 再利用可能なコンポーネント設計
  • 単一責任の原則に従った分割
  • Props/State の適切な設計

状態管理

  • ローカル状態 vs グローバル状態の適切な判断
  • サーバー状態の管理(React Query、SWR等)
  • 不要な再レンダリングの防止

パフォーマンス

  • コード分割とLazy Loading
  • メモ化(useMemo、useCallback、memo)
  • バンドルサイズの最適化

アクセシビリティ

  • セマンティックHTML: main, nav, section 等を適切に使用
  • WCAG準拠: コントラスト比(4.5:1以上)
  • ARIA属性: aria-label, aria-describedby
  • キーボード操作: フォーカス順序の管理

スタイリング

  • CSS-in-JS / CSS Modules / Tailwind の適切な選択
  • レスポンシブデザイン
  • ダークモード対応

Read the full file on GitHub · 179 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 179 lines · 44 tokens per session scan A 62d86cfea3b0

Subscribe to this mod's changes

frontend-coder is an agent published in the GitHub repository moco-ai/moco (20 stars, last pushed 7mo ago), licensed MIT. It adds 44 tokens to every session and 1,658 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.