diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73ab876 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +public/ +resources/ diff --git a/assets/sass/_custom.sass b/assets/sass/_custom.sass index 650cab2..109be8f 100644 --- a/assets/sass/_custom.sass +++ b/assets/sass/_custom.sass @@ -4,3 +4,8 @@ .bluesky svg fill: #0085ff + +// Responsive video +video + max-width: 100% + height: auto diff --git a/content/en/about.md b/content/en/about.md index 1cab410..55b2063 100644 --- a/content/en/about.md +++ b/content/en/about.md @@ -1,20 +1,19 @@ +++ title = "About" -summary = "Who's behind this blog post?" +summary = "Who's behind this blog?" date = "2022-07-18" author = "Smana" +++ ## Who am I? -I'm a senior Site Reliability Engineer with a particular interest in Linux containers and cloud technologies. -I worked in different companies (small startups and large scale) and I've been working in different areas in order to improve the reliability, availability of the platform as well as the developer experience. -I helped several companies in their transition to the Cloud. I was leading SRE/DevOps teams (diverse profiles with developers and SREs) and I really enjoy seeing them engaged in the same direction. +I'm a **senior system / SRE engineer**. I have a particular interest in Linux containers, Cloud Native technologies, and more recently in **artificial intelligence applied to software engineering**, especially AI-assisted coding using agent-based systems. Throughout my career, I've had the opportunity to work with a variety of companies, from dynamic startups to large organizations, where I've helped improve platform reliability and availability while enhancing the developer experience. My journey includes supporting several companies in their transition to Cloud solutions. I've also **led SRE/DevOps teams** made up of diverse profiles, including developers and SRE engineers, with the shared goal of driving towards common objectives. -As side activities, I am an organizer of the Cloud Native Computing meetup in Paris and the [Kubernetes Community Days France](https://www.kcdfrance.fr/). +Beyond my professional work, I'm involved in organizing the Cloud Native Computing meetup in Paris, the [Kubernetes Community Days France](https://www.kcdfrance.fr/) and the [Cloud Native Days France](https://cloudnativedays.fr/), reflecting my ongoing commitment to the Cloud ecosystem. + +Hobbies: Reading SF books, Kickboxing, Surfing, Longboarding and Inline Skating. -Hobbies: Reading SF books, Kick Boxing, Surfing/Skating/Inline Roller
-_The cute thumbnails have been generetad with DALL-E_ \ No newline at end of file +_The cool thumbnails for each article were generated with DALL-E and [Nano Banana](https://gemini.google/lu/overview/image-generation) (Google)_ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/agentic-loop.png b/content/en/post/series/agentic_ai/ai-coding-agent/agentic-loop.png new file mode 100644 index 0000000..6d7427c Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/agentic-loop.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/chrome_karpenter.mp4 b/content/en/post/series/agentic_ai/ai-coding-agent/chrome_karpenter.mp4 new file mode 100644 index 0000000..25385b0 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/chrome_karpenter.mp4 differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/cmd_context.png b/content/en/post/series/agentic_ai/ai-coding-agent/cmd_context.png new file mode 100644 index 0000000..7795ce1 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/cmd_context.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/cursor+claude.png b/content/en/post/series/agentic_ai/ai-coding-agent/cursor+claude.png new file mode 100644 index 0000000..e0b9b10 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/cursor+claude.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/dori_forgot.png b/content/en/post/series/agentic_ai/ai-coding-agent/dori_forgot.png new file mode 100644 index 0000000..41d5eb1 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/dori_forgot.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/index.md b/content/en/post/series/agentic_ai/ai-coding-agent/index.md new file mode 100644 index 0000000..9d34281 --- /dev/null +++ b/content/en/post/series/agentic_ai/ai-coding-agent/index.md @@ -0,0 +1,557 @@ ++++ +author = "Smaine Kahlouch" +title = "`Agentic Coding`: concepts and hands-on Platform Engineering use cases" +date = "2026-01-29" +summary = "Exploring **agentic coding** through `Claude Code`: from fundamentals (tokens, MCPs, skills) to real-world use cases, with an enthusiastic yet honest take on this new way of working." +featured = true +codeMaxLines = 30 +usePageBundles = true +toc = true +series = ["Agentic AI"] +tags = [ + "ai", + "devxp", + "tooling" +] +aliases = ["/en/post/ai-coding-agent/"] +thumbnail = "thumbnail.png" ++++ + +We can all see it — AI is shaking things up in a major way. The field is evolving so fast that keeping up with every new development is nearly impossible. As for measuring the impact on our daily lives and how we work, it's still too early to tell. One thing is certain though: in tech, it's a **revolution**! + +In this post, I'll walk you through a practical application in **Platform Engineering**, exploring how a **coding agent** can help with common tasks in our field. + +Most importantly, I'll try to demonstrate through concrete examples that this new way of working **truly** boosts our productivity. Really! + +## :dart: Goals of this article + +* Understand what a **coding agent** is +* Discover the key concepts: tokens, MCPs, skills, agents +* **Hands-on use cases** in Platform Engineering +* Thoughts on limitations, pitfalls to avoid, and alternatives +* For tips and workflows I've picked up along the way, check the [dedicated article](/en/post/series/agentic_ai/ai-coding-tips/) + +{{% notice tip "The reference repo" %}} + + + + + +
+The examples below come from my work on the Cloud Native Ref repository. It's a full-fledged platform combining EKS, Cilium, VictoriaMetrics, Crossplane, Flux and many other tools. +
+{{% /notice %}} + +{{% notice info "Already familiar with the concepts?" %}} +If you already know the basics of coding agents, tokens and MCPs, jump straight to the [hands-on Platform Engineering use cases](#-hands-on-platform-engineeringsre-use-cases). +{{% /notice %}} + +--- + +## :brain: Why _Coding Agents_? + +### How an agent works + +You probably already use ChatGPT, LeChat or Gemini to ask questions. That's great, but it's essentially **one-shot**: you ask a question, and you get an answer whose relevance depends on the quality of your prompt. + +A **coding agent** works differently. It runs tools in a loop to achieve a goal. This is called an [**agentic loop**](https://simonwillison.net/2025/Sep/30/designing-agentic-loops/). + +{{< img src="agentic-loop.png" alt="Agentic loop" width="580" >}} + +The cycle is simple: **reason → act → observe → repeat**. The agent calls a tool, analyzes the result, then decides on the next action. That's why it needs access to the **output of each action** — a compilation error, a failing test, an unexpected result. This ability to react and **iterate autonomously** on our local environment is what sets it apart from a simple chatbot. + +A coding agent combines several components: + +* **LLM**: The "brain" that reasons (Claude Opus 4.5, Gemini 3 Pro, Devstral 2...) +* **Tools**: Available actions (read/write files, execute commands, search the web...) +* **Memory**: Preserved context (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`... depending on the tool, plus conversation history) +* **Planning**: The ability to break down a complex task into sub-steps + +### Choosing the right model — hard to keep up 🤯 + +New models and versions appear at a breakneck pace. However, you need to be careful when choosing a model because effectiveness (code quality, hallucinations, up-to-date context) can **vary drastically**. + +The [**SWE-bench Verified**](https://www.swebench.com/) benchmark has become the reference for evaluating model capabilities in software development. It measures the ability to solve real bugs from GitHub repositories and helps guide our choices. + +{{< img src="swe-bench-leaderboard.png" alt="SWE-bench Verified Leaderboard" width="900" >}} + +{{% notice warning "These numbers change fast!" %}} +Check [swebench.com](https://www.swebench.com/) for the latest results. At the time of writing, Claude Opus 4.5 leads with **74.4%**, closely followed by Gemini 3 Pro (**74.2%**). +{{% /notice %}} + +In practice, today's top models are all capable enough for most _Platform Engineering_ tasks. + +{{% notice info "Why model choice matters" %}} +Boris Cherny, creator of Claude Code, [mentioned](https://x.com/bcherny/status/2007179832300581177) that he exclusively uses Opus 4.5 with thinking — despite being slower than Sonnet, the fact that he needs to guide it less makes him more productive overall. + +My experience aligns: with a more capable model, you spend less time rephrasing and correcting, which more than compensates for the extra latency. +{{% /notice %}} + +### Why Claude Code? + +There are many coding agent options out there. Here are a few examples: + +| Tool | Type | Strengths | +|------|------|-----------| +| [**Claude Code**](https://docs.anthropic.com/en/docs/claude-code) | Terminal | 200K context, high SWE-bench score, hooks & MCP | +| [**opencode**](https://opencode.ai/) | Terminal | **Open source**, multi-provider, local models (Ollama) | +| [**Cursor**](https://cursor.sh/) | IDE | Visual workflow, Composer mode | +| [**Antigravity**](https://antigravity.google/) | IDE | Parallel agents, Manager view | + +Other notable alternatives (non-exhaustive): [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Mistral Vibe](https://mistral.ai/news/devstral-2-vibe-cli), [GitHub Copilot](https://github.com/features/copilot)... + +I started with Cursor, then switched to Claude Code — probably because of my **sysadmin background** and natural affinity for the terminal. While others prefer working exclusively in their IDE, I feel more at home with a CLI. + +--- + +## :books: Essential Claude Code concepts + +This section cuts straight to the point: **tokens, MCPs, Skills, and Tasks**. I'll skip the initial setup (the [official docs](https://docs.anthropic.com/en/docs/claude-code) cover that well) and subagents — that's internal plumbing; what matters is what you can *build* with them. Most of these concepts **also apply to other coding agents**. + +### Tokens and context window + +#### The essentials about tokens + +A **token** is the basic unit the model processes — roughly 4 characters in English, 2-3 in French. Why does this matter? Because **everything costs tokens**: input, output, and context. + +The **context window** (200K tokens for Claude) represents the model's "working memory". The `/context` command lets you see how this space is used: + +```console +/context +``` + +{{< img src="cmd_context.png" alt="Context visualization with /context" width="650" >}} + +This view breaks down context usage across different components: + +* **System prompt/tools**: Fixed cost of Claude Code (~10%) +* **MCP tools**: Definitions of enabled MCPs +* **Memory files**: `CLAUDE.md`, `AGENTS.md`... +* **Messages**: Conversation history +* **Autocompact buffer**: Reserved for automatic compression +* **Free space**: Available space to continue + + + + + + +
+Once the limit is reached, the oldest information is simply forgotten. Fortunately, Claude Code has an auto-compaction mechanism: as the conversation approaches 200K tokens, it intelligently compresses the history while retaining important decisions and discarding verbose exchanges. This lets you work through long sessions without losing the thread — but frequent compaction degrades context quality. That's why it's worth using /clear between distinct tasks. +
+ +### MCPs: a universal language + +The **Model Context Protocol** (MCP) is an open standard created by Anthropic that allows AI agents to connect to external data sources and tools in a standardized way. + +{{% notice info "Open governance" %}} +In December 2025, Anthropic [handed MCP over to the Linux Foundation](https://www.anthropic.com/news/donating-the-model-context-protocol-and-establishing-of-the-agentic-ai-foundation) through the Agentic AI Foundation. OpenAI, Google, Microsoft and AWS are among the founding members. +{{% /notice %}} + +There are many MCP servers available. Here are the ones I use regularly to interact with my platform — **configuration, troubleshooting, analysis**: + +| MCP | What it does | Concrete example | +|-----|-------------|------------------| +| **[context7](https://github.com/upstash/context7)** | Up-to-date docs for libs/frameworks | "Use context7 for the Cilium 1.16 docs" → avoids hallucinations on changed APIs | +| **[flux](https://fluxcd.control-plane.io/mcp/)** | Debug GitOps, reconciliation state | "Why is my HelmRelease stuck?" → Claude inspects Flux state directly | +| **[victoriametrics](https://github.com/VictoriaMetrics-Community/mcp-victoriametrics)** | PromQL queries, metric exploration | "What Karpenter metrics are available?" → lists and queries in real time | +| **[victorialogs](https://github.com/VictoriaMetrics-Community/mcp-victorialogs)** | LogsQL queries, log analysis | "Find Crossplane errors from the last 2 hours" → root cause analysis | +| **[grafana](https://github.com/grafana/mcp-grafana)** | Dashboards, alerts, annotations | "Create a dashboard for these metrics" → generates and deploys the JSON | +| **[steampipe](https://github.com/turbot/steampipe-mcp)** | SQL queries on cloud infra | "List public S3 buckets" → multi-cloud audit in one question | + +{{% notice tip "Global or local configuration?" %}} +MCPs can be configured globally (`~/.claude/mcp.json`) or per project (`.mcp.json`). I use `context7` globally since I rely on it almost all the time, and the others at the repo level. +{{% /notice %}} + +### Skills: unlocking new powers + +{{< img src="skill-acquired-notif.png" width="450" >}} + +This is probably the feature that generates the most excitement in the community — and rightly so, it really lets you extend the agent's capabilities! A **skill** is a Markdown file (`.claude/skills/*/SKILL.md`) that lets you inject project-specific **conventions**, **patterns**, and **procedures**. + +In practice? You define once how to create a clean PR, how to validate a Crossplane composition, or how to debug a Cilium issue — and Claude applies those rules in every situation. It's **encapsulated know-how** that you can share with your team. + +**Two loading modes:** + +* **Automatic**: Claude analyzes the skill description and loads it when relevant +* **Explicit**: You invoke it directly via `/skill-name` + +{{% notice info "A format that's catching on" %}} +The `SKILL.md` format introduced by Anthropic has become a **de facto convention**: [GitHub Copilot](https://docs.github.com/en/copilot/concepts/agents/about-agent-skills), [Google Antigravity](https://codelabs.developers.google.com/getting-started-with-antigravity-skills), Cursor, OpenAI Codex and others adopt the same format (YAML frontmatter + Markdown). Only the directory changes (`.claude/skills/`, `.github/skills/`...). The skills you create are therefore **reusable across tools**. +{{% /notice %}} + +#### Anatomy of a skill + +A skill consists of a **YAML frontmatter** (metadata) and **Markdown content** (instructions). Here's the `/create-pr` skill from [cloud-native-ref](https://github.com/Smana/cloud-native-ref/tree/main/.claude/skills) — it generates PRs with a structured description and Mermaid diagram: + +```markdown + +--- +name: create-pr +description: Create Pull Requests with AI-generated descriptions and mermaid diagrams +allowed-tools: Bash(git:*), Bash(gh:*) +--- + +## Usage +/create-pr [base-branch] # New PR (default: main) +/create-pr --update # Update an existing PR + +## Workflow +1. Gather: git log, git diff --stat, git diff (in parallel) +2. Detect: Change type (composition, infrastructure, security...) +3. Generate: Summary, Mermaid diagram, file table +4. Create: git push + gh pr create +``` + +| Field | Role | +|-------|------| +| `name` | Skill name and `/create-pr` command | +| `description` | Helps Claude decide when to auto-load | +| `allowed-tools` | Tools authorized without confirmation (`git`, `gh`) | + +This pull request example shows how you can frame the agent's behavior to achieve the result you want — here, a structured PR with a diagram. This avoids iterating on the agent's proposals and helps you be more efficient. + +### Tasks: never losing track + +**Tasks** (v2.1.16+) solve a real problem in autonomous workflows: how do you keep track of a complex task that spans over time? + +Tasks replace the former "Todos" system and bring three key improvements: **persistence across sessions**, **shared visibility between agents**, and **dependency tracking**. + +In practice, when Claude works on a long-running task, it can: +- Break down the work into Tasks with dependencies +- Delegate certain Tasks to the background +- Resume work after an interruption without losing context + +{{% notice tip "/tasks command" %}} +Use `/tasks` to see the status of ongoing tasks. Handy for tracking where Claude is on a complex workflow. +{{% /notice %}} + +--- + +## :rocket: Hands-on Platform Engineering/SRE use cases + +Enough theory! Let's get to what really matters: how Claude Code can help us day to day. I'll share two detailed, concrete use cases that showcase the power of MCPs and the Claude workflow. + +### :mag: Full Karpenter observability with MCPs + +This case perfectly illustrates the power of the **agentic loop** introduced earlier. Thanks to MCPs, Claude has full context about my environment (metrics, logs, up-to-date documentation, cluster state) and can **iterate autonomously**: create resources, deploy them, visually validate the result, then correct if needed. + +#### The prompt + +Prompt structure is essential for guiding the agent effectively. A well-organized prompt — with context, goal, steps and constraints — helps Claude understand not only *what* to do, but also *how* to do it. The [Anthropic prompt engineering guide](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview) details these best practices. + +Here's the prompt used for this task: + +```markdown +## Context +I manage a Kubernetes cluster with Karpenter for autoscaling. +Available MCPs: grafana, victoriametrics, victorialogs, context7, chrome. + +## Goal +Create a complete observability system for Karpenter: alerts + unified dashboard. + +## Steps +1. **Documentation**: Via context7, fetch the latest Grafana docs + (alerting, dashboards) and Victoria datasources +2. **Alerts**: Create alerts for: + - Node provisioning errors + - AWS API call failures + - Quota exceeded +3. **Dashboard**: Create a unified Grafana dashboard integrating: + - Metrics (provisioning time, costs, capacity) + - Karpenter error logs + - Kubernetes events related to nodes +4. **Validation**: Deploy via kubectl, then visually validate with + the grafana and chrome MCPs +5. **Finalization**: If the rendering looks good, apply via the + Grafana operator, commit and create the PR + +## Constraints +- Use recent Grafana features (v11+) +- Follow best practices: dashboard variables, annotations, + progressive alert thresholds +``` + +#### Step 1: Planning and decomposition + +Claude analyzes the prompt and automatically generates a **structured plan** broken into sub-tasks. This decomposition lets you track progress and ensures each step is completed before moving to the next. + +{{< img src="karpenter_plan.png" alt="Plan generated by Claude Code" width="600" >}} + +Here you can see the 4 identified tasks: create VMRule alerts, build the unified dashboard, validate with kubectl and Chrome, then finalize with commit and PR. + +#### Step 2: Leveraging MCPs for context + +This is where the **power of MCPs** becomes apparent. Claude uses **several simultaneously** to gather full context: + +{{< img src="karpenter_mcp.png" alt="MCP calls" width="1200" >}} + +- **context7**: Retrieves Grafana v11+ documentation for alerting rules and dashboard JSON format +- **victoriametrics**: Lists all `karpenter_*` metrics available in my cluster +- **victorialogs**: Analyzes Karpenter logs to identify scaling events, provisioning errors and behavioral patterns + +This combination allows Claude to generate code **tailored to my actual environment** rather than generic, potentially outdated examples. + +#### Step 3: Visual validation with Chrome MCP + +Once the dashboard is deployed via `kubectl`, Claude uses the **Chrome MCP** to open Grafana and visually validate the rendering. It can verify that panels display correctly, that queries return data, and adjust if necessary. + +
+ +
+ +This is a concrete example of a **feedback loop**: Claude **observes the results of its actions** and can iterate until the desired outcome is achieved. + +#### Result: complete observability + +At the end of this workflow, Claude created a **complete PR**: 12 VMRule alerts (provisioning, AWS API, quotas, Spot interruptions) and a unified Grafana dashboard combining metrics, logs and Kubernetes events. + +{{< img src="karpenter_summary.png" width="750" >}} + +The ability to interact with my platform, identify errors and inconsistencies, then make adjustments automatically really **blew me away** 🤩. Rather than parsing Grafana JSON or listing metrics and logs through the various VictoriaMetrics UIs, I define my goal and the agent takes care of reaching it while consulting up-to-date documentation. A significant **productivity boost**! + +--- + +### :building_construction: The spec as source of truth — delivering a new service + +I've discussed in several previous articles the value of Crossplane for providing the right level of abstraction to platform users. This second use case puts that approach into practice: creating a **Crossplane composition** with the agent's help. This is one of the key principles of **Platform Engineering** — offering self-service tailored to the context while maintaining control over the underlying infrastructure. + +{{% notice info "What is Spec-Driven Development (SDD)?" %}} +**Spec-Driven Development** is a paradigm where specifications — not code — serve as the primary artifact. In the age of agentic AI, SDD provides the guardrails needed to prevent "Vibe Coding" (unstructured prompting) and ensure agents produce maintainable code. + +For those steeped in Kubernetes, here's an analogy 😉: the spec defines the **desired state**, and once validated by a human, the AI agent behaves somewhat like a *controller* — iterating based on results (tests, validations) until that state is reached. The difference: the human stays in the loop (**HITL**) to validate the spec *before* the agent starts, and to review the final result. + +**Major frameworks in 2026:** + +| Framework | Key strength | Ideal use case | +|-----------|-------------|----------------| +| **[GitHub Spec Kit](https://github.com/github/spec-kit)** | Native GitHub/Copilot integration | Greenfield projects, structured workflow | +| **[BMAD](https://github.com/bmad-sim/bmad-method)** | Multi-agent teams (PM, Architect, Dev) | Complex multi-repo systems | +| **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** | Lightweight, change-focused | Brownfield projects, rapid iteration | +{{% /notice %}} + +{{% notice tip "My SDD variant for Platform Engineering" %}} +For [cloud-native-ref](https://github.com/Smana/cloud-native-ref), I created a variant inspired by GitHub Spec Kit that I'm evolving over time. I'll admit it's still quite experimental, but the results are already impressive. + +**🛡️ Platform Constitution** — Non-negotiable principles are codified in a [constitution](https://github.com/Smana/cloud-native-ref/blob/main/docs/specs/constitution.md): `xplane-*` prefix for IAM scoping, mandatory zero-trust networking, secrets via External Secrets only. Claude checks every spec and implementation against these rules. + +**👥 4 review personas** — Each spec goes through a checklist that forces you to consider multiple angles: + +| Persona | Focus | +|---------|-------| +| **PM** | Problem clarity, user stories aligned with real needs | +| **Platform Engineer** | API consistency, KCL patterns followed | +| **Security** | Zero-trust, least privilege, externalized secrets | +| **SRE** | Health probes, observability, failure modes | + +**⚡ Claude Code Skills** — The workflow is orchestrated by [skills](/en/post/series/agentic_ai/ai-coding-agent/#skills-unlocking-new-powers) (see previous section) that automate each step: + +| Skill | Action | +|-------|--------| +| `/spec` | Creates the GitHub issue + pre-filled spec file | +| `/clarify` | Resolves `[NEEDS CLARIFICATION]` items with structured options | +| `/validate` | Checks completeness before implementation | +| `/create-pr` | Creates the PR with automatic spec reference | + +{{< img src="sdd_workflow.png" alt="SDD Workflow" width="700" >}} +{{% /notice %}} + +#### Why SDD for Platform Engineering? + +Creating a Crossplane composition isn't just a script — it's designing an **API for your users**. Every decision has lasting implications: + +| Decision | Impact | +|----------|--------| +| API structure (XRD) | Contract with product teams — hard to change after adoption | +| Resources created | Cloud costs, security surface, operational dependencies | +| Default values | What 80% of users will get without thinking about it | +| Integrations (IAM, Network, Secrets) | Compliance, isolation, auditability | + +SDD forces you to **think before coding** and **document decisions** — exactly what you need for a platform API. + +#### Our goal: building a Queue composition + +The product team needs a queuing system for their applications. Depending on the context, they want to choose between: +- **Kafka (via [Strimzi](https://strimzi.io/))**: for cases requiring streaming, long retention, or replay +- **AWS SQS**: for simple, serverless cases with native AWS integration + +Rather than asking them to configure Strimzi or SQS directly (dozens of parameters), we'll expose a **simple, unified API**. + +#### Step 1: Create the spec with `/spec` 📝 + +The `/spec` skill is the workflow entry point. It automatically creates: +- A **GitHub Issue** with the `spec:draft` label for tracking and discussions +- A **spec file** in `docs/specs/` pre-filled with the project template + +``` +/spec composition "Add queuing composition supporting Strimzi (Kafka) or SQS" +``` + +{{< img src="sdd_spec.png" width="950" >}} + +Claude analyzes the project context (existing compositions, constitution, ADRs) and pre-fills the spec with an **initial design**. It also identifies **clarification points** — here, 3 key questions about scope and authentication. + +The GitHub issue serves as a **centralized reference point** — that's where discussions happen and decision history lives — while the spec file evolves with the detailed design. + +#### Step 2: Clarify design choices with `/clarify` 🤔 + +The generated spec contains `[NEEDS CLARIFICATION]` markers for decisions Claude can't make on its own. The `/clarify` skill presents them as **structured questions with options**: + +{{< img src="sdd_clarify_1.png" width="950" >}} + +Each question proposes options analyzed from **4 perspectives** (PM, Platform Engineer, Security, SRE) with a recommendation. You simply pick by navigating the proposed options. + +Once all clarifications are resolved, Claude updates the spec with a decision summary: + +{{< img src="sdd_clarify_2.png" width="900" >}} + +These decisions are **documented in the spec** — six months from now, when someone asks "why no mTLS?", the answer will be right there. + +#### Step 3: Validate and implement ⚙️ + +Before starting implementation, the `/validate` skill checks the spec's completeness: +- All required sections are present +- All `[NEEDS CLARIFICATION]` markers are resolved +- The GitHub issue is linked +- The project constitution is referenced + +Once validated, I can start the implementation. Claude enters **plan mode** and launches exploration agents **in parallel** to understand existing patterns: + +{{< img src="sdd_implement_1.png" width="1100" >}} + +Claude explores existing compositions (`SQLInstance`, `EKS Pod Identity`, the Strimzi configuration) to understand the project's conventions **before writing a single line of code**. + +The implementation generates the appropriate resources based on the chosen backend: + +{{< img src="sdd_implement_summary.png" width="450" >}} + +For **each backend**, the composition creates the necessary resources while following the project's conventions: +- `xplane-*` prefix for all resources (IAM convention) +- `CiliumNetworkPolicy` for zero-trust networking +- `ExternalSecret` for credentials (no hardcoded secrets) +- `VMServiceScrape` for observability + +#### Step 4: Final validation 🛂 + +The `/validate` skill checks not only the spec but also the **implementation**: + +{{< img src="sdd_validation.png" width="800" >}} + +The validation covers: +- **Spec**: Sections present, clarifications resolved, issue linked +- **Implementation**: Phases completed, examples created, CI passing +- **Review checklist**: The 4 personas (PM, Platform Engineer, Security, SRE) + +Items marked "N/A" (E2E tests, documentation, failure modes) are clearly identified as optional for this type of composition. + +#### Result: the final user API 🎉 + +Developers can now declare their needs in just a few lines: + +```yaml +apiVersion: cloud.ogenki.io/v1alpha1 +kind: Queue +metadata: + name: orders-queue + namespace: ecommerce +spec: + # Kafka for streaming with retention + type: kafka + clusterRef: + name: main-kafka + config: + partitions: 6 + retentionDays: 7 +``` + +Or for SQS: + +```yaml +apiVersion: cloud.ogenki.io/v1alpha1 +kind: Queue +metadata: + name: notifications-queue + namespace: notifications +spec: + # SQS for simple cases + type: sqs + config: + visibilityTimeout: 30 + enableDLQ: true +``` + +In both cases, the platform automatically handles: +- Resource creation (Kafka topics or SQS queues) +- Authentication (SASL/SCRAM or IAM) +- Monitoring (metrics exported to VictoriaMetrics) +- Network security (CiliumNetworkPolicy) +- Credential injection into the application's namespace + +Without SDD, I would have probably jumped straight into writing the Crossplane composition, without stepping back to take a **proper product approach** or **flesh out the specifications**. And even then, delivering this new service would have taken much longer. + +By structuring the thinking upfront, **every decision is documented** and justified before the first line of code. The four perspectives (PM, Platform, Security, SRE) ensure no angle is missed, and the final PR references the spec — the reviewer has all the context they need. + + +## :thought_balloon: Final thoughts + +Through this article, we've explored agentic AI and how its principles can be useful on a daily basis. An agent with access to rich context (`CLAUDE.md`, skills, MCPs...) can be **truly** effective: quality results and, above all, impressive speed! The SDD workflow also helps formalize your intent and better guide the agent for more complex projects. + +### Things to watch out for + +That said, as impressive as the results may be, it's important to stay **clear-eyed**. Here are some lessons I've learned after several months of use: + +* **Avoid dependency and keep learning** — systematically review the specs and generated code, understand *why* that solution was chosen +* **Force yourself to work without AI** — I make a point of at least 2 "old school" sessions per week +* **Use AI as a teacher** — asking it to explain its reasoning and choices is an excellent way to learn + +{{% notice warning "Confidentiality and proprietary code" %}} +If you work with sensitive or proprietary code: +- Use the **Team** or **Enterprise** plan — your data isn't used for training +- Request the **Zero-Data-Retention** (ZDR) option if needed +- **Never** use the Free/Pro plan for confidential code + +See the [privacy documentation](https://www.anthropic.com/policies/privacy) for more details. +{{% /notice %}} + +### :bulb: Getting the most out of it + +{{% notice info "Dedicated article" %}} +Tips and workflows I've picked up along the way (CLAUDE.md, hooks, context management, worktrees, plugins...) have been compiled in a dedicated article: [A few months with Claude Code: tips and workflows that helped me](/en/post/series/agentic_ai/ai-coding-tips/). +{{% /notice %}} + +### My next steps + +This is a concern I share with many developers: **what happens if Anthropic changes the rules of the game?** This fear actually materialized in early January 2026, when Anthropic [blocked without warning](https://venturebeat.com/technology/anthropic-cracks-down-on-unauthorized-claude-usage-by-third-party-harnesses) access to Claude through third-party tools like [OpenCode](https://github.com/opencode-ai/opencode). + +Given my affinity for open source, I'm looking at exploring open alternatives: **[Mistral Vibe](https://mistral.ai/news/devstral-2-vibe-cli)** with Devstral 2 (72.2% SWE-bench) and **[OpenCode](https://opencode.ai/)** (multi-provider, local models via Ollama) for instance. + +--- + +## :bookmark: References + +### Guides and best practices +- [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices) — Anthropic Engineering +- [How I Use Every Claude Code Feature](https://blog.sshh.io/p/how-i-use-every-claude-code-feature) — Comprehensive guide by sshh + +### Spec-Driven Development +- [GitHub Spec Kit](https://github.com/github/spec-kit) — GitHub's SDD toolkit +- [OpenSpec](https://github.com/Fission-AI/OpenSpec) — Lightweight SDD for brownfield projects +- [BMAD Method](https://github.com/bmad-sim/bmad-method) — Multi-agent SDD + +### Plugins, Skills and MCPs +- [Code-Simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier) — AI code cleanup +- [Claude-Mem](https://github.com/thedotmack/claude-mem) — Persistent memory across sessions +- [CC-DevOps-Skills](https://github.com/akin-ozer/cc-devops-skills) — 31 ready-to-use DevOps skills +- [Awesome Claude Code Plugins](https://github.com/ccplugins/awesome-claude-code-plugins) — Curated list + +### Cited studies +- [METR Study on AI Productivity](https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/) — Productivity study +- [State of AI Code Quality 2025](https://www.qodo.ai/reports/state-of-ai-code-quality/) — Qodo +- [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) — Anthropic Research + +### Resources +- [Cloud Native Ref](https://github.com/Smana/cloud-native-ref) — My reference repo +- [SWE-bench Leaderboards](https://www.swebench.com/) — Reference benchmark diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_mcp.png b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_mcp.png new file mode 100644 index 0000000..8cc3807 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_mcp.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_plan.png b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_plan.png new file mode 100644 index 0000000..5309078 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_plan.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_summary.png b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_summary.png new file mode 100644 index 0000000..7a2bf5b Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/karpenter_summary.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/repo_gift.png b/content/en/post/series/agentic_ai/ai-coding-agent/repo_gift.png new file mode 100644 index 0000000..f30bff2 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/repo_gift.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_1.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_1.png new file mode 100644 index 0000000..bc524a5 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_1.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_2.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_2.png new file mode 100644 index 0000000..d45c260 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_clarify_2.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_1.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_1.png new file mode 100644 index 0000000..90f640a Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_1.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_summary.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_summary.png new file mode 100644 index 0000000..7e54d69 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_implement_summary.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_spec.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_spec.png new file mode 100644 index 0000000..f5a3756 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_spec.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_validation.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_validation.png new file mode 100644 index 0000000..65103b2 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_validation.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/sdd_workflow.png b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_workflow.png new file mode 100644 index 0000000..11a9c62 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/sdd_workflow.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/skill-acquired-notif.png b/content/en/post/series/agentic_ai/ai-coding-agent/skill-acquired-notif.png new file mode 100644 index 0000000..2ca8a55 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/skill-acquired-notif.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/swe-bench-leaderboard.png b/content/en/post/series/agentic_ai/ai-coding-agent/swe-bench-leaderboard.png new file mode 100644 index 0000000..c991ef1 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/swe-bench-leaderboard.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/tasks_notif.png b/content/en/post/series/agentic_ai/ai-coding-agent/tasks_notif.png new file mode 100644 index 0000000..93107fc Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/tasks_notif.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-agent/thumbnail.png b/content/en/post/series/agentic_ai/ai-coding-agent/thumbnail.png new file mode 100644 index 0000000..457c541 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-agent/thumbnail.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-tips/cursor+claude.png b/content/en/post/series/agentic_ai/ai-coding-tips/cursor+claude.png new file mode 100644 index 0000000..49bff27 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-tips/cursor+claude.png differ diff --git a/content/en/post/series/agentic_ai/ai-coding-tips/index.md b/content/en/post/series/agentic_ai/ai-coding-tips/index.md new file mode 100644 index 0000000..74e4290 --- /dev/null +++ b/content/en/post/series/agentic_ai/ai-coding-tips/index.md @@ -0,0 +1,350 @@ ++++ +author = "Smaine Kahlouch" +title = "A few months with `Claude Code`: tips and workflows that helped me" +date = "2026-01-29" +summary = "CLAUDE.md, hooks, context management, worktrees, plugins, anti-patterns: everything I wish I'd known from the start." +featured = true +codeMaxLines = 30 +usePageBundles = true +toc = true +series = ["Agentic AI"] +aliases = ["/en/post/ai-coding-tips/"] +tags = ["ai", "devxp", "tooling"] +thumbnail = "thumbnail.png" ++++ + +{{% notice info "Agentic AI Series — Part 2" %}} +This article follows [Agentic Coding: concepts and hands-on use cases](/en/post/series/agentic_ai/ai-coding-agent/), where we explored the fundamentals of agentic AI — tokens, MCPs, Skills, Tasks — and two detailed practical examples. **Here, we dive into advanced practices**: how to get the most out of Claude Code on a daily basis. +{{% /notice %}} + +As with any tool you adopt, it takes time to refine how you use it. After iterating on my config and workflows, I've found an efficient rhythm with Claude Code. Here's what works for me. + +{{% notice info "Living article" %}} +This article will be updated as I discover new things and as tools evolve. Feel free to check back from time to time for new tips. +{{% /notice %}} + +--- + +## :scroll: CLAUDE.md: persistent memory + +The `CLAUDE.md` file is the **first optimization lever**. These are instructions automatically injected into every conversation. If you don't have one yet, it's the first thing to set up. + +### Loading hierarchy + +Claude Code loads `CLAUDE.md` files according to a specific hierarchy: + +| Location | Scope | Use case | +|----------|-------|----------| +| `~/.claude/CLAUDE.md` | All sessions, all projects | Global preferences (language, commit style) | +| `./CLAUDE.md` | Project (shared via git) | Team conventions, build/test commands | +| `./CLAUDE.local.md` | Project (not versioned) | Personal preferences on this project | +| `./subfolder/CLAUDE.md` | Subtree | Instructions specific to a module | + +Files are **cumulative**: Claude loads all of them from most global to most local. In case of conflict, the most local one wins. + +### What I put in mine + +Here's what the `CLAUDE.md` for [cloud-native-ref](https://github.com/Smana/cloud-native-ref) actually contains: + +- **Build/test/lint commands** — the first lines, so Claude knows how to validate its work +- **Project conventions** — `xplane-*` prefix for IAM, Crossplane composition structure, KCL patterns +- **Architecture summary** — key folder structure, not a novel +- **Common pitfalls** — traps Claude keeps falling into if you don't warn it (e.g., wrong default namespace, label format) + +What I **don't** put in it: exhaustive documentation (that's what [Skills](/en/post/series/agentic_ai/ai-coding-agent/#skills-unlocking-new-powers) are for), long code examples (I reference existing files instead), and obvious instructions Claude already knows. + +Here's a condensed excerpt from the `CLAUDE.md` of [cloud-native-ref](https://github.com/Smana/cloud-native-ref) to illustrate: + +```markdown +## Common Commands + +### Terramate Operations +# Deploy entire platform +terramate script run deploy +# Preview changes across all stacks +terramate script run preview +# Check for configuration drift +terramate script run drift detect + +## Crossplane Resources +- **Resource naming**: All Crossplane-managed resources prefixed with `xplane-` + +## KCL Formatting Rules +**CRITICAL**: Always run `kcl fmt` before committing KCL code. The CI enforces strict formatting. + +### Avoid Mutation Pattern (Issue #285) +Mutating dictionaries after creation causes function-kcl to create duplicate resources. + # ❌ WRONG - Mutation causes DUPLICATES + _deployment = { ... } + _deployment.metadata.annotations["key"] = "value" # MUTATION! + + # ✅ CORRECT - Use inline conditionals + _deployment = { + metadata.annotations = { + if _ready: + "krm.kcl.dev/ready" = "True" + } + } +``` + +You'll find the three essential ingredients: **build/deploy commands** first (so Claude knows how to validate its work), **naming conventions**, and **specific pitfalls** Claude would keep reproducing if not warned. + +{{% notice warning "The ~500-line rule" %}} +Every token in `CLAUDE.md` is loaded in **every conversation**. An overly long file wastes precious context. Aim for ~500 lines maximum and move specialized instructions to **Skills** that only load on demand. +{{% /notice %}} + +### Iterating on CLAUDE.md + +Treat `CLAUDE.md` as a **production prompt**: iterate on it regularly. The `#` shortcut lets you ask Claude itself to suggest improvements to your file. You can also use Anthropic's [prompt improver](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/prompt-improver) to refine the instructions. + +--- + +## :hook: Hooks: my first automation + +**Hooks** are shell commands that run automatically in response to Claude Code events. The key difference with `CLAUDE.md`: CLAUDE.md instructions are *advisory* (Claude can ignore them), hooks are **deterministic** — they always run. + +### Getting notified when Claude is waiting + +The first hook I set up — and the one I recommend to everyone — is the **desktop notification**. When Claude finishes a task or is waiting for your input, you get a system notification with a sound. No more checking the terminal every 30 seconds. + +Configuration in `~/.claude/settings.json`: + +```json +{ + "hooks": { + "Notification": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "notify-send 'Claude Code' \"$CLAUDE_NOTIFICATION\" --icon=dialog-information && paplay /usr/share/sounds/freedesktop/stereo/complete.oga" + } + ] + } + ] + } +} +``` + +On Linux, `notify-send` is provided by the `libnotify` package and `paplay` by `pulseaudio-utils` (or `pipewire-pulse`). Other mechanisms exist for macOS (`osascript`) or other environments — see the [hooks documentation](https://docs.anthropic.com/en/docs/claude-code/hooks) for alternatives. + +### Other possibilities + +Hooks cover several events (`PreToolUse`, `PostToolUse`, `Notification`, `Stop`, `SessionStart`) and enable things like: + +- **Auto-format** after each edit (e.g., `gofmt` on Go files) +- **Sensitive file protection** — a `PreToolUse` hook that blocks writes to `.env`, `.pem`, `.key` files (exit code 2 = action blocked) +- **Audit** of executed commands in a log file + +I won't detail every variant here — the [official hooks documentation](https://docs.anthropic.com/en/docs/claude-code/hooks) does a great job. The key takeaway is that hooks are your **deterministic** safety net where `CLAUDE.md` is merely advice. + +--- + +## :brain: Mastering the context window + +The context window (200K tokens) is **the most critical resource**. Once saturated, old information gets compressed and quality degrades. This is THE topic that makes the difference between an efficient user and someone who "loses" Claude after 20 minutes. + +### `/compact` with custom instructions + +The `/compact` command compresses conversation history while preserving key decisions. The trick: you can pass **focus instructions** to keep what matters: + +``` +/compact focus on the Crossplane composition decisions and ignore the debugging steps +``` + +This is especially useful after a long debugging session where 80% of the context is noise (failed attempts, stack traces). + +### `/clear` strategy + +The `/clear` command resets the context to zero. When to use it? + +- **Always** between two distinct tasks — this is the most important rule +- When Claude starts **hallucinating** or repeating mistakes +- After a long debugging session (context is polluted with failed attempts) +- When `/context` shows < 20% free space + +I've made a habit of starting every new task with a `/clear`. It seems counterintuitive (you lose context), but in practice it's much more effective than a polluted context. + +### Tool Search: when MCPs eat your context + +The problem: each enabled MCP injects its **tool definitions** into the context. With 6-7 configured MCPs (common in platform engineering), that can represent over **10% of your window** — consumed before you even start working. + +The solution: enable **Tool Search**: + +```bash +export ENABLE_TOOL_SEARCH=auto:10 +``` + +With this option, Claude only loads tool definitions **when it needs them**, rather than keeping them all in memory. The `10` is the threshold (as a percentage of context) at which the mechanism kicks in. + +### Delegating to subagents + +For large exploration tasks (browsing a codebase, searching through logs), Claude can delegate to **subagents** that have their own isolated context. The condensed result is sent back to the main session — saving precious tokens. + +In practice, Claude does this automatically when it deems it relevant (file exploration, broad searches). But you can also guide it explicitly: *"use a subagent to explore the networking module structure"*. + +### A few simple rules + +1. **`/clear` between tasks**: Each new task should start with a `/clear` +2. **Keep CLAUDE.md concise**: Every token is loaded in every conversation +3. **CLIs > MCPs**: For mature tools (`kubectl`, `git`, `gh`...), prefer the CLI directly — LLMs know them perfectly and it avoids loading an MCP +4. **`/context` to audit**: Identify what's consuming context and disable unused MCPs + +--- + +## :arrows_counterclockwise: Multi-session workflows + +### Git Worktrees: parallelizing sessions + +Rather than juggling branches and `stash`, I use **git worktrees** to work on multiple features in parallel with independent Claude sessions. + +```console +# Create two features in parallel +git worktree add ../worktrees/feature-a -b feat/feature-a +git worktree add ../worktrees/feature-b -b feat/feature-b + +# Launch two separate Claude sessions +cd ../worktrees/feature-a && claude # Terminal 1 +cd ../worktrees/feature-b && claude # Terminal 2 +``` + +Each session has its **own context** and its own memory — no interference between tasks. + +{{% notice tip "Worktree vs repo copy" %}} +Unlike a separate `git clone`: +- **Shared history**: A single `.git`, commits are immediately visible everywhere +- **Disk space**: ~90% savings (no git object duplication) +- **Synchronized branches**: `git fetch` in one worktree updates all others +{{% /notice %}} + +When the change is done (PR merged), just go back to the main repo and clean up. + +```console +cd +git worktree remove ../worktrees/feature-a +git branch -d feat/feature-a # after PR merge +``` + +**Useful commands:** + +```console +git worktree list # See all active worktrees +git worktree prune # Clean up orphaned references +``` + +### Writer/Reviewer pattern + +A pattern I use more and more involves running **two sessions in parallel**: + +| Session | Role | Prompt | +|---------|------|--------| +| **Writer** | Implements the code | "Implement feature X according to the spec" | +| **Reviewer** | Reviews the code | "Review the changes on the feat/X branch, check security and edge cases" | + +The reviewer works on the same repo (via worktree or read-only) and provides independent feedback, without the author's bias. This is especially effective for infrastructure changes where a mistake can be costly. + +### Fan-out with `-p` + +The `-p` flag (non-interactive prompt) lets you run Claude in **headless** mode and parallelize tasks: + +```bash +# Launch 3 tasks in parallel +claude -p "Add unit tests for the auth module" & +claude -p "Document the REST API for the orders service" & +claude -p "Refactor the billing module to use the new SDK" & +wait +``` + +Each instance has its own context. This is ideal for independent tasks that don't require interaction. + +--- + +## :desktop_computer: Hybrid IDE + Claude Code workflow + +In practice, I alternate between two modes: sometimes pure terminal — old habits — and sometimes hybrid with **Cursor** for editing and **Claude Code** in the terminal. The hybrid workflow is clearly more comfortable, and I'm moving towards it more and more. + +{{< img src="cursor+claude.png" alt="Cursor + Claude Code" width="1200" >}} + +| Need | Tool | Why | +|------|------|-----| +| Quick editing, autocomplete | Cursor | Minimal latency, you stay in the flow | +| Refactoring, multi-file debugging | Claude Code | Deep reasoning, autonomous loops | + +**What I like about hybrid mode**: Claude makes changes via the terminal, and I review the diffs in the Cursor interface — much more readable than `git diff`. Changes appear in real time in the editor, which lets you follow what Claude is doing and step in quickly if needed. + +--- + +## :electric_plug: Plugins + +Claude Code has a **plugin** ecosystem that extends its capabilities. Here are the two I use daily: + +### Code-Simplifier: cleaning up generated code + +The **[code-simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier)** plugin is developed by Anthropic and used internally by the Claude Code team. It automatically cleans up AI-generated code while preserving functionality. + +I discovered this plugin recently and intend to make a habit of using it **before creating a PR** after an intensive session. It runs on Opus and should help reduce the technical debt introduced by AI code — duplicated code, unnecessarily complex structures, inconsistent style. + +### Claude-Mem: persistent memory across sessions + +The **[claude-mem](https://github.com/thedotmack/claude-mem)** plugin automatically captures your session context and reinjects it in future sessions. No more re-explaining your project at the start of every conversation. + +**Its two main strengths:** +- **Semantic search**: easily find information from a past session via the `mem-search` skill +- **Token consumption optimization**: a 3-layer workflow that significantly reduces usage (~10x savings) + +Usage examples: + + - "Search my sessions for when I debugged Karpenter" + - "Find what I learned about OpenBao PKI last week" + - "Look at my previous work on the App composition" + +{{% notice warning "Privacy considerations" %}} +Claude-mem stores session data locally. For sensitive projects, use `` tags to exclude information from capture. +{{% /notice %}} + +--- + +## :warning: Anti-patterns + +Here are the traps I fell into — and learned to avoid: + +| Anti-pattern | Symptom | Solution | +|-------------|---------|----------| +| **Kitchen sink session** | Mixing debugging, features, refactoring in the same session | `/clear` between each distinct task | +| **Correction spiral** | Claude fixes a bug, creates another, loops endlessly | Stop, `/clear`, rephrase with more context | +| **Bloated CLAUDE.md** | Context consumed from the start, degraded responses | Target ~500 lines, move the rest to Skills | +| **Trust-then-verify gap** | Accepting code without review, finding bugs in prod | Always read the diff before committing | +| **Infinite exploration** | Claude browses the entire codebase instead of acting | Give specific files/paths in the prompt | + +{{% notice tip "The most insidious trap" %}} +The **correction spiral** is by far the most dangerous. A real example: Claude was supposed to add a `CiliumNetworkPolicy` to a Crossplane composition. First attempt, wrong endpoint selector. It fixes it, but breaks the KCL format. It fixes the format, but reverts to the original bad selector. After 5 iterations and ~40K tokens consumed, I hit `/clear` and rephrased in 3 lines, specifying the target namespace and an example of an existing policy. Correct result on the first try. The lesson: when Claude loops after 2-3 attempts, it's a sign it's missing **context**, not persistence. Better to cut and rephrase than to let it spin. +{{% /notice %}} + +--- + +## :checkered_flag: Conclusion + +Over time, I've become increasingly comfortable with Claude Code, and the productivity gains are real. But they come with a lingering concern I can't fully shake: losing control — over the produced code, over the decisions made, over the understanding of what's running in production. + +These questions, as well as the methods that help me stay in control, are covered in the first article of this series. If you want to revisit the fundamentals or understand where these reflections come from, I highly recommend it: [Agentic Coding: concepts and hands-on use cases](/en/post/series/agentic_ai/ai-coding-agent/). + +--- + +## :bookmark: References + +### Official documentation +- [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices) — Anthropic Engineering +- [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code) — Official guide +- [Hooks Documentation](https://docs.anthropic.com/en/docs/claude-code/hooks) — Hooks configuration + +### Community guides +- [How I Use Every Claude Code Feature](https://blog.sshh.io/p/how-i-use-every-claude-code-feature) — Comprehensive guide by sshh +- [CC-DevOps-Skills](https://github.com/akin-ozer/cc-devops-skills) — 31 DevOps skills + +### Plugins and tools +- [Code-Simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier) — AI code cleanup (Anthropic) +- [Claude-Mem](https://github.com/thedotmack/claude-mem) — Persistent memory across sessions + +### Previous article +- [Agentic Coding: concepts and hands-on use cases](/en/post/series/agentic_ai/ai-coding-agent/) — Part 1 of the Agentic AI series diff --git a/content/en/post/series/agentic_ai/ai-coding-tips/thumbnail.png b/content/en/post/series/agentic_ai/ai-coding-tips/thumbnail.png new file mode 100644 index 0000000..703c8d7 Binary files /dev/null and b/content/en/post/series/agentic_ai/ai-coding-tips/thumbnail.png differ diff --git a/content/fr/about.md b/content/fr/about.md index e2db9ed..4a5d5d3 100644 --- a/content/fr/about.md +++ b/content/fr/about.md @@ -7,13 +7,13 @@ author = "Smana" ## Qui suis-je? -Je suis un **ingénieur système / SRE senior**. Je porte un intérêt particulier aux conteneurs Linux et les technologies dîtes "Cloud Native". Au fil de ma carrière, j'ai eu l'occasion de collaborer avec une variété d'entreprises, des startups dynamiques aux grandes structures, où j'ai contribué à optimiser la fiabilité et la disponibilité des plateformes, tout en améliorant l'expérience des développeurs. Mon parcours inclut l'accompagnement de plusieurs sociétés dans leur migration vers des solutions Cloud. J'ai également pu **diriger des équipes SRE/DevOps** composées de profils variés, incluant développeurs et ingénieurs SRE, avec pour objectif un engagement collectif vers des objectifs communs. +Je suis un **ingénieur système / SRE senior**. Je porte un intérêt particulier aux conteneurs Linux, les technologies dîtes "Cloud Native" et plus récemment à l'**intelligence artificielle appliquée à l'ingénierie logicielle**, notamment le coding assisté par agents IA. Au fil de ma carrière, j'ai eu l'occasion de collaborer avec une variété d'entreprises, des startups dynamiques aux grandes structures, où j'ai contribué à optimiser la fiabilité et la disponibilité des plateformes, tout en améliorant l'expérience des développeurs. Mon parcours inclut l'accompagnement de plusieurs sociétés dans leur migration vers des solutions Cloud. J'ai également pu **diriger des équipes SRE/DevOps** composées de profils variés, incluant développeurs et ingénieurs SRE, avec pour objectif un engagement collectif vers des objectifs communs. -En parallèle de mon parcours professionnel, je m'investis dans l'organisation du meetup Cloud Native Computing à Paris ainsi que les [Kubernetes Community Days France](https://www.kcdfrance.fr/) , reflétant mon engagement continu dans l'écosystème du Cloud. +En parallèle de mon parcours professionnel, je m'investis dans l'organisation du meetup Cloud Native Computing à Paris, les [Kubernetes Community Days France](https://www.kcdfrance.fr/) ainsi que les [Cloud Native Days France](https://cloudnativedays.fr/), reflétant mon engagement continu dans l'écosystème du Cloud. Autres centre d'intéret : Lecture de romans de science-fiction, Kickboxing, Surf, Longboard et Rollers..
-_Les images sympas (miniatures) de chaque article ont été générées avec DALL-E_ \ No newline at end of file +_Les images sympas (miniatures) de chaque article ont été générées avec DALL-E et [Nano Banana](https://gemini.google/lu/overview/image-generation) diff --git a/content/fr/post/series/agentic_ai/ai-coding-agent/index.md b/content/fr/post/series/agentic_ai/ai-coding-agent/index.md index 774442c..e8fa8af 100644 --- a/content/fr/post/series/agentic_ai/ai-coding-agent/index.md +++ b/content/fr/post/series/agentic_ai/ai-coding-agent/index.md @@ -29,7 +29,7 @@ Mais surtout, je vais tenter de vous démontrer par des cas concrets que cette n * Découvrir les concepts clés : tokens, MCPs, skills, agents * **Cas concrets** d'utilisation dans le platform engineering * Réflexions sur les limites, pièges à éviter et alternatives -* Pour les tips d'optimisation avancés, consultez l'[article dédié](/fr/post/series/agentic_ai/ai-coding-tips/) +* Pour les tips et workflows découverts au fil de mon utilisation, consultez l'[article dédié](/fr/post/series/agentic_ai/ai-coding-tips/) {{% notice tip "Le repo de référence" %}} @@ -42,11 +42,15 @@ Les exemples qui suivent sont issus de mon travail sur le repository {{% /notice %}} +{{% notice info "Déjà familier avec les concepts ?" %}} +Si vous connaissez déjà les fondamentaux des coding agents, des tokens et des MCPs, passez directement aux [cas concrets pour le Platform Engineering](#-cas-concrets-pour-le-platform-engineeringsre). +{{% /notice %}} + --- ## :brain: L'intérêt des _Coding Agents_? -### Qu'est-ce qui différencie un agent d'un chatbot ? +### Le fonctionnement d’un agent Vous utilisez probablement déjà ChatGPT, LeChat ou Gemini pour poser des questions. C'est cool, mais ça reste du **one-shot** : vous posez une question, vous obtenez une réponse dont la pertinence dépendra de la qualité de votre prompt. @@ -515,7 +519,7 @@ Consultez la [documentation sur la confidentialité](https://www.anthropic.com/p ### :bulb: Optimiser son utilisation {{% notice info "Article dédié" %}} -Les tips d'optimisation (CLAUDE.md, hooks, gestion du contexte, worktrees, plugins...) ont été regroupés dans un article dédié : [Claude Code : Optimisation et bonnes pratiques](/fr/post/series/agentic_ai/ai-coding-tips/). +Les tips et workflows découverts au fil de mon utilisation (CLAUDE.md, hooks, gestion du contexte, worktrees, plugins...) ont été regroupés dans un article dédié : [Quelques mois avec Claude Code : tips et workflows qui m'ont été utiles](/fr/post/series/agentic_ai/ai-coding-tips/). {{% /notice %}} ### Mes prochaines étapes diff --git a/content/fr/post/series/agentic_ai/ai-coding-tips/cursor+claude.png b/content/fr/post/series/agentic_ai/ai-coding-tips/cursor+claude.png index e0b9b10..49bff27 100644 Binary files a/content/fr/post/series/agentic_ai/ai-coding-tips/cursor+claude.png and b/content/fr/post/series/agentic_ai/ai-coding-tips/cursor+claude.png differ diff --git a/content/fr/post/series/agentic_ai/ai-coding-tips/index.md b/content/fr/post/series/agentic_ai/ai-coding-tips/index.md index acf49ca..c3b9ca7 100644 --- a/content/fr/post/series/agentic_ai/ai-coding-tips/index.md +++ b/content/fr/post/series/agentic_ai/ai-coding-tips/index.md @@ -1,8 +1,8 @@ +++ author = "Smaine Kahlouch" -title = "`Claude Code` : Optimisation et bonnes pratiques pour le Platform Engineer" -date = "2026-01-28" -summary = "Tips avancés pour tirer le meilleur de Claude Code : CLAUDE.md, hooks, gestion du contexte, workflows multi-sessions, plugins, anti-patterns à éviter et intégration CI/CD." +title = "Quelques mois avec `Claude Code` : tips et workflows qui m'ont été utiles" +date = "2026-01-29" +summary = "CLAUDE.md, hooks, gestion du contexte, worktrees, plugins, anti-patterns : tout ce que j'aurais aimé savoir dès le début." featured = true codeMaxLines = 30 usePageBundles = true @@ -17,13 +17,17 @@ thumbnail = "thumbnail.png" Cet article fait suite à [Agentic Coding : concepts et cas concrets](/fr/post/series/agentic_ai/ai-coding-agent/), où nous avons exploré les fondamentaux de l'IA agentique — tokens, MCPs, Skills, Tasks — et deux cas pratiques détaillés. **Ici, on passe à la pratique avancée** : comment tirer le maximum de Claude Code au quotidien. {{% /notice %}} -Après plusieurs mois d'utilisation intensive de Claude Code, certains patterns se dégagent clairement. Entre les sessions perdues faute de contexte, les hooks qui auraient pu tout automatiser, et les mauvaises habitudes qui font perdre un temps fou — voici les **tips et workflows qui ont transformé ma façon de travailler**. +Comme pour tout outil qu'on adopte, c'est avec le temps qu'on affine sa façon de l'utiliser. À force d'itérer sur ma config et mes workflows, j'ai trouvé un rythme efficace avec Claude Code. Je partage ici ce qui fonctionne pour moi. + +{{% notice info "Article vivant" %}} +Cet article sera mis à jour au fil de mes découvertes et de l'évolution des outils. N'hésitez pas à revenir de temps en temps pour y trouver de nouveaux tips. +{{% /notice %}} --- -## :scroll: CLAUDE.md : le cerveau persistant +## :scroll: CLAUDE.md : la mémoire persistante -Le fichier `CLAUDE.md` est le **premier levier d'optimisation**. C'est de la mémoire persistante : des instructions injectées automatiquement dans chaque conversation. Si vous n'en avez pas encore, c'est la première chose à mettre en place. +Le fichier `CLAUDE.md` est le **premier levier d'optimisation**. Ce sont des instructions injectées automatiquement dans chaque conversation. Si vous n'en avez pas encore, c'est la première chose à mettre en place. ### Hiérarchie de chargement @@ -49,6 +53,42 @@ Voici ce que contient le `CLAUDE.md` de [cloud-native-ref](https://github.com/Sm Ce que je n'y mets **pas** : la documentation exhaustive (c'est le rôle des [Skills](/fr/post/series/agentic_ai/ai-coding-agent/#skills--obtenir-de-nouveaux-pouvoirs)), les exemples de code longs (je référence les fichiers existants), et les instructions évidentes que Claude connaît déjà. +Voici un extrait condensé du `CLAUDE.md` de [cloud-native-ref](https://github.com/Smana/cloud-native-ref) pour illustrer : + +```markdown +## Common Commands + +### Terramate Operations +# Deploy entire platform +terramate script run deploy +# Preview changes across all stacks +terramate script run preview +# Check for configuration drift +terramate script run drift detect + +## Crossplane Resources +- **Resource naming**: All Crossplane-managed resources prefixed with `xplane-` + +## KCL Formatting Rules +**CRITICAL**: Always run `kcl fmt` before committing KCL code. The CI enforces strict formatting. + +### Avoid Mutation Pattern (Issue #285) +Mutating dictionaries after creation causes function-kcl to create duplicate resources. + # ❌ WRONG - Mutation causes DUPLICATES + _deployment = { ... } + _deployment.metadata.annotations["key"] = "value" # MUTATION! + + # ✅ CORRECT - Use inline conditionals + _deployment = { + metadata.annotations = { + if _ready: + "krm.kcl.dev/ready" = "True" + } + } +``` + +On y retrouve les trois ingrédients essentiels : les **commandes de build/deploy** en premier (pour que Claude sache valider son travail), les **conventions de nommage**, et les **pièges spécifiques** que Claude reproduirait sans cesse si on ne le prévenait pas. + {{% notice warning "Règle des ~500 lignes" %}} Chaque token de `CLAUDE.md` est chargé à **chaque conversation**. Un fichier trop long gaspille du contexte précieux. Visez ~500 lignes maximum et déplacez les instructions spécialisées vers des **Skills** qui ne se chargent qu'à la demande. {{% /notice %}} @@ -65,7 +105,7 @@ Les **hooks** sont des commandes shell exécutées automatiquement en réponse ### La notification quand Claude attend -Le premier hook que j'ai configuré — et celui que je recommande à tout le monde — c'est la **notification desktop**. Quand Claude termine une tâche ou attend votre validation, vous recevez une notification système. Fini de checker le terminal toutes les 30 secondes. +Le premier hook que j'ai configuré — et celui que je recommande à tout le monde — c'est la **notification desktop**. Quand Claude termine une tâche ou attend votre validation, vous recevez une notification système accompagnée d'un son. Fini de checker le terminal toutes les 30 secondes. Configuration dans `~/.claude/settings.json` : @@ -78,7 +118,7 @@ Configuration dans `~/.claude/settings.json` : "hooks": [ { "type": "command", - "command": "notify-send 'Claude Code' \"$CLAUDE_NOTIFICATION\" --icon=dialog-information" + "command": "notify-send 'Claude Code' \"$CLAUDE_NOTIFICATION\" --icon=dialog-information && paplay /usr/share/sounds/freedesktop/stereo/complete.oga" } ] } @@ -87,7 +127,7 @@ Configuration dans `~/.claude/settings.json` : } ``` -Sous Linux, `notify-send` est fourni par le paquet `libnotify`. Sur macOS, remplacez par `osascript -e 'display notification "..."'`. +Sous Linux, `notify-send` est fourni par le paquet `libnotify` et `paplay` par `pulseaudio-utils` (ou `pipewire-pulse`). D'autres mécanismes existent pour macOS (`osascript`) ou d'autres environnements — consultez la [doc des hooks](https://docs.anthropic.com/en/docs/claude-code/hooks) pour les alternatives. ### Les autres possibilités @@ -222,16 +262,16 @@ Chaque instance a son propre contexte. C'est idéal pour les tâches indépendan ## :desktop_computer: Workflow hybride IDE + Claude Code -C'est l'approche que j'utilise au quotidien : **Cursor** pour l'édition et la visualisation, **Claude Code** pour les tâches agentiques dans le terminal. +En pratique, j'alterne entre deux modes : parfois en terminal pur — vieille habitude — et parfois en mode hybride avec **Cursor** pour l'édition et **Claude Code** dans le terminal. Le workflow hybride est clairement plus confortable, et je m'y mets de plus en plus. -{{< img src="cursor+claude.png" alt="Cursor + Claude Code" width="1000" >}} +{{< img src="cursor+claude.png" alt="Cursor + Claude Code" width="1200" >}} | Besoin | Outil | Pourquoi | |--------|-------|----------| | Édition rapide, autocomplete | Cursor | Latence minimale, vous restez dans le flow | | Refactoring, debugging multi-fichiers | Claude Code | Raisonnement profond, boucles autonomes | -**Le vrai gain** : Claude modifie via le terminal, et je valide les diffs dans l'interface Cursor — bien plus lisible que `git diff`. Les changements apparaissent en temps réel dans l'éditeur, ce qui permet de suivre ce que Claude fait et d'intervenir rapidement si quelque chose ne va pas. +**Ce que j'apprécie dans le mode hybride** : Claude modifie via le terminal, et je valide les diffs dans l'interface Cursor — bien plus lisible que `git diff`. Les changements apparaissent en temps réel dans l'éditeur, ce qui permet de suivre ce que Claude fait et d'intervenir rapidement si besoin. --- @@ -243,23 +283,21 @@ Claude Code dispose d'un écosystème de **plugins** qui étendent ses capacité Le plugin **[code-simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier)** est développé par Anthropic et utilisé en interne par l'équipe Claude Code. Il nettoie automatiquement le code généré par l'IA tout en préservant la fonctionnalité. -J'utilise systématiquement le code-simplifier **avant de créer une PR** après une session intensive. Il tourne sur Opus et peut significativement réduire la dette technique introduite par le code IA — code dupliqué, structures inutilement complexes, style incohérent. +J'ai découvert ce plugin récemment et je compte m'efforcer de l'utiliser systématiquement **avant de créer une PR** après une session intensive. Il tourne sur Opus et devrait aider à réduire la dette technique introduite par le code IA — code dupliqué, structures inutilement complexes, style incohérent. ### Claude-Mem : mémoire persistante entre sessions Le plugin **[claude-mem](https://github.com/thedotmack/claude-mem)** capture automatiquement le contexte de vos sessions et le réinjecte dans les sessions futures. Plus besoin de réexpliquer votre projet à chaque nouvelle conversation. -**Ce que j'apprécie particulièrement :** -- **Capture automatique** : Enregistre les actions Claude (tool usage, décisions) -- **Recherche sémantique** : Skill `mem-search` pour retrouver des informations passées -- **Interface web** : Dashboard sur `http://localhost:37777` -- **Workflow 3-layer** : Optimise la consommation de tokens (~10x d'économie) +**Ses deux atouts principaux :** +- **Recherche sémantique** : retrouver facilement une information d'une session passée via le skill `mem-search` +- **Optimisation de la consommation de tokens** : un workflow 3-layer qui réduit significativement l'usage (~10x d'économie) Exemples d'utilisation : - - "Search my memories for when I debugged Karpenter" - - "Find what I learned about OpenBao PKI last week" - - "Look up my previous work on the App composition" + - "Cherche dans mes sessions quand j'ai debuggé Karpenter" + - "Retrouve ce que j'ai appris sur OpenBao PKI la semaine dernière" + - "Regarde mon travail précédent sur la composition App" {{% notice warning "Considérations de confidentialité" %}} Claude-mem stocke localement les données de session. Pour les projets sensibles, utilisez les tags `` pour exclure des informations de la capture. @@ -269,104 +307,27 @@ Claude-mem stocke localement les données de session. Pour les projets sensibles ## :warning: Anti-patterns -Après plusieurs mois d'utilisation, voici les pièges dans lesquels je suis tombé — et que j'ai appris à éviter : +Voici les pièges dans lesquels je suis tombé — et que j'ai appris à éviter : | Anti-pattern | Symptôme | Solution | |--------------|----------|----------| | **Kitchen sink session** | Mélanger debugging, feature, refactoring dans une même session | `/clear` entre chaque tâche distincte | | **Spirale de corrections** | Claude corrige un bug, en crée un autre, boucle sans fin | Arrêter, `/clear`, reformuler avec plus de contexte | -| **CLAUDE.md obèse** | Context consommé dès le départ, réponses dégradées | Viser ~500 lignes, déplacer le reste vers les Skills | +| **CLAUDE.md trop gros** | Context consommé dès le départ, réponses dégradées | Viser ~500 lignes, déplacer le reste vers les Skills | | **Trust-then-verify gap** | Accepter le code sans review, découvrir les bugs en prod | Toujours lire le diff avant de commit | | **Exploration infinie** | Claude parcourt tout le codebase au lieu d'agir | Donner des fichiers/chemins précis dans le prompt | {{% notice tip "Le piège le plus insidieux" %}} -La **spirale de corrections** est de loin le plus dangereux. Quand Claude boucle sur un même problème après 2-3 tentatives, c'est le signe qu'il lui manque du contexte. J'ai appris à mes dépens que mieux vaut `/clear` et reformuler avec les informations manquantes plutôt que de le laisser tourner. Le coût en tokens (et en frustration) est exponentiel. +La **spirale de corrections** est de loin le plus dangereux. Exemple vécu : Claude devait ajouter une `CiliumNetworkPolicy` à une composition Crossplane. Premier essai, mauvais sélecteur d'endpoint. Il corrige, mais casse le format KCL. Il re-corrige le format, mais revient au mauvais sélecteur initial. Au bout de 5 itérations et ~40K tokens consommés, j'ai fait `/clear` et reformulé en 3 lignes en précisant le namespace cible et un exemple de policy existante. Résultat correct du premier coup. La leçon : quand Claude boucle après 2-3 tentatives, c'est le signe qu'il lui manque du **contexte**, pas de la persévérance. Mieux vaut couper et reformuler que de le laisser tourner. {{% /notice %}} --- -## :bulb: Ce qui fonctionne bien vs vigilance - -| Ce que Claude fait bien | Vigilance requise | Pourquoi | -|------------------------|--------------------|---------:| -| Debugging avec contexte | Création from scratch | Sans contexte existant, les hallucinations augmentent | -| Conversion de formats | Sécurité / PKI | Les erreurs crypto sont silencieuses et critiques | -| Refactoring répétitif | Ressources cloud coûteuses | Un `apply` mal placé peut coûter cher | -| Analyse de dépendances | Breaking changes | Claude ne connaît pas vos contrats implicites | -| Génération de tests | Tests de performance | Les benchmarks nécessitent une validation humaine | -| Documentation technique | Choix d'architecture | Les décisions structurantes méritent un HITL | - ---- - -## :gear: Intégration CI/CD - -Claude Code s'intègre dans les pipelines CI/CD grâce au mode headless et à l'action GitHub officielle. C'est là que l'investissement dans les Skills et CLAUDE.md paye : les mêmes conventions que vous utilisez en local sont appliquées automatiquement en CI. - -### GitHub Actions : `claude-code-action` - -L'action [claude-code-action](https://github.com/anthropics/claude-code-action) permet d'automatiser des workflows directement dans GitHub : - -```yaml -name: Claude Code Review -on: - pull_request: - types: [opened, synchronize] - -jobs: - review: - runs-on: ubuntu-latest - steps: - - uses: anthropics/claude-code-action@v1 - with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - prompt: | - Review this PR for: - - Security vulnerabilities - - Performance issues - - Kubernetes best practices - Post your findings as PR comments. -``` - -### Mode headless pour scripts custom - -Le flag `-p` combiné avec `--output-format json` permet d'intégrer Claude dans n'importe quel script : - -```bash -# Exemple : review automatique de PR -PR_DIFF=$(gh pr diff $PR_NUMBER) -REVIEW=$(claude -p "Review ce diff pour les problèmes de sécurité : $PR_DIFF" \ - --output-format json \ - --max-turns 5) -echo "$REVIEW" | jq -r '.result' | gh pr comment $PR_NUMBER --body - -``` - -### Workflows automatisables - -| Workflow | Déclencheur | Prompt type | -|----------|-------------|-------------| -| **PR Review** | `pull_request.opened` | "Review for security, performance, K8s best practices" | -| **Issue Triage** | `issues.opened` | "Classify this issue, suggest labels and priority" | -| **Release Notes** | `release.created` | "Generate changelog from commits since last release" | -| **Security Audit** | `schedule` (cron) | "Scan for outdated dependencies and known CVEs" | - ---- - ## :checkered_flag: Conclusion -Si je devais résumer les tips essentiels de cet article : - -- **`CLAUDE.md` concis et itéré** — c'est votre levier #1, traitez-le comme un prompt de production -- **Un hook notification** — le minimum vital pour ne pas perdre du temps à attendre -- **`/clear` entre les tâches** — la règle la plus simple et la plus impactante -- **Tool Search activé** — indispensable dès que vous avez plusieurs MCPs -- **Worktrees pour paralléliser** — une branche = une session = un contexte propre -- **Toujours lire le diff** — même quand "ça a l'air bon" +Au fil du temps, je me sens de plus en plus à l'aise avec Claude Code, et le gain de productivité est réel. Mais il s'accompagne d'une crainte que je n'arrive pas à évacuer complètement : celle de perdre le contrôle — sur le code produit, sur les décisions prises, sur la compréhension de ce qui tourne en production. -L'IA agentique est un outil puissant, mais comme tout outil, c'est la maîtrise des bonnes pratiques qui fait la différence entre un gain réel de productivité et une perte de temps déguisée. - -{{% notice info "Retour à l'article 1" %}} -Pour revoir les fondamentaux (boucle agentique, tokens, MCPs, Skills, Tasks) et les cas concrets de Platform Engineering, consultez [Agentic Coding : concepts et cas concrets](/fr/post/series/agentic_ai/ai-coding-agent/). -{{% /notice %}} +Ces interrogations, mais aussi les méthodes qui me permettent d'être le maître de la situation, je les aborde dans le premier article de cette série. Si vous voulez revenir aux fondamentaux ou comprendre d'où viennent ces réflexions, je vous le conseille vivement : [Agentic Coding : concepts et cas concrets](/fr/post/series/agentic_ai/ai-coding-agent/). --- @@ -384,7 +345,6 @@ Pour revoir les fondamentaux (boucle agentique, tokens, MCPs, Skills, Tasks) et ### Plugins et outils - [Code-Simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier) — Nettoyage de code IA (Anthropic) - [Claude-Mem](https://github.com/thedotmack/claude-mem) — Mémoire persistante entre sessions -- [claude-code-action](https://github.com/anthropics/claude-code-action) — GitHub Actions officielle ### Article précédent - [Agentic Coding : concepts et cas concrets](/fr/post/series/agentic_ai/ai-coding-agent/) — Partie 1 de la série Agentic AI diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index ec020f3..74bfdb2 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -25,7 +25,7 @@ src="{{ $src | absURL }}" {{- end }} {{- with $width }} - style="max-width: {{ . }}px; display: block; margin: 0 auto;" + style="max-width: min({{ . }}px, 100%); display: block; margin: 0 auto;" {{- end }} />