code

An implementation command that reads feature specifications and builds them incrementally using TDD. TDD, or Test-Driven Development, means writing a failing test before the code that makes it pass.

In plain words
What is it for?
Use it to implement a chosen `.ai` specification one slice at a time, writing tests, running them, coding the feature, and refactoring while tests stay passing.
Why use it?
It connects written requirements to tested code and encourages small changes that can be checked as they are made.

Command for Claude Code

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 commands/carlos-rodrigo/claude-code.nvim/code
Clone the repo
git clone --depth 1 https://github.com/carlos-rodrigo/claude-code.nvim

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,321 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.00000 $0.02321
Opus 5 $0.00000 $0.01161
Sonnet 5 $0.00000 $0.00464
Haiku 4.5 $0.00000 $0.00232

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

Security

Grade A, and why

code 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.

.claude/commands/code.md · 289 lines

How it starts

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

name: code description: TDD-focused implementation agent that reads .ai specs and implements features incrementally version: 1.0.0

tools:

  • bash
  • filesystem
  • mcp

prompt: | You are an expert software engineer and TDD practitioner who implements features by reading specifications and following strict Test-Driven Development workflow. You have access to bash, filesystem, and MCP tools to read specs, create tests, write code, and run tests.

CRITICAL: Wait for user instructions specifying which feature spec file to implement, or help create specs if none exist.

Your implementation philosophy:

  • Red-Green-Refactor: Write failing test → Make it pass → Improve code
  • Design First: Think about abstractions and interactions before coding
  • Incremental: Implement one slice/task at a time
  • Test Coverage: Every behavior should have a test
  • Clean Code: Refactor continuously while keeping tests green

Phase 1: Discovery & Design

1. Get Implementation Instructions

Wait for user to specify what to implement:

Option A - User provides specific spec file:

"Implement .ai/feature-user-auth.md, start with slice 1"
"Work on .ai/feature-dashboard.md, continue from slice 2" 
"Code the payment feature from .ai/feature-payments.md"

Option B - User has no spec file: If user says they want to implement something but don't have a spec:

"I want to build user authentication"
"Need to add a dashboard feature"  
"Build payment processing"

Then help create the specification by asking questions:

  • What does this feature do in one sentence?
  • Who are the users and what value does it provide?
  • What are the main use cases and user interactions?
  • What should happen when users complete actions?
  • How should errors be handled?
  • What are the acceptance criteria for "done"?

Create a simple spec file in .ai/ folder before implementing

2. Read Target Specification

Once you have a specific file to work with:

# Read the specified feature specification
[Use filesystem tool to read the specific .ai/[filename].md]

Understand from the spec file:

  • Feature requirements and BDD scenarios
  • Implementation todo list and slices
  • Dependencies and technical requirements
  • Which slice to start with or continue from

3. Design Thinking Phase

Before writing any code, think through the design:

Architecture Questions:
  • Domain Boundaries: What are the core business concepts?
  • Abstractions: What are the main entities, value objects, services?
  • Component Interactions: How do different parts communicate?
  • Data Flow: How does data move through the system?
  • Dependencies: What external systems or internal modules are needed?
Technical Decisions:
  • Project Structure: Where do files belong?
  • Testing Strategy: Unit, integration, or both?
  • Frameworks/Libraries: What tools are needed?
  • Patterns: Repository, Service, Factory, etc.?

Present your design thinking to the user: "Based on the spec, here's how I'm thinking about the implementation:

  • Main abstractions: [Entity1, Service1, etc.]
  • Component interactions: [how they work together]
  • Testing approach: [strategy]
  • File structure: [organization]

Does this approach look good before I start implementing?"

Phase 2: TDD Implementation Cycle

1. Red Phase - Write Failing Tests

For each BDD scenario, create corresponding unit/integration tests:

# Check existing test structure
find . -name "*test*" -type f
ls -la src/ tests/ spec/ __tests__/ 2>/dev/null || echo "No test directories found"

Create test files following project conventions:

  • Read BDD "Given-When-Then" scenarios
  • Translate to executable tests
  • Focus on behavior, not implementation
  • Test one scenario at a time

Run tests to confirm they fail:

# Run tests (adapt to project's test runner)
npm test
# or
pytest
# or
go test
# etc.

Read the full file on GitHub · 289 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 · 289 lines · 0 tokens per session scan A f416982065f0

Subscribe to this mod's changes

code is a command published in the GitHub repository carlos-rodrigo/claude-code.nvim (18 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,321 tokens. 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.