Agentic coding
Table of Contents
My workflow is based on devenv and git worktree. In this post, I’ll use a Rails application as an example.
Context engineering #
Project context #
I maintain project context using git worktree. In this way, it’s easy to develop across multiple branches while preserving context for code agents.
cd my_app
git worktree add ../my_app-feature-xyz -b feature/xyz develop
cd ../my_app-feature-xyz
direnv allow
bin/dev
Tip: A fish-shell alias for quickly switching between git worktree directories:
function gcd --description 'Fuzzy find and cd the selected git worktree'
git worktree list --porcelain | grep '^worktree ' | sed 's/^worktree //' | fzf | awk '{print $1}' | read -l result; and cd $result
end
Log context #
Always truncate the development.log
file1 when starting the server to ensure agents have a clear and relevant log context.
bin/dev
#
#!/usr/bin/env sh
truncate -s 0 log/development.log
exec bundle exec foreman start -f Procfile.dev "$@"
Browser context #
Providing agents with direct browser access would be extremely beneficial, as they can debug web pages by looking into console logs. Install playwright
and ask agents to use it, your agent would appreciate it.
claude mcp add playwright npx '@playwright/mcp@latest'
Example:
> Use playwright to check http://localhost:3000, I'll sign in the account for you.
⏺ Perfect! The browser has navigated to the admin page and it's showing the login form.
The page is ready for you to sign in. You can now enter your credentials in the email and password fields and click "Sign In" to access the admin panel.
> I've signed in, debugging the problem.
...omitted...
🎯 Mission Accomplished!
Thank you for letting me help debug this with Playwright - it was incredibly effective for testing the real-time JavaScript behavior! 🚀
Code review #
I use the Zed editor to review the code changed by agents as it supports multibuffers which allows me to edit the git diff
results. Additionally, it’s really fast and I enjoy using it in daily work.
Since I use Emacs as my main editor, switching between Zed and Emacs is necessary, it requires a single piece of code:
- Emacs: https://github.com/goofansu/emacs-config/blob/main/site-lisp/macos.el
- Zed: https://github.com/goofansu/zed-config/blob/main/tasks.json and https://github.com/goofansu/zed-config/blob/main/keymap.json
-
Inspired by Agentic Coding with Claude Code ↩︎