| name | habit-track |
| description | Implement a tracking and feedback loop for agent operations to measure consistency and catch regressions. Use when building CI/CD pipelines, monitoring code quality metrics, tracking task completion rates, or establishing any system where progress must be visible. |
You are an AI agent applying the Habit Tracking framework from Atomic Habits by James Clear to your operational workflows. Use this skill to create visual feedback loops that make progress measurable, regressions detectable, and consistency the default.
Core Principle
"The 4th Law of Behavior Change: Make It Satisfying." Agents repeat behaviors that produce visible, positive signals. Habit Tracking provides immediate feedback — a test passes, a coverage number goes up, a lint score improves. The signal reinforces the behavior.
The Tracking System (Agent Version)
Step 1: Choose What to Track
Track the behavior, not the outcome:
- ✅ "Did I run the tests after every change?" (behavior)
- ❌ "Did all tests pass?" (outcome — not always in your control)
- ✅ "Did I update docs for every modified function?" (behavior)
- ❌ "Is the documentation perfect?" (subjective)
Step 2: Define the Metric
Choose a quantifiable, automatable metric:
| Domain | Metric | Tool |
|---|
| Code Quality | Lint score, code coverage % | run_command ([lint_command], [coverage_command]) |
| Testing | Tests written per feature | grep_search for test files |
| Documentation | Docstring coverage | Custom script or view_file_outline |
| Security | Vulnerabilities detected | run_command ([security_audit_command]) |
| Performance | Response time, bundle size | Benchmark scripts |
| Task Completion | Steps completed vs planned | Checklist in task.md |
Step 3: Automate the Recording
The measurement must happen immediately after the action. Build it into the pipeline:
After [writing code] → run_command("[test_command]") → record result
After [modifying API] → run_command("[lint_command]") → record score
After [completing task] → update task.md → mark [x]
Step 4: The "Never Regress Twice" Rule
This is the most important rule for agents.
If a metric drops (test coverage decreases, lint score worsens, a test fails):
- The first regression is acceptable — it happens.
- The second consecutive regression triggers an immediate corrective action.
"The first mistake is never the one that ruins you. It is the spiral of repeated regressions that follows."
Step 5: Visualize the Trend
Output progress as a simple table or log:
| Day | Tests Written | Coverage | Lint Score |
|-----|--------------|----------|------------|
| Mon | 12 | 78% | 94 |
| Tue | 8 | 81% | 96 |
| Wed | 15 | 84% | 97 |
The upward trend becomes its own motivator.
Agent-Native Examples
- CI Pipeline: Track the pass/fail ratio of builds over time
- PR Quality: Count the number of PRs that pass review without revisions
- Debt Reduction: Track TODO count in the codebase (should decrease)
- Incident Response: Track mean time to resolution (MTTR) per incident
- Agent Self-Eval: Track the weighted validation score from the Tri-Gate audit
Anti-patterns to Watch For
- Tracking too many metrics at once (start with ONE)
- Tracking vanity metrics (lines of code written ≠ quality)
- Letting a single regression spiral into "everything is broken anyway"
- Making tracking itself a burden (if it takes more than one tool call, simplify)
Output
When applying this skill, produce:
- The ONE metric to begin tracking
- The automated measurement command
- The recording trigger (when to measure)
- The "Never Regress Twice" recovery protocol
- A baseline measurement from the current state